Normand Briere
2019-08-01 29d5516687020263d3ae0454ce81879a3a450af0
GroupEditor.java
....@@ -23,6 +23,302 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
+ skyboxButton.setToolTipText(s);
34
+ skyboxButton.addActionListener(new ActionListener()
35
+ {
36
+ @Override
37
+ public void actionPerformed(ActionEvent e)
38
+ {
39
+ ChangeSkybox(path);
40
+ }
41
+ });
42
+ }
43
+
44
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
45
+ {
46
+ cGridBag tab0 = new cGridBag().setVertical(true);
47
+
48
+ tab0.setName("Urban");
49
+ skyboxpanel.add(tab0);
50
+
51
+ cGridBag row0 = new cGridBag();
52
+ cGridBag row1 = new cGridBag();
53
+ cGridBag row2 = new cGridBag();
54
+ cGridBag row3 = new cGridBag();
55
+ cGridBag row4 = new cGridBag();
56
+ cGridBag row5 = new cGridBag();
57
+ cGridBag row6 = new cGridBag();
58
+
59
+ AddSkyboxButton("default", "rgb", row0);
60
+ //AddSkyboxButton("default", "cornell", row0);
61
+ AddSkyboxButton("penguins", "dust", row0);
62
+ AddSkyboxButton("penguins", "tropic", row0);
63
+ AddSkyboxButton("penguins", "yonder", row0);
64
+
65
+ AddSkyboxButton("default", "uffizi", row1);
66
+ AddSkyboxButton("bridge", "Bridge", row1);
67
+ AddSkyboxButton("bridge", "Bridge2", row1);
68
+ AddSkyboxButton("urban", "GamlaStan2", row1);
69
+
70
+ AddSkyboxButton("urban", "Parliament", row2);
71
+ AddSkyboxButton("urban", "Roundabout", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
74
+
75
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
76
+ AddSkyboxButton("urban", "UnionSquare", row3);
77
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
78
+ AddSkyboxButton("park", "BerzeliiPark", row3);
79
+
80
+ AddSkyboxButton("park", "Buddha", row4);
81
+ AddSkyboxButton("park", "CNTower2", row4);
82
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
84
+
85
+ AddSkyboxButton("park", "Park", row5);
86
+ AddSkyboxButton("park", "Pond", row5);
87
+ AddSkyboxButton("park", "Skansen", row5);
88
+ AddSkyboxButton("park", "Skansen2", row5);
89
+
90
+ AddSkyboxButton("park", "Skansen3", row6);
91
+ AddSkyboxButton("park", "Skansen4", row6);
92
+ AddSkyboxButton("park", "Skansen5", row6);
93
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
94
+
95
+ tab0.add(row0);
96
+ tab0.add(row1);
97
+ tab0.add(row2);
98
+ tab0.add(row3);
99
+ tab0.add(row4);
100
+ tab0.add(row5);
101
+ tab0.add(row6);
102
+
103
+ for (int i=5; --i>=0;)
104
+ {
105
+ //oe.toolboxPanel.Return();
106
+ //tab0.add(new cGridBag());
107
+ }
108
+ }
109
+
110
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
111
+ {
112
+ cGridBag tab0 = new cGridBag().setVertical(true);
113
+
114
+ tab0.setName("Nature");
115
+ skyboxpanel.add(tab0);
116
+
117
+ cGridBag row0 = new cGridBag();
118
+ cGridBag row1 = new cGridBag();
119
+ cGridBag row2 = new cGridBag();
120
+ cGridBag row3 = new cGridBag();
121
+ cGridBag row4 = new cGridBag();
122
+ cGridBag row5 = new cGridBag();
123
+ cGridBag row6 = new cGridBag();
124
+
125
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
126
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
127
+ AddSkyboxButton("beach", "PalmTrees", row0);
128
+ AddSkyboxButton("beach", "Tenerife", row0);
129
+
130
+ AddSkyboxButton("beach", "Tenerife2", row1);
131
+ AddSkyboxButton("beach", "Tenerife3", row1);
132
+ AddSkyboxButton("field", "FishPond", row1);
133
+ AddSkyboxButton("field", "Footballfield", row1);
134
+
135
+ AddSkyboxButton("field", "Meadow", row2);
136
+ AddSkyboxButton("field", "Sorsele", row2);
137
+ AddSkyboxButton("field", "Sorsele2", row2);
138
+ AddSkyboxButton("field", "Sorsele3", row2);
139
+
140
+ AddSkyboxButton("forest", "Brudslojan", row3);
141
+ AddSkyboxButton("forest", "Langholmen2", row3);
142
+ AddSkyboxButton("forest", "Plants", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive", row3);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
146
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
147
+ AddSkyboxButton("mountain", "Teide", row4);
148
+ AddSkyboxButton("park", "Tantolunden4", row4);
149
+
150
+ AddSkyboxButton("park", "Stairs", row5);
151
+ AddSkyboxButton("default", "skycube", row6);
152
+ AddSkyboxButton("rocky", "Langholmen", row5);
153
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
154
+
155
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
156
+ AddSkyboxButton("default", "CloudyHills", row6);
157
+ AddSkyboxButton("daz", "Autumn", row6);
158
+ AddSkyboxButton("daz", "MountainTrail", row6);
159
+ /*
160
+Autumn
161
+Greenlands
162
+MountainTrail
163
+Oasis
164
+TheRock
165
+TopOfTheWorld
166
+Winter
167
+ */
168
+
169
+ tab0.add(row0);
170
+ tab0.add(row1);
171
+ tab0.add(row2);
172
+ tab0.add(row3);
173
+ tab0.add(row4);
174
+ tab0.add(row5);
175
+ tab0.add(row6);
176
+
177
+ for (int i=5; --i>=0;)
178
+ {
179
+ //oe.toolboxPanel.Return();
180
+ //tab0.add(new cGridBag());
181
+ }
182
+ }
183
+
184
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
185
+ {
186
+ cGridBag tab0 = new cGridBag().setVertical(true);
187
+
188
+ tab0.setName("Night");
189
+ skyboxpanel.add(tab0);
190
+
191
+ cGridBag row0 = new cGridBag();
192
+ cGridBag row1 = new cGridBag();
193
+ cGridBag row2 = new cGridBag();
194
+ cGridBag row3 = new cGridBag();
195
+ cGridBag row4 = new cGridBag();
196
+ cGridBag row5 = new cGridBag();
197
+ cGridBag row6 = new cGridBag();
198
+
199
+ AddSkyboxButton("night", "NightPath", row0);
200
+ AddSkyboxButton("night", "PondNight", row0);
201
+ AddSkyboxButton("night", "Powerlines", row0);
202
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
203
+
204
+ AddSkyboxButton("urban", "CNTower", row1);
205
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
206
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
207
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
208
+
209
+ AddSkyboxButton("penguins", "kenon_star", row2);
210
+ AddSkyboxButton("persson", "corona", row2);
211
+ AddSkyboxButton("persson", "spaceskybox", row2);
212
+ AddSkyboxButton("indoors", "Vasa", row2);
213
+
214
+ AddSkyboxButton("winter", "Backyard", row3);
215
+ AddSkyboxButton("winter", "Creek", row3);
216
+ AddSkyboxButton("winter", "FootballField3", row3);
217
+ AddSkyboxButton("winter", "Forest", row3);
218
+
219
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
220
+ AddSkyboxButton("winter", "House", row4);
221
+ AddSkyboxButton("winter", "IceLake", row4);
222
+ AddSkyboxButton("winter", "IceRiver", row4);
223
+
224
+ AddSkyboxButton("winter", "Park3", row5);
225
+ AddSkyboxButton("winter", "PondWinter", row5);
226
+ AddSkyboxButton("winter", "Tantolunden5", row5);
227
+ AddSkyboxButton("winter", "Vindelalven", row5);
228
+
229
+ AddSkyboxButton("daz", "TheRock", row6);
230
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
231
+ AddSkyboxButton("daz", "Winter", row6);
232
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
233
+
234
+ tab0.add(row0);
235
+ tab0.add(row1);
236
+ tab0.add(row2);
237
+ tab0.add(row3);
238
+ tab0.add(row4);
239
+ tab0.add(row5);
240
+ tab0.add(row6);
241
+
242
+ for (int i=5; --i>=0;)
243
+ {
244
+ //oe.toolboxPanel.Return();
245
+ //tab0.add(new cGridBag());
246
+ }
247
+ }
248
+
249
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
250
+ {
251
+ cGridBag tab0 = new cGridBag().setVertical(true);
252
+
253
+ tab0.setName("Others");
254
+ skyboxpanel.add(tab0);
255
+
256
+ cGridBag row0 = new cGridBag();
257
+ cGridBag row1 = new cGridBag();
258
+ cGridBag row2 = new cGridBag();
259
+ cGridBag row3 = new cGridBag();
260
+ cGridBag row4 = new cGridBag();
261
+ cGridBag row5 = new cGridBag();
262
+ cGridBag row6 = new cGridBag();
263
+
264
+ AddSkyboxButton("mayhem", "afterrain", row0);
265
+ AddSkyboxButton("mayhem", "aqua4", row0);
266
+ AddSkyboxButton("mayhem", "aqua9", row0);
267
+ AddSkyboxButton("mayhem", "flame", row0);
268
+
269
+ AddSkyboxButton("mayhem", "h2s", row1);
270
+ AddSkyboxButton("mayhem", "prehistoric", row1);
271
+ AddSkyboxButton("mayhem", "scorched", row1);
272
+ AddSkyboxButton("penguins", "desertdawn", row1);
273
+
274
+ AddSkyboxButton("persson", "Citadella", row2);
275
+ AddSkyboxButton("persson", "Citadella2", row2);
276
+ AddSkyboxButton("persson", "clouds1", row2);
277
+ AddSkyboxButton("penguins", "wrath", row2);
278
+
279
+ AddSkyboxButton("persson", "FishermansBastion", row3);
280
+ AddSkyboxButton("persson", "HeroesSquare", row3);
281
+ AddSkyboxButton("indoors", "DallasW", row3);
282
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
283
+
284
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
285
+ AddSkyboxButton("persson", "PereaBeach1", row4);
286
+ AddSkyboxButton("persson", "PereaBeach2", row4);
287
+ AddSkyboxButton("persson", "redeclipse", row4);
288
+
289
+ AddSkyboxButton("daz", "Greenlands", row5);
290
+ AddSkyboxButton("daz", "Oasis", row5);
291
+ AddSkyboxButton("elyvisions", "arch3", row5);
292
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
293
+
294
+ AddSkyboxButton("elyvisions", "rainbow", row6);
295
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
296
+ AddSkyboxButton("elyvisions", "heaven", row6);
297
+ AddSkyboxButton("elyvisions", "hot", row6);
298
+
299
+ tab0.add(row0);
300
+ tab0.add(row1);
301
+ tab0.add(row2);
302
+ tab0.add(row3);
303
+ tab0.add(row4);
304
+ tab0.add(row5);
305
+ tab0.add(row6);
306
+
307
+ for (int i=5; --i>=0;)
308
+ {
309
+ //oe.toolboxPanel.Return();
310
+ //tab0.add(new cGridBag());
311
+ }
312
+ }
313
+
314
+ public void ChangeSkybox(String name)
315
+ {
316
+ //cameraView.envyoff = false;
317
+ group.skyboxname = name;
318
+ group.skyboxext = "jpg";
319
+ cameraView.repaint();
320
+ }
321
+
26322 //ObjEditor objEditor;
27323 public void closeUI2()
28324 {
....@@ -60,6 +356,12 @@
60356 this.copy = this.group = group;
61357 //selectees = this.group.selectees;
62358
359
+ if (copy.versions == null)
360
+ {
361
+ copy.versions = new byte[100][];
362
+ copy.versionindex = -1;
363
+ }
364
+
63365 if(ui)
64366 SetupUI(objEditor);
65367 }
....@@ -74,16 +376,28 @@
74376 this.copy = this.group = copy;
75377 //selectees = this.group.selectees;
76378
77
- SetupMenu2(objEditor);
379
+ SetupMenu2(this); //objEditor);
78380 SetupUI2(objEditor);
79381 objEditor.SetupUI(true);
80382 SetupViews(objEditor);
81383
82384 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
385
+
386
+ if (copy.versions == null)
387
+ {
388
+ copy.versions = new byte[100][];
389
+ copy.versionindex = -1;
390
+
391
+ Save(true);
392
+ }
83393 }
84394
85395 void CloneSelection(boolean supports)
86396 {
397
+ if (Globals.REPLACEONMAKE)
398
+ Save();
399
+ boolean keep = Globals.REPLACEONMAKE;
400
+ Globals.REPLACEONMAKE = false;
87401 // Object3D keep = GrafreeD.clipboard;
88402 //Object3D obj;
89403 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,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,96 +902,238 @@
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(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
444
- fastCB.setToolTipText("Fast mode");
445
- fastCB.addItemListener(this);
446
-
447
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
448
- trackCB.setToolTipText("Enable tracking");
449
- trackCB.addItemListener(this);
450
-
451
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
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);
452927 screenfitButton.setToolTipText("Screen fit");
453928 screenfitButton.addActionListener(this);
454929
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
+
455979 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
456980 // screenfitpointButton.addActionListener(this);
457
-// oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
459
- snapobjectButton.addActionListener(this);
460
- snapobjectButton.setToolTipText("Snap Object");
461
- oe.aConstraints.gridx += 1;
462981
463
- //aConstraints.gridx = 0;
464
- //aConstraints.gridy += 1;
465
- oe.aConstraints.weighty = 0;
466
- oe.aConstraints.gridwidth = 1;
467
-
468
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
469
- flashSelectionButton.setToolTipText("Show selection");
470
- flashSelectionButton.addActionListener(this);
471
-
472
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
473
-
474
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
475
- twoButton.setToolTipText("Show center view only");
476
- twoButton.addActionListener(this);
477
- 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);
478989 fourButton.addActionListener(this);
479
- fourButton.setToolTipText("Show left panel only");
480
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
481
- sixButton.setToolTipText("2-column layout left");
482
- sixButton.addActionListener(this);
483
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
484
- 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");
4851002 threeButton.addActionListener(this);
486
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
487
- sevenButton.setToolTipText("3-column layout");
488
- 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);
4891009 //
4901010
491
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
492
- rootButton.setToolTipText("Edit selection in new tab");
1011
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1012
+ rootButton.setToolTipText("Open selection in new tab");
4931013 rootButton.addActionListener(this);
4941014
495
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1015
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
4961016 closeButton.setToolTipText("Close tab");
4971017 closeButton.addActionListener(this);
4981018 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
4991019 //clearButton.addActionListener(this);
500
-
501
- cGridBag commandsPanel = new cGridBag();
1020
+
1021
+ cGridBag row1 = new cGridBag();
5021022
503
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
504
- editButton.setToolTipText("Edit selection");
1023
+ // INSERT
1024
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
+ gridButton.setToolTipText("Create grid");
1026
+ gridButton.addActionListener(this);
1027
+
1028
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ boxButton.setToolTipText("Create box");
1030
+ boxButton.addActionListener(this);
1031
+
1032
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+ sphereButton.setToolTipText("Create sphere");
1034
+ sphereButton.addActionListener(this);
1035
+
1036
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ coneButton.setToolTipText("Create cone");
1038
+ coneButton.addActionListener(this);
1039
+
1040
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ torusButton.setToolTipText("Create torus");
1042
+ torusButton.addActionListener(this);
1043
+
1044
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ superButton.setToolTipText("Create superellipsoid");
1046
+ superButton.addActionListener(this);
1047
+
1048
+ if (Globals.ADVANCED)
1049
+ {
1050
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1051
+ kleinButton.setToolTipText("Create Klein bottle");
1052
+ kleinButton.addActionListener(this);
1053
+ }
1054
+
1055
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ particlesButton.setToolTipText("Create particle system");
1057
+ particlesButton.addActionListener(this);
1058
+
1059
+ oe.toolboxPanel.add(row1);
1060
+
1061
+ cGridBag row2 = new cGridBag();
1062
+
1063
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1064
+ groupButton.setToolTipText("Create group");
1065
+ groupButton.addActionListener(this);
1066
+
1067
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ compositeButton.setToolTipText("Create composite");
1069
+ compositeButton.addActionListener(this);
1070
+
1071
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ switchButton.setToolTipText("Create item switcher");
1073
+ switchButton.addActionListener(this);
1074
+
1075
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ loopButton.setToolTipText("Create loop");
1077
+ loopButton.addActionListener(this);
1078
+
1079
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1080
+ textureButton.setToolTipText("Create texture");
1081
+ textureButton.addActionListener(this);
1082
+
1083
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ overlayButton.setToolTipText("Create overlay");
1085
+ overlayButton.addActionListener(this);
1086
+
1087
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ lightButton.setToolTipText("Create light");
1089
+ lightButton.addActionListener(this);
1090
+
1091
+ oe.toolboxPanel.add(row2);
1092
+
1093
+ // ENVYMAPS
1094
+ cGridBag skyboxpane = new cGridBag();
1095
+ skyboxpane.preferredHeight = 100;
1096
+
1097
+ oe.toolboxPanel.add(skyboxpane);
1098
+
1099
+ JTabbedPane skyboxpanel = new JTabbedPane();
1100
+ skyboxpane.add(skyboxpanel);
1101
+
1102
+ AddSkyboxTab0(skyboxpanel);
1103
+ AddSkyboxTab1(skyboxpanel);
1104
+ AddSkyboxTab2(skyboxpanel);
1105
+ AddSkyboxTab3(skyboxpanel);
1106
+
1107
+ // EDIT panel
1108
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ editButton.setToolTipText("Pin selection controls");
5051110 editButton.addActionListener(this);
5061111
507
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
508
- uneditButton.setToolTipText("Unedit selection");
1112
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ uneditButton.setToolTipText("Remove selection controls");
5091114 uneditButton.addActionListener(this);
5101115
511
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1116
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1117
+ allParamsButton.setToolTipText("Show all controle");
1118
+ allParamsButton.addActionListener(this);
1119
+
1120
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5121121 clearPanelButton.setToolTipText("Clear edit panel");
5131122 clearPanelButton.addActionListener(this);
5141123
515
- commandsPanel.add(allParamsButton = new cButton("A", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
516
- allParamsButton.setToolTipText("All params??");
517
- allParamsButton.addActionListener(this);
518
-
519
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1124
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5201125 unselectButton.setToolTipText("Unselect");
5211126 unselectButton.addActionListener(this);
5221127
523
- commandsPanel.preferredHeight = 1;
1128
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ flashSelectionButton.setToolTipText("Highlight selection");
1130
+ flashSelectionButton.addActionListener(this);
5241131
525
- oe.treePanel.add(commandsPanel);
526
- oe.treePanel.Return();
1132
+ editCommandsPanel.preferredHeight = 1;
1133
+
1134
+ SetPinStates(false);
1135
+// oe.treePanel.add(commandsPanel);
1136
+// oe.treePanel.Return();
5271137
5281138 // oe.aConstraints.gridx += 1;
5291139 // oe.aConstraints.weighty = 0;
....@@ -540,32 +1150,20 @@
5401150
5411151 JScrollPane jSP;
5421152 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
543
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1153
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5441154 ResetModel();
5451155
5461156 oe.treePanel.add(jSPPanel);
5471157 oe.treePanel.Return();
5481158
549
- cGridBag copyOptionsPanel = new cGridBag();
550
-
551
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
552
- colorCB.setToolTipText("Copy color when dropped");
553
- colorCB.addItemListener(this);
554
-
555
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
556
- materialCB.setToolTipText("Copy material when dropped");
557
- materialCB.addItemListener(this);
558
-
559
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
560
- textureCB.setToolTipText("Copy texture when dropped");
561
- textureCB.addItemListener(this);
562
-
563
- copyOptionsPanel.preferredHeight = 1;
5641159 oe.treePanel.add(copyOptionsPanel);
5651160 oe.treePanel.Return();
1161
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1162
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1163
+ sliderPane.preferredHeight = 1;
5661164
567
-// mainPanel.setDividerLocation(0.5); //1.0);
568
-// mainPanel.setResizeWeight(0.5);
1165
+// mainPanel.setDividerLocation(0.1); //1.0);
1166
+ mainPanel.setResizeWeight(0.4);
5691167
5701168 //jList.addListSelectionListener(this);
5711169 oe.jTree.addTreeSelectionListener(this);
....@@ -573,7 +1171,7 @@
5731171 //jTree.setEditable(true);
5741172 oe.jTree.setDragEnabled(true);
5751173 //jTree.setPreferredSize(new Dimension(10,10));
576
- jSP.setPreferredSize(new Dimension(100,200));
1174
+ //jSP.setPreferredSize(new Dimension(100,200));
5771175
5781176 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
5791177
....@@ -585,19 +1183,49 @@
5851183 dgr.addDragGestureListener(this);
5861184 }catch(Exception e) {}
5871185 */
588
- radio.layout = sevenButton;
1186
+ radio.layout = sixButton; // sevenButton;
5891187 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
5901188 }
5911189
5921190 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
5931191 {
594
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
595
- supportCB.setToolTipText("Enabled rigging");
596
- 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);
1195
+
1196
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1197
+ materialCB.setToolTipText("Copy material when dropped");
1198
+ materialCB.addItemListener(this);
1199
+
1200
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1201
+ textureCB.setToolTipText("Copy texture when dropped");
1202
+ textureCB.addItemListener(this);
1203
+
1204
+ panel.Return();
1205
+
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);
5971223
5981224 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
5991225 // localCB.addItemListener(this);
6001226
1227
+ panel.Return();
1228
+
6011229 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6021230 crowdCB.setToolTipText("Used for crowds");
6031231 crowdCB.addItemListener(this);
....@@ -606,22 +1234,19 @@
6061234 smoothCB.setToolTipText("Snapping delay");
6071235 smoothCB.addItemListener(this);
6081236
609
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
610
- slowCB.setToolTipText("Smooth interpolation");
611
- slowCB.addItemListener(this);
1237
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1238
+// slowCB.setToolTipText("Smooth interpolation");
1239
+// slowCB.addItemListener(this);
1240
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1241
+ minshaderCB.setToolTipText("Minimal fast shader");
1242
+ minshaderCB.addItemListener(this);
6121243
613
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
614
- boxCB.setToolTipText("Display bounding boxes");
615
- boxCB.addItemListener(this);
616
-
617
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
618
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
619
- zoomBoxCB.addItemListener(this);
620
-
6211244 // constraints.gridy += 1;
6221245 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6231246 // speakerMocapCB.addItemListener(this);
6241247
1248
+ panel.Return();
1249
+
6251250 if (false)
6261251 {
6271252 // handled in scripts
....@@ -636,40 +1261,85 @@
6361261 //constraints.gridy += 1;
6371262 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6381263 smoothfocusCB.addItemListener(this);
1264
+ panel.Return();
6391265 }
6401266
6411267 //constraints.gridx += 1;
6421268 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6431269 // debugCB.addItemListener(this);
6441270
1271
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1272
+ trackCB.setToolTipText("Enable tracking target");
1273
+ trackCB.addItemListener(this);
1274
+
6451275 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1276
+ oeilCB.setToolTipText("Move camera when tracking");
6461277 oeilCB.addItemListener(this);
6471278
1279
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1280
+ shadowCB.setToolTipText("When live compute shadows");
1281
+ shadowCB.addItemListener(this);
1282
+
1283
+ panel.Return();
1284
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1285
+ toggleTextureCB.setToolTipText("Load textures");
1286
+ toggleTextureCB.addItemListener(this);
1287
+
1288
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1289
+ toggleSwitchCB.setToolTipText("Choose a single item");
1290
+ toggleSwitchCB.addItemListener(this);
1291
+
1292
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1293
+ autokeepCB.setToolTipText("On structure change");
1294
+ autokeepCB.addItemListener(this);
1295
+
1296
+ panel.Return();
1297
+ if (Globals.ADVANCED)
1298
+ {
6481299 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
6491300 lookAtCB.setToolTipText("Look-at target");
6501301 lookAtCB.addItemListener(this);
1302
+ }
1303
+
1304
+ }
6511305
6521306 cGridBag fill = new cGridBag();
653
-
6541307 fill.preferredHeight = 200;
1308
+ cGridBag fill2 = new cGridBag();
1309
+ fill2.preferredHeight = 200;
1310
+ cGridBag fill3 = new cGridBag();
1311
+ fill3.preferredHeight = 200;
6551312
6561313 panel.add(fill);
1314
+ panel.add(fill2);
1315
+ panel.add(fill3);
6571316
6581317 }
6591318
6601319 void EditObject(Object3D obj)
6611320 {
6621321 cRadio radioButton = new cRadio(obj.name);
1322
+
1323
+ // June 2019. Patch to avoid bug with transparency.
1324
+ radioButton.hadMaterial = obj.material != null;
1325
+ if (!radioButton.hadMaterial)
1326
+ {
1327
+ obj.material = new cMaterial();
1328
+ }
1329
+
6631330 radioButton.SetObject(obj);
664
- radioButton.layout = sevenButton;
1331
+ radioButton.layout = sixButton; // sevenButton;
6651332 radioButton.SetCamera(cameraView.renderCamera, false);
6661333 radioButton.addActionListener(this);
6671334 radioPanel.add(radioButton);
6681335 buttonGroup.add(radioButton);
6691336 radioButton.doClick();
6701337 }
1338
+
6711339 void SetupViews(ObjEditor oe)
6721340 {
1341
+ theFrame = this;
1342
+
6731343 oe.SetupViews();
6741344
6751345 System.out.println("SetupViews");
....@@ -678,23 +1348,30 @@
6781348 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6791349 }
6801350
681
- JCheckBox liveCB;
682
- JCheckBox supportCB;
683
- JCheckBox localCB;
684
- JCheckBox crowdCB;
685
- JCheckBox smoothCB;
686
- JCheckBox fastCB;
687
- JCheckBox slowCB;
688
- JCheckBox boxCB;
689
- JCheckBox zoomBoxCB;
690
- JCheckBox trackCB;
691
- JCheckBox smoothfocusCB;
1351
+ cToggleButton liveCB;
1352
+ cCheckBox supportCB;
1353
+ cCheckBox localCB;
1354
+ cCheckBox crowdCB;
1355
+ cCheckBox smoothCB;
1356
+ cCheckBox minshaderCB;
1357
+
1358
+ cToggleButton fastCB;
1359
+ cCheckBox slowCB;
1360
+ cCheckBox boxCB;
1361
+ cCheckBox zoomBoxCB;
1362
+ cCheckBox freezeCB;
1363
+ //cToggleButton trackCB;
1364
+ cCheckBox trackCB;
1365
+ cCheckBox smoothfocusCB;
6921366 // JCheckBox speakerMocapCB;
693
- JCheckBox speakerCameraCB;
694
- JCheckBox speakerFocusCB;
695
- JCheckBox debugCB;
696
- JCheckBox oeilCB;
697
- JCheckBox lookAtCB;
1367
+ cCheckBox speakerCameraCB;
1368
+ cCheckBox speakerFocusCB;
1369
+ cCheckBox debugCB;
1370
+
1371
+ cCheckBox oeilCB;
1372
+ cCheckBox shadowCB;
1373
+ cCheckBox autokeepCB;
1374
+ cCheckBox lookAtCB;
6981375
6991376 // static int COLOR = 1;
7001377 // static int MATERIAL = 2;
....@@ -702,9 +1379,9 @@
7021379
7031380 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7041381
705
- JCheckBox colorCB;
706
- JCheckBox materialCB;
707
- JCheckBox textureCB;
1382
+ cCheckBox colorCB;
1383
+ cCheckBox materialCB;
1384
+ cCheckBox textureCB;
7081385
7091386 public void itemStateChanged(ItemEvent e)
7101387 {
....@@ -732,6 +1409,7 @@
7321409 } else if(e.getSource() == liveCB)
7331410 {
7341411 cameraView.ToggleLive();
1412
+ refreshContents(false);
7351413 }
7361414 else if(e.getSource() == supportCB)
7371415 {
....@@ -747,6 +1425,12 @@
7471425 {
7481426 cameraView.ToggleInertia();
7491427 cameraView.repaint();
1428
+ }
1429
+ else if(e.getSource() == minshaderCB)
1430
+ {
1431
+ Globals.MINSHADER ^= true;
1432
+ cameraView.programInitialized = false;
1433
+ cameraView.repaint();
7501434 }
7511435 else if(e.getSource() == localCB)
7521436 {
....@@ -796,6 +1480,18 @@
7961480 {
7971481 cameraView.ToggleOeil();
7981482 }
1483
+ else if(e.getSource() == shadowCB)
1484
+ {
1485
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1486
+ }
1487
+ else if(e.getSource() == freezeCB)
1488
+ {
1489
+ Globals.FREEZEONMOVE ^= true;
1490
+ }
1491
+ else if(e.getSource() == autokeepCB)
1492
+ {
1493
+ Globals.REPLACEONMAKE ^= true;
1494
+ }
7991495 else if(e.getSource() == lookAtCB)
8001496 {
8011497 cameraView.ToggleLookAt();
....@@ -812,7 +1508,8 @@
8121508
8131509 /**/
8141510 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
815
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1511
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1512
+ TreePath path = objEditor.jTree.getSelectionPath();
8161513 if ((path == null) || (path.getPathCount() <= 1)) {
8171514 // We can't move the root node or an empty selection
8181515 return;
....@@ -875,8 +1572,6 @@
8751572 }
8761573 }
8771574
878
- String string = (String) object;
879
-
8801575 System.out.println("Transfer = " + object + "; drop : " + target);
8811576 // if( object instanceof java.io.File[])
8821577 // {
....@@ -884,7 +1579,11 @@
8841579 // objEditor.DropFile((java.io.File[]) object, true);
8851580 // return;
8861581 // }
887
- if (string.charAt(0) == '/')
1582
+
1583
+ String string = object.toString();
1584
+
1585
+ // File path for Mac and Windows
1586
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8881587 {
8891588 // file(s)
8901589 String[] names = string.split("\n");
....@@ -911,7 +1610,7 @@
9111610
9121611 flashIt = false;
9131612 CameraPane pane = (CameraPane) target;
914
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1613
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9151614 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9161615
9171616 if (group.selection.size() == 1)
....@@ -927,23 +1626,33 @@
9271626
9281627 assert target == objEditor.jTree;
9291628 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1629
+ Object3D destinationLeaf;
9301630 try {
931
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1631
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9321632 } catch (Exception e) {
9331633 System.out.println("destinationPath : " + destinationPath);
9341634 return;
9351635 }
9361636
937
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1637
+ for (int i=group.selection.size(); --i>=0;)
9381638 {
1639
+ Object3D child = (Object3D)group.selection.elementAt(i);
1640
+
1641
+ // Cannot move into itself
1642
+ if (child == destinationLeaf)
1643
+ return;
1644
+ }
1645
+
1646
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1647
+// {
9391648 loadClipboard(true);
9401649 objEditor.jTree.setSelectionPath(destinationPath);
941
- pasteInto(false);
942
- } else {
943
- loadClipboard(false);
944
- objEditor.jTree.setSelectionPath(destinationPath);
945
- pasteInto(false); // true); // ???
946
- }
1650
+ pasteInto(false, false);
1651
+// } else {
1652
+// loadClipboard(false);
1653
+// objEditor.jTree.setSelectionPath(destinationPath);
1654
+// pasteInto(false, false); // true); // ???
1655
+// }
9471656 }
9481657 public void dropActionChanged(DropTargetDragEvent dtde)
9491658 // Called if the user has modified the current drop gesture
....@@ -1048,54 +1757,71 @@
10481757 {
10491758 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10501759 //heightFieldItem.addActionListener(this);
1051
- gridItem = menu.add(new MenuItem("Grid"));
1052
- gridItem.addActionListener(this);
1053
- rectoidItem = menu.add(new MenuItem("Box"));
1054
- rectoidItem.addActionListener(this);
1055
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1056
- ellipsoidItem.addActionListener(this);
1057
- coneItem = menu.add(new MenuItem("Cone"));
1058
- coneItem.addActionListener(this);
1059
- torusItem = menu.add(new MenuItem("Torus"));
1060
- torusItem.addActionListener(this);
1061
- superItem = menu.add(new MenuItem("Superellipsoid"));
1062
- superItem.addActionListener(this);
1760
+// gridItem = menu.add(new MenuItem("Grid"));
1761
+// gridItem.addActionListener(this);
1762
+// rectoidItem = menu.add(new MenuItem("Box"));
1763
+// rectoidItem.addActionListener(this);
1764
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1765
+// ellipsoidItem.addActionListener(this);
1766
+// coneItem = menu.add(new MenuItem("Cone"));
1767
+// coneItem.addActionListener(this);
1768
+// torusItem = menu.add(new MenuItem("Torus"));
1769
+// torusItem.addActionListener(this);
1770
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1771
+// superItem.addActionListener(this);
1772
+
1773
+ cameraItem = menu.add(new MenuItem("Camera"));
1774
+ cameraItem.addActionListener(this);
1775
+
1776
+ if (!Globals.ADVANCED)
1777
+ {
10631778 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10641779 kleinItem.addActionListener(this);
1065
- particleItem = menu.add(new MenuItem("Particle system"));
1066
- particleItem.addActionListener(this);
1780
+ }
1781
+
1782
+// particleItem = menu.add(new MenuItem("Particle system"));
1783
+// particleItem.addActionListener(this);
1784
+ if (Globals.ADVANCED)
1785
+ {
10671786 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10681787 ragdollItem.addActionListener(this);
10691788 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10701789 ragdoll2Item.addActionListener(this);
1790
+ }
10711791 menu.add("-");
1072
- meshItem = menu.add(new MenuItem("Mesh"));
1792
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10731793 meshItem.addActionListener(this);
10741794 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10751795 // meshGroupItem.addActionListener(this);
1796
+ if (Globals.ADVANCED)
1797
+ {
10761798 springItem = menu.add(new MenuItem("Spring"));
10771799 springItem.addActionListener(this);
10781800 flagItem = menu.add(new MenuItem("Flag"));
10791801 flagItem.addActionListener(this);
1080
- bezierItem = menu.add(new MenuItem("Patch"));
1081
- bezierItem.addActionListener(this);
1082
- checkerItem = menu.add(new MenuItem("Checker"));
1083
- checkerItem.addActionListener(this);
10841802 blobItem = menu.add(new MenuItem("Blob"));
10851803 blobItem.addActionListener(this);
10861804 latheItem = menu.add(new MenuItem("Lathe"));
10871805 latheItem.addActionListener(this);
1088
- lightItem = menu.add(new MenuItem("Light"));
1089
- lightItem.addActionListener(this);
1806
+ }
1807
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1808
+ bezierItem.addActionListener(this);
1809
+// overlayItem = menu.add(new MenuItem("Overlay"));
1810
+// overlayItem.addActionListener(this);
1811
+// lightItem = menu.add(new MenuItem("Light"));
1812
+// lightItem.addActionListener(this);
10901813 menu.add("-");
10911814 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10921815 //superLoopItem.addActionListener(this);
1093
- loopItem = menu.add(new MenuItem("Loop"));
1094
- loopItem.addActionListener(this);
1816
+// loopItem = menu.add(new MenuItem("Loop"));
1817
+// loopItem.addActionListener(this);
10951818 doubleItem = menu.add(new MenuItem("Fork"));
10961819 doubleItem.addActionListener(this);
1820
+ if (Globals.ADVANCED)
1821
+ {
10971822 tripleItem = menu.add(new MenuItem("Trident"));
10981823 tripleItem.addActionListener(this);
1824
+ }
10991825 }
11001826
11011827 void buildToolsMenu(Menu menu)
....@@ -1104,29 +1830,34 @@
11041830 animationItem.addItemListener(this);
11051831 animationItem.setState(Globals.ANIMATION);
11061832
1833
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1834
+ archiveItem.addActionListener(this);
1835
+
11071836 menu.add("-");
11081837 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11091838 parseverticesItem.addActionListener(this);
11101839 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11111840 textureFieldItem.addActionListener(this);
1112
- alignItem = menu.add(new MenuItem("Align"));
1841
+ alignItem = menu.add(new MenuItem("Align Objects"));
11131842 alignItem.addActionListener(this);
1114
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1115
- mirrorItem.addActionListener(this);
11161843 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11171844 reduceMorphItem.addActionListener(this);
11181845 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11191846 reduce34MorphItem.addActionListener(this);
1120
-
1121
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1122
- computeAOItem.addActionListener(this);
11231847 menu.add("-");
1124
-
11251848 menu.add(memoryItem = new MenuItem("Memory Usage"));
11261849 memoryItem.addActionListener(this);
1850
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1851
+ computeAOItem.addActionListener(this);
1852
+
1853
+ if (Globals.ADVANCED)
1854
+ {
1855
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1856
+ mirrorItem.addActionListener(this);
1857
+ menu.add("-");
11271858 menu.add(analyzeItem = new MenuItem("Analyze"));
11281859 analyzeItem.addActionListener(this);
1129
- menu.add(dumpItem = new MenuItem("Dump"));
1860
+ menu.add(dumpItem = new MenuItem("Print"));
11301861 dumpItem.addActionListener(this);
11311862 // menu.add(pathItem = new MenuItem("From-to path"));
11321863 // pathItem.addActionListener(this);
....@@ -1144,6 +1875,7 @@
11441875 menu.add("-");
11451876 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11461877 editScriptItem.addActionListener(this);
1878
+ }
11471879 }
11481880
11491881 void ScreenFit()
....@@ -1266,9 +1998,34 @@
12661998 shadow.material = new cMaterial(obj.material);
12671999 shadow.material.diffuse = 0.0001f;
12682000 shadow.material.specular = 0.0001f;
2001
+ //shadow.projectedVertices[1].x = 300;
12692002
12702003 makeSomething(shadow);
12712004 }
2005
+
2006
+ private void ClearUnpinned()
2007
+ {
2008
+ //for (Object3D obj : listUI)
2009
+ for (int i=listUI.size(); --i>=0;)
2010
+ {
2011
+ Object3D obj = listUI.elementAt(i);
2012
+ if (!obj.pinned)
2013
+ {
2014
+ obj.CloseUI();
2015
+ listUI.remove(i);
2016
+ }
2017
+ }
2018
+ }
2019
+
2020
+ private void EditElement(Object3D elem, boolean newWindow)
2021
+ {
2022
+ // if (!(elem instanceof Composite))
2023
+ // newWindow = false;
2024
+ listUI.add(elem);
2025
+ elem.openEditWindow(this, newWindow); //, false);
2026
+ System.out.println("edit : " + elem);
2027
+ elem.editWindow.refreshContents(true); // ? new
2028
+ }
12722029
12732030 /**
12742031 * applyExample
....@@ -1472,9 +2229,9 @@
14722229
14732230 void Overwrite(int mask)
14742231 {
1475
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2232
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14762233 {
1477
- Object3D content = GrafreeD.clipboard.get(0);
2234
+ Object3D content = Grafreed.clipboard.get(0);
14782235
14792236 if (content instanceof cGroup && ((cGroup)content).transientlink )
14802237 content = ((cGroup)content).get(0);
....@@ -1513,7 +2270,7 @@
15132270 {
15142271 ScreenFit();
15152272 } else
1516
- if (source == switchItem)
2273
+ if (source == switchViewItem)
15172274 {
15182275 cVector v1 = new cVector();
15192276 cVector v2 = new cVector();
....@@ -1522,11 +2279,11 @@
15222279 objEditor.cameraView.renderCamera.setAim(v2, v1);
15232280 objEditor.cameraView.repaint();
15242281 } else
1525
- if (source == rectoidItem)
2282
+ if (source == rectoidItem || source == boxButton)
15262283 {
15272284 makeSomething(new Box());
15282285 } else
1529
- if (source == particleItem)
2286
+ if (source == particleItem || source == particlesButton)
15302287 {
15312288 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15322289 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1605,27 +2362,27 @@
16052362
16062363 makeSomething(obj);
16072364 } else
1608
- if (source == gridItem)
2365
+ if (source == gridItem || source == gridButton)
16092366 {
16102367 makeSomething(new Grid());
16112368 } else
1612
- if (source == ellipsoidItem)
2369
+ if (source == ellipsoidItem || source == sphereButton)
16132370 {
16142371 makeSomething(new Sphere());
16152372 } else
1616
- if (source == coneItem)
2373
+ if (source == coneItem || source == coneButton)
16172374 {
16182375 makeSomething(new Cone());
16192376 } else
1620
- if (source == torusItem)
2377
+ if (source == torusItem || source == torusButton)
16212378 {
16222379 makeSomething(new Torus());
16232380 } else
1624
- if (source == superItem)
2381
+ if (source == superItem || source == superButton)
16252382 {
16262383 makeSomething(new Superellipsoid());
16272384 } else
1628
- if (source == kleinItem)
2385
+ if (source == kleinItem || source == kleinButton)
16292386 {
16302387 makeSomething(new Klein());
16312388 } else
....@@ -1645,7 +2402,7 @@
16452402 {
16462403 makeSomething(new BezierSurface());
16472404 } else
1648
- if (source == checkerItem)
2405
+ if (source == overlayItem || source == overlayButton)
16492406 {
16502407 /*
16512408 Object3D obj = new BezierSurface(5,8);
....@@ -1693,10 +2450,27 @@
16932450 s.setup();
16942451 makeSomething(s);
16952452 } else
1696
- if (source == lightItem)
2453
+ if (source == lightItem || source == lightButton)
16972454 {
16982455 makeSomething(new Light());
16992456 } else
2457
+// if (source == skybox1Button ||
2458
+// source == skybox2Button ||
2459
+// source == skybox3Button ||
2460
+// source == skybox4Button ||
2461
+// source == skybox5Button ||
2462
+// source == skybox6Button ||
2463
+// source == skybox7Button ||
2464
+// source == skybox11Button ||
2465
+// source == skybox12Button ||
2466
+// source == skybox13Button ||
2467
+// source == skybox14Button ||
2468
+// source == skybox15Button ||
2469
+// source == skybox16Button ||
2470
+// source == skybox17Button)
2471
+// {
2472
+// ChangeSkybox(source);
2473
+// } else
17002474 if (source == csgItem)
17012475 {
17022476 group(new CSG());
....@@ -1743,30 +2517,30 @@
17432517
17442518 group(g);
17452519 } else
1746
- if (source == loopItem)
2520
+ if (source == loopItem || source == loopButton)
17472521 {
17482522 Composite csg = new GroupLeaf();
17492523 csg.count = 5;
17502524 group(csg);
1751
- Composite child = new cGroup();
2525
+ Composite child = new cGroup("Branch");
17522526 csg.addChild(child);
17532527 child.addChild(csg);
17542528 } else
17552529 if (source == doubleItem)
17562530 {
1757
- Composite csg = new GroupLeaf();
2531
+ Composite csg = new GroupLeaf("Fork");
17582532 csg.count = 5;
17592533 group(csg);
1760
- Composite child = new cGroup();
2534
+ Composite child = new cGroup("Branch A");
17612535 csg.addChild(child);
17622536 child.addChild(csg);
1763
- child = new cGroup();
2537
+ child = new cGroup("Branch B");
17642538 csg.addChild(child);
17652539 child.addChild(csg);
17662540 } else
17672541 if (source == tripleItem)
17682542 {
1769
- Composite csg = new GroupLeaf();
2543
+ Composite csg = new GroupLeaf("Trident");
17702544 csg.count = 4;
17712545 group(csg);
17722546 Composite child = new cGroup();
....@@ -1779,27 +2553,10 @@
17792553 csg.addChild(child);
17802554 child.addChild(csg);
17812555 } else
1782
-
1783
- if (source == importGFDItem)
1784
- {
1785
- ImportGFD();
1786
- } else
1787
- if (source == importVRMLX3DItem)
1788
- {
1789
- ImportVRMLX3D();
1790
- } else
1791
- if (source == import3DSItem)
1792
- {
1793
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1794
- } else
1795
- if (source == importOBJItem)
1796
- {
1797
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1798
- } else
17992556 if (source == computeAOItem)
18002557 {
18012558 Globals.drawMode = CameraPane.OCCLUSION;
1802
- Globals.theRenderer.repaint();
2559
+ cameraView.repaint();
18032560 } else
18042561 if (source == recompileItem)
18052562 {
....@@ -1814,7 +2571,7 @@
18142571 if (source == invariantsItem)
18152572 {
18162573 System.out.println("Invariants:");
1817
- GrafreeD.grafreeD.universe.invariants();
2574
+ Grafreed.grafreeD.universe.invariants();
18182575 } else
18192576 if (source == memoryItem)
18202577 {
....@@ -1833,19 +2590,61 @@
18332590 {
18342591 DumpObject();
18352592 } else
2593
+ if (source == minButton)
2594
+ {
2595
+ Minimize();
2596
+ } else
2597
+ if (source == maxButton)
2598
+ {
2599
+ Maximize();
2600
+ } else
2601
+ if (source == fullButton)
2602
+ {
2603
+ ToggleFullScreen();
2604
+ } else
2605
+ if (source == undoButton)
2606
+ {
2607
+ // Go to previous version
2608
+ //if (!Undo())
2609
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2610
+ Undo();
2611
+ } else
2612
+ if (source == restoreButton)
2613
+ {
2614
+ // Restore current version
2615
+ Restore();
2616
+ } else
2617
+ if (source == replaceButton)
2618
+ {
2619
+ // Overwrite current version
2620
+ Replace();
2621
+ } else
2622
+ if (source == redoButton)
2623
+ {
2624
+ // Go to next version
2625
+ Redo();
2626
+ } else
2627
+ if (source == saveButton)
2628
+ {
2629
+ // Save a new version
2630
+ if (!Save(true))
2631
+ java.awt.Toolkit.getDefaultToolkit().beep();
2632
+ } else
2633
+ if (source == oneStepButton)
2634
+ {
2635
+ Globals.ONESTEP = true;
2636
+ cameraView.repaint();
2637
+ } else
18362638 if (source == screenfitButton)
18372639 {
1838
- //Reload(lastConverter, lastFilename, true);
18392640 ScreenFit();
18402641 } else
18412642 if (source == screenfitpointButton)
18422643 {
1843
- //Reload(lastConverter, lastFilename, true);
18442644 ScreenFitPoint();
18452645 } else
18462646 if (source == snapobjectButton)
18472647 {
1848
- //Reload(lastConverter, lastFilename, true);
18492648 SnapObject();
18502649 } else
18512650 // if (event.getSource() == recompileButton)
....@@ -1882,12 +2681,20 @@
18822681 {
18832682 loadClipboard(true);
18842683 } else
2684
+ if (source == undoItem)
2685
+ {
2686
+ Undo();
2687
+ } else
2688
+ if (source == redoItem)
2689
+ {
2690
+ Redo();
2691
+ } else
18852692 if (source == duplicateItem)
18862693 {
1887
- Object3D keep = GrafreeD.clipboard;
2694
+ Object3D keep = Grafreed.clipboard;
18882695 loadClipboard(false);
18892696 paste(false);
1890
- GrafreeD.clipboard = keep;
2697
+ Grafreed.clipboard = keep;
18912698 } else
18922699 if (source == cloneItem)
18932700 {
....@@ -1905,13 +2712,17 @@
19052712 {
19062713 paste(false);
19072714 } else
2715
+ if (source == pasteIntoItem)
2716
+ {
2717
+ pasteInto(true, false);
2718
+ } else
19082719 if (source == pasteLinkItem)
19092720 {
1910
- pasteInto(false);
2721
+ pasteInto(false, false);
19112722 } else
19122723 if (source == pasteCloneItem)
19132724 {
1914
- pasteInto(true);
2725
+ pasteInto(true, true);
19152726 } else
19162727 if (source == pasteExpandItem)
19172728 {
....@@ -2103,9 +2914,9 @@
21032914 // group.selection.get(0).setMasterThis(content); // should be identity
21042915 // refreshContents();
21052916 // }
2106
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2917
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21072918 {
2108
- Object3D content = GrafreeD.clipboard.get(0);
2919
+ Object3D content = Grafreed.clipboard.get(0);
21092920
21102921 if (content instanceof cGroup && ((cGroup)content).transientlink )
21112922 content = ((cGroup)content).get(0);
....@@ -2113,11 +2924,11 @@
21132924 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21142925 for (int i=0; i<group.selection.size(); i++)
21152926 {
2116
- boolean random = CameraPane.RANDOM;
2117
- CameraPane.RANDOM = false; // parse all random nodes
2927
+ boolean random = CameraPane.SWITCH;
2928
+ CameraPane.SWITCH = false; // parse all random nodes
21182929 group.selection.get(i).linkVerticesThis(content);
21192930 // group.selection.get(i).setMasterThis(content); // should be identity
2120
- CameraPane.RANDOM = random;
2931
+ CameraPane.SWITCH = random;
21212932 }
21222933 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21232934 refreshContents();
....@@ -2127,20 +2938,20 @@
21272938 {
21282939 for (int i=0; i<group.selection.size(); i++)
21292940 {
2130
- boolean random = CameraPane.RANDOM;
2131
- CameraPane.RANDOM = false; // parse all random nodes
2941
+ boolean random = CameraPane.SWITCH;
2942
+ CameraPane.SWITCH = false; // parse all random nodes
21322943 group.selection.get(i).linkVerticesThis(null);
2133
- CameraPane.RANDOM = random;
2944
+ CameraPane.SWITCH = random;
21342945 }
21352946
21362947 refreshContents();
21372948 } else
21382949 if (source == relinkverticesItem)
21392950 {
2140
- boolean random = CameraPane.RANDOM;
2141
- CameraPane.RANDOM = false; // parse all random nodes
2951
+ boolean random = CameraPane.SWITCH;
2952
+ CameraPane.SWITCH = false; // parse all random nodes
21422953 group.selection.RelinkToSupport();
2143
- CameraPane.RANDOM = random;
2954
+ CameraPane.SWITCH = random;
21442955
21452956 refreshContents();
21462957 } else
....@@ -2155,9 +2966,9 @@
21552966 } else
21562967 if (source == setMasterItem)
21572968 {
2158
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2969
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21592970 {
2160
- Object3D content = GrafreeD.clipboard.get(0);
2971
+ Object3D content = Grafreed.clipboard.get(0);
21612972
21622973 if (content instanceof cGroup && ((cGroup)content).transientlink )
21632974 content = ((cGroup)content).get(0);
....@@ -2170,9 +2981,9 @@
21702981 {
21712982 if (group.selection.size() == 1)
21722983 {
2173
- if (GrafreeD.clipboard.size() == 1)
2984
+ if (Grafreed.clipboard.size() == 1)
21742985 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2986
+ Object3D content = Grafreed.clipboard.get(0);
21762987
21772988 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782989 content = ((cGroup)content).get(0);
....@@ -2189,7 +3000,7 @@
21893000 {
21903001 RevertMeshes();
21913002 } else
2192
- if (source == resetMeshItem)
3003
+ if (source == resetAllItem)
21933004 {
21943005 ResetAll();
21953006 } else
....@@ -2197,7 +3008,7 @@
21973008 {
21983009 StepAll();
21993010 } else
2200
- if (source == clearItem) // || event.getSource() == clearButton)
3011
+ if (source == deleteItem) // || event.getSource() == clearButton)
22013012 {
22023013 //int indices[] = jList.getSelectedIndices();
22033014 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2209,9 +3020,9 @@
22093020 {
22103021 ClearSelection(true);
22113022 } else
2212
- if (source == grabItem)
3023
+ if (source == grabItem || source == groupButton)
22133024 {
2214
- group(new cGroup(), true);
3025
+ group(new cGroup(), false); // true);
22153026 } else
22163027 if (source == hideItem)
22173028 {
....@@ -2229,16 +3040,16 @@
22293040 {
22303041 makeSomething(new Camera());
22313042 } else
2232
- if (source == compositeItem)
3043
+ if (source == compositeItem || source == compositeButton)
22333044 {
22343045 group(new Composite());
22353046 } else
2236
- if (source == randomItem)
3047
+ if (source == switchItem || source == switchButton)
22373048 {
22383049 RandomNode random = new RandomNode();
22393050 group(random);
22403051 if (random.size() > 0)
2241
- random.name = random.get(0).name + "Rnd";
3052
+ random.name = random.get(0).name + "Switch";
22423053 } else
22433054 if (source == physicsItem)
22443055 {
....@@ -2335,7 +3146,7 @@
23353146 {
23363147 group(new cLinker());
23373148 } else
2338
- if (source == textureItem)
3149
+ if (source == textureItem || source == textureButton)
23393150 {
23403151 group(new TextureNode());
23413152 } else
....@@ -2355,17 +3166,30 @@
23553166 {
23563167 CastShadow(2);
23573168 } else
2358
- if (source == ungroupItem)
3169
+ if (source == ungroupItem || source == ungroupButton)
23593170 {
2360
- //ungroup();
3171
+ boolean hasRoot = false;
3172
+
23613173 for (int i=0; i<group.selection.size(); i++)
23623174 {
2363
- Ungroup(group.selection.get(i));
3175
+ if (group.selection.get(i) == group)
3176
+ {
3177
+ hasRoot = true;
3178
+ break;
3179
+ }
23643180 }
23653181
2366
- ClearSelection(false);
2367
-
2368
- refreshContents();
3182
+ if (!hasRoot)
3183
+ {
3184
+ for (int i=0; i<group.selection.size(); i++)
3185
+ {
3186
+ Ungroup(group.selection.get(i));
3187
+ }
3188
+
3189
+ ClearSelection(false);
3190
+
3191
+ refreshContents();
3192
+ }
23693193 } else
23703194 if (source == genUVItem)
23713195 {
....@@ -2377,7 +3201,7 @@
23773201 } else
23783202 if (source == genNormalsMESHItem)
23793203 {
2380
- GenNormals(true); // TODO
3204
+ GenNormalsMESH();
23813205 } else
23823206 if (source == genNormalsORGANItem)
23833207 {
....@@ -2442,6 +3266,22 @@
24423266 if (source == unmarkleavesItem)
24433267 {
24443268 MarkLeaves(false);
3269
+ } else
3270
+ if (source == rewindleavesItem)
3271
+ {
3272
+ RewindLeaves(true);
3273
+ } else
3274
+ if (source == unrewindleavesItem)
3275
+ {
3276
+ RewindLeaves(false);
3277
+ } else
3278
+ if (source == randomleavesItem)
3279
+ {
3280
+ RandomLeaves(true);
3281
+ } else
3282
+ if (source == unrandomleavesItem)
3283
+ {
3284
+ RandomLeaves(false);
24453285 } else
24463286 if (source == flipVItem)
24473287 {
....@@ -2527,9 +3367,13 @@
25273367 {
25283368 SmoothMesh();
25293369 } else
2530
- if (source == transformgeometryItem)
3370
+ if (source == transformGeometryItem)
25313371 {
25323372 TransformGeometry();
3373
+ } else
3374
+ if (source == transformChildrenItem)
3375
+ {
3376
+ TransformChildren();
25333377 } else
25343378 if (source == resetTransformItem)
25353379 {
....@@ -2537,7 +3381,11 @@
25373381 } else
25383382 if (source == resetCentroidItem)
25393383 {
2540
- ResetCentroid();
3384
+ ResetCentroid(true);
3385
+ } else
3386
+ if (source == resetCentroidXZItem)
3387
+ {
3388
+ ResetCentroid(false);
25413389 } else
25423390 if (source == resetParentItem)
25433391 {
....@@ -2642,7 +3490,7 @@
26423490 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26433491 {
26443492 obj = (Object3D)e.nextElement();
2645
- obj.SetBumpTexture(null);
3493
+ obj.ResetBumpTexture();
26463494 }
26473495
26483496 refreshContents();
....@@ -2658,6 +3506,31 @@
26583506
26593507 refreshContents();
26603508 } else
3509
+ if (source == embedTexturesItem)
3510
+ {
3511
+ Object3D obj;
3512
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3513
+ {
3514
+ obj = (Object3D)e.nextElement();
3515
+ obj.EmbedTextures(true);
3516
+ }
3517
+
3518
+ refreshContents();
3519
+ } else
3520
+ if (source == deEmbedTexturesItem)
3521
+ {
3522
+ Object3D obj;
3523
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3524
+ {
3525
+ obj = (Object3D)e.nextElement();
3526
+ obj.EmbedTextures(false);
3527
+ }
3528
+
3529
+ CameraPane.texturepigment.clear();
3530
+ CameraPane.texturebump.clear();
3531
+
3532
+ refreshContents();
3533
+ } else
26613534 if (source == flashSelectionButton)
26623535 {
26633536 CameraPane.flash = true;
....@@ -2669,6 +3542,10 @@
26693542 if (source == twoButton)
26703543 {
26713544 radio.layout = twoButton;
3545
+
3546
+ if (CameraPane.FULLSCREEN)
3547
+ fullscreenLayout = radio.layout;
3548
+
26723549 // bug
26733550 //gridPanel.setDividerLocation(1.0);
26743551 //bigPanel.setDividerLocation(0.0);
....@@ -2701,10 +3578,31 @@
27013578 bigThree.ClearUI();
27023579 bigThree.add(centralPanel);
27033580 bigThree.FlushUI();
3581
+
3582
+ cameraView.requestFocusInWindow();
3583
+
3584
+// refreshContents(true);
3585
+//
3586
+// try
3587
+// {
3588
+// java.awt.Robot bot = new java.awt.Robot();
3589
+// int mask = InputEvent.BUTTON1_MASK;
3590
+// bot.mouseMove(100, 100);
3591
+// bot.mousePress(mask);
3592
+// bot.mouseRelease(mask);
3593
+// }
3594
+// catch (Exception e)
3595
+// {
3596
+//
3597
+// }
3598
+
27043599 } else
27053600 if (source == threeButton)
27063601 {
27073602 radio.layout = threeButton;
3603
+
3604
+ if (CameraPane.FULLSCREEN)
3605
+ fullscreenLayout = radio.layout;
27083606
27093607 // bigThree.remove(scenePanel);
27103608 // bigThree.remove(centralPanel);
....@@ -2734,13 +3632,18 @@
27343632 // centralPanel.setVisible(true);
27353633 // XYZPanel.setVisible(true);
27363634 bigThree.ClearUI();
3635
+ bigThree.add(scenePanel);
27373636 bigThree.add(centralPanel);
2738
- bigThree.add(XYZPanel);
27393637 bigThree.FlushUI();
3638
+
3639
+ cameraView.requestFocusInWindow();
27403640 } else
27413641 if (source == fourButton)
27423642 {
27433643 radio.layout = fourButton;
3644
+
3645
+ if (CameraPane.FULLSCREEN)
3646
+ fullscreenLayout = radio.layout;
27443647
27453648 // bigThree.remove(scenePanel);
27463649 // bigThree.remove(centralPanel);
....@@ -2772,10 +3675,15 @@
27723675 bigThree.ClearUI();
27733676 bigThree.add(scenePanel);
27743677 bigThree.FlushUI();
3678
+
3679
+ cameraView.requestFocusInWindow();
27753680 } else
27763681 if (source == sixButton)
27773682 {
27783683 radio.layout = sixButton;
3684
+
3685
+ if (CameraPane.FULLSCREEN)
3686
+ fullscreenLayout = radio.layout;
27793687
27803688 // bigThree.remove(scenePanel);
27813689 // bigThree.remove(centralPanel);
....@@ -2805,13 +3713,18 @@
28053713 // centralPanel.setVisible(true);
28063714 // XYZPanel.setVisible(false);
28073715 bigThree.ClearUI();
2808
- bigThree.add(scenePanel);
28093716 bigThree.add(centralPanel);
3717
+ bigThree.add(scenePanel);
28103718 bigThree.FlushUI();
3719
+
3720
+ cameraView.requestFocusInWindow();
28113721 } else
28123722 if (source == sevenButton)
28133723 {
28143724 radio.layout = sevenButton;
3725
+
3726
+ if (CameraPane.FULLSCREEN)
3727
+ fullscreenLayout = radio.layout;
28153728
28163729 // bigThree.remove(scenePanel);
28173730 // bigThree.remove(centralPanel);
....@@ -2845,6 +3758,8 @@
28453758 bigThree.add(centralPanel);
28463759 bigThree.add(XYZPanel);
28473760 bigThree.FlushUI();
3761
+
3762
+ cameraView.requestFocusInWindow();
28483763 } else
28493764 if (source == rootButton)
28503765 {
....@@ -2856,6 +3771,7 @@
28563771 EditObject(obj);
28573772 }
28583773
3774
+ cameraView.requestFocusInWindow();
28593775 refreshContents(true);
28603776 } else
28613777 if (source == closeButton)
....@@ -2865,22 +3781,37 @@
28653781 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28663782 {
28673783 ab = (cRadio)e.nextElement();
2868
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3784
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28693785 {
3786
+ // Patch to avoid bug with transparency.
3787
+ if (!ab.hadMaterial)
3788
+ {
3789
+ ab.object.material = null;
3790
+ }
3791
+
28703792 buttonGroup.remove(ab);
28713793 radioPanel.remove(ab);
28723794
2873
- ab.GetObject().editWindow = null;
3795
+ //ab.GetObject().editWindow = null;
3796
+ ab.GetObject().manipWindow = null;
28743797 // ab.GetObject().objectUI = null; // ?????????
28753798
28763799 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28773800 break;
28783801 }
28793802 }
3803
+
3804
+ cameraView.requestFocusInWindow();
28803805 refreshContents(true);
28813806 } else
28823807 if (source == editItem || source == editButton)
28833808 {
3809
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3810
+ {
3811
+ Object3D child = (Object3D)e.nextElement();
3812
+ child.pinned = true;
3813
+ }
3814
+
28843815 EditSelection(false);
28853816 } else
28863817 if (source == uneditButton)
....@@ -2890,12 +3821,13 @@
28903821 Object3D child = (Object3D)e.nextElement();
28913822 if(child.editWindow != null)
28923823 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3824
+ child.pinned = false;
28933825 child.CloseUI();
28943826 listUI.remove(child);
28953827
2896
- child.editWindow = null; // ???????????
3828
+ //child.editWindow = null; // ???????????
28973829 }
2898
- objEditor.ctrlPanel.validate();
3830
+ objEditor.ctrlPanel.FlushUI();
28993831 //objEditor.jTree.clearSelection();
29003832 //objEditor.ResetSliders();
29013833 refreshContents(true);
....@@ -2906,6 +3838,7 @@
29063838 //copy.ClearUI();
29073839 for (Object3D obj : listUI)
29083840 {
3841
+ obj.pinned = false;
29093842 obj.CloseUI();
29103843 }
29113844 listUI.clear();
....@@ -2915,7 +3848,7 @@
29153848 {
29163849 assert(copy == group);
29173850
2918
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3851
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29193852
29203853 for (Object3D obj : listUI)
29213854 {
....@@ -2964,6 +3897,9 @@
29643897 }
29653898
29663899 copy = group;
3900
+
3901
+ SetUndoStates();
3902
+
29673903 //Globals.theRenderer.object = group;
29683904 if(!useclient)
29693905 {
....@@ -2979,20 +3915,46 @@
29793915 frontView.object = group;
29803916 sideView.object = group;
29813917 }
2982
- group.editWindow = this;
3918
+
3919
+// fix "+" issue
3920
+ //group.editWindow = this;
3921
+ group.manipWindow = this;
3922
+
29833923 /*
29843924 currentLayout = radio.layout;
29853925 if (currentLayout == null)
29863926 currentLayout = sevenButton;
29873927 */
29883928 radio.layout.doClick();
3929
+
3930
+ ClearUnpinned();
3931
+ //Grafreed.Assert(group != null);
3932
+ //Grafreed.Assert(group.selection != null);
3933
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3934
+ if (group.selection == null || group.selection.size() == 1)
3935
+ EditSelection(false);
29893936 keepparent = group.parent;
29903937 // PARENT = NULL or not???
29913938 //group.parent = null; // ROOT
29923939 //group.attributes = -1;
29933940 ResetModel();
3941
+
3942
+ cameraView.requestFocusInWindow();
29943943 refreshContents(true);
2995
- }
3944
+ } else if (event.getSource() == editCameraItem)
3945
+ {
3946
+ cameraView.ProtectCamera();
3947
+ cameraView.repaint();
3948
+ return;
3949
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3950
+ {
3951
+ cameraView.RevertCamera();
3952
+ cameraView.repaint();
3953
+ return;
3954
+ // } else if (event.getSource() == textureButton)
3955
+ // {
3956
+ // return; // true;
3957
+ }
29963958 else
29973959 {
29983960 //return super.action(event, arg);
....@@ -3001,7 +3963,6 @@
30013963 }
30023964
30033965 boolean useclient = false;
3004
- cRadio radio;
30053966
30063967 void ToggleRoot()
30073968 {
....@@ -3053,6 +4014,28 @@
30534014 refreshContents();
30544015 }
30554016
4017
+ void TransformChildren()
4018
+ {
4019
+ Object3D obj;
4020
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4021
+ {
4022
+ obj = (Object3D)e.nextElement();
4023
+ obj.KeepTextureMatrices();
4024
+ obj.TransformChildren();
4025
+ obj.RestoreTextureMatrices();
4026
+
4027
+// if (obj.parent == null)
4028
+// {
4029
+// System.out.println("NULL PARENT!");
4030
+// new Exception().printStackTrace();
4031
+// }
4032
+// else
4033
+// TouchTransform(obj);
4034
+// //obj.parent.Touch();
4035
+ }
4036
+
4037
+ refreshContents();
4038
+ }
30564039
30574040 void ResetTransform()
30584041 {
....@@ -3165,7 +4148,7 @@
31654148 refreshContents();
31664149 }
31674150
3168
- void ResetCentroid()
4151
+ void ResetCentroid(boolean full)
31694152 {
31704153 Object3D obj;
31714154 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3180,12 +4163,16 @@
31804163 LA.matIdentity(Object3D.mat);
31814164 obj.getBounds(minima, maxima, false);
31824165 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3183
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4166
+ if (full)
4167
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31844168 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31854169 obj.TransformMesh(Object3D.mat);
4170
+
31864171 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3187
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4172
+ if (full)
4173
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31884174 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4175
+
31894176 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31904177 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31914178 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3214,7 +4201,8 @@
32144201
32154202 int size = obj.MemorySize();
32164203
3217
- System.err.println((size/1024) + " KB is the size of " + obj);
4204
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4205
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32184206 }
32194207 }
32204208 catch (Exception e)
....@@ -3251,9 +4239,9 @@
32514239 obj = (Object3D)e.nextElement();
32524240
32534241 System.out.println("Object is: " + obj);
3254
- GrafreeD.AnalyzeObject(obj);
4242
+ Grafreed.AnalyzeObject(obj);
32554243 System.out.println("Boundary rep: " + obj.bRep);
3256
- GrafreeD.AnalyzeObject(obj.bRep);
4244
+ Grafreed.AnalyzeObject(obj.bRep);
32574245
32584246 // System.err.println((size/1024) + " KB is the size of " + obj);
32594247 }
....@@ -3295,6 +4283,13 @@
32954283 void GenNormals(boolean crease)
32964284 {
32974285 group.GenNormalsS(crease);
4286
+
4287
+ refreshContents();
4288
+ }
4289
+
4290
+ void GenNormalsMESH()
4291
+ {
4292
+ group.GenNormalsMeshS();
32984293
32994294 refreshContents();
33004295 }
....@@ -3467,8 +4462,8 @@
34674462
34684463 void ParseVertices()
34694464 {
3470
- boolean epsequal = GrafreeD.epsequal;
3471
- GrafreeD.epsequal = true;
4465
+ boolean epsequal = Grafreed.epsequal;
4466
+ Grafreed.epsequal = true;
34724467
34734468 for (int i=0; i<group.selection.size(); i++)
34744469 {
....@@ -3493,7 +4488,7 @@
34934488 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34944489 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34954490
3496
- g.add(GrafreeD.clipboard);
4491
+ g.add(Grafreed.clipboard);
34974492
34984493 buffer.add(g);
34994494 }
....@@ -3508,7 +4503,7 @@
35084503 makeSomething(buffer, i==group.selection.size()-1);
35094504 }
35104505
3511
- GrafreeD.epsequal = epsequal;
4506
+ Grafreed.epsequal = epsequal;
35124507
35134508 refreshContents();
35144509 }
....@@ -3526,7 +4521,16 @@
35264521 String pigment = Object3D.GetPigment(tex);
35274522 //String bump = Object3D.GetBump(tex);
35284523
3529
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4524
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4525
+
4526
+ try
4527
+ {
4528
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4529
+ }
4530
+ catch (Exception e)
4531
+ {
4532
+ System.err.println("FAIL: " + node);
4533
+ }
35304534
35314535 double s = v.s;
35324536
....@@ -3614,11 +4618,11 @@
36144618
36154619 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36164620
3617
- boolean random = CameraPane.RANDOM;
3618
- CameraPane.RANDOM = false; // parse all random nodes
4621
+ boolean random = CameraPane.SWITCH;
4622
+ CameraPane.SWITCH = false; // parse all random nodes
36194623 lowres.linkVerticesThis(null);
36204624 lowres.linkVerticesThis(sn);
3621
- CameraPane.RANDOM = random;
4625
+ CameraPane.SWITCH = random;
36224626
36234627 System.err.flush();
36244628
....@@ -3658,7 +4662,7 @@
36584662 return;
36594663
36604664 Object3D poses = group.selection.get(0);
3661
- Object3D ref = GrafreeD.clipboard.get(0);
4665
+ Object3D ref = Grafreed.clipboard.get(0);
36624666
36634667 Object3D newgroup = new Object3D("Po:" + poses.name);
36644668
....@@ -3852,9 +4856,9 @@
38524856
38534857 void ClipMesh()
38544858 {
3855
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4859
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38564860 {
3857
- Object3D content = GrafreeD.clipboard.get(0);
4861
+ Object3D content = Grafreed.clipboard.get(0);
38584862
38594863 if (content instanceof cGroup && ((cGroup)content).transientlink )
38604864 content = ((cGroup)content).get(0);
....@@ -3863,7 +4867,7 @@
38634867 // {
38644868 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38654869 // }
3866
- group.selection.ClipMesh(GrafreeD.clipboard);
4870
+ group.selection.ClipMesh(Grafreed.clipboard);
38674871 }
38684872 // group.selection.ClipMesh(GrafreeD.clipboard);
38694873 System.out.println("DONE.");
....@@ -3910,6 +4914,18 @@
39104914 void MarkLeaves(boolean hide)
39114915 {
39124916 group.selection.MarkLeaves(hide);
4917
+ refreshContents();
4918
+ }
4919
+
4920
+ void RewindLeaves(boolean hide)
4921
+ {
4922
+ group.selection.RewindLeaves(hide);
4923
+ refreshContents();
4924
+ }
4925
+
4926
+ void RandomLeaves(boolean hide)
4927
+ {
4928
+ group.selection.RandomLeaves(hide);
39134929 refreshContents();
39144930 }
39154931
....@@ -3984,28 +5000,25 @@
39845000 // }
39855001 // }
39865002
3987
- static boolean allparams = true;
3988
-
3989
- static Vector<Object3D> listUI = new Vector<Object3D>();
3990
-
39915003 void EditSelection(boolean newWindow)
39925004 {
5005
+ if (group.selection == null)
5006
+ {
5007
+ EditElement(group, newWindow); // ? new
5008
+ return;
5009
+ }
5010
+
39935011 // aConstraints.gridy = 0;
39945012 for (int i=0; i<group.selection.size(); i++)
39955013 {
39965014 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39975015 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3998
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5016
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39995017
40005018 Object3D elem = (Object3D)group.selection.elementAt(i);
4001
- if(elem != group)
5019
+ if(elem != group || !newWindow)
40025020 {
4003
- // if (!(elem instanceof Composite))
4004
- // newWindow = false;
4005
- listUI.add(elem);
4006
- elem.openEditWindow(this, newWindow); //, false);
4007
- System.out.println("edit : " + elem);
4008
- elem.editWindow.refreshContents(true); // ? new
5021
+ EditElement(elem, newWindow); // ? new
40095022 }
40105023 }
40115024 }
....@@ -4080,7 +5093,8 @@
40805093 //new Exception().printStackTrace();
40815094
40825095 freezemodel = true;
4083
-
5096
+ ClearUnpinned();
5097
+
40845098 /**/
40855099 //switch (event.id)
40865100 {
....@@ -4088,7 +5102,6 @@
40885102 //case 702: // Event.LIST_DESELECT
40895103 group.deselectAll();
40905104 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4091
- objEditor.ClearInfo(); // .GetMaterial());
40925105 if (tps != null)
40935106 {
40945107 for (int i=0; i < tps.length; i++)
....@@ -4097,10 +5110,8 @@
40975110
40985111 //if (child.parent != null)
40995112 //child.parent.addSelectee(child);
5113
+ objEditor.SetMaterial(child);
41005114 group.addSelectee(child);
4101
- objEditor.SetMaterial(child); // .GetMaterial());
4102
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4103
- System.err.println("info : " + child.GetPath());
41045115 }
41055116 }
41065117 // else
....@@ -4110,20 +5121,28 @@
41105121 // System.err.println("info : " + group.GetPath());
41115122 // }
41125123
4113
- objEditor.SetText(); // jan 2014
4114
-
4115
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5124
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41165125 CameraPane.flash = true;
41175126
4118
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5127
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41195128 // a camera
41205129 {
4121
- CameraPane.camerachangeframe = 0; // don't refuse it
4122
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5130
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5131
+ {
5132
+ CameraPane.camerachangeframe = 0; // don't refuse it
5133
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5134
+ }
41235135 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41245136 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41255137 }
41265138
5139
+ if (tps != null && tps.length == 1)
5140
+ {
5141
+ EditSelection(false);
5142
+ }
5143
+
5144
+ SetPinStates(tps != null && tps.length > 0);
5145
+
41275146 refreshContents();
41285147 //return true;
41295148 }
....@@ -4132,6 +5151,35 @@
41325151
41335152 freezemodel = false;
41345153 }
5154
+
5155
+ void SetPinStates(boolean enabled)
5156
+ {
5157
+ editButton.setEnabled(enabled);
5158
+ uneditButton.setEnabled(enabled);
5159
+ unselectButton.setEnabled(enabled);
5160
+ flashSelectionButton.setEnabled(enabled);
5161
+ }
5162
+
5163
+ void refreshContents(boolean cp)
5164
+ {
5165
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5166
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5167
+ {
5168
+ objEditor.ClearInfo(); // .GetMaterial());
5169
+
5170
+ for (int i=0; i < group.selection.Size(); i++)
5171
+ {
5172
+ Object3D child = (Object3D) group.selection.get(i);
5173
+
5174
+ objEditor.AddInfo(child, this, true);
5175
+ System.err.println("info : " + child.GetPath());
5176
+ }
5177
+
5178
+ objEditor.SetText(); // jan 2014
5179
+ }
5180
+
5181
+ super.refreshContents(cp);
5182
+ }
41355183
41365184 void linkSomething(Object3D thing)
41375185 {
....@@ -4203,16 +5251,19 @@
42035251 {
42045252 if (group.selection.isEmpty())
42055253 return;
4206
- GrafreeD.clipboardIsTempGroup = false;
5254
+
5255
+ Grafreed.clipboardIsTempGroup = false;
42075256 Composite tGroup = null;
42085257 if (group.selection.size() > 0) // 1)
42095258 {
42105259 tGroup = new cGroup();
4211
- GrafreeD.clipboardIsTempGroup = true;
5260
+ Grafreed.clipboardIsTempGroup = true;
42125261 }
42135262
42145263 if (cut)
42155264 {
5265
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5266
+// Save();
42165267 //int indices[] = jList.getSelectedIndices();
42175268 //for (int i = indices.length - 1; i >= 0; i--)
42185269 //jList.remove(indices[i]);
....@@ -4248,16 +5299,16 @@
42485299 //System.out.println("cut " + child);
42495300 //System.out.println("parent = " + child.parent);
42505301 // tmp.addChild(child);
4251
- if (GrafreeD.clipboardIsTempGroup)
5302
+ if (Grafreed.clipboardIsTempGroup)
42525303 tGroup.add/*Child*/(tmp);
42535304 else
4254
- GrafreeD.clipboard = tmp;
5305
+ Grafreed.clipboard = tmp;
42555306 }
42565307 else
4257
- if (GrafreeD.clipboardIsTempGroup)
5308
+ if (Grafreed.clipboardIsTempGroup)
42585309 tGroup.add/*Child*/(child);
42595310 else
4260
- GrafreeD.clipboard = child;
5311
+ Grafreed.clipboard = child;
42615312 }
42625313
42635314 //ResetModel();
....@@ -4289,21 +5340,23 @@
42895340 //System.out.println("cut " + elem);
42905341 //System.out.println("parent = " + elem.parent);
42915342 // tmp.addChild(elem);
4292
- if (GrafreeD.clipboardIsTempGroup)
5343
+ if (Grafreed.clipboardIsTempGroup)
42935344 tGroup.add/*Child*/(tmp);
42945345 else
4295
- GrafreeD.clipboard = tmp;
5346
+ Grafreed.clipboard = tmp;
42965347 }
42975348 else
4298
- if (GrafreeD.clipboardIsTempGroup)
5349
+ if (Grafreed.clipboardIsTempGroup)
42995350 tGroup.add/*Child*/(child);
43005351 else
4301
- GrafreeD.clipboard = child;
5352
+ Grafreed.clipboard = child;
43025353 }
43035354
43045355 }
4305
- if (GrafreeD.clipboardIsTempGroup)
4306
- GrafreeD.clipboard = tGroup;
5356
+
5357
+ if (Grafreed.clipboardIsTempGroup)
5358
+ Grafreed.clipboard = tGroup;
5359
+
43075360 if (cut)
43085361 {
43095362 ResetModel();
....@@ -4313,11 +5366,15 @@
43135366
43145367 void paste(boolean expand)
43155368 {
5369
+ if (Globals.REPLACEONMAKE)
5370
+ Save();
5371
+ boolean keep = Globals.REPLACEONMAKE;
5372
+ Globals.REPLACEONMAKE = false;
43165373 // if (GrafreeD.clipboard == null)
43175374 // return;
43185375 boolean first = true;
43195376
4320
- if (GrafreeD.clipboardIsTempGroup)
5377
+ if (Grafreed.clipboardIsTempGroup)
43215378 {
43225379 Composite temp;
43235380
....@@ -4328,7 +5385,7 @@
43285385 temp = (Composite)Applet3D.clipboard.deepCopy();
43295386 */
43305387 Object3D elem;
4331
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5388
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43325389 {
43335390 Object3D child = (Object3D)e.nextElement();
43345391
....@@ -4362,21 +5419,22 @@
43625419 //Object3D cb = Applet3D.clipboard;
43635420 //temp.addChild(cb);
43645421 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4365
- assert(GrafreeD.clipboard.parent == null);
4366
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4367
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4368
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4369
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5422
+ assert(Grafreed.clipboard.parent == null);
5423
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5424
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5425
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5426
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43705427 else
4371
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4372
- GrafreeD.clipboard.get(0).parent = keepparent;
5428
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5429
+ Grafreed.clipboard.get(0).parent = keepparent;
43735430 }
43745431
5432
+ Globals.REPLACEONMAKE = keep;
43755433 ResetModel();
43765434 refreshContents();
43775435 }
43785436
4379
- void pasteInto(boolean copyit)
5437
+ void pasteInto(boolean copyit, boolean clone)
43805438 {
43815439 // if (GrafreeD.clipboard == null)
43825440 // return;
....@@ -4405,15 +5463,22 @@
44055463 if (copyit)
44065464 {
44075465 // paste(false);
4408
- CloneClipboard(false); // sept 2014
5466
+ if (clone)
5467
+ {
5468
+ CloneClipboard(false); // sept 2014
5469
+ }
5470
+ else
5471
+ {
5472
+ paste(false);
5473
+ }
44095474 }
44105475 else
44115476 {
44125477 boolean first = true;
44135478
4414
- if (GrafreeD.clipboardIsTempGroup)
5479
+ if (Grafreed.clipboardIsTempGroup)
44155480 {
4416
- Composite temp = (Composite)GrafreeD.clipboard;
5481
+ Composite temp = (Composite)Grafreed.clipboard;
44175482 Object3D copy;
44185483 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44195484 {
....@@ -4423,7 +5488,7 @@
44235488 }
44245489 } else
44255490 {
4426
- linkSomething(GrafreeD.clipboard); //.get(0));
5491
+ linkSomething(Grafreed.clipboard); //.get(0));
44275492 }
44285493 }
44295494 }
....@@ -4500,6 +5565,10 @@
45005565
45015566 void group(Object3D csg, boolean grab)
45025567 {
5568
+ if (Globals.REPLACEONMAKE)
5569
+ Save();
5570
+ boolean keep = Globals.REPLACEONMAKE;
5571
+ Globals.REPLACEONMAKE = false;
45035572 if (//false) // why??
45045573 !group.selection.isEmpty())
45055574 {
....@@ -4613,10 +5682,15 @@
46135682 //node.add(csg);
46145683 //makeSomething(node);
46155684 makeSomething(csg);
5685
+ Globals.REPLACEONMAKE = keep;
46165686 }
46175687
46185688 void Ungroup(Object3D g)
46195689 {
5690
+ if (Globals.REPLACEONMAKE)
5691
+ Save();
5692
+ boolean keep = Globals.REPLACEONMAKE;
5693
+ Globals.REPLACEONMAKE = false;
46205694 if (g instanceof HiddenObject)
46215695 {
46225696 HiddenObject h = (HiddenObject) g;
....@@ -4633,6 +5707,7 @@
46335707 objEditor.makeSomething(g.get(i), false);
46345708 }
46355709 }
5710
+ Globals.REPLACEONMAKE = keep;
46365711 }
46375712
46385713 void ungroup()
....@@ -4828,21 +5903,6 @@
48285903 }
48295904 */
48305905
4831
- void ImportGFD()
4832
- {
4833
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4834
- browser.show();
4835
- String filename = browser.getFile();
4836
- if (filename != null && filename.length() > 0)
4837
- {
4838
- String fullname = browser.getDirectory() + filename;
4839
-
4840
- //Object3D readobj =
4841
- objEditor.ReadGFD(fullname, objEditor);
4842
- //makeSomething(readobj);
4843
- }
4844
- }
4845
-
48465906 /*
48475907 public void Callback(Object obj)
48485908 {
....@@ -4866,26 +5926,9 @@
48665926 }
48675927 */
48685928
4869
- void ImportVRMLX3D()
4870
- {
4871
- if (GrafreeD.standAlone)
4872
- {
4873
- /**/
4874
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4875
- browser.show();
4876
- String filename = browser.getFile();
4877
- if (filename != null && filename.length() > 0)
4878
- {
4879
- String fullname = browser.getDirectory() + filename;
4880
- LoadVRMLX3D(fullname);
4881
- }
4882
- /**/
4883
- }
4884
- }
4885
-
48865929 String GetFile(String dialogName)
48875930 {
4888
- if (GrafreeD.standAlone)
5931
+ if (Grafreed.standAlone)
48895932 {
48905933 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48915934 browser.show();
....@@ -4949,10 +5992,49 @@
49495992 cButton flashSelectionButton;
49505993 cButton editButton;
49515994 cButton uneditButton;
5995
+ JCheckBox allParamsButton;
49525996 cButton clearpanelButton;
4953
- cButton allParamsButton;
49545997 cButton unselectButton;
49555998
5999
+ cButton restoreCameraButton;
6000
+
6001
+ cButton saveButton;
6002
+ cButton oneStepButton;
6003
+
6004
+ cButton groupButton;
6005
+ cButton ungroupButton;
6006
+ cButton compositeButton;
6007
+ cButton switchButton;
6008
+ cButton loopButton;
6009
+ cButton textureButton;
6010
+
6011
+ cButton skybox1Button;
6012
+ cButton skybox2Button;
6013
+ cButton skybox3Button;
6014
+ cButton skybox4Button;
6015
+ cButton skybox5Button;
6016
+ cButton skybox6Button;
6017
+ cButton skybox7Button;
6018
+
6019
+ cButton skybox11Button;
6020
+ cButton skybox12Button;
6021
+ cButton skybox13Button;
6022
+ cButton skybox14Button;
6023
+ cButton skybox15Button;
6024
+ cButton skybox16Button;
6025
+ cButton skybox17Button;
6026
+
6027
+ cButton gridButton;
6028
+ cButton boxButton;
6029
+ cButton sphereButton;
6030
+ cButton coneButton;
6031
+ cButton torusButton;
6032
+ cButton superButton;
6033
+ cButton kleinButton;
6034
+ cButton particlesButton;
6035
+ cButton overlayButton;
6036
+ cButton lightButton;
6037
+
49566038 cButton screenfitButton;
49576039 cButton screenfitpointButton;
49586040 cButton snapobjectButton;
....@@ -4964,14 +6046,6 @@
49646046
49656047 cButton setsupportButton;
49666048
4967
- cButton twoButton;
4968
- cButton sixButton;
4969
- cButton threeButton;
4970
- cButton sevenButton;
4971
- cButton fourButton; // full panel
4972
- cButton oneButton; // full XYZ
4973
- //cButton currentLayout;
4974
-
49756049 //
49766050 //Composite
49776051 Object3D // to do !!
....@@ -4981,9 +6055,11 @@
49816055 //JTree jTree;
49826056 private MenuItem lookAtItem;
49836057 private MenuItem lookFromItem;
4984
- private MenuItem switchItem;
6058
+ private MenuItem switchViewItem;
49856059 private MenuItem cutItem;
4986
- private MenuItem duplicateItem;
6060
+ private MenuItem undoItem;
6061
+ private MenuItem redoItem;
6062
+ private JMenuItem duplicateItem;
49876063 private MenuItem cloneItem;
49886064 private MenuItem cloneSupportItem;
49896065 private MenuItem overwriteGeoItem;
....@@ -4996,7 +6072,7 @@
49966072 private MenuItem linkverticesItem;
49976073 private MenuItem relinkverticesItem;
49986074 private MenuItem setMasterItem;
4999
- private MenuItem resetMeshItem;
6075
+ private MenuItem resetAllItem;
50006076 private MenuItem stepAllItem;
50016077 private MenuItem revertMeshItem;
50026078 private MenuItem poseMeshItem;
....@@ -5007,10 +6083,11 @@
50076083 private MenuItem mergeGeometriesItem;
50086084 private MenuItem copyItem;
50096085 private MenuItem pasteItem;
6086
+ private MenuItem pasteIntoItem;
50106087 private MenuItem pasteLinkItem;
50116088 private MenuItem pasteCloneItem;
50126089 private MenuItem pasteExpandItem;
5013
- private MenuItem clearItem;
6090
+ private MenuItem deleteItem;
50146091 private MenuItem clearAllItem;
50156092 private MenuItem genUVItem;
50166093 private MenuItem genNormalsMESHItem;
....@@ -5045,6 +6122,10 @@
50456122 private MenuItem showleavesItem;
50466123 private MenuItem markleavesItem;
50476124 private MenuItem unmarkleavesItem;
6125
+ private MenuItem rewindleavesItem;
6126
+ private MenuItem unrewindleavesItem;
6127
+ private MenuItem randomleavesItem;
6128
+ private MenuItem unrandomleavesItem;
50486129
50496130 private MenuItem flipVItem;
50506131 private MenuItem unflipVItem;
....@@ -5056,15 +6137,17 @@
50566137 private MenuItem panoTexturesItem;
50576138
50586139 private MenuItem resetCentroidItem;
5059
- private MenuItem transformgeometryItem;
6140
+ private MenuItem resetCentroidXZItem;
50606141 private MenuItem resetTransformItem;
6142
+ private MenuItem transformGeometryItem;
6143
+ private MenuItem transformChildrenItem;
50616144 private MenuItem hideItem;
50626145 private MenuItem grabItem;
50636146 private MenuItem backItem;
50646147 private MenuItem frontItem;
50656148 private MenuItem cameraItem;
50666149 private MenuItem compositeItem;
5067
- private MenuItem randomItem;
6150
+ private MenuItem switchItem;
50686151 private MenuItem physicsItem;
50696152 private MenuItem frameselectorItem;
50706153 private MenuItem scriptNodeItem;
....@@ -5088,6 +6171,8 @@
50886171 private MenuItem attachBumpItem;
50896172 private MenuItem detachBumpItem;
50906173 private MenuItem pigmentBumpItem;
6174
+ private MenuItem embedTexturesItem;
6175
+ private MenuItem deEmbedTexturesItem;
50916176
50926177 private MenuItem particleItem;
50936178 private MenuItem ragdollItem;
....@@ -5104,7 +6189,7 @@
51046189 private MenuItem blobItem;
51056190 private MenuItem latheItem;
51066191 private MenuItem bezierItem;
5107
- private MenuItem checkerItem;
6192
+ private MenuItem overlayItem;
51086193 private MenuItem meshItem;
51096194 // private MenuItem meshGroupItem;
51106195 private MenuItem springItem;
....@@ -5126,11 +6211,6 @@
51266211 private MenuItem doubleItem;
51276212 private MenuItem tripleItem;
51286213
5129
- private MenuItem importGFDItem;
5130
- private MenuItem importVRMLX3DItem;
5131
- private MenuItem import3DSItem;
5132
- private MenuItem importOBJItem;
5133
-
51346214 private MenuItem computeAOItem;
51356215 private MenuItem recompileItem;
51366216 private MenuItem editScriptItem;
....@@ -5140,4 +6220,8 @@
51406220 private MenuItem analyzeItem;
51416221 private MenuItem dumpItem;
51426222 //boolean freezemodel = false;
6223
+
6224
+ Menu cameraMenu;
6225
+ MenuItem editCameraItem;
6226
+ MenuItem restoreCameraItem;
51436227 }