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,18 +408,19 @@
94408
95409 makeSomething(clone, i==group.selection.size()-1);
96410 }
411
+ Globals.REPLACEONMAKE = keep;
97412 }
98413
99414 void CloneClipboard(boolean supports)
100415 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
416
+ assert(Grafreed.clipboard.parent == null);
417
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
418
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
419
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
420
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106421 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
422
+ makeSomething(CloneObject(Grafreed.clipboard, false));
423
+ Grafreed.clipboard.get(0).parent = keepparent;
109424 }
110425
111426 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +434,7 @@
119434 // obj.support = null;
120435 if (!supports)
121436 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
437
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123438 obj.parent = parent;
124439 // obj.support = support;
125440 // clone.support = support; // aout 2013
....@@ -148,30 +463,29 @@
148463
149464 //JTextField nameField;
150465
151
- void SetupMenu2(ObjEditor oe)
466
+ void SetupMenu2(GroupEditor oe)
152467 {
153
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
154
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
155
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
156
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
157
- oe.cameraMenu.add("-");
158
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
159
- openWindowItem.addActionListener(this);
160
- editLeafItem.addActionListener(this);
161
- lookAtItem.addActionListener(this);
162
- //lookFromItem.addActinoListener(this);
163
- //switchItem.addActionListener(this);
468
+ oe.jTree = new cTree();
469
+
164470 Menu menu;
165471 oe.menuBar.add(menu = new Menu("Edit"));
166472 //editItem = menu.add(new MenuItem("Edit"));
167473 //editItem.addActionListener(this);
168
- 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"));
169481 duplicateItem.addActionListener(this);
170
- menu.add("-");
171482 cloneItem = menu.add(new MenuItem("Clone"));
172483 cloneItem.addActionListener(this);
484
+ if (Globals.ADVANCED)
485
+ {
173486 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174487 cloneSupportItem.addActionListener(this);
488
+ }
175489 menu.add("-");
176490 cutItem = menu.add(new MenuItem("Cut"));
177491 cutItem.addActionListener(this);
....@@ -179,27 +493,123 @@
179493 copyItem.addActionListener(this);
180494 pasteItem = menu.add(new MenuItem("Paste"));
181495 pasteItem.addActionListener(this);
496
+
497
+ menu.add("-");
498
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
499
+ pasteIntoItem.addActionListener(this);
182500 pasteLinkItem = menu.add(new MenuItem("Paste link"));
183501 pasteLinkItem.addActionListener(this);
184502 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185503 pasteCloneItem.addActionListener(this);
186504 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187505 // pasteExpandItem.addActionListener(this);
188
- clearItem = menu.add(new MenuItem("Clear"));
189
- clearItem.addActionListener(this);
506
+ menu.add("-");
507
+ deleteItem = menu.add(new MenuItem("Delete"));
508
+ deleteItem.addActionListener(this);
509
+
510
+ if (Globals.ADVANCED)
511
+ {
512
+ // Deletes the cameras...
190513 clearAllItem = menu.add(new MenuItem("Clear All"));
191514 clearAllItem.addActionListener(this);
515
+ }
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());
192552
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
+
193604 oe.menuBar.add(menu = new Menu("Setting"));
194
- resetMeshItem = menu.add(new MenuItem("Reset All"));
195
- resetMeshItem.addActionListener(this);
196
- stepAllItem = menu.add(new MenuItem("Step All"));
197
- stepAllItem.addActionListener(this);
605
+ if (Globals.ADVANCED)
606
+ {
198607 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199608 revertMeshItem.addActionListener(this);
200609 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201610 resetreferencesItem.addActionListener(this);
202611 menu.add("-");
612
+ }
203613 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204614 overwriteGeoItem.addActionListener(this);
205615 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,79 +621,104 @@
211621 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212622 overwriteUVItem.addActionListener(this);
213623 menu.add("-");
624
+ if (Globals.ADVANCED)
625
+ {
214626 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215627 generateMeshItem.addActionListener(this);
216628 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217629 poseMeshItem.addActionListener(this);
218630 menu.add("-");
631
+ }
219632 resetsupportItem = menu.add(new MenuItem("Reset support"));
220633 resetsupportItem.addActionListener(this);
221634 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222635 linkverticesItem.addActionListener(this);
223636 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224637 relinkverticesItem.addActionListener(this);
638
+
639
+ if (Globals.ADVANCED)
640
+ {
225641 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226642 setMasterItem.addActionListener(this);
643
+ }
227644
228645 oe.menuBar.add(menu = new Menu("Group"));
229
- grabItem = menu.add(new MenuItem("Grab"));
230
- grabItem.addActionListener(this);
646
+// grabItem = menu.add(new MenuItem("Grab"));
647
+// grabItem.addActionListener(this);
231648 backItem = menu.add(new MenuItem("Back"));
232649 backItem.addActionListener(this);
233650 frontItem = menu.add(new MenuItem("Front"));
234651 frontItem.addActionListener(this);
235
- compositeItem = menu.add(new MenuItem("Composite"));
236
- compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
652
+// compositeItem = menu.add(new MenuItem("Composite"));
653
+// compositeItem.addActionListener(this);
654
+
655
+ if (Globals.ADVANCED)
656
+ {
657
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238658 hideItem.addActionListener(this);
659
+ }
239660 ungroupItem = menu.add(new MenuItem("Ungroup"));
240661 ungroupItem.addActionListener(this);
241
- menu.add("-");
242
- randomItem = menu.add(new MenuItem("Switch node"));
243
- 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
+ {
244669 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
245670 switchGeoItem.addActionListener(this);
246671 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
247672 switchTransfoItem.addActionListener(this);
673
+ morphItem = menu.add(new MenuItem("Morph Group"));
674
+ morphItem.addActionListener(this);
675
+
676
+ menu.add("-");
248677 physicsItem = menu.add(new MenuItem("Physics"));
249678 physicsItem.addActionListener(this);
250679 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
251680 frameselectorItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
253
- morphItem.addActionListener(this);
254681 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255682 scriptNodeItem.addActionListener(this);
256
- cameraItem = menu.add(new MenuItem("Camera"));
257
- cameraItem.addActionListener(this);
683
+ }
258684
259685 oe.menuBar.add(menu = new Menu("Object"));
260
- textureItem = menu.add(new MenuItem("Texture"));
261
- textureItem.addActionListener(this);
686
+// textureItem = menu.add(new MenuItem("Texture"));
687
+// textureItem.addActionListener(this);
262688 billboardItem = menu.add(new MenuItem("Billboard"));
263689 billboardItem.addActionListener(this);
264690 csgItem = menu.add(new MenuItem("CSG"));
265691 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
692
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267693 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
694
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269695 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
696
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271697 shadowZItem.addActionListener(this);
698
+ attributeItem = menu.add(new MenuItem("Attribute"));
699
+ attributeItem.addActionListener(this);
700
+
701
+ if (Globals.ADVANCED)
702
+ {
703
+ menu.add("-");
272704 linkerItem = menu.add(new MenuItem("Linker"));
273705 linkerItem.addActionListener(this);
274706 templateItem = menu.add(new MenuItem("Template"));
275707 templateItem.addActionListener(this);
276
- attributeItem = menu.add(new MenuItem("Attribute"));
277
- attributeItem.addActionListener(this);
278708 pointflowItem = menu.add(new MenuItem("Point Flow"));
279709 pointflowItem.addActionListener(this);
710
+ }
280711 menu.add("-");
281712 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282713 resetTransformItem.addActionListener(this);
283714 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284715 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
716
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
717
+ resetCentroidXZItem.addActionListener(this);
718
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
719
+ transformGeometryItem.addActionListener(this);
720
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
721
+ transformChildrenItem.addActionListener(this);
287722
288723 oe.menuBar.add(menu = new Menu("Geometry"));
289724 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +729,11 @@
294729 genNormalsCADItem.addActionListener(this);
295730 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296731 genNormalsMESHItem.addActionListener(this);
297
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
732
+ if (Globals.ADVANCED)
733
+ {
734
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
298735 genNormalsMINEItem.addActionListener(this);
736
+ }
299737 stripifyItem = menu.add(new MenuItem("Stripify"));
300738 stripifyItem.addActionListener(this);
301739 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +755,34 @@
317755 reduce34MeshItem.addActionListener(this);
318756 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319757 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322758 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323759 clipMeshItem.addActionListener(this);
760
+
761
+ if (Globals.ADVANCED)
762
+ {
763
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
764
+ smoothMeshItem.addActionListener(this);
765
+ }
324766
325767 oe.menuBar.add(menu = new Menu("Attributes"));
326768 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327769 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);
328774 menu.add("-");
329775 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330776 liveleavesItem.addActionListener(this);
331777 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332778 unliveleavesItem.addActionListener(this);
779
+ if (Globals.ADVANCED)
780
+ {
333781 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334782 supportleavesItem.addActionListener(this);
335783 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336784 unsupportleavesItem.addActionListener(this);
785
+ }
337786 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338787 hideleavesItem.addActionListener(this);
339788 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +791,14 @@
342791 markleavesItem.addActionListener(this);
343792 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344793 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);
345802 menu.add("-");
346803 flipVItem = menu.add(new MenuItem("Flip V"));
347804 flipVItem.addActionListener(this);
....@@ -367,45 +824,56 @@
367824 attachBumpItem.addActionListener(this);
368825 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
369826 pigmentBumpItem.addActionListener(this);
827
+ //embedTexturesItem
370828 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
371829 detachPigmentItem.addActionListener(this);
372830 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
373831 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);
374836 menu.add("-");
375837 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
376838 sortbysizeItem.addActionListener(this);
377839 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378840 sortbynameItem.addActionListener(this);
379841 menu.add("-");
842
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
843
+ shareGeometriesItem.addActionListener(this);
844
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
845
+ mergeGeometriesItem.addActionListener(this);
846
+ if (Globals.ADVANCED)
847
+ {
848
+ // Pretty much the same as duplicate and clone.
380849 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381850 extractGeometriesItem.addActionListener(this);
382851 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383852 cloneGeometriesItem.addActionListener(this);
384
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
385
- shareGeometriesItem.addActionListener(this);
386
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
387
- mergeGeometriesItem.addActionListener(this);
853
+ }
388854
389855 oe.menuBar.add(menu = new Menu("Insert"));
390856 buildCreateMenu(menu);
391857
392
-
393
- oe.menuBar.add(menu = new Menu("Include"));
394
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
395
- importGFDItem.addActionListener(this);
396
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
397
- importVRMLX3DItem.addActionListener(this);
398
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
399
- importOBJItem.addActionListener(this);
400
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
401
- import3DSItem.addActionListener(this);
402
-
403858 oe.menuBar.add(menu = new Menu("Tools"));
404859 buildToolsMenu(menu);
405860 }
406861
862
+
407863 void SetupUI2(ObjEditor oe)
408864 {
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
+
409877 //new Exception().printStackTrace();
410878
411879 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,93 +902,242 @@
434902 oe.radioPanel.add(dummyButton);
435903 oe.buttonGroup.add(dummyButton);
436904 */
905
+ cGridBag copyOptionsPanel = new cGridBag();
906
+
907
+ copyOptionsPanel.preferredHeight = 2;
908
+
437909 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
438910
439
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
440
- 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(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);
966
+ liveCB.setToolTipText("Enable animation");
441967 liveCB.addItemListener(this);
442968
443
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
969
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
970
+ oneStepButton.setToolTipText("Animate one step forward");
971
+ oneStepButton.addActionListener(this);
972
+
973
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
444974 fastCB.setToolTipText("Fast mode");
445975 fastCB.addItemListener(this);
446976
447
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
448
- trackCB.setToolTipText("Enable tracking");
449
- trackCB.addItemListener(this);
450
-
451
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
452
- screenfitButton.setToolTipText("Screen fit");
453
- 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);
454982
455983 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
456984 // screenfitpointButton.addActionListener(this);
457985
458986 if (Globals.ADVANCED)
459987 {
460
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
988
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
461989 snapobjectButton.addActionListener(this);
462990 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");
463995 }
464996
465
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
466
- flashSelectionButton.setToolTipText("Show selection");
467
- flashSelectionButton.addActionListener(this);
997
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
468998
469
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
470
-
471
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
472
- 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");
4731001 twoButton.addActionListener(this);
474
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
475
- fourButton.addActionListener(this);
476
- fourButton.setToolTipText("Show left panel only");
477
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
478
- sixButton.setToolTipText("2-column layout left");
479
- sixButton.addActionListener(this);
480
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
481
- 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");
4821006 threeButton.addActionListener(this);
483
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
484
- sevenButton.setToolTipText("3-column layout");
485
- 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);
4861013 //
4871014
488
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
489
- 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");
4901017 rootButton.addActionListener(this);
4911018
492
- 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);
4931020 closeButton.setToolTipText("Close tab");
4941021 closeButton.addActionListener(this);
4951022 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
4961023 //clearButton.addActionListener(this);
497
-
498
- cGridBag commandsPanel = new cGridBag();
1024
+
1025
+ cGridBag row1 = new cGridBag();
4991026
500
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
501
- 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");
5021114 editButton.addActionListener(this);
5031115
504
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
505
- uneditButton.setToolTipText("Unedit selection");
1116
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5061118 uneditButton.addActionListener(this);
5071119
508
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
509
- allParamsButton.setToolTipText("Edit all params");
1120
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1121
+ allParamsButton.setToolTipText("Show all controle");
5101122 allParamsButton.addActionListener(this);
5111123
512
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1124
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5131125 clearPanelButton.setToolTipText("Clear edit panel");
5141126 clearPanelButton.addActionListener(this);
5151127
516
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1128
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5171129 unselectButton.setToolTipText("Unselect");
5181130 unselectButton.addActionListener(this);
5191131
520
- 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);
5211135
522
- oe.treePanel.add(commandsPanel);
523
- oe.treePanel.Return();
1136
+ editCommandsPanel.preferredHeight = 1;
1137
+
1138
+ SetPinStates(false);
1139
+// oe.treePanel.add(commandsPanel);
1140
+// oe.treePanel.Return();
5241141
5251142 // oe.aConstraints.gridx += 1;
5261143 // oe.aConstraints.weighty = 0;
....@@ -537,32 +1154,20 @@
5371154
5381155 JScrollPane jSP;
5391156 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
540
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1157
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5411158 ResetModel();
5421159
5431160 oe.treePanel.add(jSPPanel);
5441161 oe.treePanel.Return();
5451162
546
- cGridBag copyOptionsPanel = new cGridBag();
547
-
548
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
549
- colorCB.setToolTipText("Copy color when dropped");
550
- colorCB.addItemListener(this);
551
-
552
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
553
- materialCB.setToolTipText("Copy material when dropped");
554
- materialCB.addItemListener(this);
555
-
556
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
557
- textureCB.setToolTipText("Copy texture when dropped");
558
- textureCB.addItemListener(this);
559
-
560
- copyOptionsPanel.preferredHeight = 1;
5611163 oe.treePanel.add(copyOptionsPanel);
5621164 oe.treePanel.Return();
1165
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1166
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1167
+ sliderPane.preferredHeight = 1;
5631168
564
-// mainPanel.setDividerLocation(0.5); //1.0);
565
-// mainPanel.setResizeWeight(0.5);
1169
+// mainPanel.setDividerLocation(0.1); //1.0);
1170
+ mainPanel.setResizeWeight(0.4);
5661171
5671172 //jList.addListSelectionListener(this);
5681173 oe.jTree.addTreeSelectionListener(this);
....@@ -570,7 +1175,7 @@
5701175 //jTree.setEditable(true);
5711176 oe.jTree.setDragEnabled(true);
5721177 //jTree.setPreferredSize(new Dimension(10,10));
573
- jSP.setPreferredSize(new Dimension(100,200));
1178
+ //jSP.setPreferredSize(new Dimension(100,200));
5741179
5751180 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
5761181
....@@ -582,19 +1187,49 @@
5821187 dgr.addDragGestureListener(this);
5831188 }catch(Exception e) {}
5841189 */
585
- radio.layout = sevenButton;
1190
+ radio.layout = threeButton; // sixButton;
5861191 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
5871192 }
5881193
5891194 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
5901195 {
591
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
592
- supportCB.setToolTipText("Enabled rigging");
593
- supportCB.addItemListener(this);
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
+
1210
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1211
+ boxCB.setToolTipText("Display bounding boxes");
1212
+ boxCB.addItemListener(this);
1213
+
1214
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1215
+ zoomBoxCB.setToolTipText("Display only for wheel");
1216
+ zoomBoxCB.addItemListener(this);
1217
+
1218
+ if (true) // Globals.ADVANCED)
1219
+ {
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);
5941227
5951228 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
5961229 // localCB.addItemListener(this);
5971230
1231
+ panel.Return();
1232
+
5981233 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
5991234 crowdCB.setToolTipText("Used for crowds");
6001235 crowdCB.addItemListener(this);
....@@ -603,22 +1238,19 @@
6031238 smoothCB.setToolTipText("Snapping delay");
6041239 smoothCB.addItemListener(this);
6051240
606
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
607
- slowCB.setToolTipText("Smooth interpolation");
608
- 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);
6091247
610
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
611
- boxCB.setToolTipText("Display bounding boxes");
612
- boxCB.addItemListener(this);
613
-
614
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
615
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
616
- zoomBoxCB.addItemListener(this);
617
-
6181248 // constraints.gridy += 1;
6191249 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6201250 // speakerMocapCB.addItemListener(this);
6211251
1252
+ panel.Return();
1253
+
6221254 if (false)
6231255 {
6241256 // handled in scripts
....@@ -633,40 +1265,85 @@
6331265 //constraints.gridy += 1;
6341266 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6351267 smoothfocusCB.addItemListener(this);
1268
+ panel.Return();
6361269 }
6371270
6381271 //constraints.gridx += 1;
6391272 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6401273 // debugCB.addItemListener(this);
6411274
1275
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1276
+ trackCB.setToolTipText("Enable tracking target");
1277
+ trackCB.addItemListener(this);
1278
+
6421279 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1280
+ oeilCB.setToolTipText("Move camera when tracking");
6431281 oeilCB.addItemListener(this);
6441282
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
+ {
6451303 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
6461304 lookAtCB.setToolTipText("Look-at target");
6471305 lookAtCB.addItemListener(this);
1306
+ }
1307
+
1308
+ }
6481309
6491310 cGridBag fill = new cGridBag();
650
-
6511311 fill.preferredHeight = 200;
1312
+ cGridBag fill2 = new cGridBag();
1313
+ fill2.preferredHeight = 200;
1314
+ cGridBag fill3 = new cGridBag();
1315
+ fill3.preferredHeight = 200;
6521316
6531317 panel.add(fill);
1318
+ panel.add(fill2);
1319
+ panel.add(fill3);
6541320
6551321 }
6561322
6571323 void EditObject(Object3D obj)
6581324 {
6591325 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
+
6601334 radioButton.SetObject(obj);
661
- radioButton.layout = sevenButton;
1335
+ radioButton.layout = threeButton; // sixButton;
6621336 radioButton.SetCamera(cameraView.renderCamera, false);
6631337 radioButton.addActionListener(this);
6641338 radioPanel.add(radioButton);
6651339 buttonGroup.add(radioButton);
6661340 radioButton.doClick();
6671341 }
1342
+
6681343 void SetupViews(ObjEditor oe)
6691344 {
1345
+ theFrame = this;
1346
+
6701347 oe.SetupViews();
6711348
6721349 System.out.println("SetupViews");
....@@ -675,23 +1352,30 @@
6751352 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6761353 }
6771354
678
- JCheckBox liveCB;
679
- JCheckBox supportCB;
680
- JCheckBox localCB;
681
- JCheckBox crowdCB;
682
- JCheckBox smoothCB;
683
- JCheckBox fastCB;
684
- JCheckBox slowCB;
685
- JCheckBox boxCB;
686
- JCheckBox zoomBoxCB;
687
- JCheckBox trackCB;
688
- 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;
6891370 // JCheckBox speakerMocapCB;
690
- JCheckBox speakerCameraCB;
691
- JCheckBox speakerFocusCB;
692
- JCheckBox debugCB;
693
- JCheckBox oeilCB;
694
- JCheckBox lookAtCB;
1371
+ cCheckBox speakerCameraCB;
1372
+ cCheckBox speakerFocusCB;
1373
+ cCheckBox debugCB;
1374
+
1375
+ cCheckBox oeilCB;
1376
+ cCheckBox shadowCB;
1377
+ cCheckBox autokeepCB;
1378
+ cCheckBox lookAtCB;
6951379
6961380 // static int COLOR = 1;
6971381 // static int MATERIAL = 2;
....@@ -699,9 +1383,9 @@
6991383
7001384 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7011385
702
- JCheckBox colorCB;
703
- JCheckBox materialCB;
704
- JCheckBox textureCB;
1386
+ cCheckBox colorCB;
1387
+ cCheckBox materialCB;
1388
+ cCheckBox textureCB;
7051389
7061390 public void itemStateChanged(ItemEvent e)
7071391 {
....@@ -729,6 +1413,7 @@
7291413 } else if(e.getSource() == liveCB)
7301414 {
7311415 cameraView.ToggleLive();
1416
+ refreshContents(false);
7321417 }
7331418 else if(e.getSource() == supportCB)
7341419 {
....@@ -744,6 +1429,12 @@
7441429 {
7451430 cameraView.ToggleInertia();
7461431 cameraView.repaint();
1432
+ }
1433
+ else if(e.getSource() == minshaderCB)
1434
+ {
1435
+ Globals.MINSHADER ^= true;
1436
+ cameraView.programInitialized = false;
1437
+ cameraView.repaint();
7471438 }
7481439 else if(e.getSource() == localCB)
7491440 {
....@@ -793,6 +1484,18 @@
7931484 {
7941485 cameraView.ToggleOeil();
7951486 }
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
+ }
7961499 else if(e.getSource() == lookAtCB)
7971500 {
7981501 cameraView.ToggleLookAt();
....@@ -809,7 +1512,8 @@
8091512
8101513 /**/
8111514 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
812
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1515
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1516
+ TreePath path = objEditor.jTree.getSelectionPath();
8131517 if ((path == null) || (path.getPathCount() <= 1)) {
8141518 // We can't move the root node or an empty selection
8151519 return;
....@@ -872,8 +1576,6 @@
8721576 }
8731577 }
8741578
875
- String string = (String) object;
876
-
8771579 System.out.println("Transfer = " + object + "; drop : " + target);
8781580 // if( object instanceof java.io.File[])
8791581 // {
....@@ -881,7 +1583,11 @@
8811583 // objEditor.DropFile((java.io.File[]) object, true);
8821584 // return;
8831585 // }
884
- if (string.charAt(0) == '/')
1586
+
1587
+ String string = object.toString();
1588
+
1589
+ // File path for Mac and Windows
1590
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8851591 {
8861592 // file(s)
8871593 String[] names = string.split("\n");
....@@ -908,7 +1614,7 @@
9081614
9091615 flashIt = false;
9101616 CameraPane pane = (CameraPane) target;
911
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1617
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9121618 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9131619
9141620 if (group.selection.size() == 1)
....@@ -924,23 +1630,33 @@
9241630
9251631 assert target == objEditor.jTree;
9261632 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1633
+ Object3D destinationLeaf;
9271634 try {
928
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1635
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9291636 } catch (Exception e) {
9301637 System.out.println("destinationPath : " + destinationPath);
9311638 return;
9321639 }
9331640
934
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1641
+ for (int i=group.selection.size(); --i>=0;)
9351642 {
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
+// {
9361652 loadClipboard(true);
9371653 objEditor.jTree.setSelectionPath(destinationPath);
938
- pasteInto(false);
939
- } else {
940
- loadClipboard(false);
941
- objEditor.jTree.setSelectionPath(destinationPath);
942
- pasteInto(false); // true); // ???
943
- }
1654
+ pasteInto(false, false);
1655
+// } else {
1656
+// loadClipboard(false);
1657
+// objEditor.jTree.setSelectionPath(destinationPath);
1658
+// pasteInto(false, false); // true); // ???
1659
+// }
9441660 }
9451661 public void dropActionChanged(DropTargetDragEvent dtde)
9461662 // Called if the user has modified the current drop gesture
....@@ -1045,54 +1761,71 @@
10451761 {
10461762 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10471763 //heightFieldItem.addActionListener(this);
1048
- gridItem = menu.add(new MenuItem("Grid"));
1049
- gridItem.addActionListener(this);
1050
- rectoidItem = menu.add(new MenuItem("Box"));
1051
- rectoidItem.addActionListener(this);
1052
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1053
- ellipsoidItem.addActionListener(this);
1054
- coneItem = menu.add(new MenuItem("Cone"));
1055
- coneItem.addActionListener(this);
1056
- torusItem = menu.add(new MenuItem("Torus"));
1057
- torusItem.addActionListener(this);
1058
- superItem = menu.add(new MenuItem("Superellipsoid"));
1059
- 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
+ {
10601782 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10611783 kleinItem.addActionListener(this);
1062
- particleItem = menu.add(new MenuItem("Particle system"));
1063
- particleItem.addActionListener(this);
1784
+ }
1785
+
1786
+// particleItem = menu.add(new MenuItem("Particle system"));
1787
+// particleItem.addActionListener(this);
1788
+ if (Globals.ADVANCED)
1789
+ {
10641790 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10651791 ragdollItem.addActionListener(this);
10661792 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10671793 ragdoll2Item.addActionListener(this);
1794
+ }
10681795 menu.add("-");
1069
- meshItem = menu.add(new MenuItem("Mesh"));
1796
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10701797 meshItem.addActionListener(this);
10711798 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10721799 // meshGroupItem.addActionListener(this);
1800
+ if (Globals.ADVANCED)
1801
+ {
10731802 springItem = menu.add(new MenuItem("Spring"));
10741803 springItem.addActionListener(this);
10751804 flagItem = menu.add(new MenuItem("Flag"));
10761805 flagItem.addActionListener(this);
1077
- bezierItem = menu.add(new MenuItem("Patch"));
1078
- bezierItem.addActionListener(this);
1079
- checkerItem = menu.add(new MenuItem("Checker"));
1080
- checkerItem.addActionListener(this);
10811806 blobItem = menu.add(new MenuItem("Blob"));
10821807 blobItem.addActionListener(this);
10831808 latheItem = menu.add(new MenuItem("Lathe"));
10841809 latheItem.addActionListener(this);
1085
- lightItem = menu.add(new MenuItem("Light"));
1086
- lightItem.addActionListener(this);
1810
+ }
1811
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1812
+ bezierItem.addActionListener(this);
1813
+// overlayItem = menu.add(new MenuItem("Overlay"));
1814
+// overlayItem.addActionListener(this);
1815
+// lightItem = menu.add(new MenuItem("Light"));
1816
+// lightItem.addActionListener(this);
10871817 menu.add("-");
10881818 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10891819 //superLoopItem.addActionListener(this);
1090
- loopItem = menu.add(new MenuItem("Loop"));
1091
- loopItem.addActionListener(this);
1820
+// loopItem = menu.add(new MenuItem("Loop"));
1821
+// loopItem.addActionListener(this);
10921822 doubleItem = menu.add(new MenuItem("Fork"));
10931823 doubleItem.addActionListener(this);
1824
+ if (Globals.ADVANCED)
1825
+ {
10941826 tripleItem = menu.add(new MenuItem("Trident"));
10951827 tripleItem.addActionListener(this);
1828
+ }
10961829 }
10971830
10981831 void buildToolsMenu(Menu menu)
....@@ -1101,29 +1834,34 @@
11011834 animationItem.addItemListener(this);
11021835 animationItem.setState(Globals.ANIMATION);
11031836
1837
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1838
+ archiveItem.addActionListener(this);
1839
+
11041840 menu.add("-");
11051841 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11061842 parseverticesItem.addActionListener(this);
11071843 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11081844 textureFieldItem.addActionListener(this);
1109
- alignItem = menu.add(new MenuItem("Align"));
1845
+ alignItem = menu.add(new MenuItem("Align Objects"));
11101846 alignItem.addActionListener(this);
1111
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1112
- mirrorItem.addActionListener(this);
11131847 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11141848 reduceMorphItem.addActionListener(this);
11151849 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11161850 reduce34MorphItem.addActionListener(this);
1117
-
1118
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1119
- computeAOItem.addActionListener(this);
11201851 menu.add("-");
1121
-
11221852 menu.add(memoryItem = new MenuItem("Memory Usage"));
11231853 memoryItem.addActionListener(this);
1854
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1855
+ computeAOItem.addActionListener(this);
1856
+
1857
+ if (Globals.ADVANCED)
1858
+ {
1859
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1860
+ mirrorItem.addActionListener(this);
1861
+ menu.add("-");
11241862 menu.add(analyzeItem = new MenuItem("Analyze"));
11251863 analyzeItem.addActionListener(this);
1126
- menu.add(dumpItem = new MenuItem("Dump"));
1864
+ menu.add(dumpItem = new MenuItem("Print"));
11271865 dumpItem.addActionListener(this);
11281866 // menu.add(pathItem = new MenuItem("From-to path"));
11291867 // pathItem.addActionListener(this);
....@@ -1141,6 +1879,7 @@
11411879 menu.add("-");
11421880 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11431881 editScriptItem.addActionListener(this);
1882
+ }
11441883 }
11451884
11461885 void ScreenFit()
....@@ -1263,9 +2002,34 @@
12632002 shadow.material = new cMaterial(obj.material);
12642003 shadow.material.diffuse = 0.0001f;
12652004 shadow.material.specular = 0.0001f;
2005
+ //shadow.projectedVertices[1].x = 300;
12662006
12672007 makeSomething(shadow);
12682008 }
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
+ }
12692033
12702034 /**
12712035 * applyExample
....@@ -1469,9 +2233,9 @@
14692233
14702234 void Overwrite(int mask)
14712235 {
1472
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2236
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14732237 {
1474
- Object3D content = GrafreeD.clipboard.get(0);
2238
+ Object3D content = Grafreed.clipboard.get(0);
14752239
14762240 if (content instanceof cGroup && ((cGroup)content).transientlink )
14772241 content = ((cGroup)content).get(0);
....@@ -1510,7 +2274,7 @@
15102274 {
15112275 ScreenFit();
15122276 } else
1513
- if (source == switchItem)
2277
+ if (source == switchViewItem)
15142278 {
15152279 cVector v1 = new cVector();
15162280 cVector v2 = new cVector();
....@@ -1519,11 +2283,11 @@
15192283 objEditor.cameraView.renderCamera.setAim(v2, v1);
15202284 objEditor.cameraView.repaint();
15212285 } else
1522
- if (source == rectoidItem)
2286
+ if (source == rectoidItem || source == boxButton)
15232287 {
15242288 makeSomething(new Box());
15252289 } else
1526
- if (source == particleItem)
2290
+ if (source == particleItem || source == particlesButton)
15272291 {
15282292 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15292293 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1602,27 +2366,27 @@
16022366
16032367 makeSomething(obj);
16042368 } else
1605
- if (source == gridItem)
2369
+ if (source == gridItem || source == gridButton)
16062370 {
16072371 makeSomething(new Grid());
16082372 } else
1609
- if (source == ellipsoidItem)
2373
+ if (source == ellipsoidItem || source == sphereButton)
16102374 {
16112375 makeSomething(new Sphere());
16122376 } else
1613
- if (source == coneItem)
2377
+ if (source == coneItem || source == coneButton)
16142378 {
16152379 makeSomething(new Cone());
16162380 } else
1617
- if (source == torusItem)
2381
+ if (source == torusItem || source == torusButton)
16182382 {
16192383 makeSomething(new Torus());
16202384 } else
1621
- if (source == superItem)
2385
+ if (source == superItem || source == superButton)
16222386 {
16232387 makeSomething(new Superellipsoid());
16242388 } else
1625
- if (source == kleinItem)
2389
+ if (source == kleinItem || source == kleinButton)
16262390 {
16272391 makeSomething(new Klein());
16282392 } else
....@@ -1642,7 +2406,7 @@
16422406 {
16432407 makeSomething(new BezierSurface());
16442408 } else
1645
- if (source == checkerItem)
2409
+ if (source == overlayItem || source == overlayButton)
16462410 {
16472411 /*
16482412 Object3D obj = new BezierSurface(5,8);
....@@ -1690,10 +2454,27 @@
16902454 s.setup();
16912455 makeSomething(s);
16922456 } else
1693
- if (source == lightItem)
2457
+ if (source == lightItem || source == lightButton)
16942458 {
16952459 makeSomething(new Light());
16962460 } 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
16972478 if (source == csgItem)
16982479 {
16992480 group(new CSG());
....@@ -1740,30 +2521,30 @@
17402521
17412522 group(g);
17422523 } else
1743
- if (source == loopItem)
2524
+ if (source == loopItem || source == loopButton)
17442525 {
17452526 Composite csg = new GroupLeaf();
17462527 csg.count = 5;
17472528 group(csg);
1748
- Composite child = new cGroup();
2529
+ Composite child = new cGroup("Branch");
17492530 csg.addChild(child);
17502531 child.addChild(csg);
17512532 } else
17522533 if (source == doubleItem)
17532534 {
1754
- Composite csg = new GroupLeaf();
2535
+ Composite csg = new GroupLeaf("Fork");
17552536 csg.count = 5;
17562537 group(csg);
1757
- Composite child = new cGroup();
2538
+ Composite child = new cGroup("Branch A");
17582539 csg.addChild(child);
17592540 child.addChild(csg);
1760
- child = new cGroup();
2541
+ child = new cGroup("Branch B");
17612542 csg.addChild(child);
17622543 child.addChild(csg);
17632544 } else
17642545 if (source == tripleItem)
17652546 {
1766
- Composite csg = new GroupLeaf();
2547
+ Composite csg = new GroupLeaf("Trident");
17672548 csg.count = 4;
17682549 group(csg);
17692550 Composite child = new cGroup();
....@@ -1776,27 +2557,10 @@
17762557 csg.addChild(child);
17772558 child.addChild(csg);
17782559 } else
1779
-
1780
- if (source == importGFDItem)
1781
- {
1782
- ImportGFD();
1783
- } else
1784
- if (source == importVRMLX3DItem)
1785
- {
1786
- ImportVRMLX3D();
1787
- } else
1788
- if (source == import3DSItem)
1789
- {
1790
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1791
- } else
1792
- if (source == importOBJItem)
1793
- {
1794
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1795
- } else
17962560 if (source == computeAOItem)
17972561 {
17982562 Globals.drawMode = CameraPane.OCCLUSION;
1799
- Globals.theRenderer.repaint();
2563
+ cameraView.repaint();
18002564 } else
18012565 if (source == recompileItem)
18022566 {
....@@ -1811,7 +2575,7 @@
18112575 if (source == invariantsItem)
18122576 {
18132577 System.out.println("Invariants:");
1814
- GrafreeD.grafreeD.universe.invariants();
2578
+ Grafreed.grafreed.universe.invariants();
18152579 } else
18162580 if (source == memoryItem)
18172581 {
....@@ -1830,19 +2594,68 @@
18302594 {
18312595 DumpObject();
18322596 } 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
2644
+ if (source == oneStepButton)
2645
+ {
2646
+ Globals.ONESTEP = true;
2647
+ cameraView.repaint();
2648
+ } else
18332649 if (source == screenfitButton)
18342650 {
1835
- //Reload(lastConverter, lastFilename, true);
18362651 ScreenFit();
18372652 } else
18382653 if (source == screenfitpointButton)
18392654 {
1840
- //Reload(lastConverter, lastFilename, true);
18412655 ScreenFitPoint();
18422656 } else
18432657 if (source == snapobjectButton)
18442658 {
1845
- //Reload(lastConverter, lastFilename, true);
18462659 SnapObject();
18472660 } else
18482661 // if (event.getSource() == recompileButton)
....@@ -1879,12 +2692,20 @@
18792692 {
18802693 loadClipboard(true);
18812694 } else
2695
+ if (source == undoItem)
2696
+ {
2697
+ PreviousVersion();
2698
+ } else
2699
+ if (source == redoItem)
2700
+ {
2701
+ NextVersion();
2702
+ } else
18822703 if (source == duplicateItem)
18832704 {
1884
- Object3D keep = GrafreeD.clipboard;
2705
+ Object3D keep = Grafreed.clipboard;
18852706 loadClipboard(false);
18862707 paste(false);
1887
- GrafreeD.clipboard = keep;
2708
+ Grafreed.clipboard = keep;
18882709 } else
18892710 if (source == cloneItem)
18902711 {
....@@ -1902,13 +2723,17 @@
19022723 {
19032724 paste(false);
19042725 } else
2726
+ if (source == pasteIntoItem)
2727
+ {
2728
+ pasteInto(true, false);
2729
+ } else
19052730 if (source == pasteLinkItem)
19062731 {
1907
- pasteInto(false);
2732
+ pasteInto(false, false);
19082733 } else
19092734 if (source == pasteCloneItem)
19102735 {
1911
- pasteInto(true);
2736
+ pasteInto(true, true);
19122737 } else
19132738 if (source == pasteExpandItem)
19142739 {
....@@ -2100,9 +2925,9 @@
21002925 // group.selection.get(0).setMasterThis(content); // should be identity
21012926 // refreshContents();
21022927 // }
2103
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2928
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21042929 {
2105
- Object3D content = GrafreeD.clipboard.get(0);
2930
+ Object3D content = Grafreed.clipboard.get(0);
21062931
21072932 if (content instanceof cGroup && ((cGroup)content).transientlink )
21082933 content = ((cGroup)content).get(0);
....@@ -2110,11 +2935,11 @@
21102935 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21112936 for (int i=0; i<group.selection.size(); i++)
21122937 {
2113
- boolean random = CameraPane.RANDOM;
2114
- CameraPane.RANDOM = false; // parse all random nodes
2938
+ boolean random = CameraPane.SWITCH;
2939
+ CameraPane.SWITCH = false; // parse all random nodes
21152940 group.selection.get(i).linkVerticesThis(content);
21162941 // group.selection.get(i).setMasterThis(content); // should be identity
2117
- CameraPane.RANDOM = random;
2942
+ CameraPane.SWITCH = random;
21182943 }
21192944 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21202945 refreshContents();
....@@ -2124,20 +2949,20 @@
21242949 {
21252950 for (int i=0; i<group.selection.size(); i++)
21262951 {
2127
- boolean random = CameraPane.RANDOM;
2128
- CameraPane.RANDOM = false; // parse all random nodes
2952
+ boolean random = CameraPane.SWITCH;
2953
+ CameraPane.SWITCH = false; // parse all random nodes
21292954 group.selection.get(i).linkVerticesThis(null);
2130
- CameraPane.RANDOM = random;
2955
+ CameraPane.SWITCH = random;
21312956 }
21322957
21332958 refreshContents();
21342959 } else
21352960 if (source == relinkverticesItem)
21362961 {
2137
- boolean random = CameraPane.RANDOM;
2138
- CameraPane.RANDOM = false; // parse all random nodes
2962
+ boolean random = CameraPane.SWITCH;
2963
+ CameraPane.SWITCH = false; // parse all random nodes
21392964 group.selection.RelinkToSupport();
2140
- CameraPane.RANDOM = random;
2965
+ CameraPane.SWITCH = random;
21412966
21422967 refreshContents();
21432968 } else
....@@ -2152,9 +2977,9 @@
21522977 } else
21532978 if (source == setMasterItem)
21542979 {
2155
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2980
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21562981 {
2157
- Object3D content = GrafreeD.clipboard.get(0);
2982
+ Object3D content = Grafreed.clipboard.get(0);
21582983
21592984 if (content instanceof cGroup && ((cGroup)content).transientlink )
21602985 content = ((cGroup)content).get(0);
....@@ -2167,9 +2992,9 @@
21672992 {
21682993 if (group.selection.size() == 1)
21692994 {
2170
- if (GrafreeD.clipboard.size() == 1)
2995
+ if (Grafreed.clipboard.size() == 1)
21712996 {
2172
- Object3D content = GrafreeD.clipboard.get(0);
2997
+ Object3D content = Grafreed.clipboard.get(0);
21732998
21742999 if (content instanceof cGroup && ((cGroup)content).transientlink )
21753000 content = ((cGroup)content).get(0);
....@@ -2186,7 +3011,7 @@
21863011 {
21873012 RevertMeshes();
21883013 } else
2189
- if (source == resetMeshItem)
3014
+ if (source == resetAllItem)
21903015 {
21913016 ResetAll();
21923017 } else
....@@ -2194,7 +3019,7 @@
21943019 {
21953020 StepAll();
21963021 } else
2197
- if (source == clearItem) // || event.getSource() == clearButton)
3022
+ if (source == deleteItem) // || event.getSource() == clearButton)
21983023 {
21993024 //int indices[] = jList.getSelectedIndices();
22003025 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2206,9 +3031,9 @@
22063031 {
22073032 ClearSelection(true);
22083033 } else
2209
- if (source == grabItem)
3034
+ if (source == grabItem || source == groupButton)
22103035 {
2211
- group(new cGroup(), true);
3036
+ group(new cGroup(), false); // true);
22123037 } else
22133038 if (source == hideItem)
22143039 {
....@@ -2226,11 +3051,11 @@
22263051 {
22273052 makeSomething(new Camera());
22283053 } else
2229
- if (source == compositeItem)
3054
+ if (source == compositeItem || source == compositeButton)
22303055 {
22313056 group(new Composite());
22323057 } else
2233
- if (source == randomItem)
3058
+ if (source == switchItem || source == switchButton)
22343059 {
22353060 RandomNode random = new RandomNode();
22363061 group(random);
....@@ -2332,7 +3157,7 @@
23323157 {
23333158 group(new cLinker());
23343159 } else
2335
- if (source == textureItem)
3160
+ if (source == textureItem || source == textureButton)
23363161 {
23373162 group(new TextureNode());
23383163 } else
....@@ -2352,17 +3177,30 @@
23523177 {
23533178 CastShadow(2);
23543179 } else
2355
- if (source == ungroupItem)
3180
+ if (source == ungroupItem || source == ungroupButton)
23563181 {
2357
- //ungroup();
3182
+ boolean hasRoot = false;
3183
+
23583184 for (int i=0; i<group.selection.size(); i++)
23593185 {
2360
- Ungroup(group.selection.get(i));
3186
+ if (group.selection.get(i) == group)
3187
+ {
3188
+ hasRoot = true;
3189
+ break;
3190
+ }
23613191 }
23623192
2363
- ClearSelection(false);
2364
-
2365
- 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
+ }
23663204 } else
23673205 if (source == genUVItem)
23683206 {
....@@ -2374,7 +3212,7 @@
23743212 } else
23753213 if (source == genNormalsMESHItem)
23763214 {
2377
- GenNormals(true); // TODO
3215
+ GenNormalsMESH();
23783216 } else
23793217 if (source == genNormalsORGANItem)
23803218 {
....@@ -2439,6 +3277,22 @@
24393277 if (source == unmarkleavesItem)
24403278 {
24413279 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);
24423296 } else
24433297 if (source == flipVItem)
24443298 {
....@@ -2524,9 +3378,13 @@
25243378 {
25253379 SmoothMesh();
25263380 } else
2527
- if (source == transformgeometryItem)
3381
+ if (source == transformGeometryItem)
25283382 {
25293383 TransformGeometry();
3384
+ } else
3385
+ if (source == transformChildrenItem)
3386
+ {
3387
+ TransformChildren();
25303388 } else
25313389 if (source == resetTransformItem)
25323390 {
....@@ -2534,7 +3392,11 @@
25343392 } else
25353393 if (source == resetCentroidItem)
25363394 {
2537
- ResetCentroid();
3395
+ ResetCentroid(true);
3396
+ } else
3397
+ if (source == resetCentroidXZItem)
3398
+ {
3399
+ ResetCentroid(false);
25383400 } else
25393401 if (source == resetParentItem)
25403402 {
....@@ -2639,7 +3501,7 @@
26393501 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26403502 {
26413503 obj = (Object3D)e.nextElement();
2642
- obj.SetBumpTexture(null);
3504
+ obj.ResetBumpTexture();
26433505 }
26443506
26453507 refreshContents();
....@@ -2655,6 +3517,31 @@
26553517
26563518 refreshContents();
26573519 } 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
26583545 if (source == flashSelectionButton)
26593546 {
26603547 CameraPane.flash = true;
....@@ -2666,6 +3553,10 @@
26663553 if (source == twoButton)
26673554 {
26683555 radio.layout = twoButton;
3556
+
3557
+ if (CameraPane.FULLSCREEN)
3558
+ fullscreenLayout = radio.layout;
3559
+
26693560 // bug
26703561 //gridPanel.setDividerLocation(1.0);
26713562 //bigPanel.setDividerLocation(0.0);
....@@ -2698,10 +3589,31 @@
26983589 bigThree.ClearUI();
26993590 bigThree.add(centralPanel);
27003591 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
+
27013610 } else
27023611 if (source == threeButton)
27033612 {
27043613 radio.layout = threeButton;
3614
+
3615
+ if (CameraPane.FULLSCREEN)
3616
+ fullscreenLayout = radio.layout;
27053617
27063618 // bigThree.remove(scenePanel);
27073619 // bigThree.remove(centralPanel);
....@@ -2731,13 +3643,18 @@
27313643 // centralPanel.setVisible(true);
27323644 // XYZPanel.setVisible(true);
27333645 bigThree.ClearUI();
3646
+ bigThree.add(scenePanel);
27343647 bigThree.add(centralPanel);
2735
- bigThree.add(XYZPanel);
27363648 bigThree.FlushUI();
3649
+
3650
+ cameraView.requestFocusInWindow();
27373651 } else
27383652 if (source == fourButton)
27393653 {
27403654 radio.layout = fourButton;
3655
+
3656
+ if (CameraPane.FULLSCREEN)
3657
+ fullscreenLayout = radio.layout;
27413658
27423659 // bigThree.remove(scenePanel);
27433660 // bigThree.remove(centralPanel);
....@@ -2769,10 +3686,15 @@
27693686 bigThree.ClearUI();
27703687 bigThree.add(scenePanel);
27713688 bigThree.FlushUI();
3689
+
3690
+ cameraView.requestFocusInWindow();
27723691 } else
27733692 if (source == sixButton)
27743693 {
27753694 radio.layout = sixButton;
3695
+
3696
+ if (CameraPane.FULLSCREEN)
3697
+ fullscreenLayout = radio.layout;
27763698
27773699 // bigThree.remove(scenePanel);
27783700 // bigThree.remove(centralPanel);
....@@ -2802,13 +3724,18 @@
28023724 // centralPanel.setVisible(true);
28033725 // XYZPanel.setVisible(false);
28043726 bigThree.ClearUI();
2805
- bigThree.add(scenePanel);
28063727 bigThree.add(centralPanel);
3728
+ bigThree.add(scenePanel);
28073729 bigThree.FlushUI();
3730
+
3731
+ cameraView.requestFocusInWindow();
28083732 } else
28093733 if (source == sevenButton)
28103734 {
28113735 radio.layout = sevenButton;
3736
+
3737
+ if (CameraPane.FULLSCREEN)
3738
+ fullscreenLayout = radio.layout;
28123739
28133740 // bigThree.remove(scenePanel);
28143741 // bigThree.remove(centralPanel);
....@@ -2842,6 +3769,8 @@
28423769 bigThree.add(centralPanel);
28433770 bigThree.add(XYZPanel);
28443771 bigThree.FlushUI();
3772
+
3773
+ cameraView.requestFocusInWindow();
28453774 } else
28463775 if (source == rootButton)
28473776 {
....@@ -2853,6 +3782,7 @@
28533782 EditObject(obj);
28543783 }
28553784
3785
+ cameraView.requestFocusInWindow();
28563786 refreshContents(true);
28573787 } else
28583788 if (source == closeButton)
....@@ -2862,22 +3792,37 @@
28623792 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28633793 {
28643794 ab = (cRadio)e.nextElement();
2865
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3795
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28663796 {
3797
+ // Patch to avoid bug with transparency.
3798
+ if (!ab.hadMaterial)
3799
+ {
3800
+ ab.object.material = null;
3801
+ }
3802
+
28673803 buttonGroup.remove(ab);
28683804 radioPanel.remove(ab);
28693805
2870
- ab.GetObject().editWindow = null;
3806
+ //ab.GetObject().editWindow = null;
3807
+ ab.GetObject().manipWindow = null;
28713808 // ab.GetObject().objectUI = null; // ?????????
28723809
28733810 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28743811 break;
28753812 }
28763813 }
3814
+
3815
+ cameraView.requestFocusInWindow();
28773816 refreshContents(true);
28783817 } else
28793818 if (source == editItem || source == editButton)
28803819 {
3820
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3821
+ {
3822
+ Object3D child = (Object3D)e.nextElement();
3823
+ child.pinned = true;
3824
+ }
3825
+
28813826 EditSelection(false);
28823827 } else
28833828 if (source == uneditButton)
....@@ -2886,11 +3831,12 @@
28863831 {
28873832 Object3D child = (Object3D)e.nextElement();
28883833 if(child.editWindow != null)
2889
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3834
+ child.pinned = false;
28903835 child.CloseUI();
28913836 listUI.remove(child);
3837
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28923838
2893
- child.editWindow = null; // ???????????
3839
+ //child.editWindow = null; // ???????????
28943840 }
28953841 objEditor.ctrlPanel.FlushUI();
28963842 //objEditor.jTree.clearSelection();
....@@ -2903,16 +3849,18 @@
29033849 //copy.ClearUI();
29043850 for (Object3D obj : listUI)
29053851 {
3852
+ obj.pinned = false;
29063853 obj.CloseUI();
29073854 }
29083855 listUI.clear();
3856
+ SetPinStates(group.selection.size() > 0);
29093857 refreshContents(true);
29103858 } else
29113859 if (source == allParamsButton)
29123860 {
29133861 assert(copy == group);
29143862
2915
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3863
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29163864
29173865 for (Object3D obj : listUI)
29183866 {
....@@ -2961,6 +3909,9 @@
29613909 }
29623910
29633911 copy = group;
3912
+
3913
+ SetUndoStates();
3914
+
29643915 //Globals.theRenderer.object = group;
29653916 if(!useclient)
29663917 {
....@@ -2976,20 +3927,49 @@
29763927 frontView.object = group;
29773928 sideView.object = group;
29783929 }
2979
- group.editWindow = this;
3930
+
3931
+// fix "+" issue
3932
+ //group.editWindow = this;
3933
+ group.manipWindow = this;
3934
+
29803935 /*
29813936 currentLayout = radio.layout;
29823937 if (currentLayout == null)
29833938 currentLayout = sevenButton;
29843939 */
29853940 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);
29863949 keepparent = group.parent;
29873950 // PARENT = NULL or not???
29883951 //group.parent = null; // ROOT
29893952 //group.attributes = -1;
29903953 ResetModel();
3954
+
3955
+ cameraView.requestFocusInWindow();
29913956 refreshContents(true);
2992
- }
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
+ }
29933973 else
29943974 {
29953975 //return super.action(event, arg);
....@@ -2998,7 +3978,6 @@
29983978 }
29993979
30003980 boolean useclient = false;
3001
- cRadio radio;
30023981
30033982 void ToggleRoot()
30043983 {
....@@ -3050,6 +4029,28 @@
30504029 refreshContents();
30514030 }
30524031
4032
+ void TransformChildren()
4033
+ {
4034
+ Object3D obj;
4035
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4036
+ {
4037
+ obj = (Object3D)e.nextElement();
4038
+ obj.KeepTextureMatrices();
4039
+ obj.TransformChildren();
4040
+ obj.RestoreTextureMatrices();
4041
+
4042
+// if (obj.parent == null)
4043
+// {
4044
+// System.out.println("NULL PARENT!");
4045
+// new Exception().printStackTrace();
4046
+// }
4047
+// else
4048
+// TouchTransform(obj);
4049
+// //obj.parent.Touch();
4050
+ }
4051
+
4052
+ refreshContents();
4053
+ }
30534054
30544055 void ResetTransform()
30554056 {
....@@ -3162,7 +4163,7 @@
31624163 refreshContents();
31634164 }
31644165
3165
- void ResetCentroid()
4166
+ void ResetCentroid(boolean full)
31664167 {
31674168 Object3D obj;
31684169 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3177,12 +4178,16 @@
31774178 LA.matIdentity(Object3D.mat);
31784179 obj.getBounds(minima, maxima, false);
31794180 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3180
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4181
+ if (full)
4182
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31814183 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31824184 obj.TransformMesh(Object3D.mat);
4185
+
31834186 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3184
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4187
+ if (full)
4188
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31854189 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4190
+
31864191 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31874192 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31884193 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3211,7 +4216,8 @@
32114216
32124217 int size = obj.MemorySize();
32134218
3214
- 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)");
32154221 }
32164222 }
32174223 catch (Exception e)
....@@ -3248,9 +4254,9 @@
32484254 obj = (Object3D)e.nextElement();
32494255
32504256 System.out.println("Object is: " + obj);
3251
- GrafreeD.AnalyzeObject(obj);
4257
+ Grafreed.AnalyzeObject(obj);
32524258 System.out.println("Boundary rep: " + obj.bRep);
3253
- GrafreeD.AnalyzeObject(obj.bRep);
4259
+ Grafreed.AnalyzeObject(obj.bRep);
32544260
32554261 // System.err.println((size/1024) + " KB is the size of " + obj);
32564262 }
....@@ -3292,6 +4298,13 @@
32924298 void GenNormals(boolean crease)
32934299 {
32944300 group.GenNormalsS(crease);
4301
+
4302
+ refreshContents();
4303
+ }
4304
+
4305
+ void GenNormalsMESH()
4306
+ {
4307
+ group.GenNormalsMeshS();
32954308
32964309 refreshContents();
32974310 }
....@@ -3464,8 +4477,8 @@
34644477
34654478 void ParseVertices()
34664479 {
3467
- boolean epsequal = GrafreeD.epsequal;
3468
- GrafreeD.epsequal = true;
4480
+ boolean epsequal = Grafreed.epsequal;
4481
+ Grafreed.epsequal = true;
34694482
34704483 for (int i=0; i<group.selection.size(); i++)
34714484 {
....@@ -3490,7 +4503,7 @@
34904503 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34914504 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34924505
3493
- g.add(GrafreeD.clipboard);
4506
+ g.add(Grafreed.clipboard);
34944507
34954508 buffer.add(g);
34964509 }
....@@ -3505,7 +4518,7 @@
35054518 makeSomething(buffer, i==group.selection.size()-1);
35064519 }
35074520
3508
- GrafreeD.epsequal = epsequal;
4521
+ Grafreed.epsequal = epsequal;
35094522
35104523 refreshContents();
35114524 }
....@@ -3523,7 +4536,16 @@
35234536 String pigment = Object3D.GetPigment(tex);
35244537 //String bump = Object3D.GetBump(tex);
35254538
3526
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4539
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4540
+
4541
+ try
4542
+ {
4543
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4544
+ }
4545
+ catch (Exception e)
4546
+ {
4547
+ System.err.println("FAIL: " + node);
4548
+ }
35274549
35284550 double s = v.s;
35294551
....@@ -3611,11 +4633,11 @@
36114633
36124634 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36134635
3614
- boolean random = CameraPane.RANDOM;
3615
- CameraPane.RANDOM = false; // parse all random nodes
4636
+ boolean random = CameraPane.SWITCH;
4637
+ CameraPane.SWITCH = false; // parse all random nodes
36164638 lowres.linkVerticesThis(null);
36174639 lowres.linkVerticesThis(sn);
3618
- CameraPane.RANDOM = random;
4640
+ CameraPane.SWITCH = random;
36194641
36204642 System.err.flush();
36214643
....@@ -3655,7 +4677,7 @@
36554677 return;
36564678
36574679 Object3D poses = group.selection.get(0);
3658
- Object3D ref = GrafreeD.clipboard.get(0);
4680
+ Object3D ref = Grafreed.clipboard.get(0);
36594681
36604682 Object3D newgroup = new Object3D("Po:" + poses.name);
36614683
....@@ -3849,9 +4871,9 @@
38494871
38504872 void ClipMesh()
38514873 {
3852
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4874
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38534875 {
3854
- Object3D content = GrafreeD.clipboard.get(0);
4876
+ Object3D content = Grafreed.clipboard.get(0);
38554877
38564878 if (content instanceof cGroup && ((cGroup)content).transientlink )
38574879 content = ((cGroup)content).get(0);
....@@ -3860,7 +4882,7 @@
38604882 // {
38614883 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38624884 // }
3863
- group.selection.ClipMesh(GrafreeD.clipboard);
4885
+ group.selection.ClipMesh(Grafreed.clipboard);
38644886 }
38654887 // group.selection.ClipMesh(GrafreeD.clipboard);
38664888 System.out.println("DONE.");
....@@ -3907,6 +4929,18 @@
39074929 void MarkLeaves(boolean hide)
39084930 {
39094931 group.selection.MarkLeaves(hide);
4932
+ refreshContents();
4933
+ }
4934
+
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);
39104944 refreshContents();
39114945 }
39124946
....@@ -3981,28 +5015,25 @@
39815015 // }
39825016 // }
39835017
3984
- static boolean allparams = true;
3985
-
3986
- static Vector<Object3D> listUI = new Vector<Object3D>();
3987
-
39885018 void EditSelection(boolean newWindow)
39895019 {
5020
+ if (group.selection == null)
5021
+ {
5022
+ EditElement(group, newWindow); // ? new
5023
+ return;
5024
+ }
5025
+
39905026 // aConstraints.gridy = 0;
39915027 for (int i=0; i<group.selection.size(); i++)
39925028 {
39935029 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39945030 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3995
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5031
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39965032
39975033 Object3D elem = (Object3D)group.selection.elementAt(i);
3998
- if(elem != group)
5034
+ if(elem != group || !newWindow)
39995035 {
4000
- // if (!(elem instanceof Composite))
4001
- // newWindow = false;
4002
- listUI.add(elem);
4003
- elem.openEditWindow(this, newWindow); //, false);
4004
- System.out.println("edit : " + elem);
4005
- elem.editWindow.refreshContents(true); // ? new
5036
+ EditElement(elem, newWindow); // ? new
40065037 }
40075038 }
40085039 }
....@@ -4065,9 +5096,7 @@
40655096
40665097 freezemodel = false;
40675098 }
4068
-
4069
- boolean flashIt = true;
4070
-
5099
+
40715100 public void valueChanged(TreeSelectionEvent e)
40725101 //public boolean handleEvent(Event event)
40735102 {
....@@ -4077,7 +5106,8 @@
40775106 //new Exception().printStackTrace();
40785107
40795108 freezemodel = true;
4080
-
5109
+ ClearUnpinned();
5110
+
40815111 /**/
40825112 //switch (event.id)
40835113 {
....@@ -4085,7 +5115,6 @@
40855115 //case 702: // Event.LIST_DESELECT
40865116 group.deselectAll();
40875117 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4088
- objEditor.ClearInfo(); // .GetMaterial());
40895118 if (tps != null)
40905119 {
40915120 for (int i=0; i < tps.length; i++)
....@@ -4094,10 +5123,8 @@
40945123
40955124 //if (child.parent != null)
40965125 //child.parent.addSelectee(child);
5126
+ objEditor.SetMaterial(child);
40975127 group.addSelectee(child);
4098
- objEditor.SetMaterial(child); // .GetMaterial());
4099
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4100
- System.err.println("info : " + child.GetPath());
41015128 }
41025129 }
41035130 // else
....@@ -4107,20 +5134,28 @@
41075134 // System.err.println("info : " + group.GetPath());
41085135 // }
41095136
4110
- objEditor.SetText(); // jan 2014
4111
-
4112
- 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))
41135138 CameraPane.flash = true;
41145139
4115
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5140
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41165141 // a camera
41175142 {
4118
- CameraPane.camerachangeframe = 0; // don't refuse it
4119
- 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
+ }
41205148 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41215149 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41225150 }
41235151
5152
+ if (tps != null && tps.length == 1)
5153
+ {
5154
+ EditSelection(false);
5155
+ }
5156
+
5157
+ SetPinStates(tps != null && tps.length > 0);
5158
+
41245159 refreshContents();
41255160 //return true;
41265161 }
....@@ -4129,6 +5164,37 @@
41295164
41305165 freezemodel = false;
41315166 }
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
+ }
41325198
41335199 void linkSomething(Object3D thing)
41345200 {
....@@ -4200,16 +5266,19 @@
42005266 {
42015267 if (group.selection.isEmpty())
42025268 return;
4203
- GrafreeD.clipboardIsTempGroup = false;
5269
+
5270
+ Grafreed.clipboardIsTempGroup = false;
42045271 Composite tGroup = null;
42055272 if (group.selection.size() > 0) // 1)
42065273 {
42075274 tGroup = new cGroup();
4208
- GrafreeD.clipboardIsTempGroup = true;
5275
+ Grafreed.clipboardIsTempGroup = true;
42095276 }
42105277
42115278 if (cut)
42125279 {
5280
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5281
+// Save();
42135282 //int indices[] = jList.getSelectedIndices();
42145283 //for (int i = indices.length - 1; i >= 0; i--)
42155284 //jList.remove(indices[i]);
....@@ -4245,16 +5314,16 @@
42455314 //System.out.println("cut " + child);
42465315 //System.out.println("parent = " + child.parent);
42475316 // tmp.addChild(child);
4248
- if (GrafreeD.clipboardIsTempGroup)
5317
+ if (Grafreed.clipboardIsTempGroup)
42495318 tGroup.add/*Child*/(tmp);
42505319 else
4251
- GrafreeD.clipboard = tmp;
5320
+ Grafreed.clipboard = tmp;
42525321 }
42535322 else
4254
- if (GrafreeD.clipboardIsTempGroup)
5323
+ if (Grafreed.clipboardIsTempGroup)
42555324 tGroup.add/*Child*/(child);
42565325 else
4257
- GrafreeD.clipboard = child;
5326
+ Grafreed.clipboard = child;
42585327 }
42595328
42605329 //ResetModel();
....@@ -4286,21 +5355,23 @@
42865355 //System.out.println("cut " + elem);
42875356 //System.out.println("parent = " + elem.parent);
42885357 // tmp.addChild(elem);
4289
- if (GrafreeD.clipboardIsTempGroup)
5358
+ if (Grafreed.clipboardIsTempGroup)
42905359 tGroup.add/*Child*/(tmp);
42915360 else
4292
- GrafreeD.clipboard = tmp;
5361
+ Grafreed.clipboard = tmp;
42935362 }
42945363 else
4295
- if (GrafreeD.clipboardIsTempGroup)
5364
+ if (Grafreed.clipboardIsTempGroup)
42965365 tGroup.add/*Child*/(child);
42975366 else
4298
- GrafreeD.clipboard = child;
5367
+ Grafreed.clipboard = child;
42995368 }
43005369
43015370 }
4302
- if (GrafreeD.clipboardIsTempGroup)
4303
- GrafreeD.clipboard = tGroup;
5371
+
5372
+ if (Grafreed.clipboardIsTempGroup)
5373
+ Grafreed.clipboard = tGroup;
5374
+
43045375 if (cut)
43055376 {
43065377 ResetModel();
....@@ -4310,11 +5381,15 @@
43105381
43115382 void paste(boolean expand)
43125383 {
5384
+ if (Globals.REPLACEONMAKE)
5385
+ Save();
5386
+ boolean keep = Globals.REPLACEONMAKE;
5387
+ Globals.REPLACEONMAKE = false;
43135388 // if (GrafreeD.clipboard == null)
43145389 // return;
43155390 boolean first = true;
43165391
4317
- if (GrafreeD.clipboardIsTempGroup)
5392
+ if (Grafreed.clipboardIsTempGroup)
43185393 {
43195394 Composite temp;
43205395
....@@ -4325,7 +5400,7 @@
43255400 temp = (Composite)Applet3D.clipboard.deepCopy();
43265401 */
43275402 Object3D elem;
4328
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5403
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43295404 {
43305405 Object3D child = (Object3D)e.nextElement();
43315406
....@@ -4359,21 +5434,22 @@
43595434 //Object3D cb = Applet3D.clipboard;
43605435 //temp.addChild(cb);
43615436 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4362
- assert(GrafreeD.clipboard.parent == null);
4363
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4364
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4365
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4366
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5437
+ assert(Grafreed.clipboard.parent == null);
5438
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5439
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5440
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5441
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43675442 else
4368
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4369
- GrafreeD.clipboard.get(0).parent = keepparent;
5443
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5444
+ Grafreed.clipboard.get(0).parent = keepparent;
43705445 }
43715446
5447
+ Globals.REPLACEONMAKE = keep;
43725448 ResetModel();
43735449 refreshContents();
43745450 }
43755451
4376
- void pasteInto(boolean copyit)
5452
+ void pasteInto(boolean copyit, boolean clone)
43775453 {
43785454 // if (GrafreeD.clipboard == null)
43795455 // return;
....@@ -4402,15 +5478,22 @@
44025478 if (copyit)
44035479 {
44045480 // paste(false);
4405
- CloneClipboard(false); // sept 2014
5481
+ if (clone)
5482
+ {
5483
+ CloneClipboard(false); // sept 2014
5484
+ }
5485
+ else
5486
+ {
5487
+ paste(false);
5488
+ }
44065489 }
44075490 else
44085491 {
44095492 boolean first = true;
44105493
4411
- if (GrafreeD.clipboardIsTempGroup)
5494
+ if (Grafreed.clipboardIsTempGroup)
44125495 {
4413
- Composite temp = (Composite)GrafreeD.clipboard;
5496
+ Composite temp = (Composite)Grafreed.clipboard;
44145497 Object3D copy;
44155498 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44165499 {
....@@ -4420,7 +5503,7 @@
44205503 }
44215504 } else
44225505 {
4423
- linkSomething(GrafreeD.clipboard); //.get(0));
5506
+ linkSomething(Grafreed.clipboard); //.get(0));
44245507 }
44255508 }
44265509 }
....@@ -4497,6 +5580,10 @@
44975580
44985581 void group(Object3D csg, boolean grab)
44995582 {
5583
+ if (Globals.REPLACEONMAKE)
5584
+ Save();
5585
+ boolean keep = Globals.REPLACEONMAKE;
5586
+ Globals.REPLACEONMAKE = false;
45005587 if (//false) // why??
45015588 !group.selection.isEmpty())
45025589 {
....@@ -4610,10 +5697,15 @@
46105697 //node.add(csg);
46115698 //makeSomething(node);
46125699 makeSomething(csg);
5700
+ Globals.REPLACEONMAKE = keep;
46135701 }
46145702
46155703 void Ungroup(Object3D g)
46165704 {
5705
+ if (Globals.REPLACEONMAKE)
5706
+ Save();
5707
+ boolean keep = Globals.REPLACEONMAKE;
5708
+ Globals.REPLACEONMAKE = false;
46175709 if (g instanceof HiddenObject)
46185710 {
46195711 HiddenObject h = (HiddenObject) g;
....@@ -4630,6 +5722,7 @@
46305722 objEditor.makeSomething(g.get(i), false);
46315723 }
46325724 }
5725
+ Globals.REPLACEONMAKE = keep;
46335726 }
46345727
46355728 void ungroup()
....@@ -4825,21 +5918,6 @@
48255918 }
48265919 */
48275920
4828
- void ImportGFD()
4829
- {
4830
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4831
- browser.show();
4832
- String filename = browser.getFile();
4833
- if (filename != null && filename.length() > 0)
4834
- {
4835
- String fullname = browser.getDirectory() + filename;
4836
-
4837
- //Object3D readobj =
4838
- objEditor.ReadGFD(fullname, objEditor);
4839
- //makeSomething(readobj);
4840
- }
4841
- }
4842
-
48435921 /*
48445922 public void Callback(Object obj)
48455923 {
....@@ -4863,26 +5941,9 @@
48635941 }
48645942 */
48655943
4866
- void ImportVRMLX3D()
4867
- {
4868
- if (GrafreeD.standAlone)
4869
- {
4870
- /**/
4871
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4872
- browser.show();
4873
- String filename = browser.getFile();
4874
- if (filename != null && filename.length() > 0)
4875
- {
4876
- String fullname = browser.getDirectory() + filename;
4877
- LoadVRMLX3D(fullname);
4878
- }
4879
- /**/
4880
- }
4881
- }
4882
-
48835944 String GetFile(String dialogName)
48845945 {
4885
- if (GrafreeD.standAlone)
5946
+ if (Grafreed.standAlone)
48865947 {
48875948 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48885949 browser.show();
....@@ -4950,6 +6011,44 @@
49506011 cButton clearpanelButton;
49516012 cButton unselectButton;
49526013
6014
+ cButton restoreCameraButton;
6015
+
6016
+ 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;
6051
+
49536052 cButton screenfitButton;
49546053 cButton screenfitpointButton;
49556054 cButton snapobjectButton;
....@@ -4961,14 +6060,6 @@
49616060
49626061 cButton setsupportButton;
49636062
4964
- cButton twoButton;
4965
- cButton sixButton;
4966
- cButton threeButton;
4967
- cButton sevenButton;
4968
- cButton fourButton; // full panel
4969
- cButton oneButton; // full XYZ
4970
- //cButton currentLayout;
4971
-
49726063 //
49736064 //Composite
49746065 Object3D // to do !!
....@@ -4978,9 +6069,11 @@
49786069 //JTree jTree;
49796070 private MenuItem lookAtItem;
49806071 private MenuItem lookFromItem;
4981
- private MenuItem switchItem;
6072
+ private MenuItem switchViewItem;
49826073 private MenuItem cutItem;
4983
- private MenuItem duplicateItem;
6074
+ private MenuItem undoItem;
6075
+ private MenuItem redoItem;
6076
+ private JMenuItem duplicateItem;
49846077 private MenuItem cloneItem;
49856078 private MenuItem cloneSupportItem;
49866079 private MenuItem overwriteGeoItem;
....@@ -4993,7 +6086,7 @@
49936086 private MenuItem linkverticesItem;
49946087 private MenuItem relinkverticesItem;
49956088 private MenuItem setMasterItem;
4996
- private MenuItem resetMeshItem;
6089
+ private MenuItem resetAllItem;
49976090 private MenuItem stepAllItem;
49986091 private MenuItem revertMeshItem;
49996092 private MenuItem poseMeshItem;
....@@ -5004,10 +6097,11 @@
50046097 private MenuItem mergeGeometriesItem;
50056098 private MenuItem copyItem;
50066099 private MenuItem pasteItem;
6100
+ private MenuItem pasteIntoItem;
50076101 private MenuItem pasteLinkItem;
50086102 private MenuItem pasteCloneItem;
50096103 private MenuItem pasteExpandItem;
5010
- private MenuItem clearItem;
6104
+ private MenuItem deleteItem;
50116105 private MenuItem clearAllItem;
50126106 private MenuItem genUVItem;
50136107 private MenuItem genNormalsMESHItem;
....@@ -5042,6 +6136,10 @@
50426136 private MenuItem showleavesItem;
50436137 private MenuItem markleavesItem;
50446138 private MenuItem unmarkleavesItem;
6139
+ private MenuItem rewindleavesItem;
6140
+ private MenuItem unrewindleavesItem;
6141
+ private MenuItem randomleavesItem;
6142
+ private MenuItem unrandomleavesItem;
50456143
50466144 private MenuItem flipVItem;
50476145 private MenuItem unflipVItem;
....@@ -5053,15 +6151,17 @@
50536151 private MenuItem panoTexturesItem;
50546152
50556153 private MenuItem resetCentroidItem;
5056
- private MenuItem transformgeometryItem;
6154
+ private MenuItem resetCentroidXZItem;
50576155 private MenuItem resetTransformItem;
6156
+ private MenuItem transformGeometryItem;
6157
+ private MenuItem transformChildrenItem;
50586158 private MenuItem hideItem;
50596159 private MenuItem grabItem;
50606160 private MenuItem backItem;
50616161 private MenuItem frontItem;
50626162 private MenuItem cameraItem;
50636163 private MenuItem compositeItem;
5064
- private MenuItem randomItem;
6164
+ private MenuItem switchItem;
50656165 private MenuItem physicsItem;
50666166 private MenuItem frameselectorItem;
50676167 private MenuItem scriptNodeItem;
....@@ -5085,6 +6185,8 @@
50856185 private MenuItem attachBumpItem;
50866186 private MenuItem detachBumpItem;
50876187 private MenuItem pigmentBumpItem;
6188
+ private MenuItem embedTexturesItem;
6189
+ private MenuItem deEmbedTexturesItem;
50886190
50896191 private MenuItem particleItem;
50906192 private MenuItem ragdollItem;
....@@ -5101,7 +6203,7 @@
51016203 private MenuItem blobItem;
51026204 private MenuItem latheItem;
51036205 private MenuItem bezierItem;
5104
- private MenuItem checkerItem;
6206
+ private MenuItem overlayItem;
51056207 private MenuItem meshItem;
51066208 // private MenuItem meshGroupItem;
51076209 private MenuItem springItem;
....@@ -5123,11 +6225,6 @@
51236225 private MenuItem doubleItem;
51246226 private MenuItem tripleItem;
51256227
5126
- private MenuItem importGFDItem;
5127
- private MenuItem importVRMLX3DItem;
5128
- private MenuItem import3DSItem;
5129
- private MenuItem importOBJItem;
5130
-
51316228 private MenuItem computeAOItem;
51326229 private MenuItem recompileItem;
51336230 private MenuItem editScriptItem;
....@@ -5137,4 +6234,8 @@
51376234 private MenuItem analyzeItem;
51386235 private MenuItem dumpItem;
51396236 //boolean freezemodel = false;
6237
+
6238
+ Menu cameraMenu;
6239
+ MenuItem editCameraItem;
6240
+ MenuItem restoreCameraItem;
51406241 }