Normand Briere
2019-08-01 650ecb410e75381cf73a4139325741b36d84d94e
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,110 +902,239 @@
434902 oe.radioPanel.add(dummyButton);
435903 oe.buttonGroup.add(dummyButton);
436904 */
437
- aConstraints.gridy += 1;
905
+ cGridBag copyOptionsPanel = new cGridBag();
906
+
907
+ copyOptionsPanel.preferredHeight = 2;
438908
439909 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
440910
441
- oe.aConstraints.gridwidth = 1;
442
- oe.aConstraints.gridx = 0;
911
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
912
+ //minButton.setToolTipText("Minimize window");
913
+ //minButton.addActionListener(this);
443914
444
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
445
- liveCB.setToolTipText("Enabled animation");
446
- liveCB.addItemListener(this);
447
-
448
- oe.aConstraints.gridx += 1;
449
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
450
- trackCB.setToolTipText("Enable tracking");
451
- trackCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
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);
455927 screenfitButton.setToolTipText("Screen fit");
456928 screenfitButton.addActionListener(this);
457
- oe.aConstraints.gridx += 1;
929
+
930
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ restoreCameraButton.setToolTipText("Restore viewpoint");
932
+ restoreCameraButton.addActionListener(this);
933
+
934
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveButton.setToolTipText("Duplicate current 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 version (undo latest change)");
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 version (save latest change)");
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
+
458979 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
459980 // screenfitpointButton.addActionListener(this);
460
-// oe.aConstraints.gridx += 1;
461
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
462
- snapobjectButton.addActionListener(this);
463
- snapobjectButton.setToolTipText("Snap Object");
464
- oe.aConstraints.gridx += 1;
465981
466
- //aConstraints.gridx = 0;
467
- //aConstraints.gridy += 1;
468
- oe.aConstraints.weighty = 0;
469
- oe.aConstraints.gridwidth = 1;
470
-
471
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
472
- flashSelectionButton.setToolTipText("Show selection");
473
- flashSelectionButton.addActionListener(this);
474
-
475
- oe.toolbarPanel.add(new cButton(" ", false));
476
-
477
- oe.aConstraints.gridx += 1;
478
- oe.aConstraints.weighty = 0;
479
- oe.aConstraints.gridwidth = 1;
480
-
481
- //
482
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
483
- twoButton.setToolTipText("Show center view only");
484
- twoButton.addActionListener(this);
485
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, 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);
486989 fourButton.addActionListener(this);
487
- fourButton.setToolTipText("Show left panel only");
488
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
489
- sixButton.setToolTipText("2-column layout left");
490
- sixButton.addActionListener(this);
491
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
492
- 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");
4931002 threeButton.addActionListener(this);
494
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
495
- sevenButton.setToolTipText("3-column layout");
496
- 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);
4971009 //
4981010
499
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
500
- rootButton.setToolTipText("Edit object in new tab");
1011
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1012
+ rootButton.setToolTipText("Open selection in new tab");
5011013 rootButton.addActionListener(this);
502
- oe.aConstraints.gridx += 1;
503
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1014
+
1015
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5041016 closeButton.setToolTipText("Close tab");
5051017 closeButton.addActionListener(this);
5061018 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5071019 //clearButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509
-
510
- oe.aConstraints.gridx = 1; //
511
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
512
- editButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
5161020
517
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1021
+ cGridBag row1 = new cGridBag();
1022
+
1023
+ // INSERT
1024
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
+ gridButton.setToolTipText("Create grid");
1026
+ gridButton.addActionListener(this);
1027
+
1028
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ boxButton.setToolTipText("Create box");
1030
+ boxButton.addActionListener(this);
1031
+
1032
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+ sphereButton.setToolTipText("Create sphere");
1034
+ sphereButton.addActionListener(this);
1035
+
1036
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ coneButton.setToolTipText("Create cone");
1038
+ coneButton.addActionListener(this);
1039
+
1040
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ torusButton.setToolTipText("Create torus");
1042
+ torusButton.addActionListener(this);
1043
+
1044
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ superButton.setToolTipText("Create superellipsoid");
1046
+ superButton.addActionListener(this);
1047
+
1048
+ if (Globals.ADVANCED)
1049
+ {
1050
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1051
+ kleinButton.setToolTipText("Create Klein bottle");
1052
+ kleinButton.addActionListener(this);
1053
+ }
1054
+
1055
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ particlesButton.setToolTipText("Create particle system");
1057
+ particlesButton.addActionListener(this);
1058
+
1059
+ oe.toolboxPanel.add(row1);
1060
+
1061
+ cGridBag row2 = new cGridBag();
1062
+
1063
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1064
+ groupButton.setToolTipText("Create group");
1065
+ groupButton.addActionListener(this);
1066
+
1067
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ compositeButton.setToolTipText("Create composite");
1069
+ compositeButton.addActionListener(this);
1070
+
1071
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ switchButton.setToolTipText("Create item switcher");
1073
+ switchButton.addActionListener(this);
1074
+
1075
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ loopButton.setToolTipText("Create loop");
1077
+ loopButton.addActionListener(this);
1078
+
1079
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1080
+ textureButton.setToolTipText("Create texture");
1081
+ textureButton.addActionListener(this);
1082
+
1083
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ overlayButton.setToolTipText("Create overlay");
1085
+ overlayButton.addActionListener(this);
1086
+
1087
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ lightButton.setToolTipText("Create light");
1089
+ lightButton.addActionListener(this);
1090
+
1091
+ oe.toolboxPanel.add(row2);
1092
+
1093
+ // ENVYMAPS
1094
+ cGridBag skyboxpane = new cGridBag();
1095
+ skyboxpane.preferredHeight = 100;
1096
+
1097
+ oe.toolboxPanel.add(skyboxpane);
1098
+
1099
+ JTabbedPane skyboxpanel = new JTabbedPane();
1100
+ skyboxpane.add(skyboxpanel);
1101
+
1102
+ AddSkyboxTab0(skyboxpanel);
1103
+ AddSkyboxTab1(skyboxpanel);
1104
+ AddSkyboxTab2(skyboxpanel);
1105
+ AddSkyboxTab3(skyboxpanel);
1106
+
1107
+ // EDIT panel
1108
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ editButton.setToolTipText("Pin selection controls");
1110
+ editButton.addActionListener(this);
1111
+
1112
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ uneditButton.setToolTipText("Remove selection controls");
5181114 uneditButton.addActionListener(this);
5191115
520
- oe.aConstraints.gridx += 1;
521
- oe.aConstraints.weighty = 0;
522
- oe.aConstraints.gridwidth = 1;
523
-
524
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
525
- clearPanelButton.addActionListener(this);
526
-
527
- oe.aConstraints.gridx += 1;
528
- oe.aConstraints.weighty = 0;
529
- oe.aConstraints.gridwidth = 1;
530
-
531
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1116
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1117
+ allParamsButton.setToolTipText("Show all controle");
5321118 allParamsButton.addActionListener(this);
5331119
534
- oe.aConstraints.gridx += 1;
535
- oe.aConstraints.weighty = 0;
536
- oe.aConstraints.gridwidth = 1;
537
-
538
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
1120
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1121
+ clearPanelButton.setToolTipText("Clear edit panel");
1122
+ clearPanelButton.addActionListener(this);
1123
+
1124
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1125
+ unselectButton.setToolTipText("Unselect");
5391126 unselectButton.addActionListener(this);
5401127
1128
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ flashSelectionButton.setToolTipText("Highlight selection");
1130
+ flashSelectionButton.addActionListener(this);
1131
+
1132
+ editCommandsPanel.preferredHeight = 1;
1133
+
1134
+ SetPinStates(false);
1135
+// oe.treePanel.add(commandsPanel);
1136
+// oe.treePanel.Return();
1137
+
5411138 // oe.aConstraints.gridx += 1;
5421139 // oe.aConstraints.weighty = 0;
5431140 // oe.aConstraints.gridwidth = 1;
....@@ -549,47 +1146,32 @@
5491146 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5501147 // gcButton.addActionListener(this);
5511148
552
- oe.aConstraints.gridx = 0;
553
- oe.aConstraints.gridy += 1;
554
-
555
- //ctrlPanel.add(objList = new List(5, true));
556
- oe.aConstraints.gridwidth = 100;
557
- // oe.aConstraints.gridheight = 100;
558
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
559
- oe.aConstraints.gridheight = 1;
560
- oe.aConstraints.weighty = 0.5;
561
- oe.aConstraints.gridx = 0;
562
- JScrollPane jSP;
1149
+ cGridBag jSPPanel = new cGridBag();
1150
+
1151
+ JScrollPane jSP;
5631152 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
564
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1153
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5651154 ResetModel();
566
- oe.aConstraints.weighty = 0.5;
567
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
568
- oe.aConstraints.gridy += 1;
569
- oe.aConstraints.gridwidth = 1;
570
-
571
- oe.aConstraints.weighty = 0;
572
- oe.aConstraints.gridwidth = 2;
573
-
574
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
575
- colorCB.addItemListener(this);
576
- oe.aConstraints.gridx += 2;
577
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
578
- materialCB.addItemListener(this);
579
- oe.aConstraints.gridx += 2;
580
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
581
- textureCB.addItemListener(this);
582
-
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
5851155
1156
+ oe.treePanel.add(jSPPanel);
1157
+ oe.treePanel.Return();
1158
+
1159
+ oe.treePanel.add(copyOptionsPanel);
1160
+ oe.treePanel.Return();
1161
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1162
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1163
+ sliderPane.preferredHeight = 1;
1164
+
1165
+// mainPanel.setDividerLocation(0.1); //1.0);
1166
+ mainPanel.setResizeWeight(0.4);
1167
+
5861168 //jList.addListSelectionListener(this);
5871169 oe.jTree.addTreeSelectionListener(this);
5881170 //jTree.setRootVisible(false);
5891171 //jTree.setEditable(true);
5901172 oe.jTree.setDragEnabled(true);
5911173 //jTree.setPreferredSize(new Dimension(10,10));
592
- jSP.setPreferredSize(new Dimension(100,200));
1174
+ //jSP.setPreferredSize(new Dimension(100,200));
5931175
5941176 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
5951177
....@@ -601,53 +1183,70 @@
6011183 dgr.addDragGestureListener(this);
6021184 }catch(Exception e) {}
6031185 */
604
- radio.layout = sevenButton;
1186
+ radio.layout = threeButton; // sixButton;
6051187 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6061188 }
6071189
6081190 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6091191 {
610
- //constraints.gridx = 0;
611
- //constraints.gridy = 0;
612
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
613
- fastCB.setToolTipText("Fast mode");
614
- fastCB.addItemListener(this);
615
- //constraints.gridy += 1;
616
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
617
- supportCB.setToolTipText("Enabled rigging");
618
- 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);
6191195
620
- // constraints.gridy += 1;
1196
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1197
+ materialCB.setToolTipText("Copy material when dropped");
1198
+ materialCB.addItemListener(this);
1199
+
1200
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1201
+ textureCB.setToolTipText("Copy texture when dropped");
1202
+ textureCB.addItemListener(this);
1203
+
1204
+ panel.Return();
1205
+
1206
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1207
+ boxCB.setToolTipText("Display bounding boxes");
1208
+ boxCB.addItemListener(this);
1209
+
1210
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1211
+ zoomBoxCB.setToolTipText("Display only for wheel");
1212
+ zoomBoxCB.addItemListener(this);
1213
+
1214
+ if (true) // Globals.ADVANCED)
1215
+ {
1216
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1217
+// supportCB.setToolTipText("Enable rigging");
1218
+// supportCB.addItemListener(this);
1219
+
1220
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1221
+ freezeCB.setToolTipText("Fast moving camera");
1222
+ freezeCB.addItemListener(this);
1223
+
6211224 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6221225 // localCB.addItemListener(this);
6231226
624
- //constraints.gridy += 1;
1227
+ panel.Return();
1228
+
6251229 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6261230 crowdCB.setToolTipText("Used for crowds");
6271231 crowdCB.addItemListener(this);
6281232
629
- //constraints.gridy += 1;
6301233 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
6311234 smoothCB.setToolTipText("Snapping delay");
6321235 smoothCB.addItemListener(this);
6331236
634
- //constraints.gridy += 1;
635
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
636
- slowCB.setToolTipText("Smooth interpolation");
637
- slowCB.addItemListener(this);
638
- //constraints.gridy += 1;
639
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
640
- boxCB.setToolTipText("Display bounding boxes");
641
- boxCB.addItemListener(this);
642
- //constraints.gridy += 1;
643
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
644
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
645
- zoomBoxCB.addItemListener(this);
646
-
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);
1243
+
6471244 // constraints.gridy += 1;
6481245 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6491246 // speakerMocapCB.addItemListener(this);
6501247
1248
+ panel.Return();
1249
+
6511250 if (false)
6521251 {
6531252 // handled in scripts
....@@ -662,36 +1261,85 @@
6621261 //constraints.gridy += 1;
6631262 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6641263 smoothfocusCB.addItemListener(this);
1264
+ panel.Return();
6651265 }
6661266
6671267 //constraints.gridx += 1;
6681268 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6691269 // debugCB.addItemListener(this);
6701270
671
- //constraints.gridy += 1;
1271
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1272
+ trackCB.setToolTipText("Enable tracking target");
1273
+ trackCB.addItemListener(this);
1274
+
6721275 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1276
+ oeilCB.setToolTipText("Move camera when tracking");
6731277 oeilCB.addItemListener(this);
6741278
675
- //constraints.gridy += 1;
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
+ {
6761299 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
6771300 lookAtCB.setToolTipText("Look-at target");
6781301 lookAtCB.addItemListener(this);
1302
+ }
1303
+
1304
+ }
1305
+
1306
+ cGridBag fill = new cGridBag();
1307
+ fill.preferredHeight = 200;
1308
+ cGridBag fill2 = new cGridBag();
1309
+ fill2.preferredHeight = 200;
1310
+ cGridBag fill3 = new cGridBag();
1311
+ fill3.preferredHeight = 200;
1312
+
1313
+ panel.add(fill);
1314
+ panel.add(fill2);
1315
+ panel.add(fill3);
6791316
6801317 }
6811318
6821319 void EditObject(Object3D obj)
6831320 {
6841321 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
+
6851330 radioButton.SetObject(obj);
686
- radioButton.layout = sevenButton;
1331
+ radioButton.layout = threeButton; // sixButton;
6871332 radioButton.SetCamera(cameraView.renderCamera, false);
6881333 radioButton.addActionListener(this);
6891334 radioPanel.add(radioButton);
6901335 buttonGroup.add(radioButton);
6911336 radioButton.doClick();
6921337 }
1338
+
6931339 void SetupViews(ObjEditor oe)
6941340 {
1341
+ theFrame = this;
1342
+
6951343 oe.SetupViews();
6961344
6971345 System.out.println("SetupViews");
....@@ -700,23 +1348,30 @@
7001348 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7011349 }
7021350
703
- JCheckBox liveCB;
704
- JCheckBox supportCB;
705
- JCheckBox localCB;
706
- JCheckBox crowdCB;
707
- JCheckBox smoothCB;
708
- JCheckBox fastCB;
709
- JCheckBox slowCB;
710
- JCheckBox boxCB;
711
- JCheckBox zoomBoxCB;
712
- JCheckBox trackCB;
713
- 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;
7141366 // JCheckBox speakerMocapCB;
715
- JCheckBox speakerCameraCB;
716
- JCheckBox speakerFocusCB;
717
- JCheckBox debugCB;
718
- JCheckBox oeilCB;
719
- JCheckBox lookAtCB;
1367
+ cCheckBox speakerCameraCB;
1368
+ cCheckBox speakerFocusCB;
1369
+ cCheckBox debugCB;
1370
+
1371
+ cCheckBox oeilCB;
1372
+ cCheckBox shadowCB;
1373
+ cCheckBox autokeepCB;
1374
+ cCheckBox lookAtCB;
7201375
7211376 // static int COLOR = 1;
7221377 // static int MATERIAL = 2;
....@@ -724,9 +1379,9 @@
7241379
7251380 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7261381
727
- JCheckBox colorCB;
728
- JCheckBox materialCB;
729
- JCheckBox textureCB;
1382
+ cCheckBox colorCB;
1383
+ cCheckBox materialCB;
1384
+ cCheckBox textureCB;
7301385
7311386 public void itemStateChanged(ItemEvent e)
7321387 {
....@@ -754,6 +1409,7 @@
7541409 } else if(e.getSource() == liveCB)
7551410 {
7561411 cameraView.ToggleLive();
1412
+ refreshContents(false);
7571413 }
7581414 else if(e.getSource() == supportCB)
7591415 {
....@@ -769,6 +1425,12 @@
7691425 {
7701426 cameraView.ToggleInertia();
7711427 cameraView.repaint();
1428
+ }
1429
+ else if(e.getSource() == minshaderCB)
1430
+ {
1431
+ Globals.MINSHADER ^= true;
1432
+ cameraView.programInitialized = false;
1433
+ cameraView.repaint();
7721434 }
7731435 else if(e.getSource() == localCB)
7741436 {
....@@ -818,6 +1480,18 @@
8181480 {
8191481 cameraView.ToggleOeil();
8201482 }
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
+ }
8211495 else if(e.getSource() == lookAtCB)
8221496 {
8231497 cameraView.ToggleLookAt();
....@@ -834,7 +1508,8 @@
8341508
8351509 /**/
8361510 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
837
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1511
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1512
+ TreePath path = objEditor.jTree.getSelectionPath();
8381513 if ((path == null) || (path.getPathCount() <= 1)) {
8391514 // We can't move the root node or an empty selection
8401515 return;
....@@ -897,8 +1572,6 @@
8971572 }
8981573 }
8991574
900
- String string = (String) object;
901
-
9021575 System.out.println("Transfer = " + object + "; drop : " + target);
9031576 // if( object instanceof java.io.File[])
9041577 // {
....@@ -906,7 +1579,11 @@
9061579 // objEditor.DropFile((java.io.File[]) object, true);
9071580 // return;
9081581 // }
909
- 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) == ':')
9101587 {
9111588 // file(s)
9121589 String[] names = string.split("\n");
....@@ -933,7 +1610,7 @@
9331610
9341611 flashIt = false;
9351612 CameraPane pane = (CameraPane) target;
936
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1613
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9371614 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9381615
9391616 if (group.selection.size() == 1)
....@@ -949,23 +1626,33 @@
9491626
9501627 assert target == objEditor.jTree;
9511628 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1629
+ Object3D destinationLeaf;
9521630 try {
953
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1631
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9541632 } catch (Exception e) {
9551633 System.out.println("destinationPath : " + destinationPath);
9561634 return;
9571635 }
9581636
959
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1637
+ for (int i=group.selection.size(); --i>=0;)
9601638 {
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
+// {
9611648 loadClipboard(true);
9621649 objEditor.jTree.setSelectionPath(destinationPath);
963
- pasteInto(false);
964
- } else {
965
- loadClipboard(false);
966
- objEditor.jTree.setSelectionPath(destinationPath);
967
- pasteInto(false); // true); // ???
968
- }
1650
+ pasteInto(false, false);
1651
+// } else {
1652
+// loadClipboard(false);
1653
+// objEditor.jTree.setSelectionPath(destinationPath);
1654
+// pasteInto(false, false); // true); // ???
1655
+// }
9691656 }
9701657 public void dropActionChanged(DropTargetDragEvent dtde)
9711658 // Called if the user has modified the current drop gesture
....@@ -1070,85 +1757,107 @@
10701757 {
10711758 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10721759 //heightFieldItem.addActionListener(this);
1073
- gridItem = menu.add(new MenuItem("Grid"));
1074
- gridItem.addActionListener(this);
1075
- rectoidItem = menu.add(new MenuItem("Box"));
1076
- rectoidItem.addActionListener(this);
1077
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1078
- ellipsoidItem.addActionListener(this);
1079
- coneItem = menu.add(new MenuItem("Cone"));
1080
- coneItem.addActionListener(this);
1081
- torusItem = menu.add(new MenuItem("Torus"));
1082
- torusItem.addActionListener(this);
1083
- superItem = menu.add(new MenuItem("Superellipsoid"));
1084
- 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
+ {
10851778 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10861779 kleinItem.addActionListener(this);
1087
- particleItem = menu.add(new MenuItem("Particle system"));
1088
- particleItem.addActionListener(this);
1780
+ }
1781
+
1782
+// particleItem = menu.add(new MenuItem("Particle system"));
1783
+// particleItem.addActionListener(this);
1784
+ if (Globals.ADVANCED)
1785
+ {
10891786 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10901787 ragdollItem.addActionListener(this);
10911788 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10921789 ragdoll2Item.addActionListener(this);
1790
+ }
10931791 menu.add("-");
1094
- meshItem = menu.add(new MenuItem("Mesh"));
1792
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10951793 meshItem.addActionListener(this);
10961794 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10971795 // meshGroupItem.addActionListener(this);
1796
+ if (Globals.ADVANCED)
1797
+ {
10981798 springItem = menu.add(new MenuItem("Spring"));
10991799 springItem.addActionListener(this);
11001800 flagItem = menu.add(new MenuItem("Flag"));
11011801 flagItem.addActionListener(this);
1102
- bezierItem = menu.add(new MenuItem("Patch"));
1103
- bezierItem.addActionListener(this);
1104
- checkerItem = menu.add(new MenuItem("Checker"));
1105
- checkerItem.addActionListener(this);
11061802 blobItem = menu.add(new MenuItem("Blob"));
11071803 blobItem.addActionListener(this);
11081804 latheItem = menu.add(new MenuItem("Lathe"));
11091805 latheItem.addActionListener(this);
1110
- lightItem = menu.add(new MenuItem("Light"));
1111
- 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);
11121813 menu.add("-");
11131814 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11141815 //superLoopItem.addActionListener(this);
1115
- loopItem = menu.add(new MenuItem("Loop"));
1116
- loopItem.addActionListener(this);
1816
+// loopItem = menu.add(new MenuItem("Loop"));
1817
+// loopItem.addActionListener(this);
11171818 doubleItem = menu.add(new MenuItem("Fork"));
11181819 doubleItem.addActionListener(this);
1820
+ if (Globals.ADVANCED)
1821
+ {
11191822 tripleItem = menu.add(new MenuItem("Trident"));
11201823 tripleItem.addActionListener(this);
1824
+ }
11211825 }
11221826
11231827 void buildToolsMenu(Menu menu)
11241828 {
11251829 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11261830 animationItem.addItemListener(this);
1127
- animationItem.setState(CameraPane.ANIMATION);
1831
+ animationItem.setState(Globals.ANIMATION);
1832
+
1833
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1834
+ archiveItem.addActionListener(this);
11281835
11291836 menu.add("-");
11301837 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11311838 parseverticesItem.addActionListener(this);
11321839 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11331840 textureFieldItem.addActionListener(this);
1134
- alignItem = menu.add(new MenuItem("Align"));
1841
+ alignItem = menu.add(new MenuItem("Align Objects"));
11351842 alignItem.addActionListener(this);
1136
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1137
- mirrorItem.addActionListener(this);
11381843 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11391844 reduceMorphItem.addActionListener(this);
11401845 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11411846 reduce34MorphItem.addActionListener(this);
1142
-
1143
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1144
- computeAOItem.addActionListener(this);
11451847 menu.add("-");
1146
-
11471848 menu.add(memoryItem = new MenuItem("Memory Usage"));
11481849 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("-");
11491858 menu.add(analyzeItem = new MenuItem("Analyze"));
11501859 analyzeItem.addActionListener(this);
1151
- menu.add(dumpItem = new MenuItem("Dump"));
1860
+ menu.add(dumpItem = new MenuItem("Print"));
11521861 dumpItem.addActionListener(this);
11531862 // menu.add(pathItem = new MenuItem("From-to path"));
11541863 // pathItem.addActionListener(this);
....@@ -1166,6 +1875,7 @@
11661875 menu.add("-");
11671876 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11681877 editScriptItem.addActionListener(this);
1878
+ }
11691879 }
11701880
11711881 void ScreenFit()
....@@ -1288,9 +1998,34 @@
12881998 shadow.material = new cMaterial(obj.material);
12891999 shadow.material.diffuse = 0.0001f;
12902000 shadow.material.specular = 0.0001f;
2001
+ //shadow.projectedVertices[1].x = 300;
12912002
12922003 makeSomething(shadow);
12932004 }
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
+ }
12942029
12952030 /**
12962031 * applyExample
....@@ -1494,9 +2229,9 @@
14942229
14952230 void Overwrite(int mask)
14962231 {
1497
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2232
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14982233 {
1499
- Object3D content = GrafreeD.clipboard.get(0);
2234
+ Object3D content = Grafreed.clipboard.get(0);
15002235
15012236 if (content instanceof cGroup && ((cGroup)content).transientlink )
15022237 content = ((cGroup)content).get(0);
....@@ -1535,7 +2270,7 @@
15352270 {
15362271 ScreenFit();
15372272 } else
1538
- if (source == switchItem)
2273
+ if (source == switchViewItem)
15392274 {
15402275 cVector v1 = new cVector();
15412276 cVector v2 = new cVector();
....@@ -1544,11 +2279,11 @@
15442279 objEditor.cameraView.renderCamera.setAim(v2, v1);
15452280 objEditor.cameraView.repaint();
15462281 } else
1547
- if (source == rectoidItem)
2282
+ if (source == rectoidItem || source == boxButton)
15482283 {
15492284 makeSomething(new Box());
15502285 } else
1551
- if (source == particleItem)
2286
+ if (source == particleItem || source == particlesButton)
15522287 {
15532288 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15542289 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1627,27 +2362,27 @@
16272362
16282363 makeSomething(obj);
16292364 } else
1630
- if (source == gridItem)
2365
+ if (source == gridItem || source == gridButton)
16312366 {
16322367 makeSomething(new Grid());
16332368 } else
1634
- if (source == ellipsoidItem)
2369
+ if (source == ellipsoidItem || source == sphereButton)
16352370 {
16362371 makeSomething(new Sphere());
16372372 } else
1638
- if (source == coneItem)
2373
+ if (source == coneItem || source == coneButton)
16392374 {
16402375 makeSomething(new Cone());
16412376 } else
1642
- if (source == torusItem)
2377
+ if (source == torusItem || source == torusButton)
16432378 {
16442379 makeSomething(new Torus());
16452380 } else
1646
- if (source == superItem)
2381
+ if (source == superItem || source == superButton)
16472382 {
16482383 makeSomething(new Superellipsoid());
16492384 } else
1650
- if (source == kleinItem)
2385
+ if (source == kleinItem || source == kleinButton)
16512386 {
16522387 makeSomething(new Klein());
16532388 } else
....@@ -1667,7 +2402,7 @@
16672402 {
16682403 makeSomething(new BezierSurface());
16692404 } else
1670
- if (source == checkerItem)
2405
+ if (source == overlayItem || source == overlayButton)
16712406 {
16722407 /*
16732408 Object3D obj = new BezierSurface(5,8);
....@@ -1715,10 +2450,27 @@
17152450 s.setup();
17162451 makeSomething(s);
17172452 } else
1718
- if (source == lightItem)
2453
+ if (source == lightItem || source == lightButton)
17192454 {
17202455 makeSomething(new Light());
17212456 } 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
17222474 if (source == csgItem)
17232475 {
17242476 group(new CSG());
....@@ -1765,30 +2517,30 @@
17652517
17662518 group(g);
17672519 } else
1768
- if (source == loopItem)
2520
+ if (source == loopItem || source == loopButton)
17692521 {
17702522 Composite csg = new GroupLeaf();
17712523 csg.count = 5;
17722524 group(csg);
1773
- Composite child = new cGroup();
2525
+ Composite child = new cGroup("Branch");
17742526 csg.addChild(child);
17752527 child.addChild(csg);
17762528 } else
17772529 if (source == doubleItem)
17782530 {
1779
- Composite csg = new GroupLeaf();
2531
+ Composite csg = new GroupLeaf("Fork");
17802532 csg.count = 5;
17812533 group(csg);
1782
- Composite child = new cGroup();
2534
+ Composite child = new cGroup("Branch A");
17832535 csg.addChild(child);
17842536 child.addChild(csg);
1785
- child = new cGroup();
2537
+ child = new cGroup("Branch B");
17862538 csg.addChild(child);
17872539 child.addChild(csg);
17882540 } else
17892541 if (source == tripleItem)
17902542 {
1791
- Composite csg = new GroupLeaf();
2543
+ Composite csg = new GroupLeaf("Trident");
17922544 csg.count = 4;
17932545 group(csg);
17942546 Composite child = new cGroup();
....@@ -1801,27 +2553,10 @@
18012553 csg.addChild(child);
18022554 child.addChild(csg);
18032555 } else
1804
-
1805
- if (source == importGFDItem)
1806
- {
1807
- ImportGFD();
1808
- } else
1809
- if (source == importVRMLX3DItem)
1810
- {
1811
- ImportVRMLX3D();
1812
- } else
1813
- if (source == import3DSItem)
1814
- {
1815
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1816
- } else
1817
- if (source == importOBJItem)
1818
- {
1819
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1820
- } else
18212556 if (source == computeAOItem)
18222557 {
18232558 Globals.drawMode = CameraPane.OCCLUSION;
1824
- Globals.theRenderer.repaint();
2559
+ cameraView.repaint();
18252560 } else
18262561 if (source == recompileItem)
18272562 {
....@@ -1836,7 +2571,7 @@
18362571 if (source == invariantsItem)
18372572 {
18382573 System.out.println("Invariants:");
1839
- GrafreeD.grafreeD.universe.invariants();
2574
+ Grafreed.grafreeD.universe.invariants();
18402575 } else
18412576 if (source == memoryItem)
18422577 {
....@@ -1855,19 +2590,61 @@
18552590 {
18562591 DumpObject();
18572592 } 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
18582638 if (source == screenfitButton)
18592639 {
1860
- //Reload(lastConverter, lastFilename, true);
18612640 ScreenFit();
18622641 } else
18632642 if (source == screenfitpointButton)
18642643 {
1865
- //Reload(lastConverter, lastFilename, true);
18662644 ScreenFitPoint();
18672645 } else
18682646 if (source == snapobjectButton)
18692647 {
1870
- //Reload(lastConverter, lastFilename, true);
18712648 SnapObject();
18722649 } else
18732650 // if (event.getSource() == recompileButton)
....@@ -1904,12 +2681,20 @@
19042681 {
19052682 loadClipboard(true);
19062683 } else
2684
+ if (source == undoItem)
2685
+ {
2686
+ Undo();
2687
+ } else
2688
+ if (source == redoItem)
2689
+ {
2690
+ Redo();
2691
+ } else
19072692 if (source == duplicateItem)
19082693 {
1909
- Object3D keep = GrafreeD.clipboard;
2694
+ Object3D keep = Grafreed.clipboard;
19102695 loadClipboard(false);
19112696 paste(false);
1912
- GrafreeD.clipboard = keep;
2697
+ Grafreed.clipboard = keep;
19132698 } else
19142699 if (source == cloneItem)
19152700 {
....@@ -1927,13 +2712,17 @@
19272712 {
19282713 paste(false);
19292714 } else
2715
+ if (source == pasteIntoItem)
2716
+ {
2717
+ pasteInto(true, false);
2718
+ } else
19302719 if (source == pasteLinkItem)
19312720 {
1932
- pasteInto(false);
2721
+ pasteInto(false, false);
19332722 } else
19342723 if (source == pasteCloneItem)
19352724 {
1936
- pasteInto(true);
2725
+ pasteInto(true, true);
19372726 } else
19382727 if (source == pasteExpandItem)
19392728 {
....@@ -2125,9 +2914,9 @@
21252914 // group.selection.get(0).setMasterThis(content); // should be identity
21262915 // refreshContents();
21272916 // }
2128
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2917
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21292918 {
2130
- Object3D content = GrafreeD.clipboard.get(0);
2919
+ Object3D content = Grafreed.clipboard.get(0);
21312920
21322921 if (content instanceof cGroup && ((cGroup)content).transientlink )
21332922 content = ((cGroup)content).get(0);
....@@ -2135,11 +2924,11 @@
21352924 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21362925 for (int i=0; i<group.selection.size(); i++)
21372926 {
2138
- boolean random = CameraPane.RANDOM;
2139
- CameraPane.RANDOM = false; // parse all random nodes
2927
+ boolean random = CameraPane.SWITCH;
2928
+ CameraPane.SWITCH = false; // parse all random nodes
21402929 group.selection.get(i).linkVerticesThis(content);
21412930 // group.selection.get(i).setMasterThis(content); // should be identity
2142
- CameraPane.RANDOM = random;
2931
+ CameraPane.SWITCH = random;
21432932 }
21442933 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21452934 refreshContents();
....@@ -2149,20 +2938,20 @@
21492938 {
21502939 for (int i=0; i<group.selection.size(); i++)
21512940 {
2152
- boolean random = CameraPane.RANDOM;
2153
- CameraPane.RANDOM = false; // parse all random nodes
2941
+ boolean random = CameraPane.SWITCH;
2942
+ CameraPane.SWITCH = false; // parse all random nodes
21542943 group.selection.get(i).linkVerticesThis(null);
2155
- CameraPane.RANDOM = random;
2944
+ CameraPane.SWITCH = random;
21562945 }
21572946
21582947 refreshContents();
21592948 } else
21602949 if (source == relinkverticesItem)
21612950 {
2162
- boolean random = CameraPane.RANDOM;
2163
- CameraPane.RANDOM = false; // parse all random nodes
2951
+ boolean random = CameraPane.SWITCH;
2952
+ CameraPane.SWITCH = false; // parse all random nodes
21642953 group.selection.RelinkToSupport();
2165
- CameraPane.RANDOM = random;
2954
+ CameraPane.SWITCH = random;
21662955
21672956 refreshContents();
21682957 } else
....@@ -2177,9 +2966,9 @@
21772966 } else
21782967 if (source == setMasterItem)
21792968 {
2180
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2969
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21812970 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2971
+ Object3D content = Grafreed.clipboard.get(0);
21832972
21842973 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852974 content = ((cGroup)content).get(0);
....@@ -2192,9 +2981,9 @@
21922981 {
21932982 if (group.selection.size() == 1)
21942983 {
2195
- if (GrafreeD.clipboard.size() == 1)
2984
+ if (Grafreed.clipboard.size() == 1)
21962985 {
2197
- Object3D content = GrafreeD.clipboard.get(0);
2986
+ Object3D content = Grafreed.clipboard.get(0);
21982987
21992988 if (content instanceof cGroup && ((cGroup)content).transientlink )
22002989 content = ((cGroup)content).get(0);
....@@ -2211,7 +3000,7 @@
22113000 {
22123001 RevertMeshes();
22133002 } else
2214
- if (source == resetMeshItem)
3003
+ if (source == resetAllItem)
22153004 {
22163005 ResetAll();
22173006 } else
....@@ -2219,7 +3008,7 @@
22193008 {
22203009 StepAll();
22213010 } else
2222
- if (source == clearItem) // || event.getSource() == clearButton)
3011
+ if (source == deleteItem) // || event.getSource() == clearButton)
22233012 {
22243013 //int indices[] = jList.getSelectedIndices();
22253014 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2231,9 +3020,9 @@
22313020 {
22323021 ClearSelection(true);
22333022 } else
2234
- if (source == grabItem)
3023
+ if (source == grabItem || source == groupButton)
22353024 {
2236
- group(new cGroup(), true);
3025
+ group(new cGroup(), false); // true);
22373026 } else
22383027 if (source == hideItem)
22393028 {
....@@ -2251,16 +3040,16 @@
22513040 {
22523041 makeSomething(new Camera());
22533042 } else
2254
- if (source == compositeItem)
3043
+ if (source == compositeItem || source == compositeButton)
22553044 {
22563045 group(new Composite());
22573046 } else
2258
- if (source == randomItem)
3047
+ if (source == switchItem || source == switchButton)
22593048 {
22603049 RandomNode random = new RandomNode();
22613050 group(random);
22623051 if (random.size() > 0)
2263
- random.name = random.get(0).name + "Rnd";
3052
+ random.name = random.get(0).name + "Switch";
22643053 } else
22653054 if (source == physicsItem)
22663055 {
....@@ -2357,7 +3146,7 @@
23573146 {
23583147 group(new cLinker());
23593148 } else
2360
- if (source == textureItem)
3149
+ if (source == textureItem || source == textureButton)
23613150 {
23623151 group(new TextureNode());
23633152 } else
....@@ -2377,17 +3166,30 @@
23773166 {
23783167 CastShadow(2);
23793168 } else
2380
- if (source == ungroupItem)
3169
+ if (source == ungroupItem || source == ungroupButton)
23813170 {
2382
- //ungroup();
3171
+ boolean hasRoot = false;
3172
+
23833173 for (int i=0; i<group.selection.size(); i++)
23843174 {
2385
- Ungroup(group.selection.get(i));
3175
+ if (group.selection.get(i) == group)
3176
+ {
3177
+ hasRoot = true;
3178
+ break;
3179
+ }
23863180 }
23873181
2388
- ClearSelection(false);
2389
-
2390
- 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
+ }
23913193 } else
23923194 if (source == genUVItem)
23933195 {
....@@ -2399,7 +3201,7 @@
23993201 } else
24003202 if (source == genNormalsMESHItem)
24013203 {
2402
- GenNormals(true); // TODO
3204
+ GenNormalsMESH();
24033205 } else
24043206 if (source == genNormalsORGANItem)
24053207 {
....@@ -2464,6 +3266,22 @@
24643266 if (source == unmarkleavesItem)
24653267 {
24663268 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);
24673285 } else
24683286 if (source == flipVItem)
24693287 {
....@@ -2549,9 +3367,13 @@
25493367 {
25503368 SmoothMesh();
25513369 } else
2552
- if (source == transformgeometryItem)
3370
+ if (source == transformGeometryItem)
25533371 {
25543372 TransformGeometry();
3373
+ } else
3374
+ if (source == transformChildrenItem)
3375
+ {
3376
+ TransformChildren();
25553377 } else
25563378 if (source == resetTransformItem)
25573379 {
....@@ -2559,7 +3381,11 @@
25593381 } else
25603382 if (source == resetCentroidItem)
25613383 {
2562
- ResetCentroid();
3384
+ ResetCentroid(true);
3385
+ } else
3386
+ if (source == resetCentroidXZItem)
3387
+ {
3388
+ ResetCentroid(false);
25633389 } else
25643390 if (source == resetParentItem)
25653391 {
....@@ -2664,7 +3490,7 @@
26643490 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26653491 {
26663492 obj = (Object3D)e.nextElement();
2667
- obj.SetBumpTexture(null);
3493
+ obj.ResetBumpTexture();
26683494 }
26693495
26703496 refreshContents();
....@@ -2680,6 +3506,31 @@
26803506
26813507 refreshContents();
26823508 } 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
26833534 if (source == flashSelectionButton)
26843535 {
26853536 CameraPane.flash = true;
....@@ -2691,6 +3542,10 @@
26913542 if (source == twoButton)
26923543 {
26933544 radio.layout = twoButton;
3545
+
3546
+ if (CameraPane.FULLSCREEN)
3547
+ fullscreenLayout = radio.layout;
3548
+
26943549 // bug
26953550 //gridPanel.setDividerLocation(1.0);
26963551 //bigPanel.setDividerLocation(0.0);
....@@ -2723,10 +3578,31 @@
27233578 bigThree.ClearUI();
27243579 bigThree.add(centralPanel);
27253580 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
+
27263599 } else
27273600 if (source == threeButton)
27283601 {
27293602 radio.layout = threeButton;
3603
+
3604
+ if (CameraPane.FULLSCREEN)
3605
+ fullscreenLayout = radio.layout;
27303606
27313607 // bigThree.remove(scenePanel);
27323608 // bigThree.remove(centralPanel);
....@@ -2756,13 +3632,18 @@
27563632 // centralPanel.setVisible(true);
27573633 // XYZPanel.setVisible(true);
27583634 bigThree.ClearUI();
3635
+ bigThree.add(scenePanel);
27593636 bigThree.add(centralPanel);
2760
- bigThree.add(XYZPanel);
27613637 bigThree.FlushUI();
3638
+
3639
+ cameraView.requestFocusInWindow();
27623640 } else
27633641 if (source == fourButton)
27643642 {
27653643 radio.layout = fourButton;
3644
+
3645
+ if (CameraPane.FULLSCREEN)
3646
+ fullscreenLayout = radio.layout;
27663647
27673648 // bigThree.remove(scenePanel);
27683649 // bigThree.remove(centralPanel);
....@@ -2794,10 +3675,15 @@
27943675 bigThree.ClearUI();
27953676 bigThree.add(scenePanel);
27963677 bigThree.FlushUI();
3678
+
3679
+ cameraView.requestFocusInWindow();
27973680 } else
27983681 if (source == sixButton)
27993682 {
28003683 radio.layout = sixButton;
3684
+
3685
+ if (CameraPane.FULLSCREEN)
3686
+ fullscreenLayout = radio.layout;
28013687
28023688 // bigThree.remove(scenePanel);
28033689 // bigThree.remove(centralPanel);
....@@ -2827,13 +3713,18 @@
28273713 // centralPanel.setVisible(true);
28283714 // XYZPanel.setVisible(false);
28293715 bigThree.ClearUI();
2830
- bigThree.add(scenePanel);
28313716 bigThree.add(centralPanel);
3717
+ bigThree.add(scenePanel);
28323718 bigThree.FlushUI();
3719
+
3720
+ cameraView.requestFocusInWindow();
28333721 } else
28343722 if (source == sevenButton)
28353723 {
28363724 radio.layout = sevenButton;
3725
+
3726
+ if (CameraPane.FULLSCREEN)
3727
+ fullscreenLayout = radio.layout;
28373728
28383729 // bigThree.remove(scenePanel);
28393730 // bigThree.remove(centralPanel);
....@@ -2867,6 +3758,8 @@
28673758 bigThree.add(centralPanel);
28683759 bigThree.add(XYZPanel);
28693760 bigThree.FlushUI();
3761
+
3762
+ cameraView.requestFocusInWindow();
28703763 } else
28713764 if (source == rootButton)
28723765 {
....@@ -2878,6 +3771,7 @@
28783771 EditObject(obj);
28793772 }
28803773
3774
+ cameraView.requestFocusInWindow();
28813775 refreshContents(true);
28823776 } else
28833777 if (source == closeButton)
....@@ -2887,22 +3781,37 @@
28873781 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28883782 {
28893783 ab = (cRadio)e.nextElement();
2890
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3784
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28913785 {
3786
+ // Patch to avoid bug with transparency.
3787
+ if (!ab.hadMaterial)
3788
+ {
3789
+ ab.object.material = null;
3790
+ }
3791
+
28923792 buttonGroup.remove(ab);
28933793 radioPanel.remove(ab);
28943794
2895
- ab.GetObject().editWindow = null;
3795
+ //ab.GetObject().editWindow = null;
3796
+ ab.GetObject().manipWindow = null;
28963797 // ab.GetObject().objectUI = null; // ?????????
28973798
28983799 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28993800 break;
29003801 }
29013802 }
3803
+
3804
+ cameraView.requestFocusInWindow();
29023805 refreshContents(true);
29033806 } else
29043807 if (source == editItem || source == editButton)
29053808 {
3809
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3810
+ {
3811
+ Object3D child = (Object3D)e.nextElement();
3812
+ child.pinned = true;
3813
+ }
3814
+
29063815 EditSelection(false);
29073816 } else
29083817 if (source == uneditButton)
....@@ -2912,12 +3821,13 @@
29123821 Object3D child = (Object3D)e.nextElement();
29133822 if(child.editWindow != null)
29143823 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3824
+ child.pinned = false;
29153825 child.CloseUI();
29163826 listUI.remove(child);
29173827
2918
- child.editWindow = null; // ???????????
3828
+ //child.editWindow = null; // ???????????
29193829 }
2920
- objEditor.ctrlPanel.validate();
3830
+ objEditor.ctrlPanel.FlushUI();
29213831 //objEditor.jTree.clearSelection();
29223832 //objEditor.ResetSliders();
29233833 refreshContents(true);
....@@ -2928,6 +3838,7 @@
29283838 //copy.ClearUI();
29293839 for (Object3D obj : listUI)
29303840 {
3841
+ obj.pinned = false;
29313842 obj.CloseUI();
29323843 }
29333844 listUI.clear();
....@@ -2937,7 +3848,7 @@
29373848 {
29383849 assert(copy == group);
29393850
2940
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3851
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29413852
29423853 for (Object3D obj : listUI)
29433854 {
....@@ -2986,6 +3897,9 @@
29863897 }
29873898
29883899 copy = group;
3900
+
3901
+ SetUndoStates();
3902
+
29893903 //Globals.theRenderer.object = group;
29903904 if(!useclient)
29913905 {
....@@ -3001,20 +3915,48 @@
30013915 frontView.object = group;
30023916 sideView.object = group;
30033917 }
3004
- group.editWindow = this;
3918
+
3919
+// fix "+" issue
3920
+ //group.editWindow = this;
3921
+ group.manipWindow = this;
3922
+
30053923 /*
30063924 currentLayout = radio.layout;
30073925 if (currentLayout == null)
30083926 currentLayout = sevenButton;
30093927 */
30103928 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);
30113936 keepparent = group.parent;
30123937 // PARENT = NULL or not???
30133938 //group.parent = null; // ROOT
30143939 //group.attributes = -1;
30153940 ResetModel();
3941
+
3942
+ cameraView.requestFocusInWindow();
30163943 refreshContents(true);
3017
- }
3944
+ } else if (event.getSource() == editCameraItem)
3945
+ {
3946
+ cameraView.ProtectCamera();
3947
+ cameraView.requestFocusInWindow();
3948
+ cameraView.repaint();
3949
+ return;
3950
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3951
+ {
3952
+ cameraView.RevertCamera();
3953
+ cameraView.requestFocusInWindow();
3954
+ cameraView.repaint();
3955
+ return;
3956
+ // } else if (event.getSource() == textureButton)
3957
+ // {
3958
+ // return; // true;
3959
+ }
30183960 else
30193961 {
30203962 //return super.action(event, arg);
....@@ -3023,7 +3965,6 @@
30233965 }
30243966
30253967 boolean useclient = false;
3026
- cRadio radio;
30273968
30283969 void ToggleRoot()
30293970 {
....@@ -3075,6 +4016,28 @@
30754016 refreshContents();
30764017 }
30774018
4019
+ void TransformChildren()
4020
+ {
4021
+ Object3D obj;
4022
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4023
+ {
4024
+ obj = (Object3D)e.nextElement();
4025
+ obj.KeepTextureMatrices();
4026
+ obj.TransformChildren();
4027
+ obj.RestoreTextureMatrices();
4028
+
4029
+// if (obj.parent == null)
4030
+// {
4031
+// System.out.println("NULL PARENT!");
4032
+// new Exception().printStackTrace();
4033
+// }
4034
+// else
4035
+// TouchTransform(obj);
4036
+// //obj.parent.Touch();
4037
+ }
4038
+
4039
+ refreshContents();
4040
+ }
30784041
30794042 void ResetTransform()
30804043 {
....@@ -3187,7 +4150,7 @@
31874150 refreshContents();
31884151 }
31894152
3190
- void ResetCentroid()
4153
+ void ResetCentroid(boolean full)
31914154 {
31924155 Object3D obj;
31934156 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3202,12 +4165,16 @@
32024165 LA.matIdentity(Object3D.mat);
32034166 obj.getBounds(minima, maxima, false);
32044167 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3205
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4168
+ if (full)
4169
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32064170 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32074171 obj.TransformMesh(Object3D.mat);
4172
+
32084173 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3209
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4174
+ if (full)
4175
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32104176 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4177
+
32114178 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32124179 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32134180 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3236,7 +4203,8 @@
32364203
32374204 int size = obj.MemorySize();
32384205
3239
- System.err.println((size/1024) + " KB is the size of " + obj);
4206
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4207
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32404208 }
32414209 }
32424210 catch (Exception e)
....@@ -3273,9 +4241,9 @@
32734241 obj = (Object3D)e.nextElement();
32744242
32754243 System.out.println("Object is: " + obj);
3276
- GrafreeD.AnalyzeObject(obj);
4244
+ Grafreed.AnalyzeObject(obj);
32774245 System.out.println("Boundary rep: " + obj.bRep);
3278
- GrafreeD.AnalyzeObject(obj.bRep);
4246
+ Grafreed.AnalyzeObject(obj.bRep);
32794247
32804248 // System.err.println((size/1024) + " KB is the size of " + obj);
32814249 }
....@@ -3317,6 +4285,13 @@
33174285 void GenNormals(boolean crease)
33184286 {
33194287 group.GenNormalsS(crease);
4288
+
4289
+ refreshContents();
4290
+ }
4291
+
4292
+ void GenNormalsMESH()
4293
+ {
4294
+ group.GenNormalsMeshS();
33204295
33214296 refreshContents();
33224297 }
....@@ -3489,8 +4464,8 @@
34894464
34904465 void ParseVertices()
34914466 {
3492
- boolean epsequal = GrafreeD.epsequal;
3493
- GrafreeD.epsequal = true;
4467
+ boolean epsequal = Grafreed.epsequal;
4468
+ Grafreed.epsequal = true;
34944469
34954470 for (int i=0; i<group.selection.size(); i++)
34964471 {
....@@ -3515,7 +4490,7 @@
35154490 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35164491 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35174492
3518
- g.add(GrafreeD.clipboard);
4493
+ g.add(Grafreed.clipboard);
35194494
35204495 buffer.add(g);
35214496 }
....@@ -3530,7 +4505,7 @@
35304505 makeSomething(buffer, i==group.selection.size()-1);
35314506 }
35324507
3533
- GrafreeD.epsequal = epsequal;
4508
+ Grafreed.epsequal = epsequal;
35344509
35354510 refreshContents();
35364511 }
....@@ -3548,7 +4523,16 @@
35484523 String pigment = Object3D.GetPigment(tex);
35494524 //String bump = Object3D.GetBump(tex);
35504525
3551
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4526
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4527
+
4528
+ try
4529
+ {
4530
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4531
+ }
4532
+ catch (Exception e)
4533
+ {
4534
+ System.err.println("FAIL: " + node);
4535
+ }
35524536
35534537 double s = v.s;
35544538
....@@ -3636,11 +4620,11 @@
36364620
36374621 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36384622
3639
- boolean random = CameraPane.RANDOM;
3640
- CameraPane.RANDOM = false; // parse all random nodes
4623
+ boolean random = CameraPane.SWITCH;
4624
+ CameraPane.SWITCH = false; // parse all random nodes
36414625 lowres.linkVerticesThis(null);
36424626 lowres.linkVerticesThis(sn);
3643
- CameraPane.RANDOM = random;
4627
+ CameraPane.SWITCH = random;
36444628
36454629 System.err.flush();
36464630
....@@ -3680,7 +4664,7 @@
36804664 return;
36814665
36824666 Object3D poses = group.selection.get(0);
3683
- Object3D ref = GrafreeD.clipboard.get(0);
4667
+ Object3D ref = Grafreed.clipboard.get(0);
36844668
36854669 Object3D newgroup = new Object3D("Po:" + poses.name);
36864670
....@@ -3874,9 +4858,9 @@
38744858
38754859 void ClipMesh()
38764860 {
3877
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4861
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38784862 {
3879
- Object3D content = GrafreeD.clipboard.get(0);
4863
+ Object3D content = Grafreed.clipboard.get(0);
38804864
38814865 if (content instanceof cGroup && ((cGroup)content).transientlink )
38824866 content = ((cGroup)content).get(0);
....@@ -3885,7 +4869,7 @@
38854869 // {
38864870 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38874871 // }
3888
- group.selection.ClipMesh(GrafreeD.clipboard);
4872
+ group.selection.ClipMesh(Grafreed.clipboard);
38894873 }
38904874 // group.selection.ClipMesh(GrafreeD.clipboard);
38914875 System.out.println("DONE.");
....@@ -3932,6 +4916,18 @@
39324916 void MarkLeaves(boolean hide)
39334917 {
39344918 group.selection.MarkLeaves(hide);
4919
+ refreshContents();
4920
+ }
4921
+
4922
+ void RewindLeaves(boolean hide)
4923
+ {
4924
+ group.selection.RewindLeaves(hide);
4925
+ refreshContents();
4926
+ }
4927
+
4928
+ void RandomLeaves(boolean hide)
4929
+ {
4930
+ group.selection.RandomLeaves(hide);
39354931 refreshContents();
39364932 }
39374933
....@@ -4006,28 +5002,25 @@
40065002 // }
40075003 // }
40085004
4009
- static boolean allparams = true;
4010
-
4011
- static Vector<Object3D> listUI = new Vector<Object3D>();
4012
-
40135005 void EditSelection(boolean newWindow)
40145006 {
5007
+ if (group.selection == null)
5008
+ {
5009
+ EditElement(group, newWindow); // ? new
5010
+ return;
5011
+ }
5012
+
40155013 // aConstraints.gridy = 0;
40165014 for (int i=0; i<group.selection.size(); i++)
40175015 {
40185016 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40195017 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4020
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5018
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40215019
40225020 Object3D elem = (Object3D)group.selection.elementAt(i);
4023
- if(elem != group)
5021
+ if(elem != group || !newWindow)
40245022 {
4025
- // if (!(elem instanceof Composite))
4026
- // newWindow = false;
4027
- listUI.add(elem);
4028
- elem.openEditWindow(this, newWindow); //, false);
4029
- System.out.println("edit : " + elem);
4030
- elem.editWindow.refreshContents(true); // ? new
5023
+ EditElement(elem, newWindow); // ? new
40315024 }
40325025 }
40335026 }
....@@ -4102,7 +5095,8 @@
41025095 //new Exception().printStackTrace();
41035096
41045097 freezemodel = true;
4105
-
5098
+ ClearUnpinned();
5099
+
41065100 /**/
41075101 //switch (event.id)
41085102 {
....@@ -4110,7 +5104,6 @@
41105104 //case 702: // Event.LIST_DESELECT
41115105 group.deselectAll();
41125106 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4113
- objEditor.ClearInfo(); // .GetMaterial());
41145107 if (tps != null)
41155108 {
41165109 for (int i=0; i < tps.length; i++)
....@@ -4119,33 +5112,39 @@
41195112
41205113 //if (child.parent != null)
41215114 //child.parent.addSelectee(child);
5115
+ objEditor.SetMaterial(child);
41225116 group.addSelectee(child);
4123
- objEditor.SetMaterial(child); // .GetMaterial());
4124
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4125
- System.err.println("info : " + child.GetPath());
41265117 }
41275118 }
4128
- else
4129
- {
4130
- objEditor.SetMaterial(group); // .GetMaterial());
4131
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4132
- System.err.println("info : " + group.GetPath());
4133
- }
5119
+// else
5120
+// {
5121
+// objEditor.SetMaterial(group); // .GetMaterial());
5122
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5123
+// System.err.println("info : " + group.GetPath());
5124
+// }
41345125
4135
- objEditor.SetText(); // jan 2014
4136
-
4137
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5126
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41385127 CameraPane.flash = true;
41395128
4140
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5129
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41415130 // a camera
41425131 {
4143
- CameraPane.camerachangeframe = 0; // don't refuse it
4144
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5132
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5133
+ {
5134
+ CameraPane.camerachangeframe = 0; // don't refuse it
5135
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5136
+ }
41455137 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41465138 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41475139 }
41485140
5141
+ if (tps != null && tps.length == 1)
5142
+ {
5143
+ EditSelection(false);
5144
+ }
5145
+
5146
+ SetPinStates(tps != null && tps.length > 0);
5147
+
41495148 refreshContents();
41505149 //return true;
41515150 }
....@@ -4154,6 +5153,35 @@
41545153
41555154 freezemodel = false;
41565155 }
5156
+
5157
+ void SetPinStates(boolean enabled)
5158
+ {
5159
+ editButton.setEnabled(enabled);
5160
+ uneditButton.setEnabled(enabled);
5161
+ unselectButton.setEnabled(enabled);
5162
+ flashSelectionButton.setEnabled(enabled);
5163
+ }
5164
+
5165
+ void refreshContents(boolean cp)
5166
+ {
5167
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5168
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5169
+ {
5170
+ objEditor.ClearInfo(); // .GetMaterial());
5171
+
5172
+ for (int i=0; i < group.selection.Size(); i++)
5173
+ {
5174
+ Object3D child = (Object3D) group.selection.get(i);
5175
+
5176
+ objEditor.AddInfo(child, this, true);
5177
+ System.err.println("info : " + child.GetPath());
5178
+ }
5179
+
5180
+ objEditor.SetText(); // jan 2014
5181
+ }
5182
+
5183
+ super.refreshContents(cp);
5184
+ }
41575185
41585186 void linkSomething(Object3D thing)
41595187 {
....@@ -4225,16 +5253,19 @@
42255253 {
42265254 if (group.selection.isEmpty())
42275255 return;
4228
- GrafreeD.clipboardIsTempGroup = false;
5256
+
5257
+ Grafreed.clipboardIsTempGroup = false;
42295258 Composite tGroup = null;
42305259 if (group.selection.size() > 0) // 1)
42315260 {
42325261 tGroup = new cGroup();
4233
- GrafreeD.clipboardIsTempGroup = true;
5262
+ Grafreed.clipboardIsTempGroup = true;
42345263 }
42355264
42365265 if (cut)
42375266 {
5267
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5268
+// Save();
42385269 //int indices[] = jList.getSelectedIndices();
42395270 //for (int i = indices.length - 1; i >= 0; i--)
42405271 //jList.remove(indices[i]);
....@@ -4270,16 +5301,16 @@
42705301 //System.out.println("cut " + child);
42715302 //System.out.println("parent = " + child.parent);
42725303 // tmp.addChild(child);
4273
- if (GrafreeD.clipboardIsTempGroup)
5304
+ if (Grafreed.clipboardIsTempGroup)
42745305 tGroup.add/*Child*/(tmp);
42755306 else
4276
- GrafreeD.clipboard = tmp;
5307
+ Grafreed.clipboard = tmp;
42775308 }
42785309 else
4279
- if (GrafreeD.clipboardIsTempGroup)
5310
+ if (Grafreed.clipboardIsTempGroup)
42805311 tGroup.add/*Child*/(child);
42815312 else
4282
- GrafreeD.clipboard = child;
5313
+ Grafreed.clipboard = child;
42835314 }
42845315
42855316 //ResetModel();
....@@ -4311,21 +5342,23 @@
43115342 //System.out.println("cut " + elem);
43125343 //System.out.println("parent = " + elem.parent);
43135344 // tmp.addChild(elem);
4314
- if (GrafreeD.clipboardIsTempGroup)
5345
+ if (Grafreed.clipboardIsTempGroup)
43155346 tGroup.add/*Child*/(tmp);
43165347 else
4317
- GrafreeD.clipboard = tmp;
5348
+ Grafreed.clipboard = tmp;
43185349 }
43195350 else
4320
- if (GrafreeD.clipboardIsTempGroup)
5351
+ if (Grafreed.clipboardIsTempGroup)
43215352 tGroup.add/*Child*/(child);
43225353 else
4323
- GrafreeD.clipboard = child;
5354
+ Grafreed.clipboard = child;
43245355 }
43255356
43265357 }
4327
- if (GrafreeD.clipboardIsTempGroup)
4328
- GrafreeD.clipboard = tGroup;
5358
+
5359
+ if (Grafreed.clipboardIsTempGroup)
5360
+ Grafreed.clipboard = tGroup;
5361
+
43295362 if (cut)
43305363 {
43315364 ResetModel();
....@@ -4335,11 +5368,15 @@
43355368
43365369 void paste(boolean expand)
43375370 {
5371
+ if (Globals.REPLACEONMAKE)
5372
+ Save();
5373
+ boolean keep = Globals.REPLACEONMAKE;
5374
+ Globals.REPLACEONMAKE = false;
43385375 // if (GrafreeD.clipboard == null)
43395376 // return;
43405377 boolean first = true;
43415378
4342
- if (GrafreeD.clipboardIsTempGroup)
5379
+ if (Grafreed.clipboardIsTempGroup)
43435380 {
43445381 Composite temp;
43455382
....@@ -4350,7 +5387,7 @@
43505387 temp = (Composite)Applet3D.clipboard.deepCopy();
43515388 */
43525389 Object3D elem;
4353
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5390
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43545391 {
43555392 Object3D child = (Object3D)e.nextElement();
43565393
....@@ -4384,21 +5421,22 @@
43845421 //Object3D cb = Applet3D.clipboard;
43855422 //temp.addChild(cb);
43865423 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4387
- assert(GrafreeD.clipboard.parent == null);
4388
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4389
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4390
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4391
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5424
+ assert(Grafreed.clipboard.parent == null);
5425
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5426
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5427
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5428
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43925429 else
4393
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4394
- GrafreeD.clipboard.get(0).parent = keepparent;
5430
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5431
+ Grafreed.clipboard.get(0).parent = keepparent;
43955432 }
43965433
5434
+ Globals.REPLACEONMAKE = keep;
43975435 ResetModel();
43985436 refreshContents();
43995437 }
44005438
4401
- void pasteInto(boolean copyit)
5439
+ void pasteInto(boolean copyit, boolean clone)
44025440 {
44035441 // if (GrafreeD.clipboard == null)
44045442 // return;
....@@ -4427,15 +5465,22 @@
44275465 if (copyit)
44285466 {
44295467 // paste(false);
4430
- CloneClipboard(false); // sept 2014
5468
+ if (clone)
5469
+ {
5470
+ CloneClipboard(false); // sept 2014
5471
+ }
5472
+ else
5473
+ {
5474
+ paste(false);
5475
+ }
44315476 }
44325477 else
44335478 {
44345479 boolean first = true;
44355480
4436
- if (GrafreeD.clipboardIsTempGroup)
5481
+ if (Grafreed.clipboardIsTempGroup)
44375482 {
4438
- Composite temp = (Composite)GrafreeD.clipboard;
5483
+ Composite temp = (Composite)Grafreed.clipboard;
44395484 Object3D copy;
44405485 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44415486 {
....@@ -4445,7 +5490,7 @@
44455490 }
44465491 } else
44475492 {
4448
- linkSomething(GrafreeD.clipboard); //.get(0));
5493
+ linkSomething(Grafreed.clipboard); //.get(0));
44495494 }
44505495 }
44515496 }
....@@ -4522,6 +5567,10 @@
45225567
45235568 void group(Object3D csg, boolean grab)
45245569 {
5570
+ if (Globals.REPLACEONMAKE)
5571
+ Save();
5572
+ boolean keep = Globals.REPLACEONMAKE;
5573
+ Globals.REPLACEONMAKE = false;
45255574 if (//false) // why??
45265575 !group.selection.isEmpty())
45275576 {
....@@ -4635,10 +5684,15 @@
46355684 //node.add(csg);
46365685 //makeSomething(node);
46375686 makeSomething(csg);
5687
+ Globals.REPLACEONMAKE = keep;
46385688 }
46395689
46405690 void Ungroup(Object3D g)
46415691 {
5692
+ if (Globals.REPLACEONMAKE)
5693
+ Save();
5694
+ boolean keep = Globals.REPLACEONMAKE;
5695
+ Globals.REPLACEONMAKE = false;
46425696 if (g instanceof HiddenObject)
46435697 {
46445698 HiddenObject h = (HiddenObject) g;
....@@ -4655,6 +5709,7 @@
46555709 objEditor.makeSomething(g.get(i), false);
46565710 }
46575711 }
5712
+ Globals.REPLACEONMAKE = keep;
46585713 }
46595714
46605715 void ungroup()
....@@ -4850,21 +5905,6 @@
48505905 }
48515906 */
48525907
4853
- void ImportGFD()
4854
- {
4855
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4856
- browser.show();
4857
- String filename = browser.getFile();
4858
- if (filename != null && filename.length() > 0)
4859
- {
4860
- String fullname = browser.getDirectory() + filename;
4861
-
4862
- //Object3D readobj =
4863
- objEditor.ReadGFD(fullname, objEditor);
4864
- //makeSomething(readobj);
4865
- }
4866
- }
4867
-
48685908 /*
48695909 public void Callback(Object obj)
48705910 {
....@@ -4888,26 +5928,9 @@
48885928 }
48895929 */
48905930
4891
- void ImportVRMLX3D()
4892
- {
4893
- if (GrafreeD.standAlone)
4894
- {
4895
- /**/
4896
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4897
- browser.show();
4898
- String filename = browser.getFile();
4899
- if (filename != null && filename.length() > 0)
4900
- {
4901
- String fullname = browser.getDirectory() + filename;
4902
- LoadVRMLX3D(fullname);
4903
- }
4904
- /**/
4905
- }
4906
- }
4907
-
49085931 String GetFile(String dialogName)
49095932 {
4910
- if (GrafreeD.standAlone)
5933
+ if (Grafreed.standAlone)
49115934 {
49125935 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49135936 browser.show();
....@@ -4971,10 +5994,49 @@
49715994 cButton flashSelectionButton;
49725995 cButton editButton;
49735996 cButton uneditButton;
5997
+ JCheckBox allParamsButton;
49745998 cButton clearpanelButton;
4975
- cButton allParamsButton;
49765999 cButton unselectButton;
49776000
6001
+ cButton restoreCameraButton;
6002
+
6003
+ cButton saveButton;
6004
+ cButton oneStepButton;
6005
+
6006
+ cButton groupButton;
6007
+ cButton ungroupButton;
6008
+ cButton compositeButton;
6009
+ cButton switchButton;
6010
+ cButton loopButton;
6011
+ cButton textureButton;
6012
+
6013
+ cButton skybox1Button;
6014
+ cButton skybox2Button;
6015
+ cButton skybox3Button;
6016
+ cButton skybox4Button;
6017
+ cButton skybox5Button;
6018
+ cButton skybox6Button;
6019
+ cButton skybox7Button;
6020
+
6021
+ cButton skybox11Button;
6022
+ cButton skybox12Button;
6023
+ cButton skybox13Button;
6024
+ cButton skybox14Button;
6025
+ cButton skybox15Button;
6026
+ cButton skybox16Button;
6027
+ cButton skybox17Button;
6028
+
6029
+ cButton gridButton;
6030
+ cButton boxButton;
6031
+ cButton sphereButton;
6032
+ cButton coneButton;
6033
+ cButton torusButton;
6034
+ cButton superButton;
6035
+ cButton kleinButton;
6036
+ cButton particlesButton;
6037
+ cButton overlayButton;
6038
+ cButton lightButton;
6039
+
49786040 cButton screenfitButton;
49796041 cButton screenfitpointButton;
49806042 cButton snapobjectButton;
....@@ -4986,14 +6048,6 @@
49866048
49876049 cButton setsupportButton;
49886050
4989
- cButton twoButton;
4990
- cButton sixButton;
4991
- cButton threeButton;
4992
- cButton sevenButton;
4993
- cButton fourButton; // full panel
4994
- cButton oneButton; // full XYZ
4995
- //cButton currentLayout;
4996
-
49976051 //
49986052 //Composite
49996053 Object3D // to do !!
....@@ -5003,9 +6057,11 @@
50036057 //JTree jTree;
50046058 private MenuItem lookAtItem;
50056059 private MenuItem lookFromItem;
5006
- private MenuItem switchItem;
6060
+ private MenuItem switchViewItem;
50076061 private MenuItem cutItem;
5008
- private MenuItem duplicateItem;
6062
+ private MenuItem undoItem;
6063
+ private MenuItem redoItem;
6064
+ private JMenuItem duplicateItem;
50096065 private MenuItem cloneItem;
50106066 private MenuItem cloneSupportItem;
50116067 private MenuItem overwriteGeoItem;
....@@ -5018,7 +6074,7 @@
50186074 private MenuItem linkverticesItem;
50196075 private MenuItem relinkverticesItem;
50206076 private MenuItem setMasterItem;
5021
- private MenuItem resetMeshItem;
6077
+ private MenuItem resetAllItem;
50226078 private MenuItem stepAllItem;
50236079 private MenuItem revertMeshItem;
50246080 private MenuItem poseMeshItem;
....@@ -5029,10 +6085,11 @@
50296085 private MenuItem mergeGeometriesItem;
50306086 private MenuItem copyItem;
50316087 private MenuItem pasteItem;
6088
+ private MenuItem pasteIntoItem;
50326089 private MenuItem pasteLinkItem;
50336090 private MenuItem pasteCloneItem;
50346091 private MenuItem pasteExpandItem;
5035
- private MenuItem clearItem;
6092
+ private MenuItem deleteItem;
50366093 private MenuItem clearAllItem;
50376094 private MenuItem genUVItem;
50386095 private MenuItem genNormalsMESHItem;
....@@ -5067,6 +6124,10 @@
50676124 private MenuItem showleavesItem;
50686125 private MenuItem markleavesItem;
50696126 private MenuItem unmarkleavesItem;
6127
+ private MenuItem rewindleavesItem;
6128
+ private MenuItem unrewindleavesItem;
6129
+ private MenuItem randomleavesItem;
6130
+ private MenuItem unrandomleavesItem;
50706131
50716132 private MenuItem flipVItem;
50726133 private MenuItem unflipVItem;
....@@ -5078,15 +6139,17 @@
50786139 private MenuItem panoTexturesItem;
50796140
50806141 private MenuItem resetCentroidItem;
5081
- private MenuItem transformgeometryItem;
6142
+ private MenuItem resetCentroidXZItem;
50826143 private MenuItem resetTransformItem;
6144
+ private MenuItem transformGeometryItem;
6145
+ private MenuItem transformChildrenItem;
50836146 private MenuItem hideItem;
50846147 private MenuItem grabItem;
50856148 private MenuItem backItem;
50866149 private MenuItem frontItem;
50876150 private MenuItem cameraItem;
50886151 private MenuItem compositeItem;
5089
- private MenuItem randomItem;
6152
+ private MenuItem switchItem;
50906153 private MenuItem physicsItem;
50916154 private MenuItem frameselectorItem;
50926155 private MenuItem scriptNodeItem;
....@@ -5110,6 +6173,8 @@
51106173 private MenuItem attachBumpItem;
51116174 private MenuItem detachBumpItem;
51126175 private MenuItem pigmentBumpItem;
6176
+ private MenuItem embedTexturesItem;
6177
+ private MenuItem deEmbedTexturesItem;
51136178
51146179 private MenuItem particleItem;
51156180 private MenuItem ragdollItem;
....@@ -5126,7 +6191,7 @@
51266191 private MenuItem blobItem;
51276192 private MenuItem latheItem;
51286193 private MenuItem bezierItem;
5129
- private MenuItem checkerItem;
6194
+ private MenuItem overlayItem;
51306195 private MenuItem meshItem;
51316196 // private MenuItem meshGroupItem;
51326197 private MenuItem springItem;
....@@ -5148,11 +6213,6 @@
51486213 private MenuItem doubleItem;
51496214 private MenuItem tripleItem;
51506215
5151
- private MenuItem importGFDItem;
5152
- private MenuItem importVRMLX3DItem;
5153
- private MenuItem import3DSItem;
5154
- private MenuItem importOBJItem;
5155
-
51566216 private MenuItem computeAOItem;
51576217 private MenuItem recompileItem;
51586218 private MenuItem editScriptItem;
....@@ -5162,4 +6222,8 @@
51626222 private MenuItem analyzeItem;
51636223 private MenuItem dumpItem;
51646224 //boolean freezemodel = false;
6225
+
6226
+ Menu cameraMenu;
6227
+ MenuItem editCameraItem;
6228
+ MenuItem restoreCameraItem;
51656229 }