Normand Briere
2019-08-01 c99d954f5e2bffa601c599142371cfeb45630f40
GroupEditor.java
....@@ -23,6 +23,302 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
+ skyboxButton.setToolTipText(s);
34
+ skyboxButton.addActionListener(new ActionListener()
35
+ {
36
+ @Override
37
+ public void actionPerformed(ActionEvent e)
38
+ {
39
+ ChangeSkybox(path);
40
+ }
41
+ });
42
+ }
43
+
44
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
45
+ {
46
+ cGridBag tab0 = new cGridBag().setVertical(true);
47
+
48
+ tab0.setName("Urban");
49
+ skyboxpanel.add(tab0);
50
+
51
+ cGridBag row0 = new cGridBag();
52
+ cGridBag row1 = new cGridBag();
53
+ cGridBag row2 = new cGridBag();
54
+ cGridBag row3 = new cGridBag();
55
+ cGridBag row4 = new cGridBag();
56
+ cGridBag row5 = new cGridBag();
57
+ cGridBag row6 = new cGridBag();
58
+
59
+ AddSkyboxButton("default", "rgb", row0);
60
+ //AddSkyboxButton("default", "cornell", row0);
61
+ AddSkyboxButton("penguins", "dust", row0);
62
+ AddSkyboxButton("penguins", "tropic", row0);
63
+ AddSkyboxButton("penguins", "yonder", row0);
64
+
65
+ AddSkyboxButton("default", "uffizi", row1);
66
+ AddSkyboxButton("bridge", "Bridge", row1);
67
+ AddSkyboxButton("bridge", "Bridge2", row1);
68
+ AddSkyboxButton("urban", "GamlaStan2", row1);
69
+
70
+ AddSkyboxButton("urban", "Parliament", row2);
71
+ AddSkyboxButton("urban", "Roundabout", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
74
+
75
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
76
+ AddSkyboxButton("urban", "UnionSquare", row3);
77
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
78
+ AddSkyboxButton("park", "BerzeliiPark", row3);
79
+
80
+ AddSkyboxButton("park", "Buddha", row4);
81
+ AddSkyboxButton("park", "CNTower2", row4);
82
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
84
+
85
+ AddSkyboxButton("park", "Park", row5);
86
+ AddSkyboxButton("park", "Pond", row5);
87
+ AddSkyboxButton("park", "Skansen", row5);
88
+ AddSkyboxButton("park", "Skansen2", row5);
89
+
90
+ AddSkyboxButton("park", "Skansen3", row6);
91
+ AddSkyboxButton("park", "Skansen4", row6);
92
+ AddSkyboxButton("park", "Skansen5", row6);
93
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
94
+
95
+ tab0.add(row0);
96
+ tab0.add(row1);
97
+ tab0.add(row2);
98
+ tab0.add(row3);
99
+ tab0.add(row4);
100
+ tab0.add(row5);
101
+ tab0.add(row6);
102
+
103
+ for (int i=5; --i>=0;)
104
+ {
105
+ //oe.toolboxPanel.Return();
106
+ //tab0.add(new cGridBag());
107
+ }
108
+ }
109
+
110
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
111
+ {
112
+ cGridBag tab0 = new cGridBag().setVertical(true);
113
+
114
+ tab0.setName("Nature");
115
+ skyboxpanel.add(tab0);
116
+
117
+ cGridBag row0 = new cGridBag();
118
+ cGridBag row1 = new cGridBag();
119
+ cGridBag row2 = new cGridBag();
120
+ cGridBag row3 = new cGridBag();
121
+ cGridBag row4 = new cGridBag();
122
+ cGridBag row5 = new cGridBag();
123
+ cGridBag row6 = new cGridBag();
124
+
125
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
126
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
127
+ AddSkyboxButton("beach", "PalmTrees", row0);
128
+ AddSkyboxButton("beach", "Tenerife", row0);
129
+
130
+ AddSkyboxButton("beach", "Tenerife2", row1);
131
+ AddSkyboxButton("beach", "Tenerife3", row1);
132
+ AddSkyboxButton("field", "FishPond", row1);
133
+ AddSkyboxButton("field", "Footballfield", row1);
134
+
135
+ AddSkyboxButton("field", "Meadow", row2);
136
+ AddSkyboxButton("field", "Sorsele", row2);
137
+ AddSkyboxButton("field", "Sorsele2", row2);
138
+ AddSkyboxButton("field", "Sorsele3", row2);
139
+
140
+ AddSkyboxButton("forest", "Brudslojan", row3);
141
+ AddSkyboxButton("forest", "Langholmen2", row3);
142
+ AddSkyboxButton("forest", "Plants", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive", row3);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
146
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
147
+ AddSkyboxButton("mountain", "Teide", row4);
148
+ AddSkyboxButton("park", "Tantolunden4", row4);
149
+
150
+ AddSkyboxButton("park", "Stairs", row5);
151
+ AddSkyboxButton("default", "skycube", row6);
152
+ AddSkyboxButton("rocky", "Langholmen", row5);
153
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
154
+
155
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
156
+ AddSkyboxButton("default", "CloudyHills", row6);
157
+ AddSkyboxButton("daz", "Autumn", row6);
158
+ AddSkyboxButton("daz", "MountainTrail", row6);
159
+ /*
160
+Autumn
161
+Greenlands
162
+MountainTrail
163
+Oasis
164
+TheRock
165
+TopOfTheWorld
166
+Winter
167
+ */
168
+
169
+ tab0.add(row0);
170
+ tab0.add(row1);
171
+ tab0.add(row2);
172
+ tab0.add(row3);
173
+ tab0.add(row4);
174
+ tab0.add(row5);
175
+ tab0.add(row6);
176
+
177
+ for (int i=5; --i>=0;)
178
+ {
179
+ //oe.toolboxPanel.Return();
180
+ //tab0.add(new cGridBag());
181
+ }
182
+ }
183
+
184
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
185
+ {
186
+ cGridBag tab0 = new cGridBag().setVertical(true);
187
+
188
+ tab0.setName("Night");
189
+ skyboxpanel.add(tab0);
190
+
191
+ cGridBag row0 = new cGridBag();
192
+ cGridBag row1 = new cGridBag();
193
+ cGridBag row2 = new cGridBag();
194
+ cGridBag row3 = new cGridBag();
195
+ cGridBag row4 = new cGridBag();
196
+ cGridBag row5 = new cGridBag();
197
+ cGridBag row6 = new cGridBag();
198
+
199
+ AddSkyboxButton("night", "NightPath", row0);
200
+ AddSkyboxButton("night", "PondNight", row0);
201
+ AddSkyboxButton("night", "Powerlines", row0);
202
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
203
+
204
+ AddSkyboxButton("urban", "CNTower", row1);
205
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
206
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
207
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
208
+
209
+ AddSkyboxButton("penguins", "kenon_star", row2);
210
+ AddSkyboxButton("persson", "corona", row2);
211
+ AddSkyboxButton("persson", "spaceskybox", row2);
212
+ AddSkyboxButton("indoors", "Vasa", row2);
213
+
214
+ AddSkyboxButton("winter", "Backyard", row3);
215
+ AddSkyboxButton("winter", "Creek", row3);
216
+ AddSkyboxButton("winter", "FootballField3", row3);
217
+ AddSkyboxButton("winter", "Forest", row3);
218
+
219
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
220
+ AddSkyboxButton("winter", "House", row4);
221
+ AddSkyboxButton("winter", "IceLake", row4);
222
+ AddSkyboxButton("winter", "IceRiver", row4);
223
+
224
+ AddSkyboxButton("winter", "Park3", row5);
225
+ AddSkyboxButton("winter", "PondWinter", row5);
226
+ AddSkyboxButton("winter", "Tantolunden5", row5);
227
+ AddSkyboxButton("winter", "Vindelalven", row5);
228
+
229
+ AddSkyboxButton("daz", "TheRock", row6);
230
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
231
+ AddSkyboxButton("daz", "Winter", row6);
232
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
233
+
234
+ tab0.add(row0);
235
+ tab0.add(row1);
236
+ tab0.add(row2);
237
+ tab0.add(row3);
238
+ tab0.add(row4);
239
+ tab0.add(row5);
240
+ tab0.add(row6);
241
+
242
+ for (int i=5; --i>=0;)
243
+ {
244
+ //oe.toolboxPanel.Return();
245
+ //tab0.add(new cGridBag());
246
+ }
247
+ }
248
+
249
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
250
+ {
251
+ cGridBag tab0 = new cGridBag().setVertical(true);
252
+
253
+ tab0.setName("Others");
254
+ skyboxpanel.add(tab0);
255
+
256
+ cGridBag row0 = new cGridBag();
257
+ cGridBag row1 = new cGridBag();
258
+ cGridBag row2 = new cGridBag();
259
+ cGridBag row3 = new cGridBag();
260
+ cGridBag row4 = new cGridBag();
261
+ cGridBag row5 = new cGridBag();
262
+ cGridBag row6 = new cGridBag();
263
+
264
+ AddSkyboxButton("mayhem", "afterrain", row0);
265
+ AddSkyboxButton("mayhem", "aqua4", row0);
266
+ AddSkyboxButton("mayhem", "aqua9", row0);
267
+ AddSkyboxButton("mayhem", "flame", row0);
268
+
269
+ AddSkyboxButton("mayhem", "h2s", row1);
270
+ AddSkyboxButton("mayhem", "prehistoric", row1);
271
+ AddSkyboxButton("mayhem", "scorched", row1);
272
+ AddSkyboxButton("penguins", "desertdawn", row1);
273
+
274
+ AddSkyboxButton("persson", "Citadella", row2);
275
+ AddSkyboxButton("persson", "Citadella2", row2);
276
+ AddSkyboxButton("persson", "clouds1", row2);
277
+ AddSkyboxButton("penguins", "wrath", row2);
278
+
279
+ AddSkyboxButton("persson", "FishermansBastion", row3);
280
+ AddSkyboxButton("persson", "HeroesSquare", row3);
281
+ AddSkyboxButton("indoors", "DallasW", row3);
282
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
283
+
284
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
285
+ AddSkyboxButton("persson", "PereaBeach1", row4);
286
+ AddSkyboxButton("persson", "PereaBeach2", row4);
287
+ AddSkyboxButton("persson", "redeclipse", row4);
288
+
289
+ AddSkyboxButton("daz", "Greenlands", row5);
290
+ AddSkyboxButton("daz", "Oasis", row5);
291
+ AddSkyboxButton("elyvisions", "arch3", row5);
292
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
293
+
294
+ AddSkyboxButton("elyvisions", "rainbow", row6);
295
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
296
+ AddSkyboxButton("elyvisions", "heaven", row6);
297
+ AddSkyboxButton("elyvisions", "hot", row6);
298
+
299
+ tab0.add(row0);
300
+ tab0.add(row1);
301
+ tab0.add(row2);
302
+ tab0.add(row3);
303
+ tab0.add(row4);
304
+ tab0.add(row5);
305
+ tab0.add(row6);
306
+
307
+ for (int i=5; --i>=0;)
308
+ {
309
+ //oe.toolboxPanel.Return();
310
+ //tab0.add(new cGridBag());
311
+ }
312
+ }
313
+
314
+ public void ChangeSkybox(String name)
315
+ {
316
+ //cameraView.envyoff = false;
317
+ group.skyboxname = name;
318
+ group.skyboxext = "jpg";
319
+ cameraView.repaint();
320
+ }
321
+
26322 //ObjEditor objEditor;
27323 public void closeUI2()
28324 {
....@@ -60,6 +356,12 @@
60356 this.copy = this.group = group;
61357 //selectees = this.group.selectees;
62358
359
+ if (copy.versions == null)
360
+ {
361
+ copy.versions = new byte[100][];
362
+ copy.versionindex = -1;
363
+ }
364
+
63365 if(ui)
64366 SetupUI(objEditor);
65367 }
....@@ -74,16 +376,28 @@
74376 this.copy = this.group = copy;
75377 //selectees = this.group.selectees;
76378
77
- SetupMenu2(objEditor);
379
+ SetupMenu2(this); //objEditor);
78380 SetupUI2(objEditor);
79381 objEditor.SetupUI(true);
80382 SetupViews(objEditor);
81383
82384 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
385
+
386
+ if (copy.versions == null)
387
+ {
388
+ copy.versions = new byte[100][];
389
+ copy.versionindex = -1;
390
+
391
+ Save(true);
392
+ }
83393 }
84394
85395 void CloneSelection(boolean supports)
86396 {
397
+ if (Globals.REPLACEONMAKE)
398
+ Save();
399
+ boolean keep = Globals.REPLACEONMAKE;
400
+ Globals.REPLACEONMAKE = false;
87401 // Object3D keep = GrafreeD.clipboard;
88402 //Object3D obj;
89403 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,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("Random"));
243
- randomItem.addActionListener(this);
244
- physicsItem = menu.add(new MenuItem("Physics"));
245
- physicsItem.addActionListener(this);
246
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
247
- frameselectorItem.addActionListener(this);
662
+
663
+// menu.add("-");
664
+//
665
+// switchItem = menu.add(new MenuItem("Switch node"));
666
+// switchItem.addActionListener(this);
667
+ if (Globals.ADVANCED)
668
+ {
248669 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249670 switchGeoItem.addActionListener(this);
250671 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251672 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
673
+ morphItem = menu.add(new MenuItem("Morph Group"));
253674 morphItem.addActionListener(this);
675
+
676
+ menu.add("-");
677
+ physicsItem = menu.add(new MenuItem("Physics"));
678
+ physicsItem.addActionListener(this);
679
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
680
+ frameselectorItem.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,98 +902,239 @@
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");
441
- liveCB.addItemListener(this);
442
-
443
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
444
- trackCB.setToolTipText("Enable tracking");
445
- trackCB.addItemListener(this);
446
-
447
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
911
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
912
+ //minButton.setToolTipText("Minimize window");
913
+ //minButton.addActionListener(this);
914
+
915
+ if (Globals.ADVANCED)
916
+ {
917
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
+ maxButton.setToolTipText("Maximize window");
919
+ maxButton.addActionListener(this);
920
+ }
921
+
922
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
923
+ fullButton.setToolTipText("Full-screen window");
924
+ fullButton.addActionListener(this);
925
+
926
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
448927 screenfitButton.setToolTipText("Screen fit");
449928 screenfitButton.addActionListener(this);
450929
930
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ restoreCameraButton.setToolTipText("Restore viewpoint");
932
+ restoreCameraButton.addActionListener(this);
933
+
934
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveButton.setToolTipText("New version");
936
+ saveButton.addActionListener(this);
937
+
938
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ undoButton.setToolTipText("Previous version");
940
+ undoButton.addActionListener(this);
941
+ undoButton.setEnabled(false);
942
+
943
+ cGridBag updown = new cGridBag().setVertical(true);
944
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
+ restoreButton.setToolTipText("Restore current");
946
+ restoreButton.addActionListener(this);
947
+ restoreButton.setEnabled(false);
948
+
949
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ replaceButton.setToolTipText("Replace current");
951
+ replaceButton.addActionListener(this);
952
+ replaceButton.setEnabled(false);
953
+
954
+ copyOptionsPanel.add(updown);
955
+
956
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
957
+ redoButton.setToolTipText("Next version");
958
+ redoButton.addActionListener(this);
959
+ redoButton.setEnabled(false);
960
+
961
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
962
+ liveCB.setToolTipText("Enable animation");
963
+ liveCB.addItemListener(this);
964
+
965
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
966
+ oneStepButton.setToolTipText("Animate one step forward");
967
+ oneStepButton.addActionListener(this);
968
+
969
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
970
+ fastCB.setToolTipText("Fast mode");
971
+ fastCB.addItemListener(this);
972
+
973
+ //oe.toolboxPanel.Return();
974
+
975
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
976
+// trackCB.setToolTipText("Enable tracking");
977
+// trackCB.addItemListener(this);
978
+
451979 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
452980 // screenfitpointButton.addActionListener(this);
453
-// oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
455
- snapobjectButton.addActionListener(this);
456
- snapobjectButton.setToolTipText("Snap Object");
457
- oe.aConstraints.gridx += 1;
458981
459
- //aConstraints.gridx = 0;
460
- //aConstraints.gridy += 1;
461
- oe.aConstraints.weighty = 0;
462
- oe.aConstraints.gridwidth = 1;
463
-
464
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
465
- flashSelectionButton.setToolTipText("Show selection");
466
- flashSelectionButton.addActionListener(this);
467
-
468
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
469
-
470
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
471
- twoButton.setToolTipText("Show center view only");
472
- twoButton.addActionListener(this);
473
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
982
+ if (Globals.ADVANCED)
983
+ {
984
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
985
+ snapobjectButton.addActionListener(this);
986
+ snapobjectButton.setToolTipText("Snap Object");
987
+
988
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
474989 fourButton.addActionListener(this);
475
- fourButton.setToolTipText("Show left panel only");
476
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
477
- sixButton.setToolTipText("2-column layout left");
478
- sixButton.addActionListener(this);
479
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
480
- threeButton.setToolTipText("2-column layout right");
990
+ fourButton.setToolTipText("Show control panel only");
991
+ }
992
+
993
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
994
+
995
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
996
+ twoButton.setToolTipText("Show 3D view only");
997
+ twoButton.addActionListener(this);
998
+ this.fullscreenLayout = twoButton;
999
+
1000
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1001
+ threeButton.setToolTipText("Show controls and 3D view");
4811002 threeButton.addActionListener(this);
482
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
483
- sevenButton.setToolTipText("3-column layout");
484
- sevenButton.addActionListener(this);
1003
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1004
+ sixButton.setToolTipText("Show 3D view and controls");
1005
+ sixButton.addActionListener(this);
1006
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
+// sevenButton.setToolTipText("3-column layout");
1008
+// sevenButton.addActionListener(this);
4851009 //
4861010
487
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
488
- rootButton.setToolTipText("Edit object in new tab");
1011
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1012
+ rootButton.setToolTipText("Open selection in new tab");
4891013 rootButton.addActionListener(this);
490
- oe.aConstraints.gridx += 1;
491
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1014
+
1015
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
4921016 closeButton.setToolTipText("Close tab");
4931017 closeButton.addActionListener(this);
4941018 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
4951019 //clearButton.addActionListener(this);
496
- oe.aConstraints.gridx += 1;
497
-
498
- oe.aConstraints.gridx = 1; //
499
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
500
- editButton.addActionListener(this);
501
- oe.aConstraints.gridx += 1;
502
- oe.aConstraints.weighty = 0;
503
- oe.aConstraints.gridwidth = 1;
5041020
505
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1021
+ cGridBag row1 = new cGridBag();
1022
+
1023
+ // INSERT
1024
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
+ gridButton.setToolTipText("Create grid");
1026
+ gridButton.addActionListener(this);
1027
+
1028
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ boxButton.setToolTipText("Create box");
1030
+ boxButton.addActionListener(this);
1031
+
1032
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+ sphereButton.setToolTipText("Create sphere");
1034
+ sphereButton.addActionListener(this);
1035
+
1036
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ coneButton.setToolTipText("Create cone");
1038
+ coneButton.addActionListener(this);
1039
+
1040
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ torusButton.setToolTipText("Create torus");
1042
+ torusButton.addActionListener(this);
1043
+
1044
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ superButton.setToolTipText("Create superellipsoid");
1046
+ superButton.addActionListener(this);
1047
+
1048
+ if (Globals.ADVANCED)
1049
+ {
1050
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1051
+ kleinButton.setToolTipText("Create Klein bottle");
1052
+ kleinButton.addActionListener(this);
1053
+ }
1054
+
1055
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ particlesButton.setToolTipText("Create particle system");
1057
+ particlesButton.addActionListener(this);
1058
+
1059
+ oe.toolboxPanel.add(row1);
1060
+
1061
+ cGridBag row2 = new cGridBag();
1062
+
1063
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1064
+ groupButton.setToolTipText("Create group");
1065
+ groupButton.addActionListener(this);
1066
+
1067
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ compositeButton.setToolTipText("Create composite");
1069
+ compositeButton.addActionListener(this);
1070
+
1071
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ switchButton.setToolTipText("Create item switcher");
1073
+ switchButton.addActionListener(this);
1074
+
1075
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ loopButton.setToolTipText("Create loop");
1077
+ loopButton.addActionListener(this);
1078
+
1079
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1080
+ textureButton.setToolTipText("Create texture");
1081
+ textureButton.addActionListener(this);
1082
+
1083
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ overlayButton.setToolTipText("Create overlay");
1085
+ overlayButton.addActionListener(this);
1086
+
1087
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ lightButton.setToolTipText("Create light");
1089
+ lightButton.addActionListener(this);
1090
+
1091
+ oe.toolboxPanel.add(row2);
1092
+
1093
+ // ENVYMAPS
1094
+ cGridBag skyboxpane = new cGridBag();
1095
+ skyboxpane.preferredHeight = 100;
1096
+
1097
+ oe.toolboxPanel.add(skyboxpane);
1098
+
1099
+ JTabbedPane skyboxpanel = new JTabbedPane();
1100
+ skyboxpane.add(skyboxpanel);
1101
+
1102
+ AddSkyboxTab0(skyboxpanel);
1103
+ AddSkyboxTab1(skyboxpanel);
1104
+ AddSkyboxTab2(skyboxpanel);
1105
+ AddSkyboxTab3(skyboxpanel);
1106
+
1107
+ // EDIT panel
1108
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ editButton.setToolTipText("Pin selection controls");
1110
+ editButton.addActionListener(this);
1111
+
1112
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ uneditButton.setToolTipText("Remove selection controls");
5061114 uneditButton.addActionListener(this);
5071115
508
- oe.aConstraints.gridx += 1;
509
- oe.aConstraints.weighty = 0;
510
- oe.aConstraints.gridwidth = 1;
511
-
512
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
513
- clearPanelButton.addActionListener(this);
514
-
515
- oe.aConstraints.gridx += 1;
516
- oe.aConstraints.weighty = 0;
517
- oe.aConstraints.gridwidth = 1;
518
-
519
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1116
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1117
+ allParamsButton.setToolTipText("Show all controle");
5201118 allParamsButton.addActionListener(this);
5211119
522
- oe.aConstraints.gridx += 1;
523
- oe.aConstraints.weighty = 0;
524
- oe.aConstraints.gridwidth = 1;
525
-
526
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
1120
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1121
+ clearPanelButton.setToolTipText("Clear edit panel");
1122
+ clearPanelButton.addActionListener(this);
1123
+
1124
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ unselectButton.setToolTipText("Unselect");
5271126 unselectButton.addActionListener(this);
5281127
1128
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ flashSelectionButton.setToolTipText("Highlight selection");
1130
+ flashSelectionButton.addActionListener(this);
1131
+
1132
+ editCommandsPanel.preferredHeight = 1;
1133
+
1134
+ SetPinStates(false);
1135
+// oe.treePanel.add(commandsPanel);
1136
+// oe.treePanel.Return();
1137
+
5291138 // oe.aConstraints.gridx += 1;
5301139 // oe.aConstraints.weighty = 0;
5311140 // oe.aConstraints.gridwidth = 1;
....@@ -537,47 +1146,32 @@
5371146 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5381147 // gcButton.addActionListener(this);
5391148
540
- oe.aConstraints.gridx = 0;
541
- oe.aConstraints.gridy += 1;
542
-
543
- //ctrlPanel.add(objList = new List(5, true));
544
- oe.aConstraints.gridwidth = 100;
545
- // oe.aConstraints.gridheight = 100;
546
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
547
- oe.aConstraints.gridheight = 1;
548
- oe.aConstraints.weighty = 0.5;
549
- oe.aConstraints.gridx = 0;
550
- JScrollPane jSP;
1149
+ cGridBag jSPPanel = new cGridBag();
1150
+
1151
+ JScrollPane jSP;
5511152 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
552
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1153
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5531154 ResetModel();
554
- oe.aConstraints.weighty = 0.5;
555
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
556
- oe.aConstraints.gridy += 1;
557
- oe.aConstraints.gridwidth = 1;
558
-
559
- oe.aConstraints.weighty = 0;
560
- oe.aConstraints.gridwidth = 2;
561
-
562
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
563
- colorCB.addItemListener(this);
564
- oe.aConstraints.gridx += 2;
565
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
566
- materialCB.addItemListener(this);
567
- oe.aConstraints.gridx += 2;
568
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
569
- textureCB.addItemListener(this);
570
-
571
- oe.aConstraints.gridx = 0;
572
- oe.aConstraints.gridy += 1;
5731155
1156
+ oe.treePanel.add(jSPPanel);
1157
+ oe.treePanel.Return();
1158
+
1159
+ oe.treePanel.add(copyOptionsPanel);
1160
+ oe.treePanel.Return();
1161
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1162
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1163
+ sliderPane.preferredHeight = 1;
1164
+
1165
+// mainPanel.setDividerLocation(0.1); //1.0);
1166
+ mainPanel.setResizeWeight(0.4);
1167
+
5741168 //jList.addListSelectionListener(this);
5751169 oe.jTree.addTreeSelectionListener(this);
5761170 //jTree.setRootVisible(false);
5771171 //jTree.setEditable(true);
5781172 oe.jTree.setDragEnabled(true);
5791173 //jTree.setPreferredSize(new Dimension(10,10));
580
- jSP.setPreferredSize(new Dimension(100,200));
1174
+ //jSP.setPreferredSize(new Dimension(100,200));
5811175
5821176 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
5831177
....@@ -589,53 +1183,67 @@
5891183 dgr.addDragGestureListener(this);
5901184 }catch(Exception e) {}
5911185 */
592
- radio.layout = sevenButton;
1186
+ radio.layout = sixButton; // sevenButton;
5931187 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
5941188 }
5951189
5961190 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
5971191 {
598
- //constraints.gridx = 0;
599
- //constraints.gridy = 0;
600
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
601
- fastCB.setToolTipText("Fast mode");
602
- fastCB.addItemListener(this);
603
- //constraints.gridy += 1;
604
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
605
- supportCB.setToolTipText("Enabled rigging");
606
- supportCB.addItemListener(this);
1192
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1193
+ colorCB.setToolTipText("Copy color when dropped");
1194
+ colorCB.addItemListener(this);
6071195
608
- // constraints.gridy += 1;
1196
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1197
+ materialCB.setToolTipText("Copy material when dropped");
1198
+ materialCB.addItemListener(this);
1199
+
1200
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1201
+ textureCB.setToolTipText("Copy texture when dropped");
1202
+ textureCB.addItemListener(this);
1203
+
1204
+ panel.Return();
1205
+
1206
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1207
+ boxCB.setToolTipText("Display bounding boxes");
1208
+ boxCB.addItemListener(this);
1209
+
1210
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1211
+ zoomBoxCB.setToolTipText("Display only for wheel");
1212
+ zoomBoxCB.addItemListener(this);
1213
+
1214
+ if (true) // Globals.ADVANCED)
1215
+ {
1216
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1217
+// supportCB.setToolTipText("Enable rigging");
1218
+// supportCB.addItemListener(this);
1219
+
1220
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1221
+ freezeCB.setToolTipText("Fast moving camera");
1222
+ freezeCB.addItemListener(this);
1223
+
6091224 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6101225 // localCB.addItemListener(this);
6111226
612
- //constraints.gridy += 1;
1227
+ panel.Return();
1228
+
6131229 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6141230 crowdCB.setToolTipText("Used for crowds");
6151231 crowdCB.addItemListener(this);
6161232
617
- //constraints.gridy += 1;
6181233 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
6191234 smoothCB.setToolTipText("Snapping delay");
6201235 smoothCB.addItemListener(this);
6211236
622
- //constraints.gridy += 1;
6231237 panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
6241238 slowCB.setToolTipText("Smooth interpolation");
6251239 slowCB.addItemListener(this);
626
- //constraints.gridy += 1;
627
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
628
- boxCB.setToolTipText("Display bounding boxes");
629
- boxCB.addItemListener(this);
630
- //constraints.gridy += 1;
631
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
632
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
633
- zoomBoxCB.addItemListener(this);
634
-
1240
+
6351241 // constraints.gridy += 1;
6361242 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6371243 // speakerMocapCB.addItemListener(this);
6381244
1245
+ panel.Return();
1246
+
6391247 if (false)
6401248 {
6411249 // handled in scripts
....@@ -650,36 +1258,85 @@
6501258 //constraints.gridy += 1;
6511259 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6521260 smoothfocusCB.addItemListener(this);
1261
+ panel.Return();
6531262 }
6541263
6551264 //constraints.gridx += 1;
6561265 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6571266 // debugCB.addItemListener(this);
6581267
659
- //constraints.gridy += 1;
1268
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1269
+ trackCB.setToolTipText("Enable tracking target");
1270
+ trackCB.addItemListener(this);
1271
+
6601272 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1273
+ oeilCB.setToolTipText("Move camera when tracking");
6611274 oeilCB.addItemListener(this);
6621275
663
- //constraints.gridy += 1;
1276
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1277
+ shadowCB.setToolTipText("When live compute shadows");
1278
+ shadowCB.addItemListener(this);
1279
+
1280
+ panel.Return();
1281
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1282
+ toggleTextureCB.setToolTipText("Load textures");
1283
+ toggleTextureCB.addItemListener(this);
1284
+
1285
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1286
+ toggleSwitchCB.setToolTipText("Choose a single item");
1287
+ toggleSwitchCB.addItemListener(this);
1288
+
1289
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1290
+ autokeepCB.setToolTipText("On structure change");
1291
+ autokeepCB.addItemListener(this);
1292
+
1293
+ panel.Return();
1294
+ if (Globals.ADVANCED)
1295
+ {
6641296 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
6651297 lookAtCB.setToolTipText("Look-at target");
6661298 lookAtCB.addItemListener(this);
1299
+ }
1300
+
1301
+ }
1302
+
1303
+ cGridBag fill = new cGridBag();
1304
+ fill.preferredHeight = 200;
1305
+ cGridBag fill2 = new cGridBag();
1306
+ fill2.preferredHeight = 200;
1307
+ cGridBag fill3 = new cGridBag();
1308
+ fill3.preferredHeight = 200;
1309
+
1310
+ panel.add(fill);
1311
+ panel.add(fill2);
1312
+ panel.add(fill3);
6671313
6681314 }
6691315
6701316 void EditObject(Object3D obj)
6711317 {
6721318 cRadio radioButton = new cRadio(obj.name);
1319
+
1320
+ // June 2019. Patch to avoid bug with transparency.
1321
+ radioButton.hadMaterial = obj.material != null;
1322
+ if (!radioButton.hadMaterial)
1323
+ {
1324
+ obj.material = new cMaterial();
1325
+ }
1326
+
6731327 radioButton.SetObject(obj);
674
- radioButton.layout = sevenButton;
1328
+ radioButton.layout = sixButton; // sevenButton;
6751329 radioButton.SetCamera(cameraView.renderCamera, false);
6761330 radioButton.addActionListener(this);
6771331 radioPanel.add(radioButton);
6781332 buttonGroup.add(radioButton);
6791333 radioButton.doClick();
6801334 }
1335
+
6811336 void SetupViews(ObjEditor oe)
6821337 {
1338
+ theFrame = this;
1339
+
6831340 oe.SetupViews();
6841341
6851342 System.out.println("SetupViews");
....@@ -688,23 +1345,28 @@
6881345 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6891346 }
6901347
691
- JCheckBox liveCB;
692
- JCheckBox supportCB;
693
- JCheckBox localCB;
694
- JCheckBox crowdCB;
695
- JCheckBox smoothCB;
696
- JCheckBox fastCB;
697
- JCheckBox slowCB;
698
- JCheckBox boxCB;
699
- JCheckBox zoomBoxCB;
700
- JCheckBox trackCB;
701
- JCheckBox smoothfocusCB;
1348
+ cToggleButton liveCB;
1349
+ cCheckBox supportCB;
1350
+ cCheckBox localCB;
1351
+ cCheckBox crowdCB;
1352
+ cCheckBox smoothCB;
1353
+ cToggleButton fastCB;
1354
+ cCheckBox slowCB;
1355
+ cCheckBox boxCB;
1356
+ cCheckBox zoomBoxCB;
1357
+ cCheckBox freezeCB;
1358
+ //cToggleButton trackCB;
1359
+ cCheckBox trackCB;
1360
+ cCheckBox smoothfocusCB;
7021361 // JCheckBox speakerMocapCB;
703
- JCheckBox speakerCameraCB;
704
- JCheckBox speakerFocusCB;
705
- JCheckBox debugCB;
706
- JCheckBox oeilCB;
707
- JCheckBox lookAtCB;
1362
+ cCheckBox speakerCameraCB;
1363
+ cCheckBox speakerFocusCB;
1364
+ cCheckBox debugCB;
1365
+
1366
+ cCheckBox oeilCB;
1367
+ cCheckBox shadowCB;
1368
+ cCheckBox autokeepCB;
1369
+ cCheckBox lookAtCB;
7081370
7091371 // static int COLOR = 1;
7101372 // static int MATERIAL = 2;
....@@ -712,9 +1374,9 @@
7121374
7131375 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7141376
715
- JCheckBox colorCB;
716
- JCheckBox materialCB;
717
- JCheckBox textureCB;
1377
+ cCheckBox colorCB;
1378
+ cCheckBox materialCB;
1379
+ cCheckBox textureCB;
7181380
7191381 public void itemStateChanged(ItemEvent e)
7201382 {
....@@ -742,6 +1404,7 @@
7421404 } else if(e.getSource() == liveCB)
7431405 {
7441406 cameraView.ToggleLive();
1407
+ refreshContents(false);
7451408 }
7461409 else if(e.getSource() == supportCB)
7471410 {
....@@ -806,6 +1469,18 @@
8061469 {
8071470 cameraView.ToggleOeil();
8081471 }
1472
+ else if(e.getSource() == shadowCB)
1473
+ {
1474
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1475
+ }
1476
+ else if(e.getSource() == freezeCB)
1477
+ {
1478
+ Globals.FREEZEONMOVE ^= true;
1479
+ }
1480
+ else if(e.getSource() == autokeepCB)
1481
+ {
1482
+ Globals.REPLACEONMAKE ^= true;
1483
+ }
8091484 else if(e.getSource() == lookAtCB)
8101485 {
8111486 cameraView.ToggleLookAt();
....@@ -822,7 +1497,8 @@
8221497
8231498 /**/
8241499 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
825
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1500
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1501
+ TreePath path = objEditor.jTree.getSelectionPath();
8261502 if ((path == null) || (path.getPathCount() <= 1)) {
8271503 // We can't move the root node or an empty selection
8281504 return;
....@@ -885,8 +1561,6 @@
8851561 }
8861562 }
8871563
888
- String string = (String) object;
889
-
8901564 System.out.println("Transfer = " + object + "; drop : " + target);
8911565 // if( object instanceof java.io.File[])
8921566 // {
....@@ -894,7 +1568,11 @@
8941568 // objEditor.DropFile((java.io.File[]) object, true);
8951569 // return;
8961570 // }
897
- if (string.charAt(0) == '/')
1571
+
1572
+ String string = object.toString();
1573
+
1574
+ // File path for Mac and Windows
1575
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8981576 {
8991577 // file(s)
9001578 String[] names = string.split("\n");
....@@ -921,7 +1599,7 @@
9211599
9221600 flashIt = false;
9231601 CameraPane pane = (CameraPane) target;
924
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1602
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9251603 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9261604
9271605 if (group.selection.size() == 1)
....@@ -937,23 +1615,33 @@
9371615
9381616 assert target == objEditor.jTree;
9391617 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1618
+ Object3D destinationLeaf;
9401619 try {
941
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1620
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9421621 } catch (Exception e) {
9431622 System.out.println("destinationPath : " + destinationPath);
9441623 return;
9451624 }
9461625
947
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1626
+ for (int i=group.selection.size(); --i>=0;)
9481627 {
1628
+ Object3D child = (Object3D)group.selection.elementAt(i);
1629
+
1630
+ // Cannot move into itself
1631
+ if (child == destinationLeaf)
1632
+ return;
1633
+ }
1634
+
1635
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1636
+// {
9491637 loadClipboard(true);
9501638 objEditor.jTree.setSelectionPath(destinationPath);
951
- pasteInto(false);
952
- } else {
953
- loadClipboard(false);
954
- objEditor.jTree.setSelectionPath(destinationPath);
955
- pasteInto(false); // true); // ???
956
- }
1639
+ pasteInto(false, false);
1640
+// } else {
1641
+// loadClipboard(false);
1642
+// objEditor.jTree.setSelectionPath(destinationPath);
1643
+// pasteInto(false, false); // true); // ???
1644
+// }
9571645 }
9581646 public void dropActionChanged(DropTargetDragEvent dtde)
9591647 // Called if the user has modified the current drop gesture
....@@ -1058,85 +1746,107 @@
10581746 {
10591747 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10601748 //heightFieldItem.addActionListener(this);
1061
- gridItem = menu.add(new MenuItem("Grid"));
1062
- gridItem.addActionListener(this);
1063
- rectoidItem = menu.add(new MenuItem("Box"));
1064
- rectoidItem.addActionListener(this);
1065
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1066
- ellipsoidItem.addActionListener(this);
1067
- coneItem = menu.add(new MenuItem("Cone"));
1068
- coneItem.addActionListener(this);
1069
- torusItem = menu.add(new MenuItem("Torus"));
1070
- torusItem.addActionListener(this);
1071
- superItem = menu.add(new MenuItem("Superellipsoid"));
1072
- superItem.addActionListener(this);
1749
+// gridItem = menu.add(new MenuItem("Grid"));
1750
+// gridItem.addActionListener(this);
1751
+// rectoidItem = menu.add(new MenuItem("Box"));
1752
+// rectoidItem.addActionListener(this);
1753
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1754
+// ellipsoidItem.addActionListener(this);
1755
+// coneItem = menu.add(new MenuItem("Cone"));
1756
+// coneItem.addActionListener(this);
1757
+// torusItem = menu.add(new MenuItem("Torus"));
1758
+// torusItem.addActionListener(this);
1759
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1760
+// superItem.addActionListener(this);
1761
+
1762
+ cameraItem = menu.add(new MenuItem("Camera"));
1763
+ cameraItem.addActionListener(this);
1764
+
1765
+ if (!Globals.ADVANCED)
1766
+ {
10731767 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10741768 kleinItem.addActionListener(this);
1075
- particleItem = menu.add(new MenuItem("Particle system"));
1076
- particleItem.addActionListener(this);
1769
+ }
1770
+
1771
+// particleItem = menu.add(new MenuItem("Particle system"));
1772
+// particleItem.addActionListener(this);
1773
+ if (Globals.ADVANCED)
1774
+ {
10771775 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10781776 ragdollItem.addActionListener(this);
10791777 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10801778 ragdoll2Item.addActionListener(this);
1779
+ }
10811780 menu.add("-");
1082
- meshItem = menu.add(new MenuItem("Mesh"));
1781
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10831782 meshItem.addActionListener(this);
10841783 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10851784 // meshGroupItem.addActionListener(this);
1785
+ if (Globals.ADVANCED)
1786
+ {
10861787 springItem = menu.add(new MenuItem("Spring"));
10871788 springItem.addActionListener(this);
10881789 flagItem = menu.add(new MenuItem("Flag"));
10891790 flagItem.addActionListener(this);
1090
- bezierItem = menu.add(new MenuItem("Patch"));
1091
- bezierItem.addActionListener(this);
1092
- checkerItem = menu.add(new MenuItem("Checker"));
1093
- checkerItem.addActionListener(this);
10941791 blobItem = menu.add(new MenuItem("Blob"));
10951792 blobItem.addActionListener(this);
10961793 latheItem = menu.add(new MenuItem("Lathe"));
10971794 latheItem.addActionListener(this);
1098
- lightItem = menu.add(new MenuItem("Light"));
1099
- lightItem.addActionListener(this);
1795
+ }
1796
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1797
+ bezierItem.addActionListener(this);
1798
+// overlayItem = menu.add(new MenuItem("Overlay"));
1799
+// overlayItem.addActionListener(this);
1800
+// lightItem = menu.add(new MenuItem("Light"));
1801
+// lightItem.addActionListener(this);
11001802 menu.add("-");
11011803 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11021804 //superLoopItem.addActionListener(this);
1103
- loopItem = menu.add(new MenuItem("Loop"));
1104
- loopItem.addActionListener(this);
1805
+// loopItem = menu.add(new MenuItem("Loop"));
1806
+// loopItem.addActionListener(this);
11051807 doubleItem = menu.add(new MenuItem("Fork"));
11061808 doubleItem.addActionListener(this);
1809
+ if (Globals.ADVANCED)
1810
+ {
11071811 tripleItem = menu.add(new MenuItem("Trident"));
11081812 tripleItem.addActionListener(this);
1813
+ }
11091814 }
11101815
11111816 void buildToolsMenu(Menu menu)
11121817 {
11131818 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11141819 animationItem.addItemListener(this);
1115
- animationItem.setState(CameraPane.ANIMATION);
1820
+ animationItem.setState(Globals.ANIMATION);
1821
+
1822
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1823
+ archiveItem.addActionListener(this);
11161824
11171825 menu.add("-");
11181826 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11191827 parseverticesItem.addActionListener(this);
11201828 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11211829 textureFieldItem.addActionListener(this);
1122
- alignItem = menu.add(new MenuItem("Align"));
1830
+ alignItem = menu.add(new MenuItem("Align Objects"));
11231831 alignItem.addActionListener(this);
1124
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1125
- mirrorItem.addActionListener(this);
11261832 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11271833 reduceMorphItem.addActionListener(this);
11281834 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11291835 reduce34MorphItem.addActionListener(this);
1130
-
1131
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1132
- computeAOItem.addActionListener(this);
11331836 menu.add("-");
1134
-
11351837 menu.add(memoryItem = new MenuItem("Memory Usage"));
11361838 memoryItem.addActionListener(this);
1839
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1840
+ computeAOItem.addActionListener(this);
1841
+
1842
+ if (Globals.ADVANCED)
1843
+ {
1844
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1845
+ mirrorItem.addActionListener(this);
1846
+ menu.add("-");
11371847 menu.add(analyzeItem = new MenuItem("Analyze"));
11381848 analyzeItem.addActionListener(this);
1139
- menu.add(dumpItem = new MenuItem("Dump"));
1849
+ menu.add(dumpItem = new MenuItem("Print"));
11401850 dumpItem.addActionListener(this);
11411851 // menu.add(pathItem = new MenuItem("From-to path"));
11421852 // pathItem.addActionListener(this);
....@@ -1154,6 +1864,7 @@
11541864 menu.add("-");
11551865 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11561866 editScriptItem.addActionListener(this);
1867
+ }
11571868 }
11581869
11591870 void ScreenFit()
....@@ -1276,9 +1987,34 @@
12761987 shadow.material = new cMaterial(obj.material);
12771988 shadow.material.diffuse = 0.0001f;
12781989 shadow.material.specular = 0.0001f;
1990
+ //shadow.projectedVertices[1].x = 300;
12791991
12801992 makeSomething(shadow);
12811993 }
1994
+
1995
+ private void ClearUnpinned()
1996
+ {
1997
+ //for (Object3D obj : listUI)
1998
+ for (int i=listUI.size(); --i>=0;)
1999
+ {
2000
+ Object3D obj = listUI.elementAt(i);
2001
+ if (!obj.pinned)
2002
+ {
2003
+ obj.CloseUI();
2004
+ listUI.remove(i);
2005
+ }
2006
+ }
2007
+ }
2008
+
2009
+ private void EditElement(Object3D elem, boolean newWindow)
2010
+ {
2011
+ // if (!(elem instanceof Composite))
2012
+ // newWindow = false;
2013
+ listUI.add(elem);
2014
+ elem.openEditWindow(this, newWindow); //, false);
2015
+ System.out.println("edit : " + elem);
2016
+ elem.editWindow.refreshContents(true); // ? new
2017
+ }
12822018
12832019 /**
12842020 * applyExample
....@@ -1482,9 +2218,9 @@
14822218
14832219 void Overwrite(int mask)
14842220 {
1485
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2221
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14862222 {
1487
- Object3D content = GrafreeD.clipboard.get(0);
2223
+ Object3D content = Grafreed.clipboard.get(0);
14882224
14892225 if (content instanceof cGroup && ((cGroup)content).transientlink )
14902226 content = ((cGroup)content).get(0);
....@@ -1523,7 +2259,7 @@
15232259 {
15242260 ScreenFit();
15252261 } else
1526
- if (source == switchItem)
2262
+ if (source == switchViewItem)
15272263 {
15282264 cVector v1 = new cVector();
15292265 cVector v2 = new cVector();
....@@ -1532,11 +2268,11 @@
15322268 objEditor.cameraView.renderCamera.setAim(v2, v1);
15332269 objEditor.cameraView.repaint();
15342270 } else
1535
- if (source == rectoidItem)
2271
+ if (source == rectoidItem || source == boxButton)
15362272 {
15372273 makeSomething(new Box());
15382274 } else
1539
- if (source == particleItem)
2275
+ if (source == particleItem || source == particlesButton)
15402276 {
15412277 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15422278 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1615,27 +2351,27 @@
16152351
16162352 makeSomething(obj);
16172353 } else
1618
- if (source == gridItem)
2354
+ if (source == gridItem || source == gridButton)
16192355 {
16202356 makeSomething(new Grid());
16212357 } else
1622
- if (source == ellipsoidItem)
2358
+ if (source == ellipsoidItem || source == sphereButton)
16232359 {
16242360 makeSomething(new Sphere());
16252361 } else
1626
- if (source == coneItem)
2362
+ if (source == coneItem || source == coneButton)
16272363 {
16282364 makeSomething(new Cone());
16292365 } else
1630
- if (source == torusItem)
2366
+ if (source == torusItem || source == torusButton)
16312367 {
16322368 makeSomething(new Torus());
16332369 } else
1634
- if (source == superItem)
2370
+ if (source == superItem || source == superButton)
16352371 {
16362372 makeSomething(new Superellipsoid());
16372373 } else
1638
- if (source == kleinItem)
2374
+ if (source == kleinItem || source == kleinButton)
16392375 {
16402376 makeSomething(new Klein());
16412377 } else
....@@ -1655,7 +2391,7 @@
16552391 {
16562392 makeSomething(new BezierSurface());
16572393 } else
1658
- if (source == checkerItem)
2394
+ if (source == overlayItem || source == overlayButton)
16592395 {
16602396 /*
16612397 Object3D obj = new BezierSurface(5,8);
....@@ -1703,10 +2439,27 @@
17032439 s.setup();
17042440 makeSomething(s);
17052441 } else
1706
- if (source == lightItem)
2442
+ if (source == lightItem || source == lightButton)
17072443 {
17082444 makeSomething(new Light());
17092445 } else
2446
+// if (source == skybox1Button ||
2447
+// source == skybox2Button ||
2448
+// source == skybox3Button ||
2449
+// source == skybox4Button ||
2450
+// source == skybox5Button ||
2451
+// source == skybox6Button ||
2452
+// source == skybox7Button ||
2453
+// source == skybox11Button ||
2454
+// source == skybox12Button ||
2455
+// source == skybox13Button ||
2456
+// source == skybox14Button ||
2457
+// source == skybox15Button ||
2458
+// source == skybox16Button ||
2459
+// source == skybox17Button)
2460
+// {
2461
+// ChangeSkybox(source);
2462
+// } else
17102463 if (source == csgItem)
17112464 {
17122465 group(new CSG());
....@@ -1753,30 +2506,30 @@
17532506
17542507 group(g);
17552508 } else
1756
- if (source == loopItem)
2509
+ if (source == loopItem || source == loopButton)
17572510 {
17582511 Composite csg = new GroupLeaf();
17592512 csg.count = 5;
17602513 group(csg);
1761
- Composite child = new cGroup();
2514
+ Composite child = new cGroup("Branch");
17622515 csg.addChild(child);
17632516 child.addChild(csg);
17642517 } else
17652518 if (source == doubleItem)
17662519 {
1767
- Composite csg = new GroupLeaf();
2520
+ Composite csg = new GroupLeaf("Fork");
17682521 csg.count = 5;
17692522 group(csg);
1770
- Composite child = new cGroup();
2523
+ Composite child = new cGroup("Branch A");
17712524 csg.addChild(child);
17722525 child.addChild(csg);
1773
- child = new cGroup();
2526
+ child = new cGroup("Branch B");
17742527 csg.addChild(child);
17752528 child.addChild(csg);
17762529 } else
17772530 if (source == tripleItem)
17782531 {
1779
- Composite csg = new GroupLeaf();
2532
+ Composite csg = new GroupLeaf("Trident");
17802533 csg.count = 4;
17812534 group(csg);
17822535 Composite child = new cGroup();
....@@ -1789,27 +2542,10 @@
17892542 csg.addChild(child);
17902543 child.addChild(csg);
17912544 } else
1792
-
1793
- if (source == importGFDItem)
1794
- {
1795
- ImportGFD();
1796
- } else
1797
- if (source == importVRMLX3DItem)
1798
- {
1799
- ImportVRMLX3D();
1800
- } else
1801
- if (source == import3DSItem)
1802
- {
1803
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1804
- } else
1805
- if (source == importOBJItem)
1806
- {
1807
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1808
- } else
18092545 if (source == computeAOItem)
18102546 {
18112547 Globals.drawMode = CameraPane.OCCLUSION;
1812
- Globals.theRenderer.repaint();
2548
+ cameraView.repaint();
18132549 } else
18142550 if (source == recompileItem)
18152551 {
....@@ -1824,7 +2560,7 @@
18242560 if (source == invariantsItem)
18252561 {
18262562 System.out.println("Invariants:");
1827
- GrafreeD.grafreeD.universe.invariants();
2563
+ Grafreed.grafreeD.universe.invariants();
18282564 } else
18292565 if (source == memoryItem)
18302566 {
....@@ -1843,19 +2579,61 @@
18432579 {
18442580 DumpObject();
18452581 } else
2582
+ if (source == minButton)
2583
+ {
2584
+ Minimize();
2585
+ } else
2586
+ if (source == maxButton)
2587
+ {
2588
+ Maximize();
2589
+ } else
2590
+ if (source == fullButton)
2591
+ {
2592
+ ToggleFullScreen();
2593
+ } else
2594
+ if (source == undoButton)
2595
+ {
2596
+ // Go to previous version
2597
+ //if (!Undo())
2598
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2599
+ Undo();
2600
+ } else
2601
+ if (source == restoreButton)
2602
+ {
2603
+ // Restore current version
2604
+ Restore();
2605
+ } else
2606
+ if (source == replaceButton)
2607
+ {
2608
+ // Overwrite current version
2609
+ Replace();
2610
+ } else
2611
+ if (source == redoButton)
2612
+ {
2613
+ // Go to next version
2614
+ Redo();
2615
+ } else
2616
+ if (source == saveButton)
2617
+ {
2618
+ // Save a new version
2619
+ if (!Save(true))
2620
+ java.awt.Toolkit.getDefaultToolkit().beep();
2621
+ } else
2622
+ if (source == oneStepButton)
2623
+ {
2624
+ Globals.ONESTEP = true;
2625
+ cameraView.repaint();
2626
+ } else
18462627 if (source == screenfitButton)
18472628 {
1848
- //Reload(lastConverter, lastFilename, true);
18492629 ScreenFit();
18502630 } else
18512631 if (source == screenfitpointButton)
18522632 {
1853
- //Reload(lastConverter, lastFilename, true);
18542633 ScreenFitPoint();
18552634 } else
18562635 if (source == snapobjectButton)
18572636 {
1858
- //Reload(lastConverter, lastFilename, true);
18592637 SnapObject();
18602638 } else
18612639 // if (event.getSource() == recompileButton)
....@@ -1892,12 +2670,20 @@
18922670 {
18932671 loadClipboard(true);
18942672 } else
2673
+ if (source == undoItem)
2674
+ {
2675
+ Undo();
2676
+ } else
2677
+ if (source == redoItem)
2678
+ {
2679
+ Redo();
2680
+ } else
18952681 if (source == duplicateItem)
18962682 {
1897
- Object3D keep = GrafreeD.clipboard;
2683
+ Object3D keep = Grafreed.clipboard;
18982684 loadClipboard(false);
18992685 paste(false);
1900
- GrafreeD.clipboard = keep;
2686
+ Grafreed.clipboard = keep;
19012687 } else
19022688 if (source == cloneItem)
19032689 {
....@@ -1915,13 +2701,17 @@
19152701 {
19162702 paste(false);
19172703 } else
2704
+ if (source == pasteIntoItem)
2705
+ {
2706
+ pasteInto(true, false);
2707
+ } else
19182708 if (source == pasteLinkItem)
19192709 {
1920
- pasteInto(false);
2710
+ pasteInto(false, false);
19212711 } else
19222712 if (source == pasteCloneItem)
19232713 {
1924
- pasteInto(true);
2714
+ pasteInto(true, true);
19252715 } else
19262716 if (source == pasteExpandItem)
19272717 {
....@@ -2113,9 +2903,9 @@
21132903 // group.selection.get(0).setMasterThis(content); // should be identity
21142904 // refreshContents();
21152905 // }
2116
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2906
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21172907 {
2118
- Object3D content = GrafreeD.clipboard.get(0);
2908
+ Object3D content = Grafreed.clipboard.get(0);
21192909
21202910 if (content instanceof cGroup && ((cGroup)content).transientlink )
21212911 content = ((cGroup)content).get(0);
....@@ -2123,11 +2913,11 @@
21232913 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21242914 for (int i=0; i<group.selection.size(); i++)
21252915 {
2126
- boolean random = CameraPane.RANDOM;
2127
- CameraPane.RANDOM = false; // parse all random nodes
2916
+ boolean random = CameraPane.SWITCH;
2917
+ CameraPane.SWITCH = false; // parse all random nodes
21282918 group.selection.get(i).linkVerticesThis(content);
21292919 // group.selection.get(i).setMasterThis(content); // should be identity
2130
- CameraPane.RANDOM = random;
2920
+ CameraPane.SWITCH = random;
21312921 }
21322922 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21332923 refreshContents();
....@@ -2137,20 +2927,20 @@
21372927 {
21382928 for (int i=0; i<group.selection.size(); i++)
21392929 {
2140
- boolean random = CameraPane.RANDOM;
2141
- CameraPane.RANDOM = false; // parse all random nodes
2930
+ boolean random = CameraPane.SWITCH;
2931
+ CameraPane.SWITCH = false; // parse all random nodes
21422932 group.selection.get(i).linkVerticesThis(null);
2143
- CameraPane.RANDOM = random;
2933
+ CameraPane.SWITCH = random;
21442934 }
21452935
21462936 refreshContents();
21472937 } else
21482938 if (source == relinkverticesItem)
21492939 {
2150
- boolean random = CameraPane.RANDOM;
2151
- CameraPane.RANDOM = false; // parse all random nodes
2940
+ boolean random = CameraPane.SWITCH;
2941
+ CameraPane.SWITCH = false; // parse all random nodes
21522942 group.selection.RelinkToSupport();
2153
- CameraPane.RANDOM = random;
2943
+ CameraPane.SWITCH = random;
21542944
21552945 refreshContents();
21562946 } else
....@@ -2165,9 +2955,9 @@
21652955 } else
21662956 if (source == setMasterItem)
21672957 {
2168
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2958
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21692959 {
2170
- Object3D content = GrafreeD.clipboard.get(0);
2960
+ Object3D content = Grafreed.clipboard.get(0);
21712961
21722962 if (content instanceof cGroup && ((cGroup)content).transientlink )
21732963 content = ((cGroup)content).get(0);
....@@ -2180,9 +2970,9 @@
21802970 {
21812971 if (group.selection.size() == 1)
21822972 {
2183
- if (GrafreeD.clipboard.size() == 1)
2973
+ if (Grafreed.clipboard.size() == 1)
21842974 {
2185
- Object3D content = GrafreeD.clipboard.get(0);
2975
+ Object3D content = Grafreed.clipboard.get(0);
21862976
21872977 if (content instanceof cGroup && ((cGroup)content).transientlink )
21882978 content = ((cGroup)content).get(0);
....@@ -2199,7 +2989,7 @@
21992989 {
22002990 RevertMeshes();
22012991 } else
2202
- if (source == resetMeshItem)
2992
+ if (source == resetAllItem)
22032993 {
22042994 ResetAll();
22052995 } else
....@@ -2207,7 +2997,7 @@
22072997 {
22082998 StepAll();
22092999 } else
2210
- if (source == clearItem) // || event.getSource() == clearButton)
3000
+ if (source == deleteItem) // || event.getSource() == clearButton)
22113001 {
22123002 //int indices[] = jList.getSelectedIndices();
22133003 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2219,9 +3009,9 @@
22193009 {
22203010 ClearSelection(true);
22213011 } else
2222
- if (source == grabItem)
3012
+ if (source == grabItem || source == groupButton)
22233013 {
2224
- group(new cGroup(), true);
3014
+ group(new cGroup(), false); // true);
22253015 } else
22263016 if (source == hideItem)
22273017 {
....@@ -2239,16 +3029,16 @@
22393029 {
22403030 makeSomething(new Camera());
22413031 } else
2242
- if (source == compositeItem)
3032
+ if (source == compositeItem || source == compositeButton)
22433033 {
22443034 group(new Composite());
22453035 } else
2246
- if (source == randomItem)
3036
+ if (source == switchItem || source == switchButton)
22473037 {
22483038 RandomNode random = new RandomNode();
22493039 group(random);
22503040 if (random.size() > 0)
2251
- random.name = random.get(0).name + "Rnd";
3041
+ random.name = random.get(0).name + "Switch";
22523042 } else
22533043 if (source == physicsItem)
22543044 {
....@@ -2345,7 +3135,7 @@
23453135 {
23463136 group(new cLinker());
23473137 } else
2348
- if (source == textureItem)
3138
+ if (source == textureItem || source == textureButton)
23493139 {
23503140 group(new TextureNode());
23513141 } else
....@@ -2365,17 +3155,30 @@
23653155 {
23663156 CastShadow(2);
23673157 } else
2368
- if (source == ungroupItem)
3158
+ if (source == ungroupItem || source == ungroupButton)
23693159 {
2370
- //ungroup();
3160
+ boolean hasRoot = false;
3161
+
23713162 for (int i=0; i<group.selection.size(); i++)
23723163 {
2373
- Ungroup(group.selection.get(i));
3164
+ if (group.selection.get(i) == group)
3165
+ {
3166
+ hasRoot = true;
3167
+ break;
3168
+ }
23743169 }
23753170
2376
- ClearSelection(false);
2377
-
2378
- refreshContents();
3171
+ if (!hasRoot)
3172
+ {
3173
+ for (int i=0; i<group.selection.size(); i++)
3174
+ {
3175
+ Ungroup(group.selection.get(i));
3176
+ }
3177
+
3178
+ ClearSelection(false);
3179
+
3180
+ refreshContents();
3181
+ }
23793182 } else
23803183 if (source == genUVItem)
23813184 {
....@@ -2387,7 +3190,7 @@
23873190 } else
23883191 if (source == genNormalsMESHItem)
23893192 {
2390
- GenNormals(true); // TODO
3193
+ GenNormalsMESH();
23913194 } else
23923195 if (source == genNormalsORGANItem)
23933196 {
....@@ -2452,6 +3255,22 @@
24523255 if (source == unmarkleavesItem)
24533256 {
24543257 MarkLeaves(false);
3258
+ } else
3259
+ if (source == rewindleavesItem)
3260
+ {
3261
+ RewindLeaves(true);
3262
+ } else
3263
+ if (source == unrewindleavesItem)
3264
+ {
3265
+ RewindLeaves(false);
3266
+ } else
3267
+ if (source == randomleavesItem)
3268
+ {
3269
+ RandomLeaves(true);
3270
+ } else
3271
+ if (source == unrandomleavesItem)
3272
+ {
3273
+ RandomLeaves(false);
24553274 } else
24563275 if (source == flipVItem)
24573276 {
....@@ -2537,9 +3356,13 @@
25373356 {
25383357 SmoothMesh();
25393358 } else
2540
- if (source == transformgeometryItem)
3359
+ if (source == transformGeometryItem)
25413360 {
25423361 TransformGeometry();
3362
+ } else
3363
+ if (source == transformChildrenItem)
3364
+ {
3365
+ TransformChildren();
25433366 } else
25443367 if (source == resetTransformItem)
25453368 {
....@@ -2547,7 +3370,11 @@
25473370 } else
25483371 if (source == resetCentroidItem)
25493372 {
2550
- ResetCentroid();
3373
+ ResetCentroid(true);
3374
+ } else
3375
+ if (source == resetCentroidXZItem)
3376
+ {
3377
+ ResetCentroid(false);
25513378 } else
25523379 if (source == resetParentItem)
25533380 {
....@@ -2652,7 +3479,7 @@
26523479 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26533480 {
26543481 obj = (Object3D)e.nextElement();
2655
- obj.SetBumpTexture(null);
3482
+ obj.ResetBumpTexture();
26563483 }
26573484
26583485 refreshContents();
....@@ -2668,6 +3495,31 @@
26683495
26693496 refreshContents();
26703497 } else
3498
+ if (source == embedTexturesItem)
3499
+ {
3500
+ Object3D obj;
3501
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3502
+ {
3503
+ obj = (Object3D)e.nextElement();
3504
+ obj.EmbedTextures(true);
3505
+ }
3506
+
3507
+ refreshContents();
3508
+ } else
3509
+ if (source == deEmbedTexturesItem)
3510
+ {
3511
+ Object3D obj;
3512
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3513
+ {
3514
+ obj = (Object3D)e.nextElement();
3515
+ obj.EmbedTextures(false);
3516
+ }
3517
+
3518
+ CameraPane.texturepigment.clear();
3519
+ CameraPane.texturebump.clear();
3520
+
3521
+ refreshContents();
3522
+ } else
26713523 if (source == flashSelectionButton)
26723524 {
26733525 CameraPane.flash = true;
....@@ -2679,6 +3531,10 @@
26793531 if (source == twoButton)
26803532 {
26813533 radio.layout = twoButton;
3534
+
3535
+ if (CameraPane.FULLSCREEN)
3536
+ fullscreenLayout = radio.layout;
3537
+
26823538 // bug
26833539 //gridPanel.setDividerLocation(1.0);
26843540 //bigPanel.setDividerLocation(0.0);
....@@ -2711,10 +3567,31 @@
27113567 bigThree.ClearUI();
27123568 bigThree.add(centralPanel);
27133569 bigThree.FlushUI();
3570
+
3571
+ cameraView.requestFocusInWindow();
3572
+
3573
+// refreshContents(true);
3574
+//
3575
+// try
3576
+// {
3577
+// java.awt.Robot bot = new java.awt.Robot();
3578
+// int mask = InputEvent.BUTTON1_MASK;
3579
+// bot.mouseMove(100, 100);
3580
+// bot.mousePress(mask);
3581
+// bot.mouseRelease(mask);
3582
+// }
3583
+// catch (Exception e)
3584
+// {
3585
+//
3586
+// }
3587
+
27143588 } else
27153589 if (source == threeButton)
27163590 {
27173591 radio.layout = threeButton;
3592
+
3593
+ if (CameraPane.FULLSCREEN)
3594
+ fullscreenLayout = radio.layout;
27183595
27193596 // bigThree.remove(scenePanel);
27203597 // bigThree.remove(centralPanel);
....@@ -2744,13 +3621,18 @@
27443621 // centralPanel.setVisible(true);
27453622 // XYZPanel.setVisible(true);
27463623 bigThree.ClearUI();
3624
+ bigThree.add(scenePanel);
27473625 bigThree.add(centralPanel);
2748
- bigThree.add(XYZPanel);
27493626 bigThree.FlushUI();
3627
+
3628
+ cameraView.requestFocusInWindow();
27503629 } else
27513630 if (source == fourButton)
27523631 {
27533632 radio.layout = fourButton;
3633
+
3634
+ if (CameraPane.FULLSCREEN)
3635
+ fullscreenLayout = radio.layout;
27543636
27553637 // bigThree.remove(scenePanel);
27563638 // bigThree.remove(centralPanel);
....@@ -2782,10 +3664,15 @@
27823664 bigThree.ClearUI();
27833665 bigThree.add(scenePanel);
27843666 bigThree.FlushUI();
3667
+
3668
+ cameraView.requestFocusInWindow();
27853669 } else
27863670 if (source == sixButton)
27873671 {
27883672 radio.layout = sixButton;
3673
+
3674
+ if (CameraPane.FULLSCREEN)
3675
+ fullscreenLayout = radio.layout;
27893676
27903677 // bigThree.remove(scenePanel);
27913678 // bigThree.remove(centralPanel);
....@@ -2815,13 +3702,18 @@
28153702 // centralPanel.setVisible(true);
28163703 // XYZPanel.setVisible(false);
28173704 bigThree.ClearUI();
2818
- bigThree.add(scenePanel);
28193705 bigThree.add(centralPanel);
3706
+ bigThree.add(scenePanel);
28203707 bigThree.FlushUI();
3708
+
3709
+ cameraView.requestFocusInWindow();
28213710 } else
28223711 if (source == sevenButton)
28233712 {
28243713 radio.layout = sevenButton;
3714
+
3715
+ if (CameraPane.FULLSCREEN)
3716
+ fullscreenLayout = radio.layout;
28253717
28263718 // bigThree.remove(scenePanel);
28273719 // bigThree.remove(centralPanel);
....@@ -2855,6 +3747,8 @@
28553747 bigThree.add(centralPanel);
28563748 bigThree.add(XYZPanel);
28573749 bigThree.FlushUI();
3750
+
3751
+ cameraView.requestFocusInWindow();
28583752 } else
28593753 if (source == rootButton)
28603754 {
....@@ -2866,6 +3760,7 @@
28663760 EditObject(obj);
28673761 }
28683762
3763
+ cameraView.requestFocusInWindow();
28693764 refreshContents(true);
28703765 } else
28713766 if (source == closeButton)
....@@ -2875,22 +3770,37 @@
28753770 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28763771 {
28773772 ab = (cRadio)e.nextElement();
2878
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3773
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28793774 {
3775
+ // Patch to avoid bug with transparency.
3776
+ if (!ab.hadMaterial)
3777
+ {
3778
+ ab.object.material = null;
3779
+ }
3780
+
28803781 buttonGroup.remove(ab);
28813782 radioPanel.remove(ab);
28823783
2883
- ab.GetObject().editWindow = null;
3784
+ //ab.GetObject().editWindow = null;
3785
+ ab.GetObject().manipWindow = null;
28843786 // ab.GetObject().objectUI = null; // ?????????
28853787
28863788 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28873789 break;
28883790 }
28893791 }
3792
+
3793
+ cameraView.requestFocusInWindow();
28903794 refreshContents(true);
28913795 } else
28923796 if (source == editItem || source == editButton)
28933797 {
3798
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3799
+ {
3800
+ Object3D child = (Object3D)e.nextElement();
3801
+ child.pinned = true;
3802
+ }
3803
+
28943804 EditSelection(false);
28953805 } else
28963806 if (source == uneditButton)
....@@ -2900,12 +3810,13 @@
29003810 Object3D child = (Object3D)e.nextElement();
29013811 if(child.editWindow != null)
29023812 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3813
+ child.pinned = false;
29033814 child.CloseUI();
29043815 listUI.remove(child);
29053816
2906
- child.editWindow = null; // ???????????
3817
+ //child.editWindow = null; // ???????????
29073818 }
2908
- objEditor.ctrlPanel.validate();
3819
+ objEditor.ctrlPanel.FlushUI();
29093820 //objEditor.jTree.clearSelection();
29103821 //objEditor.ResetSliders();
29113822 refreshContents(true);
....@@ -2916,6 +3827,7 @@
29163827 //copy.ClearUI();
29173828 for (Object3D obj : listUI)
29183829 {
3830
+ obj.pinned = false;
29193831 obj.CloseUI();
29203832 }
29213833 listUI.clear();
....@@ -2925,7 +3837,7 @@
29253837 {
29263838 assert(copy == group);
29273839
2928
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3840
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29293841
29303842 for (Object3D obj : listUI)
29313843 {
....@@ -2974,6 +3886,9 @@
29743886 }
29753887
29763888 copy = group;
3889
+
3890
+ SetUndoStates();
3891
+
29773892 //Globals.theRenderer.object = group;
29783893 if(!useclient)
29793894 {
....@@ -2989,20 +3904,46 @@
29893904 frontView.object = group;
29903905 sideView.object = group;
29913906 }
2992
- group.editWindow = this;
3907
+
3908
+// fix "+" issue
3909
+ //group.editWindow = this;
3910
+ group.manipWindow = this;
3911
+
29933912 /*
29943913 currentLayout = radio.layout;
29953914 if (currentLayout == null)
29963915 currentLayout = sevenButton;
29973916 */
29983917 radio.layout.doClick();
3918
+
3919
+ ClearUnpinned();
3920
+ //Grafreed.Assert(group != null);
3921
+ //Grafreed.Assert(group.selection != null);
3922
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3923
+ if (group.selection == null || group.selection.size() == 1)
3924
+ EditSelection(false);
29993925 keepparent = group.parent;
30003926 // PARENT = NULL or not???
30013927 //group.parent = null; // ROOT
30023928 //group.attributes = -1;
30033929 ResetModel();
3930
+
3931
+ cameraView.requestFocusInWindow();
30043932 refreshContents(true);
3005
- }
3933
+ } else if (event.getSource() == editCameraItem)
3934
+ {
3935
+ cameraView.ProtectCamera();
3936
+ cameraView.repaint();
3937
+ return;
3938
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3939
+ {
3940
+ cameraView.RevertCamera();
3941
+ cameraView.repaint();
3942
+ return;
3943
+ // } else if (event.getSource() == textureButton)
3944
+ // {
3945
+ // return; // true;
3946
+ }
30063947 else
30073948 {
30083949 //return super.action(event, arg);
....@@ -3011,7 +3952,6 @@
30113952 }
30123953
30133954 boolean useclient = false;
3014
- cRadio radio;
30153955
30163956 void ToggleRoot()
30173957 {
....@@ -3063,6 +4003,28 @@
30634003 refreshContents();
30644004 }
30654005
4006
+ void TransformChildren()
4007
+ {
4008
+ Object3D obj;
4009
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4010
+ {
4011
+ obj = (Object3D)e.nextElement();
4012
+ obj.KeepTextureMatrices();
4013
+ obj.TransformChildren();
4014
+ obj.RestoreTextureMatrices();
4015
+
4016
+// if (obj.parent == null)
4017
+// {
4018
+// System.out.println("NULL PARENT!");
4019
+// new Exception().printStackTrace();
4020
+// }
4021
+// else
4022
+// TouchTransform(obj);
4023
+// //obj.parent.Touch();
4024
+ }
4025
+
4026
+ refreshContents();
4027
+ }
30664028
30674029 void ResetTransform()
30684030 {
....@@ -3175,7 +4137,7 @@
31754137 refreshContents();
31764138 }
31774139
3178
- void ResetCentroid()
4140
+ void ResetCentroid(boolean full)
31794141 {
31804142 Object3D obj;
31814143 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3190,12 +4152,16 @@
31904152 LA.matIdentity(Object3D.mat);
31914153 obj.getBounds(minima, maxima, false);
31924154 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3193
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4155
+ if (full)
4156
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31944157 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31954158 obj.TransformMesh(Object3D.mat);
4159
+
31964160 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3197
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4161
+ if (full)
4162
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31984163 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4164
+
31994165 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32004166 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32014167 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3224,7 +4190,8 @@
32244190
32254191 int size = obj.MemorySize();
32264192
3227
- System.err.println((size/1024) + " KB is the size of " + obj);
4193
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4194
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32284195 }
32294196 }
32304197 catch (Exception e)
....@@ -3261,9 +4228,9 @@
32614228 obj = (Object3D)e.nextElement();
32624229
32634230 System.out.println("Object is: " + obj);
3264
- GrafreeD.AnalyzeObject(obj);
4231
+ Grafreed.AnalyzeObject(obj);
32654232 System.out.println("Boundary rep: " + obj.bRep);
3266
- GrafreeD.AnalyzeObject(obj.bRep);
4233
+ Grafreed.AnalyzeObject(obj.bRep);
32674234
32684235 // System.err.println((size/1024) + " KB is the size of " + obj);
32694236 }
....@@ -3305,6 +4272,13 @@
33054272 void GenNormals(boolean crease)
33064273 {
33074274 group.GenNormalsS(crease);
4275
+
4276
+ refreshContents();
4277
+ }
4278
+
4279
+ void GenNormalsMESH()
4280
+ {
4281
+ group.GenNormalsMeshS();
33084282
33094283 refreshContents();
33104284 }
....@@ -3477,8 +4451,8 @@
34774451
34784452 void ParseVertices()
34794453 {
3480
- boolean epsequal = GrafreeD.epsequal;
3481
- GrafreeD.epsequal = true;
4454
+ boolean epsequal = Grafreed.epsequal;
4455
+ Grafreed.epsequal = true;
34824456
34834457 for (int i=0; i<group.selection.size(); i++)
34844458 {
....@@ -3503,7 +4477,7 @@
35034477 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35044478 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35054479
3506
- g.add(GrafreeD.clipboard);
4480
+ g.add(Grafreed.clipboard);
35074481
35084482 buffer.add(g);
35094483 }
....@@ -3518,7 +4492,7 @@
35184492 makeSomething(buffer, i==group.selection.size()-1);
35194493 }
35204494
3521
- GrafreeD.epsequal = epsequal;
4495
+ Grafreed.epsequal = epsequal;
35224496
35234497 refreshContents();
35244498 }
....@@ -3536,7 +4510,16 @@
35364510 String pigment = Object3D.GetPigment(tex);
35374511 //String bump = Object3D.GetBump(tex);
35384512
3539
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4513
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4514
+
4515
+ try
4516
+ {
4517
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4518
+ }
4519
+ catch (Exception e)
4520
+ {
4521
+ System.err.println("FAIL: " + node);
4522
+ }
35404523
35414524 double s = v.s;
35424525
....@@ -3624,11 +4607,11 @@
36244607
36254608 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36264609
3627
- boolean random = CameraPane.RANDOM;
3628
- CameraPane.RANDOM = false; // parse all random nodes
4610
+ boolean random = CameraPane.SWITCH;
4611
+ CameraPane.SWITCH = false; // parse all random nodes
36294612 lowres.linkVerticesThis(null);
36304613 lowres.linkVerticesThis(sn);
3631
- CameraPane.RANDOM = random;
4614
+ CameraPane.SWITCH = random;
36324615
36334616 System.err.flush();
36344617
....@@ -3668,7 +4651,7 @@
36684651 return;
36694652
36704653 Object3D poses = group.selection.get(0);
3671
- Object3D ref = GrafreeD.clipboard.get(0);
4654
+ Object3D ref = Grafreed.clipboard.get(0);
36724655
36734656 Object3D newgroup = new Object3D("Po:" + poses.name);
36744657
....@@ -3862,9 +4845,9 @@
38624845
38634846 void ClipMesh()
38644847 {
3865
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4848
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38664849 {
3867
- Object3D content = GrafreeD.clipboard.get(0);
4850
+ Object3D content = Grafreed.clipboard.get(0);
38684851
38694852 if (content instanceof cGroup && ((cGroup)content).transientlink )
38704853 content = ((cGroup)content).get(0);
....@@ -3873,7 +4856,7 @@
38734856 // {
38744857 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38754858 // }
3876
- group.selection.ClipMesh(GrafreeD.clipboard);
4859
+ group.selection.ClipMesh(Grafreed.clipboard);
38774860 }
38784861 // group.selection.ClipMesh(GrafreeD.clipboard);
38794862 System.out.println("DONE.");
....@@ -3920,6 +4903,18 @@
39204903 void MarkLeaves(boolean hide)
39214904 {
39224905 group.selection.MarkLeaves(hide);
4906
+ refreshContents();
4907
+ }
4908
+
4909
+ void RewindLeaves(boolean hide)
4910
+ {
4911
+ group.selection.RewindLeaves(hide);
4912
+ refreshContents();
4913
+ }
4914
+
4915
+ void RandomLeaves(boolean hide)
4916
+ {
4917
+ group.selection.RandomLeaves(hide);
39234918 refreshContents();
39244919 }
39254920
....@@ -3994,28 +4989,25 @@
39944989 // }
39954990 // }
39964991
3997
- static boolean allparams = true;
3998
-
3999
- static Vector<Object3D> listUI = new Vector<Object3D>();
4000
-
40014992 void EditSelection(boolean newWindow)
40024993 {
4994
+ if (group.selection == null)
4995
+ {
4996
+ EditElement(group, newWindow); // ? new
4997
+ return;
4998
+ }
4999
+
40035000 // aConstraints.gridy = 0;
40045001 for (int i=0; i<group.selection.size(); i++)
40055002 {
40065003 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40075004 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4008
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5005
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40095006
40105007 Object3D elem = (Object3D)group.selection.elementAt(i);
4011
- if(elem != group)
5008
+ if(elem != group || !newWindow)
40125009 {
4013
- // if (!(elem instanceof Composite))
4014
- // newWindow = false;
4015
- listUI.add(elem);
4016
- elem.openEditWindow(this, newWindow); //, false);
4017
- System.out.println("edit : " + elem);
4018
- elem.editWindow.refreshContents(true); // ? new
5010
+ EditElement(elem, newWindow); // ? new
40195011 }
40205012 }
40215013 }
....@@ -4090,7 +5082,8 @@
40905082 //new Exception().printStackTrace();
40915083
40925084 freezemodel = true;
4093
-
5085
+ ClearUnpinned();
5086
+
40945087 /**/
40955088 //switch (event.id)
40965089 {
....@@ -4098,7 +5091,6 @@
40985091 //case 702: // Event.LIST_DESELECT
40995092 group.deselectAll();
41005093 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4101
- objEditor.ClearInfo(); // .GetMaterial());
41025094 if (tps != null)
41035095 {
41045096 for (int i=0; i < tps.length; i++)
....@@ -4107,33 +5099,39 @@
41075099
41085100 //if (child.parent != null)
41095101 //child.parent.addSelectee(child);
5102
+ objEditor.SetMaterial(child);
41105103 group.addSelectee(child);
4111
- objEditor.SetMaterial(child); // .GetMaterial());
4112
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4113
- System.err.println("info : " + child.GetPath());
41145104 }
41155105 }
4116
- else
4117
- {
4118
- objEditor.SetMaterial(group); // .GetMaterial());
4119
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4120
- System.err.println("info : " + group.GetPath());
4121
- }
5106
+// else
5107
+// {
5108
+// objEditor.SetMaterial(group); // .GetMaterial());
5109
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5110
+// System.err.println("info : " + group.GetPath());
5111
+// }
41225112
4123
- objEditor.SetText(); // jan 2014
4124
-
4125
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5113
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41265114 CameraPane.flash = true;
41275115
4128
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5116
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41295117 // a camera
41305118 {
4131
- CameraPane.camerachangeframe = 0; // don't refuse it
4132
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5119
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5120
+ {
5121
+ CameraPane.camerachangeframe = 0; // don't refuse it
5122
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5123
+ }
41335124 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41345125 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41355126 }
41365127
5128
+ if (tps != null && tps.length == 1)
5129
+ {
5130
+ EditSelection(false);
5131
+ }
5132
+
5133
+ SetPinStates(tps != null && tps.length > 0);
5134
+
41375135 refreshContents();
41385136 //return true;
41395137 }
....@@ -4142,6 +5140,35 @@
41425140
41435141 freezemodel = false;
41445142 }
5143
+
5144
+ void SetPinStates(boolean enabled)
5145
+ {
5146
+ editButton.setEnabled(enabled);
5147
+ uneditButton.setEnabled(enabled);
5148
+ unselectButton.setEnabled(enabled);
5149
+ flashSelectionButton.setEnabled(enabled);
5150
+ }
5151
+
5152
+ void refreshContents(boolean cp)
5153
+ {
5154
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5155
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5156
+ {
5157
+ objEditor.ClearInfo(); // .GetMaterial());
5158
+
5159
+ for (int i=0; i < group.selection.Size(); i++)
5160
+ {
5161
+ Object3D child = (Object3D) group.selection.get(i);
5162
+
5163
+ objEditor.AddInfo(child, this, true);
5164
+ System.err.println("info : " + child.GetPath());
5165
+ }
5166
+
5167
+ objEditor.SetText(); // jan 2014
5168
+ }
5169
+
5170
+ super.refreshContents(cp);
5171
+ }
41455172
41465173 void linkSomething(Object3D thing)
41475174 {
....@@ -4213,16 +5240,19 @@
42135240 {
42145241 if (group.selection.isEmpty())
42155242 return;
4216
- GrafreeD.clipboardIsTempGroup = false;
5243
+
5244
+ Grafreed.clipboardIsTempGroup = false;
42175245 Composite tGroup = null;
42185246 if (group.selection.size() > 0) // 1)
42195247 {
42205248 tGroup = new cGroup();
4221
- GrafreeD.clipboardIsTempGroup = true;
5249
+ Grafreed.clipboardIsTempGroup = true;
42225250 }
42235251
42245252 if (cut)
42255253 {
5254
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5255
+// Save();
42265256 //int indices[] = jList.getSelectedIndices();
42275257 //for (int i = indices.length - 1; i >= 0; i--)
42285258 //jList.remove(indices[i]);
....@@ -4258,16 +5288,16 @@
42585288 //System.out.println("cut " + child);
42595289 //System.out.println("parent = " + child.parent);
42605290 // tmp.addChild(child);
4261
- if (GrafreeD.clipboardIsTempGroup)
5291
+ if (Grafreed.clipboardIsTempGroup)
42625292 tGroup.add/*Child*/(tmp);
42635293 else
4264
- GrafreeD.clipboard = tmp;
5294
+ Grafreed.clipboard = tmp;
42655295 }
42665296 else
4267
- if (GrafreeD.clipboardIsTempGroup)
5297
+ if (Grafreed.clipboardIsTempGroup)
42685298 tGroup.add/*Child*/(child);
42695299 else
4270
- GrafreeD.clipboard = child;
5300
+ Grafreed.clipboard = child;
42715301 }
42725302
42735303 //ResetModel();
....@@ -4299,21 +5329,23 @@
42995329 //System.out.println("cut " + elem);
43005330 //System.out.println("parent = " + elem.parent);
43015331 // tmp.addChild(elem);
4302
- if (GrafreeD.clipboardIsTempGroup)
5332
+ if (Grafreed.clipboardIsTempGroup)
43035333 tGroup.add/*Child*/(tmp);
43045334 else
4305
- GrafreeD.clipboard = tmp;
5335
+ Grafreed.clipboard = tmp;
43065336 }
43075337 else
4308
- if (GrafreeD.clipboardIsTempGroup)
5338
+ if (Grafreed.clipboardIsTempGroup)
43095339 tGroup.add/*Child*/(child);
43105340 else
4311
- GrafreeD.clipboard = child;
5341
+ Grafreed.clipboard = child;
43125342 }
43135343
43145344 }
4315
- if (GrafreeD.clipboardIsTempGroup)
4316
- GrafreeD.clipboard = tGroup;
5345
+
5346
+ if (Grafreed.clipboardIsTempGroup)
5347
+ Grafreed.clipboard = tGroup;
5348
+
43175349 if (cut)
43185350 {
43195351 ResetModel();
....@@ -4323,11 +5355,15 @@
43235355
43245356 void paste(boolean expand)
43255357 {
5358
+ if (Globals.REPLACEONMAKE)
5359
+ Save();
5360
+ boolean keep = Globals.REPLACEONMAKE;
5361
+ Globals.REPLACEONMAKE = false;
43265362 // if (GrafreeD.clipboard == null)
43275363 // return;
43285364 boolean first = true;
43295365
4330
- if (GrafreeD.clipboardIsTempGroup)
5366
+ if (Grafreed.clipboardIsTempGroup)
43315367 {
43325368 Composite temp;
43335369
....@@ -4338,7 +5374,7 @@
43385374 temp = (Composite)Applet3D.clipboard.deepCopy();
43395375 */
43405376 Object3D elem;
4341
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5377
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43425378 {
43435379 Object3D child = (Object3D)e.nextElement();
43445380
....@@ -4372,21 +5408,22 @@
43725408 //Object3D cb = Applet3D.clipboard;
43735409 //temp.addChild(cb);
43745410 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4375
- assert(GrafreeD.clipboard.parent == null);
4376
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4377
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4378
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4379
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5411
+ assert(Grafreed.clipboard.parent == null);
5412
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5413
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5414
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5415
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43805416 else
4381
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4382
- GrafreeD.clipboard.get(0).parent = keepparent;
5417
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5418
+ Grafreed.clipboard.get(0).parent = keepparent;
43835419 }
43845420
5421
+ Globals.REPLACEONMAKE = keep;
43855422 ResetModel();
43865423 refreshContents();
43875424 }
43885425
4389
- void pasteInto(boolean copyit)
5426
+ void pasteInto(boolean copyit, boolean clone)
43905427 {
43915428 // if (GrafreeD.clipboard == null)
43925429 // return;
....@@ -4415,15 +5452,22 @@
44155452 if (copyit)
44165453 {
44175454 // paste(false);
4418
- CloneClipboard(false); // sept 2014
5455
+ if (clone)
5456
+ {
5457
+ CloneClipboard(false); // sept 2014
5458
+ }
5459
+ else
5460
+ {
5461
+ paste(false);
5462
+ }
44195463 }
44205464 else
44215465 {
44225466 boolean first = true;
44235467
4424
- if (GrafreeD.clipboardIsTempGroup)
5468
+ if (Grafreed.clipboardIsTempGroup)
44255469 {
4426
- Composite temp = (Composite)GrafreeD.clipboard;
5470
+ Composite temp = (Composite)Grafreed.clipboard;
44275471 Object3D copy;
44285472 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44295473 {
....@@ -4433,7 +5477,7 @@
44335477 }
44345478 } else
44355479 {
4436
- linkSomething(GrafreeD.clipboard); //.get(0));
5480
+ linkSomething(Grafreed.clipboard); //.get(0));
44375481 }
44385482 }
44395483 }
....@@ -4510,6 +5554,10 @@
45105554
45115555 void group(Object3D csg, boolean grab)
45125556 {
5557
+ if (Globals.REPLACEONMAKE)
5558
+ Save();
5559
+ boolean keep = Globals.REPLACEONMAKE;
5560
+ Globals.REPLACEONMAKE = false;
45135561 if (//false) // why??
45145562 !group.selection.isEmpty())
45155563 {
....@@ -4623,10 +5671,15 @@
46235671 //node.add(csg);
46245672 //makeSomething(node);
46255673 makeSomething(csg);
5674
+ Globals.REPLACEONMAKE = keep;
46265675 }
46275676
46285677 void Ungroup(Object3D g)
46295678 {
5679
+ if (Globals.REPLACEONMAKE)
5680
+ Save();
5681
+ boolean keep = Globals.REPLACEONMAKE;
5682
+ Globals.REPLACEONMAKE = false;
46305683 if (g instanceof HiddenObject)
46315684 {
46325685 HiddenObject h = (HiddenObject) g;
....@@ -4643,6 +5696,7 @@
46435696 objEditor.makeSomething(g.get(i), false);
46445697 }
46455698 }
5699
+ Globals.REPLACEONMAKE = keep;
46465700 }
46475701
46485702 void ungroup()
....@@ -4838,21 +5892,6 @@
48385892 }
48395893 */
48405894
4841
- void ImportGFD()
4842
- {
4843
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4844
- browser.show();
4845
- String filename = browser.getFile();
4846
- if (filename != null && filename.length() > 0)
4847
- {
4848
- String fullname = browser.getDirectory() + filename;
4849
-
4850
- //Object3D readobj =
4851
- objEditor.ReadGFD(fullname, objEditor);
4852
- //makeSomething(readobj);
4853
- }
4854
- }
4855
-
48565895 /*
48575896 public void Callback(Object obj)
48585897 {
....@@ -4876,26 +5915,9 @@
48765915 }
48775916 */
48785917
4879
- void ImportVRMLX3D()
4880
- {
4881
- if (GrafreeD.standAlone)
4882
- {
4883
- /**/
4884
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4885
- browser.show();
4886
- String filename = browser.getFile();
4887
- if (filename != null && filename.length() > 0)
4888
- {
4889
- String fullname = browser.getDirectory() + filename;
4890
- LoadVRMLX3D(fullname);
4891
- }
4892
- /**/
4893
- }
4894
- }
4895
-
48965918 String GetFile(String dialogName)
48975919 {
4898
- if (GrafreeD.standAlone)
5920
+ if (Grafreed.standAlone)
48995921 {
49005922 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49015923 browser.show();
....@@ -4959,10 +5981,49 @@
49595981 cButton flashSelectionButton;
49605982 cButton editButton;
49615983 cButton uneditButton;
5984
+ JCheckBox allParamsButton;
49625985 cButton clearpanelButton;
4963
- cButton allParamsButton;
49645986 cButton unselectButton;
49655987
5988
+ cButton restoreCameraButton;
5989
+
5990
+ cButton saveButton;
5991
+ cButton oneStepButton;
5992
+
5993
+ cButton groupButton;
5994
+ cButton ungroupButton;
5995
+ cButton compositeButton;
5996
+ cButton switchButton;
5997
+ cButton loopButton;
5998
+ cButton textureButton;
5999
+
6000
+ cButton skybox1Button;
6001
+ cButton skybox2Button;
6002
+ cButton skybox3Button;
6003
+ cButton skybox4Button;
6004
+ cButton skybox5Button;
6005
+ cButton skybox6Button;
6006
+ cButton skybox7Button;
6007
+
6008
+ cButton skybox11Button;
6009
+ cButton skybox12Button;
6010
+ cButton skybox13Button;
6011
+ cButton skybox14Button;
6012
+ cButton skybox15Button;
6013
+ cButton skybox16Button;
6014
+ cButton skybox17Button;
6015
+
6016
+ cButton gridButton;
6017
+ cButton boxButton;
6018
+ cButton sphereButton;
6019
+ cButton coneButton;
6020
+ cButton torusButton;
6021
+ cButton superButton;
6022
+ cButton kleinButton;
6023
+ cButton particlesButton;
6024
+ cButton overlayButton;
6025
+ cButton lightButton;
6026
+
49666027 cButton screenfitButton;
49676028 cButton screenfitpointButton;
49686029 cButton snapobjectButton;
....@@ -4974,14 +6035,6 @@
49746035
49756036 cButton setsupportButton;
49766037
4977
- cButton twoButton;
4978
- cButton sixButton;
4979
- cButton threeButton;
4980
- cButton sevenButton;
4981
- cButton fourButton; // full panel
4982
- cButton oneButton; // full XYZ
4983
- //cButton currentLayout;
4984
-
49856038 //
49866039 //Composite
49876040 Object3D // to do !!
....@@ -4991,9 +6044,11 @@
49916044 //JTree jTree;
49926045 private MenuItem lookAtItem;
49936046 private MenuItem lookFromItem;
4994
- private MenuItem switchItem;
6047
+ private MenuItem switchViewItem;
49956048 private MenuItem cutItem;
4996
- private MenuItem duplicateItem;
6049
+ private MenuItem undoItem;
6050
+ private MenuItem redoItem;
6051
+ private JMenuItem duplicateItem;
49976052 private MenuItem cloneItem;
49986053 private MenuItem cloneSupportItem;
49996054 private MenuItem overwriteGeoItem;
....@@ -5006,7 +6061,7 @@
50066061 private MenuItem linkverticesItem;
50076062 private MenuItem relinkverticesItem;
50086063 private MenuItem setMasterItem;
5009
- private MenuItem resetMeshItem;
6064
+ private MenuItem resetAllItem;
50106065 private MenuItem stepAllItem;
50116066 private MenuItem revertMeshItem;
50126067 private MenuItem poseMeshItem;
....@@ -5017,10 +6072,11 @@
50176072 private MenuItem mergeGeometriesItem;
50186073 private MenuItem copyItem;
50196074 private MenuItem pasteItem;
6075
+ private MenuItem pasteIntoItem;
50206076 private MenuItem pasteLinkItem;
50216077 private MenuItem pasteCloneItem;
50226078 private MenuItem pasteExpandItem;
5023
- private MenuItem clearItem;
6079
+ private MenuItem deleteItem;
50246080 private MenuItem clearAllItem;
50256081 private MenuItem genUVItem;
50266082 private MenuItem genNormalsMESHItem;
....@@ -5055,6 +6111,10 @@
50556111 private MenuItem showleavesItem;
50566112 private MenuItem markleavesItem;
50576113 private MenuItem unmarkleavesItem;
6114
+ private MenuItem rewindleavesItem;
6115
+ private MenuItem unrewindleavesItem;
6116
+ private MenuItem randomleavesItem;
6117
+ private MenuItem unrandomleavesItem;
50586118
50596119 private MenuItem flipVItem;
50606120 private MenuItem unflipVItem;
....@@ -5066,15 +6126,17 @@
50666126 private MenuItem panoTexturesItem;
50676127
50686128 private MenuItem resetCentroidItem;
5069
- private MenuItem transformgeometryItem;
6129
+ private MenuItem resetCentroidXZItem;
50706130 private MenuItem resetTransformItem;
6131
+ private MenuItem transformGeometryItem;
6132
+ private MenuItem transformChildrenItem;
50716133 private MenuItem hideItem;
50726134 private MenuItem grabItem;
50736135 private MenuItem backItem;
50746136 private MenuItem frontItem;
50756137 private MenuItem cameraItem;
50766138 private MenuItem compositeItem;
5077
- private MenuItem randomItem;
6139
+ private MenuItem switchItem;
50786140 private MenuItem physicsItem;
50796141 private MenuItem frameselectorItem;
50806142 private MenuItem scriptNodeItem;
....@@ -5098,6 +6160,8 @@
50986160 private MenuItem attachBumpItem;
50996161 private MenuItem detachBumpItem;
51006162 private MenuItem pigmentBumpItem;
6163
+ private MenuItem embedTexturesItem;
6164
+ private MenuItem deEmbedTexturesItem;
51016165
51026166 private MenuItem particleItem;
51036167 private MenuItem ragdollItem;
....@@ -5114,7 +6178,7 @@
51146178 private MenuItem blobItem;
51156179 private MenuItem latheItem;
51166180 private MenuItem bezierItem;
5117
- private MenuItem checkerItem;
6181
+ private MenuItem overlayItem;
51186182 private MenuItem meshItem;
51196183 // private MenuItem meshGroupItem;
51206184 private MenuItem springItem;
....@@ -5136,11 +6200,6 @@
51366200 private MenuItem doubleItem;
51376201 private MenuItem tripleItem;
51386202
5139
- private MenuItem importGFDItem;
5140
- private MenuItem importVRMLX3DItem;
5141
- private MenuItem import3DSItem;
5142
- private MenuItem importOBJItem;
5143
-
51446203 private MenuItem computeAOItem;
51456204 private MenuItem recompileItem;
51466205 private MenuItem editScriptItem;
....@@ -5150,4 +6209,8 @@
51506209 private MenuItem analyzeItem;
51516210 private MenuItem dumpItem;
51526211 //boolean freezemodel = false;
6212
+
6213
+ Menu cameraMenu;
6214
+ MenuItem editCameraItem;
6215
+ MenuItem restoreCameraItem;
51536216 }