Normand Briere
2019-08-01 29d5516687020263d3ae0454ce81879a3a450af0
GroupEditor.java
....@@ -23,6 +23,302 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
+ skyboxButton.setToolTipText(s);
34
+ skyboxButton.addActionListener(new ActionListener()
35
+ {
36
+ @Override
37
+ public void actionPerformed(ActionEvent e)
38
+ {
39
+ ChangeSkybox(path);
40
+ }
41
+ });
42
+ }
43
+
44
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
45
+ {
46
+ cGridBag tab0 = new cGridBag().setVertical(true);
47
+
48
+ tab0.setName("Urban");
49
+ skyboxpanel.add(tab0);
50
+
51
+ cGridBag row0 = new cGridBag();
52
+ cGridBag row1 = new cGridBag();
53
+ cGridBag row2 = new cGridBag();
54
+ cGridBag row3 = new cGridBag();
55
+ cGridBag row4 = new cGridBag();
56
+ cGridBag row5 = new cGridBag();
57
+ cGridBag row6 = new cGridBag();
58
+
59
+ AddSkyboxButton("default", "rgb", row0);
60
+ //AddSkyboxButton("default", "cornell", row0);
61
+ AddSkyboxButton("penguins", "dust", row0);
62
+ AddSkyboxButton("penguins", "tropic", row0);
63
+ AddSkyboxButton("penguins", "yonder", row0);
64
+
65
+ AddSkyboxButton("default", "uffizi", row1);
66
+ AddSkyboxButton("bridge", "Bridge", row1);
67
+ AddSkyboxButton("bridge", "Bridge2", row1);
68
+ AddSkyboxButton("urban", "GamlaStan2", row1);
69
+
70
+ AddSkyboxButton("urban", "Parliament", row2);
71
+ AddSkyboxButton("urban", "Roundabout", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
74
+
75
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
76
+ AddSkyboxButton("urban", "UnionSquare", row3);
77
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
78
+ AddSkyboxButton("park", "BerzeliiPark", row3);
79
+
80
+ AddSkyboxButton("park", "Buddha", row4);
81
+ AddSkyboxButton("park", "CNTower2", row4);
82
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
84
+
85
+ AddSkyboxButton("park", "Park", row5);
86
+ AddSkyboxButton("park", "Pond", row5);
87
+ AddSkyboxButton("park", "Skansen", row5);
88
+ AddSkyboxButton("park", "Skansen2", row5);
89
+
90
+ AddSkyboxButton("park", "Skansen3", row6);
91
+ AddSkyboxButton("park", "Skansen4", row6);
92
+ AddSkyboxButton("park", "Skansen5", row6);
93
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
94
+
95
+ tab0.add(row0);
96
+ tab0.add(row1);
97
+ tab0.add(row2);
98
+ tab0.add(row3);
99
+ tab0.add(row4);
100
+ tab0.add(row5);
101
+ tab0.add(row6);
102
+
103
+ for (int i=5; --i>=0;)
104
+ {
105
+ //oe.toolboxPanel.Return();
106
+ //tab0.add(new cGridBag());
107
+ }
108
+ }
109
+
110
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
111
+ {
112
+ cGridBag tab0 = new cGridBag().setVertical(true);
113
+
114
+ tab0.setName("Nature");
115
+ skyboxpanel.add(tab0);
116
+
117
+ cGridBag row0 = new cGridBag();
118
+ cGridBag row1 = new cGridBag();
119
+ cGridBag row2 = new cGridBag();
120
+ cGridBag row3 = new cGridBag();
121
+ cGridBag row4 = new cGridBag();
122
+ cGridBag row5 = new cGridBag();
123
+ cGridBag row6 = new cGridBag();
124
+
125
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
126
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
127
+ AddSkyboxButton("beach", "PalmTrees", row0);
128
+ AddSkyboxButton("beach", "Tenerife", row0);
129
+
130
+ AddSkyboxButton("beach", "Tenerife2", row1);
131
+ AddSkyboxButton("beach", "Tenerife3", row1);
132
+ AddSkyboxButton("field", "FishPond", row1);
133
+ AddSkyboxButton("field", "Footballfield", row1);
134
+
135
+ AddSkyboxButton("field", "Meadow", row2);
136
+ AddSkyboxButton("field", "Sorsele", row2);
137
+ AddSkyboxButton("field", "Sorsele2", row2);
138
+ AddSkyboxButton("field", "Sorsele3", row2);
139
+
140
+ AddSkyboxButton("forest", "Brudslojan", row3);
141
+ AddSkyboxButton("forest", "Langholmen2", row3);
142
+ AddSkyboxButton("forest", "Plants", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive", row3);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
146
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
147
+ AddSkyboxButton("mountain", "Teide", row4);
148
+ AddSkyboxButton("park", "Tantolunden4", row4);
149
+
150
+ AddSkyboxButton("park", "Stairs", row5);
151
+ AddSkyboxButton("default", "skycube", row6);
152
+ AddSkyboxButton("rocky", "Langholmen", row5);
153
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
154
+
155
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
156
+ AddSkyboxButton("default", "CloudyHills", row6);
157
+ AddSkyboxButton("daz", "Autumn", row6);
158
+ AddSkyboxButton("daz", "MountainTrail", row6);
159
+ /*
160
+Autumn
161
+Greenlands
162
+MountainTrail
163
+Oasis
164
+TheRock
165
+TopOfTheWorld
166
+Winter
167
+ */
168
+
169
+ tab0.add(row0);
170
+ tab0.add(row1);
171
+ tab0.add(row2);
172
+ tab0.add(row3);
173
+ tab0.add(row4);
174
+ tab0.add(row5);
175
+ tab0.add(row6);
176
+
177
+ for (int i=5; --i>=0;)
178
+ {
179
+ //oe.toolboxPanel.Return();
180
+ //tab0.add(new cGridBag());
181
+ }
182
+ }
183
+
184
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
185
+ {
186
+ cGridBag tab0 = new cGridBag().setVertical(true);
187
+
188
+ tab0.setName("Night");
189
+ skyboxpanel.add(tab0);
190
+
191
+ cGridBag row0 = new cGridBag();
192
+ cGridBag row1 = new cGridBag();
193
+ cGridBag row2 = new cGridBag();
194
+ cGridBag row3 = new cGridBag();
195
+ cGridBag row4 = new cGridBag();
196
+ cGridBag row5 = new cGridBag();
197
+ cGridBag row6 = new cGridBag();
198
+
199
+ AddSkyboxButton("night", "NightPath", row0);
200
+ AddSkyboxButton("night", "PondNight", row0);
201
+ AddSkyboxButton("night", "Powerlines", row0);
202
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
203
+
204
+ AddSkyboxButton("urban", "CNTower", row1);
205
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
206
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
207
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
208
+
209
+ AddSkyboxButton("penguins", "kenon_star", row2);
210
+ AddSkyboxButton("persson", "corona", row2);
211
+ AddSkyboxButton("persson", "spaceskybox", row2);
212
+ AddSkyboxButton("indoors", "Vasa", row2);
213
+
214
+ AddSkyboxButton("winter", "Backyard", row3);
215
+ AddSkyboxButton("winter", "Creek", row3);
216
+ AddSkyboxButton("winter", "FootballField3", row3);
217
+ AddSkyboxButton("winter", "Forest", row3);
218
+
219
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
220
+ AddSkyboxButton("winter", "House", row4);
221
+ AddSkyboxButton("winter", "IceLake", row4);
222
+ AddSkyboxButton("winter", "IceRiver", row4);
223
+
224
+ AddSkyboxButton("winter", "Park3", row5);
225
+ AddSkyboxButton("winter", "PondWinter", row5);
226
+ AddSkyboxButton("winter", "Tantolunden5", row5);
227
+ AddSkyboxButton("winter", "Vindelalven", row5);
228
+
229
+ AddSkyboxButton("daz", "TheRock", row6);
230
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
231
+ AddSkyboxButton("daz", "Winter", row6);
232
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
233
+
234
+ tab0.add(row0);
235
+ tab0.add(row1);
236
+ tab0.add(row2);
237
+ tab0.add(row3);
238
+ tab0.add(row4);
239
+ tab0.add(row5);
240
+ tab0.add(row6);
241
+
242
+ for (int i=5; --i>=0;)
243
+ {
244
+ //oe.toolboxPanel.Return();
245
+ //tab0.add(new cGridBag());
246
+ }
247
+ }
248
+
249
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
250
+ {
251
+ cGridBag tab0 = new cGridBag().setVertical(true);
252
+
253
+ tab0.setName("Others");
254
+ skyboxpanel.add(tab0);
255
+
256
+ cGridBag row0 = new cGridBag();
257
+ cGridBag row1 = new cGridBag();
258
+ cGridBag row2 = new cGridBag();
259
+ cGridBag row3 = new cGridBag();
260
+ cGridBag row4 = new cGridBag();
261
+ cGridBag row5 = new cGridBag();
262
+ cGridBag row6 = new cGridBag();
263
+
264
+ AddSkyboxButton("mayhem", "afterrain", row0);
265
+ AddSkyboxButton("mayhem", "aqua4", row0);
266
+ AddSkyboxButton("mayhem", "aqua9", row0);
267
+ AddSkyboxButton("mayhem", "flame", row0);
268
+
269
+ AddSkyboxButton("mayhem", "h2s", row1);
270
+ AddSkyboxButton("mayhem", "prehistoric", row1);
271
+ AddSkyboxButton("mayhem", "scorched", row1);
272
+ AddSkyboxButton("penguins", "desertdawn", row1);
273
+
274
+ AddSkyboxButton("persson", "Citadella", row2);
275
+ AddSkyboxButton("persson", "Citadella2", row2);
276
+ AddSkyboxButton("persson", "clouds1", row2);
277
+ AddSkyboxButton("penguins", "wrath", row2);
278
+
279
+ AddSkyboxButton("persson", "FishermansBastion", row3);
280
+ AddSkyboxButton("persson", "HeroesSquare", row3);
281
+ AddSkyboxButton("indoors", "DallasW", row3);
282
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
283
+
284
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
285
+ AddSkyboxButton("persson", "PereaBeach1", row4);
286
+ AddSkyboxButton("persson", "PereaBeach2", row4);
287
+ AddSkyboxButton("persson", "redeclipse", row4);
288
+
289
+ AddSkyboxButton("daz", "Greenlands", row5);
290
+ AddSkyboxButton("daz", "Oasis", row5);
291
+ AddSkyboxButton("elyvisions", "arch3", row5);
292
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
293
+
294
+ AddSkyboxButton("elyvisions", "rainbow", row6);
295
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
296
+ AddSkyboxButton("elyvisions", "heaven", row6);
297
+ AddSkyboxButton("elyvisions", "hot", row6);
298
+
299
+ tab0.add(row0);
300
+ tab0.add(row1);
301
+ tab0.add(row2);
302
+ tab0.add(row3);
303
+ tab0.add(row4);
304
+ tab0.add(row5);
305
+ tab0.add(row6);
306
+
307
+ for (int i=5; --i>=0;)
308
+ {
309
+ //oe.toolboxPanel.Return();
310
+ //tab0.add(new cGridBag());
311
+ }
312
+ }
313
+
314
+ public void ChangeSkybox(String name)
315
+ {
316
+ //cameraView.envyoff = false;
317
+ group.skyboxname = name;
318
+ group.skyboxext = "jpg";
319
+ cameraView.repaint();
320
+ }
321
+
26322 //ObjEditor objEditor;
27323 public void closeUI2()
28324 {
....@@ -60,6 +356,12 @@
60356 this.copy = this.group = group;
61357 //selectees = this.group.selectees;
62358
359
+ if (copy.versions == null)
360
+ {
361
+ copy.versions = new byte[100][];
362
+ copy.versionindex = -1;
363
+ }
364
+
63365 if(ui)
64366 SetupUI(objEditor);
65367 }
....@@ -74,16 +376,28 @@
74376 this.copy = this.group = copy;
75377 //selectees = this.group.selectees;
76378
77
- SetupMenu2(objEditor);
379
+ SetupMenu2(this); //objEditor);
78380 SetupUI2(objEditor);
79381 objEditor.SetupUI(true);
80382 SetupViews(objEditor);
81383
82384 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
385
+
386
+ if (copy.versions == null)
387
+ {
388
+ copy.versions = new byte[100][];
389
+ copy.versionindex = -1;
390
+
391
+ Save(true);
392
+ }
83393 }
84394
85395 void CloneSelection(boolean supports)
86396 {
397
+ if (Globals.REPLACEONMAKE)
398
+ Save();
399
+ boolean keep = Globals.REPLACEONMAKE;
400
+ Globals.REPLACEONMAKE = false;
87401 // Object3D keep = GrafreeD.clipboard;
88402 //Object3D obj;
89403 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +408,19 @@
94408
95409 makeSomething(clone, i==group.selection.size()-1);
96410 }
411
+ Globals.REPLACEONMAKE = keep;
97412 }
98413
99414 void CloneClipboard(boolean supports)
100415 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
416
+ assert(Grafreed.clipboard.parent == null);
417
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
418
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
419
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
420
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106421 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
422
+ makeSomething(CloneObject(Grafreed.clipboard, false));
423
+ Grafreed.clipboard.get(0).parent = keepparent;
109424 }
110425
111426 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +434,7 @@
119434 // obj.support = null;
120435 if (!supports)
121436 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
437
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123438 obj.parent = parent;
124439 // obj.support = support;
125440 // clone.support = support; // aout 2013
....@@ -148,30 +463,29 @@
148463
149464 //JTextField nameField;
150465
151
- void SetupMenu2(ObjEditor oe)
466
+ void SetupMenu2(GroupEditor oe)
152467 {
153
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
154
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
155
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
156
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
157
- oe.cameraMenu.add("-");
158
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
159
- openWindowItem.addActionListener(this);
160
- editLeafItem.addActionListener(this);
161
- lookAtItem.addActionListener(this);
162
- //lookFromItem.addActinoListener(this);
163
- //switchItem.addActionListener(this);
468
+ oe.jTree = new cTree();
469
+
164470 Menu menu;
165471 oe.menuBar.add(menu = new Menu("Edit"));
166472 //editItem = menu.add(new MenuItem("Edit"));
167473 //editItem.addActionListener(this);
168
- duplicateItem = menu.add(new MenuItem("Duplicate"));
474
+
475
+// undoItem = menu.add(new MenuItem("Undo"));
476
+// undoItem.addActionListener(this);
477
+// redoItem = menu.add(new MenuItem("Redo"));
478
+// redoItem.addActionListener(this);
479
+// menu.add("-");
480
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
169481 duplicateItem.addActionListener(this);
170
- menu.add("-");
171482 cloneItem = menu.add(new MenuItem("Clone"));
172483 cloneItem.addActionListener(this);
484
+ if (Globals.ADVANCED)
485
+ {
173486 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174487 cloneSupportItem.addActionListener(this);
488
+ }
175489 menu.add("-");
176490 cutItem = menu.add(new MenuItem("Cut"));
177491 cutItem.addActionListener(this);
....@@ -179,27 +493,123 @@
179493 copyItem.addActionListener(this);
180494 pasteItem = menu.add(new MenuItem("Paste"));
181495 pasteItem.addActionListener(this);
496
+
497
+ menu.add("-");
498
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
499
+ pasteIntoItem.addActionListener(this);
182500 pasteLinkItem = menu.add(new MenuItem("Paste link"));
183501 pasteLinkItem.addActionListener(this);
184502 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185503 pasteCloneItem.addActionListener(this);
186504 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187505 // pasteExpandItem.addActionListener(this);
188
- clearItem = menu.add(new MenuItem("Clear"));
189
- clearItem.addActionListener(this);
506
+ menu.add("-");
507
+ deleteItem = menu.add(new MenuItem("Delete"));
508
+ deleteItem.addActionListener(this);
509
+
510
+ if (Globals.ADVANCED)
511
+ {
512
+ // Deletes the cameras...
190513 clearAllItem = menu.add(new MenuItem("Clear All"));
191514 clearAllItem.addActionListener(this);
515
+ }
516
+
517
+ menuBar.add(cameraMenu = new Menu("View"));
518
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
519
+ //zBufferItem.addActionListener(this);
520
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
521
+ //normalLensItem.addActionListener(this);
522
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
523
+ restoreCameraItem.addActionListener(this);
524
+
525
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
526
+// toggleFullScreenItem.addItemListener(this);
527
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
528
+// cameraMenu.add("-");
529
+//
530
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
531
+// toggleTextureItem.addItemListener(this);
532
+// toggleTextureItem.setState(CameraPane.textureon);
533
+//
534
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
535
+// toggleSwitchItem.addItemListener(this);
536
+// toggleSwitchItem.setState(CameraPane.SWITCH);
537
+
538
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
539
+ toggleHandleItem.addItemListener(this);
540
+ toggleHandleItem.setState(CameraPane.HANDLES);
541
+
542
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
543
+ togglePaintItem.addItemListener(this);
544
+ togglePaintItem.setState(CameraPane.PAINTMODE);
545
+
546
+ if (Globals.ADVANCED)
547
+ {
548
+ cameraMenu.add("-");
549
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
550
+ toggleLiveItem.addItemListener(this);
551
+ toggleLiveItem.setState(Globals.isLIVE());
192552
553
+ cameraMenu.add(stepItem = new MenuItem("Step"));
554
+ stepItem.addActionListener(this);
555
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
556
+ // toggleDLItem.addItemListener(this);
557
+ // toggleDLItem.setState(false);
558
+
559
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
560
+ toggleRenderItem.addItemListener(this);
561
+ toggleRenderItem.setState(!CameraPane.frozen);
562
+
563
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
564
+ toggleDebugItem.addItemListener(this);
565
+ toggleDebugItem.setState(Globals.DEBUG);
566
+
567
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
568
+ toggleFrustumItem.addItemListener(this);
569
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
570
+
571
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
572
+ toggleFootContactItem.addItemListener(this);
573
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
574
+
575
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
576
+ toggleTimelineItem.addItemListener(this);
577
+ }
578
+
579
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
580
+// toggleRootItem.addItemListener(this);
581
+// toggleRootItem.setState(false);
582
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
583
+// animationItem.addItemListener(this);
584
+// animationItem.setState(CameraPane.ANIMATION);
585
+ cameraMenu.add("-");
586
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
587
+ editCameraItem.addActionListener(this);
588
+
589
+ if (Globals.ADVANCED)
590
+ {
591
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
592
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
593
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
594
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
595
+ oe.cameraMenu.add("-");
596
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
597
+ openWindowItem.addActionListener(this);
598
+ editLeafItem.addActionListener(this);
599
+ lookAtItem.addActionListener(this);
600
+ //lookFromItem.addActinoListener(this);
601
+ //switchViewItem.addActionListener(this);
602
+ }
603
+
193604 oe.menuBar.add(menu = new Menu("Setting"));
194
- resetMeshItem = menu.add(new MenuItem("Reset All"));
195
- resetMeshItem.addActionListener(this);
196
- stepAllItem = menu.add(new MenuItem("Step All"));
197
- stepAllItem.addActionListener(this);
605
+ if (Globals.ADVANCED)
606
+ {
198607 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199608 revertMeshItem.addActionListener(this);
200609 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201610 resetreferencesItem.addActionListener(this);
202611 menu.add("-");
612
+ }
203613 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204614 overwriteGeoItem.addActionListener(this);
205615 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,79 +621,104 @@
211621 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212622 overwriteUVItem.addActionListener(this);
213623 menu.add("-");
624
+ if (Globals.ADVANCED)
625
+ {
214626 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215627 generateMeshItem.addActionListener(this);
216628 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217629 poseMeshItem.addActionListener(this);
218630 menu.add("-");
631
+ }
219632 resetsupportItem = menu.add(new MenuItem("Reset support"));
220633 resetsupportItem.addActionListener(this);
221634 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222635 linkverticesItem.addActionListener(this);
223636 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224637 relinkverticesItem.addActionListener(this);
638
+
639
+ if (Globals.ADVANCED)
640
+ {
225641 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226642 setMasterItem.addActionListener(this);
643
+ }
227644
228645 oe.menuBar.add(menu = new Menu("Group"));
229
- grabItem = menu.add(new MenuItem("Grab"));
230
- grabItem.addActionListener(this);
646
+// grabItem = menu.add(new MenuItem("Grab"));
647
+// grabItem.addActionListener(this);
231648 backItem = menu.add(new MenuItem("Back"));
232649 backItem.addActionListener(this);
233650 frontItem = menu.add(new MenuItem("Front"));
234651 frontItem.addActionListener(this);
235
- compositeItem = menu.add(new MenuItem("Composite"));
236
- compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
652
+// compositeItem = menu.add(new MenuItem("Composite"));
653
+// compositeItem.addActionListener(this);
654
+
655
+ if (Globals.ADVANCED)
656
+ {
657
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238658 hideItem.addActionListener(this);
659
+ }
239660 ungroupItem = menu.add(new MenuItem("Ungroup"));
240661 ungroupItem.addActionListener(this);
241
- menu.add("-");
242
- randomItem = menu.add(new MenuItem("Switch node"));
243
- randomItem.addActionListener(this);
662
+
663
+// menu.add("-");
664
+//
665
+// switchItem = menu.add(new MenuItem("Switch node"));
666
+// switchItem.addActionListener(this);
667
+ if (Globals.ADVANCED)
668
+ {
244669 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
245670 switchGeoItem.addActionListener(this);
246671 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
247672 switchTransfoItem.addActionListener(this);
673
+ morphItem = menu.add(new MenuItem("Morph Group"));
674
+ morphItem.addActionListener(this);
675
+
676
+ menu.add("-");
248677 physicsItem = menu.add(new MenuItem("Physics"));
249678 physicsItem.addActionListener(this);
250679 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
251680 frameselectorItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
253
- morphItem.addActionListener(this);
254681 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255682 scriptNodeItem.addActionListener(this);
256
- cameraItem = menu.add(new MenuItem("Camera"));
257
- cameraItem.addActionListener(this);
683
+ }
258684
259685 oe.menuBar.add(menu = new Menu("Object"));
260
- textureItem = menu.add(new MenuItem("Texture"));
261
- textureItem.addActionListener(this);
686
+// textureItem = menu.add(new MenuItem("Texture"));
687
+// textureItem.addActionListener(this);
262688 billboardItem = menu.add(new MenuItem("Billboard"));
263689 billboardItem.addActionListener(this);
264690 csgItem = menu.add(new MenuItem("CSG"));
265691 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
692
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267693 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
694
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269695 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
696
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271697 shadowZItem.addActionListener(this);
698
+ attributeItem = menu.add(new MenuItem("Attribute"));
699
+ attributeItem.addActionListener(this);
700
+
701
+ if (Globals.ADVANCED)
702
+ {
703
+ menu.add("-");
272704 linkerItem = menu.add(new MenuItem("Linker"));
273705 linkerItem.addActionListener(this);
274706 templateItem = menu.add(new MenuItem("Template"));
275707 templateItem.addActionListener(this);
276
- attributeItem = menu.add(new MenuItem("Attribute"));
277
- attributeItem.addActionListener(this);
278708 pointflowItem = menu.add(new MenuItem("Point Flow"));
279709 pointflowItem.addActionListener(this);
710
+ }
280711 menu.add("-");
281712 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282713 resetTransformItem.addActionListener(this);
283714 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284715 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
716
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
717
+ resetCentroidXZItem.addActionListener(this);
718
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
719
+ transformGeometryItem.addActionListener(this);
720
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
721
+ transformChildrenItem.addActionListener(this);
287722
288723 oe.menuBar.add(menu = new Menu("Geometry"));
289724 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +729,11 @@
294729 genNormalsCADItem.addActionListener(this);
295730 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296731 genNormalsMESHItem.addActionListener(this);
297
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
732
+ if (Globals.ADVANCED)
733
+ {
734
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
298735 genNormalsMINEItem.addActionListener(this);
736
+ }
299737 stripifyItem = menu.add(new MenuItem("Stripify"));
300738 stripifyItem.addActionListener(this);
301739 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +755,34 @@
317755 reduce34MeshItem.addActionListener(this);
318756 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319757 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322758 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323759 clipMeshItem.addActionListener(this);
760
+
761
+ if (Globals.ADVANCED)
762
+ {
763
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
764
+ smoothMeshItem.addActionListener(this);
765
+ }
324766
325767 oe.menuBar.add(menu = new Menu("Attributes"));
326768 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327769 clearMaterialsItem.addActionListener(this);
770
+ resetAllItem = menu.add(new MenuItem("Reset All"));
771
+ resetAllItem.addActionListener(this);
772
+ stepAllItem = menu.add(new MenuItem("Step All"));
773
+ stepAllItem.addActionListener(this);
328774 menu.add("-");
329775 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330776 liveleavesItem.addActionListener(this);
331777 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332778 unliveleavesItem.addActionListener(this);
779
+ if (Globals.ADVANCED)
780
+ {
333781 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334782 supportleavesItem.addActionListener(this);
335783 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336784 unsupportleavesItem.addActionListener(this);
785
+ }
337786 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338787 hideleavesItem.addActionListener(this);
339788 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +791,14 @@
342791 markleavesItem.addActionListener(this);
343792 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344793 unmarkleavesItem.addActionListener(this);
794
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
795
+ rewindleavesItem.addActionListener(this);
796
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
797
+ unrewindleavesItem.addActionListener(this);
798
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
799
+ randomleavesItem.addActionListener(this);
800
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
801
+ unrandomleavesItem.addActionListener(this);
345802 menu.add("-");
346803 flipVItem = menu.add(new MenuItem("Flip V"));
347804 flipVItem.addActionListener(this);
....@@ -367,45 +824,56 @@
367824 attachBumpItem.addActionListener(this);
368825 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
369826 pigmentBumpItem.addActionListener(this);
827
+ //embedTexturesItem
370828 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
371829 detachPigmentItem.addActionListener(this);
372830 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
373831 detachBumpItem.addActionListener(this);
832
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
833
+ embedTexturesItem.addActionListener(this);
834
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
835
+ deEmbedTexturesItem.addActionListener(this);
374836 menu.add("-");
375837 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
376838 sortbysizeItem.addActionListener(this);
377839 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378840 sortbynameItem.addActionListener(this);
379841 menu.add("-");
842
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
843
+ shareGeometriesItem.addActionListener(this);
844
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
845
+ mergeGeometriesItem.addActionListener(this);
846
+ if (Globals.ADVANCED)
847
+ {
848
+ // Pretty much the same as duplicate and clone.
380849 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381850 extractGeometriesItem.addActionListener(this);
382851 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383852 cloneGeometriesItem.addActionListener(this);
384
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
385
- shareGeometriesItem.addActionListener(this);
386
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
387
- mergeGeometriesItem.addActionListener(this);
853
+ }
388854
389855 oe.menuBar.add(menu = new Menu("Insert"));
390856 buildCreateMenu(menu);
391857
392
-
393
- oe.menuBar.add(menu = new Menu("Include"));
394
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
395
- importGFDItem.addActionListener(this);
396
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
397
- importVRMLX3DItem.addActionListener(this);
398
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
399
- importOBJItem.addActionListener(this);
400
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
401
- import3DSItem.addActionListener(this);
402
-
403858 oe.menuBar.add(menu = new Menu("Tools"));
404859 buildToolsMenu(menu);
405860 }
406861
862
+
407863 void SetupUI2(ObjEditor oe)
408864 {
865
+ // June 2019
866
+ if (oe == null)
867
+ {
868
+ //super.SetupUI2(this);
869
+ //return;
870
+ }
871
+
872
+ if (copy != group)
873
+ {
874
+ //super.SetupUI2(this);
875
+ }
876
+
409877 //new Exception().printStackTrace();
410878
411879 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,93 +902,238 @@
434902 oe.radioPanel.add(dummyButton);
435903 oe.buttonGroup.add(dummyButton);
436904 */
905
+ cGridBag copyOptionsPanel = new cGridBag();
906
+
907
+ copyOptionsPanel.preferredHeight = 2;
908
+
437909 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
438910
439
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
440
- liveCB.setToolTipText("Enabled animation");
911
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
912
+ //minButton.setToolTipText("Minimize window");
913
+ //minButton.addActionListener(this);
914
+
915
+ if (Globals.ADVANCED)
916
+ {
917
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
+ maxButton.setToolTipText("Maximize window");
919
+ maxButton.addActionListener(this);
920
+ }
921
+
922
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
923
+ fullButton.setToolTipText("Full-screen window");
924
+ fullButton.addActionListener(this);
925
+
926
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
927
+ screenfitButton.setToolTipText("Screen fit");
928
+ screenfitButton.addActionListener(this);
929
+
930
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ restoreCameraButton.setToolTipText("Restore viewpoint");
932
+ restoreCameraButton.addActionListener(this);
933
+
934
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveButton.setToolTipText("New version");
936
+ saveButton.addActionListener(this);
937
+
938
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ undoButton.setToolTipText("Previous version");
940
+ undoButton.addActionListener(this);
941
+ undoButton.setEnabled(false);
942
+
943
+ cGridBag updown = new cGridBag().setVertical(true);
944
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
+ restoreButton.setToolTipText("Restore current");
946
+ restoreButton.addActionListener(this);
947
+ restoreButton.setEnabled(false);
948
+
949
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ replaceButton.setToolTipText("Replace current");
951
+ replaceButton.addActionListener(this);
952
+ replaceButton.setEnabled(false);
953
+
954
+ copyOptionsPanel.add(updown);
955
+
956
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
957
+ redoButton.setToolTipText("Next version");
958
+ redoButton.addActionListener(this);
959
+ redoButton.setEnabled(false);
960
+
961
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
962
+ liveCB.setToolTipText("Enable animation");
441963 liveCB.addItemListener(this);
442964
443
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
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);
444970 fastCB.setToolTipText("Fast mode");
445971 fastCB.addItemListener(this);
446972
447
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
448
- trackCB.setToolTipText("Enable tracking");
449
- trackCB.addItemListener(this);
450
-
451
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
452
- screenfitButton.setToolTipText("Screen fit");
453
- screenfitButton.addActionListener(this);
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);
454978
455979 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
456980 // screenfitpointButton.addActionListener(this);
457981
458982 if (Globals.ADVANCED)
459983 {
460
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
984
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
461985 snapobjectButton.addActionListener(this);
462986 snapobjectButton.setToolTipText("Snap Object");
987
+
988
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
989
+ fourButton.addActionListener(this);
990
+ fourButton.setToolTipText("Show control panel only");
463991 }
464992
465
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
466
- flashSelectionButton.setToolTipText("Show selection");
467
- flashSelectionButton.addActionListener(this);
993
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
468994
469
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
470
-
471
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
472
- twoButton.setToolTipText("Show center view only");
995
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
996
+ twoButton.setToolTipText("Show 3D view only");
473997 twoButton.addActionListener(this);
474
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
475
- fourButton.addActionListener(this);
476
- fourButton.setToolTipText("Show left panel only");
477
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
478
- sixButton.setToolTipText("2-column layout left");
479
- sixButton.addActionListener(this);
480
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
481
- threeButton.setToolTipText("2-column layout right");
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");
4821002 threeButton.addActionListener(this);
483
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
484
- sevenButton.setToolTipText("3-column layout");
485
- 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);
4861009 //
4871010
488
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
489
- rootButton.setToolTipText("Edit selection in new tab");
1011
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1012
+ rootButton.setToolTipText("Open selection in new tab");
4901013 rootButton.addActionListener(this);
4911014
492
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1015
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
4931016 closeButton.setToolTipText("Close tab");
4941017 closeButton.addActionListener(this);
4951018 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
4961019 //clearButton.addActionListener(this);
497
-
498
- cGridBag commandsPanel = new cGridBag();
1020
+
1021
+ cGridBag row1 = new cGridBag();
4991022
500
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
501
- editButton.setToolTipText("Edit selection");
1023
+ // INSERT
1024
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
+ gridButton.setToolTipText("Create grid");
1026
+ gridButton.addActionListener(this);
1027
+
1028
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ boxButton.setToolTipText("Create box");
1030
+ boxButton.addActionListener(this);
1031
+
1032
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+ sphereButton.setToolTipText("Create sphere");
1034
+ sphereButton.addActionListener(this);
1035
+
1036
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ coneButton.setToolTipText("Create cone");
1038
+ coneButton.addActionListener(this);
1039
+
1040
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ torusButton.setToolTipText("Create torus");
1042
+ torusButton.addActionListener(this);
1043
+
1044
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ superButton.setToolTipText("Create superellipsoid");
1046
+ superButton.addActionListener(this);
1047
+
1048
+ if (Globals.ADVANCED)
1049
+ {
1050
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1051
+ kleinButton.setToolTipText("Create Klein bottle");
1052
+ kleinButton.addActionListener(this);
1053
+ }
1054
+
1055
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ particlesButton.setToolTipText("Create particle system");
1057
+ particlesButton.addActionListener(this);
1058
+
1059
+ oe.toolboxPanel.add(row1);
1060
+
1061
+ cGridBag row2 = new cGridBag();
1062
+
1063
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1064
+ groupButton.setToolTipText("Create group");
1065
+ groupButton.addActionListener(this);
1066
+
1067
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ compositeButton.setToolTipText("Create composite");
1069
+ compositeButton.addActionListener(this);
1070
+
1071
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ switchButton.setToolTipText("Create item switcher");
1073
+ switchButton.addActionListener(this);
1074
+
1075
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ loopButton.setToolTipText("Create loop");
1077
+ loopButton.addActionListener(this);
1078
+
1079
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1080
+ textureButton.setToolTipText("Create texture");
1081
+ textureButton.addActionListener(this);
1082
+
1083
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ overlayButton.setToolTipText("Create overlay");
1085
+ overlayButton.addActionListener(this);
1086
+
1087
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ lightButton.setToolTipText("Create light");
1089
+ lightButton.addActionListener(this);
1090
+
1091
+ oe.toolboxPanel.add(row2);
1092
+
1093
+ // ENVYMAPS
1094
+ cGridBag skyboxpane = new cGridBag();
1095
+ skyboxpane.preferredHeight = 100;
1096
+
1097
+ oe.toolboxPanel.add(skyboxpane);
1098
+
1099
+ JTabbedPane skyboxpanel = new JTabbedPane();
1100
+ skyboxpane.add(skyboxpanel);
1101
+
1102
+ AddSkyboxTab0(skyboxpanel);
1103
+ AddSkyboxTab1(skyboxpanel);
1104
+ AddSkyboxTab2(skyboxpanel);
1105
+ AddSkyboxTab3(skyboxpanel);
1106
+
1107
+ // EDIT panel
1108
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ editButton.setToolTipText("Pin selection controls");
5021110 editButton.addActionListener(this);
5031111
504
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
505
- uneditButton.setToolTipText("Unedit selection");
1112
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ uneditButton.setToolTipText("Remove selection controls");
5061114 uneditButton.addActionListener(this);
5071115
508
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
509
- allParamsButton.setToolTipText("Edit all params");
1116
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1117
+ allParamsButton.setToolTipText("Show all controle");
5101118 allParamsButton.addActionListener(this);
5111119
512
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1120
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5131121 clearPanelButton.setToolTipText("Clear edit panel");
5141122 clearPanelButton.addActionListener(this);
5151123
516
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1124
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5171125 unselectButton.setToolTipText("Unselect");
5181126 unselectButton.addActionListener(this);
5191127
520
- commandsPanel.preferredHeight = 1;
1128
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ flashSelectionButton.setToolTipText("Highlight selection");
1130
+ flashSelectionButton.addActionListener(this);
5211131
522
- oe.treePanel.add(commandsPanel);
523
- oe.treePanel.Return();
1132
+ editCommandsPanel.preferredHeight = 1;
1133
+
1134
+ SetPinStates(false);
1135
+// oe.treePanel.add(commandsPanel);
1136
+// oe.treePanel.Return();
5241137
5251138 // oe.aConstraints.gridx += 1;
5261139 // oe.aConstraints.weighty = 0;
....@@ -537,32 +1150,20 @@
5371150
5381151 JScrollPane jSP;
5391152 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
540
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1153
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5411154 ResetModel();
5421155
5431156 oe.treePanel.add(jSPPanel);
5441157 oe.treePanel.Return();
5451158
546
- cGridBag copyOptionsPanel = new cGridBag();
547
-
548
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
549
- colorCB.setToolTipText("Copy color when dropped");
550
- colorCB.addItemListener(this);
551
-
552
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
553
- materialCB.setToolTipText("Copy material when dropped");
554
- materialCB.addItemListener(this);
555
-
556
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
557
- textureCB.setToolTipText("Copy texture when dropped");
558
- textureCB.addItemListener(this);
559
-
560
- copyOptionsPanel.preferredHeight = 1;
5611159 oe.treePanel.add(copyOptionsPanel);
5621160 oe.treePanel.Return();
1161
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1162
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1163
+ sliderPane.preferredHeight = 1;
5631164
564
-// mainPanel.setDividerLocation(0.5); //1.0);
565
-// mainPanel.setResizeWeight(0.5);
1165
+// mainPanel.setDividerLocation(0.1); //1.0);
1166
+ mainPanel.setResizeWeight(0.4);
5661167
5671168 //jList.addListSelectionListener(this);
5681169 oe.jTree.addTreeSelectionListener(this);
....@@ -570,7 +1171,7 @@
5701171 //jTree.setEditable(true);
5711172 oe.jTree.setDragEnabled(true);
5721173 //jTree.setPreferredSize(new Dimension(10,10));
573
- jSP.setPreferredSize(new Dimension(100,200));
1174
+ //jSP.setPreferredSize(new Dimension(100,200));
5741175
5751176 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
5761177
....@@ -582,19 +1183,49 @@
5821183 dgr.addDragGestureListener(this);
5831184 }catch(Exception e) {}
5841185 */
585
- radio.layout = sevenButton;
1186
+ radio.layout = sixButton; // sevenButton;
5861187 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
5871188 }
5881189
5891190 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
5901191 {
591
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
592
- supportCB.setToolTipText("Enabled rigging");
593
- supportCB.addItemListener(this);
1192
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1193
+ colorCB.setToolTipText("Copy color when dropped");
1194
+ colorCB.addItemListener(this);
1195
+
1196
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1197
+ materialCB.setToolTipText("Copy material when dropped");
1198
+ materialCB.addItemListener(this);
1199
+
1200
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1201
+ textureCB.setToolTipText("Copy texture when dropped");
1202
+ textureCB.addItemListener(this);
1203
+
1204
+ panel.Return();
1205
+
1206
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1207
+ boxCB.setToolTipText("Display bounding boxes");
1208
+ boxCB.addItemListener(this);
1209
+
1210
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1211
+ zoomBoxCB.setToolTipText("Display only for wheel");
1212
+ zoomBoxCB.addItemListener(this);
1213
+
1214
+ if (true) // Globals.ADVANCED)
1215
+ {
1216
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1217
+// supportCB.setToolTipText("Enable rigging");
1218
+// supportCB.addItemListener(this);
1219
+
1220
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1221
+ freezeCB.setToolTipText("Fast moving camera");
1222
+ freezeCB.addItemListener(this);
5941223
5951224 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
5961225 // localCB.addItemListener(this);
5971226
1227
+ panel.Return();
1228
+
5981229 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
5991230 crowdCB.setToolTipText("Used for crowds");
6001231 crowdCB.addItemListener(this);
....@@ -603,22 +1234,19 @@
6031234 smoothCB.setToolTipText("Snapping delay");
6041235 smoothCB.addItemListener(this);
6051236
606
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
607
- slowCB.setToolTipText("Smooth interpolation");
608
- slowCB.addItemListener(this);
1237
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1238
+// slowCB.setToolTipText("Smooth interpolation");
1239
+// slowCB.addItemListener(this);
1240
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1241
+ minshaderCB.setToolTipText("Minimal fast shader");
1242
+ minshaderCB.addItemListener(this);
6091243
610
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
611
- boxCB.setToolTipText("Display bounding boxes");
612
- boxCB.addItemListener(this);
613
-
614
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
615
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
616
- zoomBoxCB.addItemListener(this);
617
-
6181244 // constraints.gridy += 1;
6191245 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6201246 // speakerMocapCB.addItemListener(this);
6211247
1248
+ panel.Return();
1249
+
6221250 if (false)
6231251 {
6241252 // handled in scripts
....@@ -633,40 +1261,85 @@
6331261 //constraints.gridy += 1;
6341262 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6351263 smoothfocusCB.addItemListener(this);
1264
+ panel.Return();
6361265 }
6371266
6381267 //constraints.gridx += 1;
6391268 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6401269 // debugCB.addItemListener(this);
6411270
1271
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1272
+ trackCB.setToolTipText("Enable tracking target");
1273
+ trackCB.addItemListener(this);
1274
+
6421275 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1276
+ oeilCB.setToolTipText("Move camera when tracking");
6431277 oeilCB.addItemListener(this);
6441278
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
+ {
6451299 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
6461300 lookAtCB.setToolTipText("Look-at target");
6471301 lookAtCB.addItemListener(this);
1302
+ }
1303
+
1304
+ }
6481305
6491306 cGridBag fill = new cGridBag();
650
-
6511307 fill.preferredHeight = 200;
1308
+ cGridBag fill2 = new cGridBag();
1309
+ fill2.preferredHeight = 200;
1310
+ cGridBag fill3 = new cGridBag();
1311
+ fill3.preferredHeight = 200;
6521312
6531313 panel.add(fill);
1314
+ panel.add(fill2);
1315
+ panel.add(fill3);
6541316
6551317 }
6561318
6571319 void EditObject(Object3D obj)
6581320 {
6591321 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
+
6601330 radioButton.SetObject(obj);
661
- radioButton.layout = sevenButton;
1331
+ radioButton.layout = sixButton; // sevenButton;
6621332 radioButton.SetCamera(cameraView.renderCamera, false);
6631333 radioButton.addActionListener(this);
6641334 radioPanel.add(radioButton);
6651335 buttonGroup.add(radioButton);
6661336 radioButton.doClick();
6671337 }
1338
+
6681339 void SetupViews(ObjEditor oe)
6691340 {
1341
+ theFrame = this;
1342
+
6701343 oe.SetupViews();
6711344
6721345 System.out.println("SetupViews");
....@@ -675,23 +1348,30 @@
6751348 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6761349 }
6771350
678
- JCheckBox liveCB;
679
- JCheckBox supportCB;
680
- JCheckBox localCB;
681
- JCheckBox crowdCB;
682
- JCheckBox smoothCB;
683
- JCheckBox fastCB;
684
- JCheckBox slowCB;
685
- JCheckBox boxCB;
686
- JCheckBox zoomBoxCB;
687
- JCheckBox trackCB;
688
- JCheckBox smoothfocusCB;
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;
6891366 // JCheckBox speakerMocapCB;
690
- JCheckBox speakerCameraCB;
691
- JCheckBox speakerFocusCB;
692
- JCheckBox debugCB;
693
- JCheckBox oeilCB;
694
- JCheckBox lookAtCB;
1367
+ cCheckBox speakerCameraCB;
1368
+ cCheckBox speakerFocusCB;
1369
+ cCheckBox debugCB;
1370
+
1371
+ cCheckBox oeilCB;
1372
+ cCheckBox shadowCB;
1373
+ cCheckBox autokeepCB;
1374
+ cCheckBox lookAtCB;
6951375
6961376 // static int COLOR = 1;
6971377 // static int MATERIAL = 2;
....@@ -699,9 +1379,9 @@
6991379
7001380 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7011381
702
- JCheckBox colorCB;
703
- JCheckBox materialCB;
704
- JCheckBox textureCB;
1382
+ cCheckBox colorCB;
1383
+ cCheckBox materialCB;
1384
+ cCheckBox textureCB;
7051385
7061386 public void itemStateChanged(ItemEvent e)
7071387 {
....@@ -729,6 +1409,7 @@
7291409 } else if(e.getSource() == liveCB)
7301410 {
7311411 cameraView.ToggleLive();
1412
+ refreshContents(false);
7321413 }
7331414 else if(e.getSource() == supportCB)
7341415 {
....@@ -744,6 +1425,12 @@
7441425 {
7451426 cameraView.ToggleInertia();
7461427 cameraView.repaint();
1428
+ }
1429
+ else if(e.getSource() == minshaderCB)
1430
+ {
1431
+ Globals.MINSHADER ^= true;
1432
+ cameraView.programInitialized = false;
1433
+ cameraView.repaint();
7471434 }
7481435 else if(e.getSource() == localCB)
7491436 {
....@@ -793,6 +1480,18 @@
7931480 {
7941481 cameraView.ToggleOeil();
7951482 }
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
+ }
7961495 else if(e.getSource() == lookAtCB)
7971496 {
7981497 cameraView.ToggleLookAt();
....@@ -809,7 +1508,8 @@
8091508
8101509 /**/
8111510 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
812
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1511
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1512
+ TreePath path = objEditor.jTree.getSelectionPath();
8131513 if ((path == null) || (path.getPathCount() <= 1)) {
8141514 // We can't move the root node or an empty selection
8151515 return;
....@@ -872,8 +1572,6 @@
8721572 }
8731573 }
8741574
875
- String string = (String) object;
876
-
8771575 System.out.println("Transfer = " + object + "; drop : " + target);
8781576 // if( object instanceof java.io.File[])
8791577 // {
....@@ -881,7 +1579,11 @@
8811579 // objEditor.DropFile((java.io.File[]) object, true);
8821580 // return;
8831581 // }
884
- 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) == ':')
8851587 {
8861588 // file(s)
8871589 String[] names = string.split("\n");
....@@ -908,7 +1610,7 @@
9081610
9091611 flashIt = false;
9101612 CameraPane pane = (CameraPane) target;
911
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1613
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9121614 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9131615
9141616 if (group.selection.size() == 1)
....@@ -924,23 +1626,33 @@
9241626
9251627 assert target == objEditor.jTree;
9261628 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1629
+ Object3D destinationLeaf;
9271630 try {
928
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1631
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9291632 } catch (Exception e) {
9301633 System.out.println("destinationPath : " + destinationPath);
9311634 return;
9321635 }
9331636
934
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1637
+ for (int i=group.selection.size(); --i>=0;)
9351638 {
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
+// {
9361648 loadClipboard(true);
9371649 objEditor.jTree.setSelectionPath(destinationPath);
938
- pasteInto(false);
939
- } else {
940
- loadClipboard(false);
941
- objEditor.jTree.setSelectionPath(destinationPath);
942
- pasteInto(false); // true); // ???
943
- }
1650
+ pasteInto(false, false);
1651
+// } else {
1652
+// loadClipboard(false);
1653
+// objEditor.jTree.setSelectionPath(destinationPath);
1654
+// pasteInto(false, false); // true); // ???
1655
+// }
9441656 }
9451657 public void dropActionChanged(DropTargetDragEvent dtde)
9461658 // Called if the user has modified the current drop gesture
....@@ -1045,54 +1757,71 @@
10451757 {
10461758 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10471759 //heightFieldItem.addActionListener(this);
1048
- gridItem = menu.add(new MenuItem("Grid"));
1049
- gridItem.addActionListener(this);
1050
- rectoidItem = menu.add(new MenuItem("Box"));
1051
- rectoidItem.addActionListener(this);
1052
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1053
- ellipsoidItem.addActionListener(this);
1054
- coneItem = menu.add(new MenuItem("Cone"));
1055
- coneItem.addActionListener(this);
1056
- torusItem = menu.add(new MenuItem("Torus"));
1057
- torusItem.addActionListener(this);
1058
- superItem = menu.add(new MenuItem("Superellipsoid"));
1059
- superItem.addActionListener(this);
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
+ {
10601778 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10611779 kleinItem.addActionListener(this);
1062
- particleItem = menu.add(new MenuItem("Particle system"));
1063
- particleItem.addActionListener(this);
1780
+ }
1781
+
1782
+// particleItem = menu.add(new MenuItem("Particle system"));
1783
+// particleItem.addActionListener(this);
1784
+ if (Globals.ADVANCED)
1785
+ {
10641786 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10651787 ragdollItem.addActionListener(this);
10661788 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10671789 ragdoll2Item.addActionListener(this);
1790
+ }
10681791 menu.add("-");
1069
- meshItem = menu.add(new MenuItem("Mesh"));
1792
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10701793 meshItem.addActionListener(this);
10711794 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10721795 // meshGroupItem.addActionListener(this);
1796
+ if (Globals.ADVANCED)
1797
+ {
10731798 springItem = menu.add(new MenuItem("Spring"));
10741799 springItem.addActionListener(this);
10751800 flagItem = menu.add(new MenuItem("Flag"));
10761801 flagItem.addActionListener(this);
1077
- bezierItem = menu.add(new MenuItem("Patch"));
1078
- bezierItem.addActionListener(this);
1079
- checkerItem = menu.add(new MenuItem("Checker"));
1080
- checkerItem.addActionListener(this);
10811802 blobItem = menu.add(new MenuItem("Blob"));
10821803 blobItem.addActionListener(this);
10831804 latheItem = menu.add(new MenuItem("Lathe"));
10841805 latheItem.addActionListener(this);
1085
- lightItem = menu.add(new MenuItem("Light"));
1086
- 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);
10871813 menu.add("-");
10881814 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10891815 //superLoopItem.addActionListener(this);
1090
- loopItem = menu.add(new MenuItem("Loop"));
1091
- loopItem.addActionListener(this);
1816
+// loopItem = menu.add(new MenuItem("Loop"));
1817
+// loopItem.addActionListener(this);
10921818 doubleItem = menu.add(new MenuItem("Fork"));
10931819 doubleItem.addActionListener(this);
1820
+ if (Globals.ADVANCED)
1821
+ {
10941822 tripleItem = menu.add(new MenuItem("Trident"));
10951823 tripleItem.addActionListener(this);
1824
+ }
10961825 }
10971826
10981827 void buildToolsMenu(Menu menu)
....@@ -1101,29 +1830,34 @@
11011830 animationItem.addItemListener(this);
11021831 animationItem.setState(Globals.ANIMATION);
11031832
1833
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1834
+ archiveItem.addActionListener(this);
1835
+
11041836 menu.add("-");
11051837 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11061838 parseverticesItem.addActionListener(this);
11071839 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11081840 textureFieldItem.addActionListener(this);
1109
- alignItem = menu.add(new MenuItem("Align"));
1841
+ alignItem = menu.add(new MenuItem("Align Objects"));
11101842 alignItem.addActionListener(this);
1111
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1112
- mirrorItem.addActionListener(this);
11131843 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11141844 reduceMorphItem.addActionListener(this);
11151845 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11161846 reduce34MorphItem.addActionListener(this);
1117
-
1118
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1119
- computeAOItem.addActionListener(this);
11201847 menu.add("-");
1121
-
11221848 menu.add(memoryItem = new MenuItem("Memory Usage"));
11231849 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("-");
11241858 menu.add(analyzeItem = new MenuItem("Analyze"));
11251859 analyzeItem.addActionListener(this);
1126
- menu.add(dumpItem = new MenuItem("Dump"));
1860
+ menu.add(dumpItem = new MenuItem("Print"));
11271861 dumpItem.addActionListener(this);
11281862 // menu.add(pathItem = new MenuItem("From-to path"));
11291863 // pathItem.addActionListener(this);
....@@ -1141,6 +1875,7 @@
11411875 menu.add("-");
11421876 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11431877 editScriptItem.addActionListener(this);
1878
+ }
11441879 }
11451880
11461881 void ScreenFit()
....@@ -1263,9 +1998,34 @@
12631998 shadow.material = new cMaterial(obj.material);
12641999 shadow.material.diffuse = 0.0001f;
12652000 shadow.material.specular = 0.0001f;
2001
+ //shadow.projectedVertices[1].x = 300;
12662002
12672003 makeSomething(shadow);
12682004 }
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
+ }
12692029
12702030 /**
12712031 * applyExample
....@@ -1469,9 +2229,9 @@
14692229
14702230 void Overwrite(int mask)
14712231 {
1472
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2232
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14732233 {
1474
- Object3D content = GrafreeD.clipboard.get(0);
2234
+ Object3D content = Grafreed.clipboard.get(0);
14752235
14762236 if (content instanceof cGroup && ((cGroup)content).transientlink )
14772237 content = ((cGroup)content).get(0);
....@@ -1510,7 +2270,7 @@
15102270 {
15112271 ScreenFit();
15122272 } else
1513
- if (source == switchItem)
2273
+ if (source == switchViewItem)
15142274 {
15152275 cVector v1 = new cVector();
15162276 cVector v2 = new cVector();
....@@ -1519,11 +2279,11 @@
15192279 objEditor.cameraView.renderCamera.setAim(v2, v1);
15202280 objEditor.cameraView.repaint();
15212281 } else
1522
- if (source == rectoidItem)
2282
+ if (source == rectoidItem || source == boxButton)
15232283 {
15242284 makeSomething(new Box());
15252285 } else
1526
- if (source == particleItem)
2286
+ if (source == particleItem || source == particlesButton)
15272287 {
15282288 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15292289 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1602,27 +2362,27 @@
16022362
16032363 makeSomething(obj);
16042364 } else
1605
- if (source == gridItem)
2365
+ if (source == gridItem || source == gridButton)
16062366 {
16072367 makeSomething(new Grid());
16082368 } else
1609
- if (source == ellipsoidItem)
2369
+ if (source == ellipsoidItem || source == sphereButton)
16102370 {
16112371 makeSomething(new Sphere());
16122372 } else
1613
- if (source == coneItem)
2373
+ if (source == coneItem || source == coneButton)
16142374 {
16152375 makeSomething(new Cone());
16162376 } else
1617
- if (source == torusItem)
2377
+ if (source == torusItem || source == torusButton)
16182378 {
16192379 makeSomething(new Torus());
16202380 } else
1621
- if (source == superItem)
2381
+ if (source == superItem || source == superButton)
16222382 {
16232383 makeSomething(new Superellipsoid());
16242384 } else
1625
- if (source == kleinItem)
2385
+ if (source == kleinItem || source == kleinButton)
16262386 {
16272387 makeSomething(new Klein());
16282388 } else
....@@ -1642,7 +2402,7 @@
16422402 {
16432403 makeSomething(new BezierSurface());
16442404 } else
1645
- if (source == checkerItem)
2405
+ if (source == overlayItem || source == overlayButton)
16462406 {
16472407 /*
16482408 Object3D obj = new BezierSurface(5,8);
....@@ -1690,10 +2450,27 @@
16902450 s.setup();
16912451 makeSomething(s);
16922452 } else
1693
- if (source == lightItem)
2453
+ if (source == lightItem || source == lightButton)
16942454 {
16952455 makeSomething(new Light());
16962456 } 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
16972474 if (source == csgItem)
16982475 {
16992476 group(new CSG());
....@@ -1740,30 +2517,30 @@
17402517
17412518 group(g);
17422519 } else
1743
- if (source == loopItem)
2520
+ if (source == loopItem || source == loopButton)
17442521 {
17452522 Composite csg = new GroupLeaf();
17462523 csg.count = 5;
17472524 group(csg);
1748
- Composite child = new cGroup();
2525
+ Composite child = new cGroup("Branch");
17492526 csg.addChild(child);
17502527 child.addChild(csg);
17512528 } else
17522529 if (source == doubleItem)
17532530 {
1754
- Composite csg = new GroupLeaf();
2531
+ Composite csg = new GroupLeaf("Fork");
17552532 csg.count = 5;
17562533 group(csg);
1757
- Composite child = new cGroup();
2534
+ Composite child = new cGroup("Branch A");
17582535 csg.addChild(child);
17592536 child.addChild(csg);
1760
- child = new cGroup();
2537
+ child = new cGroup("Branch B");
17612538 csg.addChild(child);
17622539 child.addChild(csg);
17632540 } else
17642541 if (source == tripleItem)
17652542 {
1766
- Composite csg = new GroupLeaf();
2543
+ Composite csg = new GroupLeaf("Trident");
17672544 csg.count = 4;
17682545 group(csg);
17692546 Composite child = new cGroup();
....@@ -1776,27 +2553,10 @@
17762553 csg.addChild(child);
17772554 child.addChild(csg);
17782555 } else
1779
-
1780
- if (source == importGFDItem)
1781
- {
1782
- ImportGFD();
1783
- } else
1784
- if (source == importVRMLX3DItem)
1785
- {
1786
- ImportVRMLX3D();
1787
- } else
1788
- if (source == import3DSItem)
1789
- {
1790
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1791
- } else
1792
- if (source == importOBJItem)
1793
- {
1794
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1795
- } else
17962556 if (source == computeAOItem)
17972557 {
17982558 Globals.drawMode = CameraPane.OCCLUSION;
1799
- Globals.theRenderer.repaint();
2559
+ cameraView.repaint();
18002560 } else
18012561 if (source == recompileItem)
18022562 {
....@@ -1811,7 +2571,7 @@
18112571 if (source == invariantsItem)
18122572 {
18132573 System.out.println("Invariants:");
1814
- GrafreeD.grafreeD.universe.invariants();
2574
+ Grafreed.grafreeD.universe.invariants();
18152575 } else
18162576 if (source == memoryItem)
18172577 {
....@@ -1830,19 +2590,61 @@
18302590 {
18312591 DumpObject();
18322592 } 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
18332638 if (source == screenfitButton)
18342639 {
1835
- //Reload(lastConverter, lastFilename, true);
18362640 ScreenFit();
18372641 } else
18382642 if (source == screenfitpointButton)
18392643 {
1840
- //Reload(lastConverter, lastFilename, true);
18412644 ScreenFitPoint();
18422645 } else
18432646 if (source == snapobjectButton)
18442647 {
1845
- //Reload(lastConverter, lastFilename, true);
18462648 SnapObject();
18472649 } else
18482650 // if (event.getSource() == recompileButton)
....@@ -1879,12 +2681,20 @@
18792681 {
18802682 loadClipboard(true);
18812683 } else
2684
+ if (source == undoItem)
2685
+ {
2686
+ Undo();
2687
+ } else
2688
+ if (source == redoItem)
2689
+ {
2690
+ Redo();
2691
+ } else
18822692 if (source == duplicateItem)
18832693 {
1884
- Object3D keep = GrafreeD.clipboard;
2694
+ Object3D keep = Grafreed.clipboard;
18852695 loadClipboard(false);
18862696 paste(false);
1887
- GrafreeD.clipboard = keep;
2697
+ Grafreed.clipboard = keep;
18882698 } else
18892699 if (source == cloneItem)
18902700 {
....@@ -1902,13 +2712,17 @@
19022712 {
19032713 paste(false);
19042714 } else
2715
+ if (source == pasteIntoItem)
2716
+ {
2717
+ pasteInto(true, false);
2718
+ } else
19052719 if (source == pasteLinkItem)
19062720 {
1907
- pasteInto(false);
2721
+ pasteInto(false, false);
19082722 } else
19092723 if (source == pasteCloneItem)
19102724 {
1911
- pasteInto(true);
2725
+ pasteInto(true, true);
19122726 } else
19132727 if (source == pasteExpandItem)
19142728 {
....@@ -2100,9 +2914,9 @@
21002914 // group.selection.get(0).setMasterThis(content); // should be identity
21012915 // refreshContents();
21022916 // }
2103
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2917
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21042918 {
2105
- Object3D content = GrafreeD.clipboard.get(0);
2919
+ Object3D content = Grafreed.clipboard.get(0);
21062920
21072921 if (content instanceof cGroup && ((cGroup)content).transientlink )
21082922 content = ((cGroup)content).get(0);
....@@ -2110,11 +2924,11 @@
21102924 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21112925 for (int i=0; i<group.selection.size(); i++)
21122926 {
2113
- boolean random = CameraPane.RANDOM;
2114
- CameraPane.RANDOM = false; // parse all random nodes
2927
+ boolean random = CameraPane.SWITCH;
2928
+ CameraPane.SWITCH = false; // parse all random nodes
21152929 group.selection.get(i).linkVerticesThis(content);
21162930 // group.selection.get(i).setMasterThis(content); // should be identity
2117
- CameraPane.RANDOM = random;
2931
+ CameraPane.SWITCH = random;
21182932 }
21192933 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21202934 refreshContents();
....@@ -2124,20 +2938,20 @@
21242938 {
21252939 for (int i=0; i<group.selection.size(); i++)
21262940 {
2127
- boolean random = CameraPane.RANDOM;
2128
- CameraPane.RANDOM = false; // parse all random nodes
2941
+ boolean random = CameraPane.SWITCH;
2942
+ CameraPane.SWITCH = false; // parse all random nodes
21292943 group.selection.get(i).linkVerticesThis(null);
2130
- CameraPane.RANDOM = random;
2944
+ CameraPane.SWITCH = random;
21312945 }
21322946
21332947 refreshContents();
21342948 } else
21352949 if (source == relinkverticesItem)
21362950 {
2137
- boolean random = CameraPane.RANDOM;
2138
- CameraPane.RANDOM = false; // parse all random nodes
2951
+ boolean random = CameraPane.SWITCH;
2952
+ CameraPane.SWITCH = false; // parse all random nodes
21392953 group.selection.RelinkToSupport();
2140
- CameraPane.RANDOM = random;
2954
+ CameraPane.SWITCH = random;
21412955
21422956 refreshContents();
21432957 } else
....@@ -2152,9 +2966,9 @@
21522966 } else
21532967 if (source == setMasterItem)
21542968 {
2155
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2969
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21562970 {
2157
- Object3D content = GrafreeD.clipboard.get(0);
2971
+ Object3D content = Grafreed.clipboard.get(0);
21582972
21592973 if (content instanceof cGroup && ((cGroup)content).transientlink )
21602974 content = ((cGroup)content).get(0);
....@@ -2167,9 +2981,9 @@
21672981 {
21682982 if (group.selection.size() == 1)
21692983 {
2170
- if (GrafreeD.clipboard.size() == 1)
2984
+ if (Grafreed.clipboard.size() == 1)
21712985 {
2172
- Object3D content = GrafreeD.clipboard.get(0);
2986
+ Object3D content = Grafreed.clipboard.get(0);
21732987
21742988 if (content instanceof cGroup && ((cGroup)content).transientlink )
21752989 content = ((cGroup)content).get(0);
....@@ -2186,7 +3000,7 @@
21863000 {
21873001 RevertMeshes();
21883002 } else
2189
- if (source == resetMeshItem)
3003
+ if (source == resetAllItem)
21903004 {
21913005 ResetAll();
21923006 } else
....@@ -2194,7 +3008,7 @@
21943008 {
21953009 StepAll();
21963010 } else
2197
- if (source == clearItem) // || event.getSource() == clearButton)
3011
+ if (source == deleteItem) // || event.getSource() == clearButton)
21983012 {
21993013 //int indices[] = jList.getSelectedIndices();
22003014 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2206,9 +3020,9 @@
22063020 {
22073021 ClearSelection(true);
22083022 } else
2209
- if (source == grabItem)
3023
+ if (source == grabItem || source == groupButton)
22103024 {
2211
- group(new cGroup(), true);
3025
+ group(new cGroup(), false); // true);
22123026 } else
22133027 if (source == hideItem)
22143028 {
....@@ -2226,11 +3040,11 @@
22263040 {
22273041 makeSomething(new Camera());
22283042 } else
2229
- if (source == compositeItem)
3043
+ if (source == compositeItem || source == compositeButton)
22303044 {
22313045 group(new Composite());
22323046 } else
2233
- if (source == randomItem)
3047
+ if (source == switchItem || source == switchButton)
22343048 {
22353049 RandomNode random = new RandomNode();
22363050 group(random);
....@@ -2332,7 +3146,7 @@
23323146 {
23333147 group(new cLinker());
23343148 } else
2335
- if (source == textureItem)
3149
+ if (source == textureItem || source == textureButton)
23363150 {
23373151 group(new TextureNode());
23383152 } else
....@@ -2352,17 +3166,30 @@
23523166 {
23533167 CastShadow(2);
23543168 } else
2355
- if (source == ungroupItem)
3169
+ if (source == ungroupItem || source == ungroupButton)
23563170 {
2357
- //ungroup();
3171
+ boolean hasRoot = false;
3172
+
23583173 for (int i=0; i<group.selection.size(); i++)
23593174 {
2360
- Ungroup(group.selection.get(i));
3175
+ if (group.selection.get(i) == group)
3176
+ {
3177
+ hasRoot = true;
3178
+ break;
3179
+ }
23613180 }
23623181
2363
- ClearSelection(false);
2364
-
2365
- 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
+ }
23663193 } else
23673194 if (source == genUVItem)
23683195 {
....@@ -2374,7 +3201,7 @@
23743201 } else
23753202 if (source == genNormalsMESHItem)
23763203 {
2377
- GenNormals(true); // TODO
3204
+ GenNormalsMESH();
23783205 } else
23793206 if (source == genNormalsORGANItem)
23803207 {
....@@ -2439,6 +3266,22 @@
24393266 if (source == unmarkleavesItem)
24403267 {
24413268 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);
24423285 } else
24433286 if (source == flipVItem)
24443287 {
....@@ -2524,9 +3367,13 @@
25243367 {
25253368 SmoothMesh();
25263369 } else
2527
- if (source == transformgeometryItem)
3370
+ if (source == transformGeometryItem)
25283371 {
25293372 TransformGeometry();
3373
+ } else
3374
+ if (source == transformChildrenItem)
3375
+ {
3376
+ TransformChildren();
25303377 } else
25313378 if (source == resetTransformItem)
25323379 {
....@@ -2534,7 +3381,11 @@
25343381 } else
25353382 if (source == resetCentroidItem)
25363383 {
2537
- ResetCentroid();
3384
+ ResetCentroid(true);
3385
+ } else
3386
+ if (source == resetCentroidXZItem)
3387
+ {
3388
+ ResetCentroid(false);
25383389 } else
25393390 if (source == resetParentItem)
25403391 {
....@@ -2639,7 +3490,7 @@
26393490 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26403491 {
26413492 obj = (Object3D)e.nextElement();
2642
- obj.SetBumpTexture(null);
3493
+ obj.ResetBumpTexture();
26433494 }
26443495
26453496 refreshContents();
....@@ -2655,6 +3506,31 @@
26553506
26563507 refreshContents();
26573508 } 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
26583534 if (source == flashSelectionButton)
26593535 {
26603536 CameraPane.flash = true;
....@@ -2666,6 +3542,10 @@
26663542 if (source == twoButton)
26673543 {
26683544 radio.layout = twoButton;
3545
+
3546
+ if (CameraPane.FULLSCREEN)
3547
+ fullscreenLayout = radio.layout;
3548
+
26693549 // bug
26703550 //gridPanel.setDividerLocation(1.0);
26713551 //bigPanel.setDividerLocation(0.0);
....@@ -2698,10 +3578,31 @@
26983578 bigThree.ClearUI();
26993579 bigThree.add(centralPanel);
27003580 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
+
27013599 } else
27023600 if (source == threeButton)
27033601 {
27043602 radio.layout = threeButton;
3603
+
3604
+ if (CameraPane.FULLSCREEN)
3605
+ fullscreenLayout = radio.layout;
27053606
27063607 // bigThree.remove(scenePanel);
27073608 // bigThree.remove(centralPanel);
....@@ -2731,13 +3632,18 @@
27313632 // centralPanel.setVisible(true);
27323633 // XYZPanel.setVisible(true);
27333634 bigThree.ClearUI();
3635
+ bigThree.add(scenePanel);
27343636 bigThree.add(centralPanel);
2735
- bigThree.add(XYZPanel);
27363637 bigThree.FlushUI();
3638
+
3639
+ cameraView.requestFocusInWindow();
27373640 } else
27383641 if (source == fourButton)
27393642 {
27403643 radio.layout = fourButton;
3644
+
3645
+ if (CameraPane.FULLSCREEN)
3646
+ fullscreenLayout = radio.layout;
27413647
27423648 // bigThree.remove(scenePanel);
27433649 // bigThree.remove(centralPanel);
....@@ -2769,10 +3675,15 @@
27693675 bigThree.ClearUI();
27703676 bigThree.add(scenePanel);
27713677 bigThree.FlushUI();
3678
+
3679
+ cameraView.requestFocusInWindow();
27723680 } else
27733681 if (source == sixButton)
27743682 {
27753683 radio.layout = sixButton;
3684
+
3685
+ if (CameraPane.FULLSCREEN)
3686
+ fullscreenLayout = radio.layout;
27763687
27773688 // bigThree.remove(scenePanel);
27783689 // bigThree.remove(centralPanel);
....@@ -2802,13 +3713,18 @@
28023713 // centralPanel.setVisible(true);
28033714 // XYZPanel.setVisible(false);
28043715 bigThree.ClearUI();
2805
- bigThree.add(scenePanel);
28063716 bigThree.add(centralPanel);
3717
+ bigThree.add(scenePanel);
28073718 bigThree.FlushUI();
3719
+
3720
+ cameraView.requestFocusInWindow();
28083721 } else
28093722 if (source == sevenButton)
28103723 {
28113724 radio.layout = sevenButton;
3725
+
3726
+ if (CameraPane.FULLSCREEN)
3727
+ fullscreenLayout = radio.layout;
28123728
28133729 // bigThree.remove(scenePanel);
28143730 // bigThree.remove(centralPanel);
....@@ -2842,6 +3758,8 @@
28423758 bigThree.add(centralPanel);
28433759 bigThree.add(XYZPanel);
28443760 bigThree.FlushUI();
3761
+
3762
+ cameraView.requestFocusInWindow();
28453763 } else
28463764 if (source == rootButton)
28473765 {
....@@ -2853,6 +3771,7 @@
28533771 EditObject(obj);
28543772 }
28553773
3774
+ cameraView.requestFocusInWindow();
28563775 refreshContents(true);
28573776 } else
28583777 if (source == closeButton)
....@@ -2862,22 +3781,37 @@
28623781 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28633782 {
28643783 ab = (cRadio)e.nextElement();
2865
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3784
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28663785 {
3786
+ // Patch to avoid bug with transparency.
3787
+ if (!ab.hadMaterial)
3788
+ {
3789
+ ab.object.material = null;
3790
+ }
3791
+
28673792 buttonGroup.remove(ab);
28683793 radioPanel.remove(ab);
28693794
2870
- ab.GetObject().editWindow = null;
3795
+ //ab.GetObject().editWindow = null;
3796
+ ab.GetObject().manipWindow = null;
28713797 // ab.GetObject().objectUI = null; // ?????????
28723798
28733799 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28743800 break;
28753801 }
28763802 }
3803
+
3804
+ cameraView.requestFocusInWindow();
28773805 refreshContents(true);
28783806 } else
28793807 if (source == editItem || source == editButton)
28803808 {
3809
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3810
+ {
3811
+ Object3D child = (Object3D)e.nextElement();
3812
+ child.pinned = true;
3813
+ }
3814
+
28813815 EditSelection(false);
28823816 } else
28833817 if (source == uneditButton)
....@@ -2887,10 +3821,11 @@
28873821 Object3D child = (Object3D)e.nextElement();
28883822 if(child.editWindow != null)
28893823 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3824
+ child.pinned = false;
28903825 child.CloseUI();
28913826 listUI.remove(child);
28923827
2893
- child.editWindow = null; // ???????????
3828
+ //child.editWindow = null; // ???????????
28943829 }
28953830 objEditor.ctrlPanel.FlushUI();
28963831 //objEditor.jTree.clearSelection();
....@@ -2903,6 +3838,7 @@
29033838 //copy.ClearUI();
29043839 for (Object3D obj : listUI)
29053840 {
3841
+ obj.pinned = false;
29063842 obj.CloseUI();
29073843 }
29083844 listUI.clear();
....@@ -2912,7 +3848,7 @@
29123848 {
29133849 assert(copy == group);
29143850
2915
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3851
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29163852
29173853 for (Object3D obj : listUI)
29183854 {
....@@ -2961,6 +3897,9 @@
29613897 }
29623898
29633899 copy = group;
3900
+
3901
+ SetUndoStates();
3902
+
29643903 //Globals.theRenderer.object = group;
29653904 if(!useclient)
29663905 {
....@@ -2976,20 +3915,46 @@
29763915 frontView.object = group;
29773916 sideView.object = group;
29783917 }
2979
- group.editWindow = this;
3918
+
3919
+// fix "+" issue
3920
+ //group.editWindow = this;
3921
+ group.manipWindow = this;
3922
+
29803923 /*
29813924 currentLayout = radio.layout;
29823925 if (currentLayout == null)
29833926 currentLayout = sevenButton;
29843927 */
29853928 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);
29863936 keepparent = group.parent;
29873937 // PARENT = NULL or not???
29883938 //group.parent = null; // ROOT
29893939 //group.attributes = -1;
29903940 ResetModel();
3941
+
3942
+ cameraView.requestFocusInWindow();
29913943 refreshContents(true);
2992
- }
3944
+ } else if (event.getSource() == editCameraItem)
3945
+ {
3946
+ cameraView.ProtectCamera();
3947
+ cameraView.repaint();
3948
+ return;
3949
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3950
+ {
3951
+ cameraView.RevertCamera();
3952
+ cameraView.repaint();
3953
+ return;
3954
+ // } else if (event.getSource() == textureButton)
3955
+ // {
3956
+ // return; // true;
3957
+ }
29933958 else
29943959 {
29953960 //return super.action(event, arg);
....@@ -2998,7 +3963,6 @@
29983963 }
29993964
30003965 boolean useclient = false;
3001
- cRadio radio;
30023966
30033967 void ToggleRoot()
30043968 {
....@@ -3050,6 +4014,28 @@
30504014 refreshContents();
30514015 }
30524016
4017
+ void TransformChildren()
4018
+ {
4019
+ Object3D obj;
4020
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4021
+ {
4022
+ obj = (Object3D)e.nextElement();
4023
+ obj.KeepTextureMatrices();
4024
+ obj.TransformChildren();
4025
+ obj.RestoreTextureMatrices();
4026
+
4027
+// if (obj.parent == null)
4028
+// {
4029
+// System.out.println("NULL PARENT!");
4030
+// new Exception().printStackTrace();
4031
+// }
4032
+// else
4033
+// TouchTransform(obj);
4034
+// //obj.parent.Touch();
4035
+ }
4036
+
4037
+ refreshContents();
4038
+ }
30534039
30544040 void ResetTransform()
30554041 {
....@@ -3162,7 +4148,7 @@
31624148 refreshContents();
31634149 }
31644150
3165
- void ResetCentroid()
4151
+ void ResetCentroid(boolean full)
31664152 {
31674153 Object3D obj;
31684154 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3177,12 +4163,16 @@
31774163 LA.matIdentity(Object3D.mat);
31784164 obj.getBounds(minima, maxima, false);
31794165 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3180
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4166
+ if (full)
4167
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31814168 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31824169 obj.TransformMesh(Object3D.mat);
4170
+
31834171 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3184
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4172
+ if (full)
4173
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31854174 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4175
+
31864176 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31874177 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31884178 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3211,7 +4201,8 @@
32114201
32124202 int size = obj.MemorySize();
32134203
3214
- System.err.println((size/1024) + " KB is the size of " + obj);
4204
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4205
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32154206 }
32164207 }
32174208 catch (Exception e)
....@@ -3248,9 +4239,9 @@
32484239 obj = (Object3D)e.nextElement();
32494240
32504241 System.out.println("Object is: " + obj);
3251
- GrafreeD.AnalyzeObject(obj);
4242
+ Grafreed.AnalyzeObject(obj);
32524243 System.out.println("Boundary rep: " + obj.bRep);
3253
- GrafreeD.AnalyzeObject(obj.bRep);
4244
+ Grafreed.AnalyzeObject(obj.bRep);
32544245
32554246 // System.err.println((size/1024) + " KB is the size of " + obj);
32564247 }
....@@ -3292,6 +4283,13 @@
32924283 void GenNormals(boolean crease)
32934284 {
32944285 group.GenNormalsS(crease);
4286
+
4287
+ refreshContents();
4288
+ }
4289
+
4290
+ void GenNormalsMESH()
4291
+ {
4292
+ group.GenNormalsMeshS();
32954293
32964294 refreshContents();
32974295 }
....@@ -3464,8 +4462,8 @@
34644462
34654463 void ParseVertices()
34664464 {
3467
- boolean epsequal = GrafreeD.epsequal;
3468
- GrafreeD.epsequal = true;
4465
+ boolean epsequal = Grafreed.epsequal;
4466
+ Grafreed.epsequal = true;
34694467
34704468 for (int i=0; i<group.selection.size(); i++)
34714469 {
....@@ -3490,7 +4488,7 @@
34904488 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34914489 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34924490
3493
- g.add(GrafreeD.clipboard);
4491
+ g.add(Grafreed.clipboard);
34944492
34954493 buffer.add(g);
34964494 }
....@@ -3505,7 +4503,7 @@
35054503 makeSomething(buffer, i==group.selection.size()-1);
35064504 }
35074505
3508
- GrafreeD.epsequal = epsequal;
4506
+ Grafreed.epsequal = epsequal;
35094507
35104508 refreshContents();
35114509 }
....@@ -3523,7 +4521,16 @@
35234521 String pigment = Object3D.GetPigment(tex);
35244522 //String bump = Object3D.GetBump(tex);
35254523
3526
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4524
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4525
+
4526
+ try
4527
+ {
4528
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4529
+ }
4530
+ catch (Exception e)
4531
+ {
4532
+ System.err.println("FAIL: " + node);
4533
+ }
35274534
35284535 double s = v.s;
35294536
....@@ -3611,11 +4618,11 @@
36114618
36124619 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36134620
3614
- boolean random = CameraPane.RANDOM;
3615
- CameraPane.RANDOM = false; // parse all random nodes
4621
+ boolean random = CameraPane.SWITCH;
4622
+ CameraPane.SWITCH = false; // parse all random nodes
36164623 lowres.linkVerticesThis(null);
36174624 lowres.linkVerticesThis(sn);
3618
- CameraPane.RANDOM = random;
4625
+ CameraPane.SWITCH = random;
36194626
36204627 System.err.flush();
36214628
....@@ -3655,7 +4662,7 @@
36554662 return;
36564663
36574664 Object3D poses = group.selection.get(0);
3658
- Object3D ref = GrafreeD.clipboard.get(0);
4665
+ Object3D ref = Grafreed.clipboard.get(0);
36594666
36604667 Object3D newgroup = new Object3D("Po:" + poses.name);
36614668
....@@ -3849,9 +4856,9 @@
38494856
38504857 void ClipMesh()
38514858 {
3852
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4859
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38534860 {
3854
- Object3D content = GrafreeD.clipboard.get(0);
4861
+ Object3D content = Grafreed.clipboard.get(0);
38554862
38564863 if (content instanceof cGroup && ((cGroup)content).transientlink )
38574864 content = ((cGroup)content).get(0);
....@@ -3860,7 +4867,7 @@
38604867 // {
38614868 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38624869 // }
3863
- group.selection.ClipMesh(GrafreeD.clipboard);
4870
+ group.selection.ClipMesh(Grafreed.clipboard);
38644871 }
38654872 // group.selection.ClipMesh(GrafreeD.clipboard);
38664873 System.out.println("DONE.");
....@@ -3907,6 +4914,18 @@
39074914 void MarkLeaves(boolean hide)
39084915 {
39094916 group.selection.MarkLeaves(hide);
4917
+ refreshContents();
4918
+ }
4919
+
4920
+ void RewindLeaves(boolean hide)
4921
+ {
4922
+ group.selection.RewindLeaves(hide);
4923
+ refreshContents();
4924
+ }
4925
+
4926
+ void RandomLeaves(boolean hide)
4927
+ {
4928
+ group.selection.RandomLeaves(hide);
39104929 refreshContents();
39114930 }
39124931
....@@ -3981,28 +5000,25 @@
39815000 // }
39825001 // }
39835002
3984
- static boolean allparams = true;
3985
-
3986
- static Vector<Object3D> listUI = new Vector<Object3D>();
3987
-
39885003 void EditSelection(boolean newWindow)
39895004 {
5005
+ if (group.selection == null)
5006
+ {
5007
+ EditElement(group, newWindow); // ? new
5008
+ return;
5009
+ }
5010
+
39905011 // aConstraints.gridy = 0;
39915012 for (int i=0; i<group.selection.size(); i++)
39925013 {
39935014 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39945015 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3995
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5016
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39965017
39975018 Object3D elem = (Object3D)group.selection.elementAt(i);
3998
- if(elem != group)
5019
+ if(elem != group || !newWindow)
39995020 {
4000
- // if (!(elem instanceof Composite))
4001
- // newWindow = false;
4002
- listUI.add(elem);
4003
- elem.openEditWindow(this, newWindow); //, false);
4004
- System.out.println("edit : " + elem);
4005
- elem.editWindow.refreshContents(true); // ? new
5021
+ EditElement(elem, newWindow); // ? new
40065022 }
40075023 }
40085024 }
....@@ -4077,7 +5093,8 @@
40775093 //new Exception().printStackTrace();
40785094
40795095 freezemodel = true;
4080
-
5096
+ ClearUnpinned();
5097
+
40815098 /**/
40825099 //switch (event.id)
40835100 {
....@@ -4085,7 +5102,6 @@
40855102 //case 702: // Event.LIST_DESELECT
40865103 group.deselectAll();
40875104 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4088
- objEditor.ClearInfo(); // .GetMaterial());
40895105 if (tps != null)
40905106 {
40915107 for (int i=0; i < tps.length; i++)
....@@ -4094,10 +5110,8 @@
40945110
40955111 //if (child.parent != null)
40965112 //child.parent.addSelectee(child);
5113
+ objEditor.SetMaterial(child);
40975114 group.addSelectee(child);
4098
- objEditor.SetMaterial(child); // .GetMaterial());
4099
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4100
- System.err.println("info : " + child.GetPath());
41015115 }
41025116 }
41035117 // else
....@@ -4107,20 +5121,28 @@
41075121 // System.err.println("info : " + group.GetPath());
41085122 // }
41095123
4110
- objEditor.SetText(); // jan 2014
4111
-
4112
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5124
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41135125 CameraPane.flash = true;
41145126
4115
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5127
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41165128 // a camera
41175129 {
4118
- CameraPane.camerachangeframe = 0; // don't refuse it
4119
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5130
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5131
+ {
5132
+ CameraPane.camerachangeframe = 0; // don't refuse it
5133
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5134
+ }
41205135 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41215136 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41225137 }
41235138
5139
+ if (tps != null && tps.length == 1)
5140
+ {
5141
+ EditSelection(false);
5142
+ }
5143
+
5144
+ SetPinStates(tps != null && tps.length > 0);
5145
+
41245146 refreshContents();
41255147 //return true;
41265148 }
....@@ -4129,6 +5151,35 @@
41295151
41305152 freezemodel = false;
41315153 }
5154
+
5155
+ void SetPinStates(boolean enabled)
5156
+ {
5157
+ editButton.setEnabled(enabled);
5158
+ uneditButton.setEnabled(enabled);
5159
+ unselectButton.setEnabled(enabled);
5160
+ flashSelectionButton.setEnabled(enabled);
5161
+ }
5162
+
5163
+ void refreshContents(boolean cp)
5164
+ {
5165
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5166
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5167
+ {
5168
+ objEditor.ClearInfo(); // .GetMaterial());
5169
+
5170
+ for (int i=0; i < group.selection.Size(); i++)
5171
+ {
5172
+ Object3D child = (Object3D) group.selection.get(i);
5173
+
5174
+ objEditor.AddInfo(child, this, true);
5175
+ System.err.println("info : " + child.GetPath());
5176
+ }
5177
+
5178
+ objEditor.SetText(); // jan 2014
5179
+ }
5180
+
5181
+ super.refreshContents(cp);
5182
+ }
41325183
41335184 void linkSomething(Object3D thing)
41345185 {
....@@ -4200,16 +5251,19 @@
42005251 {
42015252 if (group.selection.isEmpty())
42025253 return;
4203
- GrafreeD.clipboardIsTempGroup = false;
5254
+
5255
+ Grafreed.clipboardIsTempGroup = false;
42045256 Composite tGroup = null;
42055257 if (group.selection.size() > 0) // 1)
42065258 {
42075259 tGroup = new cGroup();
4208
- GrafreeD.clipboardIsTempGroup = true;
5260
+ Grafreed.clipboardIsTempGroup = true;
42095261 }
42105262
42115263 if (cut)
42125264 {
5265
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5266
+// Save();
42135267 //int indices[] = jList.getSelectedIndices();
42145268 //for (int i = indices.length - 1; i >= 0; i--)
42155269 //jList.remove(indices[i]);
....@@ -4245,16 +5299,16 @@
42455299 //System.out.println("cut " + child);
42465300 //System.out.println("parent = " + child.parent);
42475301 // tmp.addChild(child);
4248
- if (GrafreeD.clipboardIsTempGroup)
5302
+ if (Grafreed.clipboardIsTempGroup)
42495303 tGroup.add/*Child*/(tmp);
42505304 else
4251
- GrafreeD.clipboard = tmp;
5305
+ Grafreed.clipboard = tmp;
42525306 }
42535307 else
4254
- if (GrafreeD.clipboardIsTempGroup)
5308
+ if (Grafreed.clipboardIsTempGroup)
42555309 tGroup.add/*Child*/(child);
42565310 else
4257
- GrafreeD.clipboard = child;
5311
+ Grafreed.clipboard = child;
42585312 }
42595313
42605314 //ResetModel();
....@@ -4286,21 +5340,23 @@
42865340 //System.out.println("cut " + elem);
42875341 //System.out.println("parent = " + elem.parent);
42885342 // tmp.addChild(elem);
4289
- if (GrafreeD.clipboardIsTempGroup)
5343
+ if (Grafreed.clipboardIsTempGroup)
42905344 tGroup.add/*Child*/(tmp);
42915345 else
4292
- GrafreeD.clipboard = tmp;
5346
+ Grafreed.clipboard = tmp;
42935347 }
42945348 else
4295
- if (GrafreeD.clipboardIsTempGroup)
5349
+ if (Grafreed.clipboardIsTempGroup)
42965350 tGroup.add/*Child*/(child);
42975351 else
4298
- GrafreeD.clipboard = child;
5352
+ Grafreed.clipboard = child;
42995353 }
43005354
43015355 }
4302
- if (GrafreeD.clipboardIsTempGroup)
4303
- GrafreeD.clipboard = tGroup;
5356
+
5357
+ if (Grafreed.clipboardIsTempGroup)
5358
+ Grafreed.clipboard = tGroup;
5359
+
43045360 if (cut)
43055361 {
43065362 ResetModel();
....@@ -4310,11 +5366,15 @@
43105366
43115367 void paste(boolean expand)
43125368 {
5369
+ if (Globals.REPLACEONMAKE)
5370
+ Save();
5371
+ boolean keep = Globals.REPLACEONMAKE;
5372
+ Globals.REPLACEONMAKE = false;
43135373 // if (GrafreeD.clipboard == null)
43145374 // return;
43155375 boolean first = true;
43165376
4317
- if (GrafreeD.clipboardIsTempGroup)
5377
+ if (Grafreed.clipboardIsTempGroup)
43185378 {
43195379 Composite temp;
43205380
....@@ -4325,7 +5385,7 @@
43255385 temp = (Composite)Applet3D.clipboard.deepCopy();
43265386 */
43275387 Object3D elem;
4328
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5388
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43295389 {
43305390 Object3D child = (Object3D)e.nextElement();
43315391
....@@ -4359,21 +5419,22 @@
43595419 //Object3D cb = Applet3D.clipboard;
43605420 //temp.addChild(cb);
43615421 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4362
- assert(GrafreeD.clipboard.parent == null);
4363
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4364
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4365
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4366
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5422
+ assert(Grafreed.clipboard.parent == null);
5423
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5424
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5425
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5426
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43675427 else
4368
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4369
- GrafreeD.clipboard.get(0).parent = keepparent;
5428
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5429
+ Grafreed.clipboard.get(0).parent = keepparent;
43705430 }
43715431
5432
+ Globals.REPLACEONMAKE = keep;
43725433 ResetModel();
43735434 refreshContents();
43745435 }
43755436
4376
- void pasteInto(boolean copyit)
5437
+ void pasteInto(boolean copyit, boolean clone)
43775438 {
43785439 // if (GrafreeD.clipboard == null)
43795440 // return;
....@@ -4402,15 +5463,22 @@
44025463 if (copyit)
44035464 {
44045465 // paste(false);
4405
- CloneClipboard(false); // sept 2014
5466
+ if (clone)
5467
+ {
5468
+ CloneClipboard(false); // sept 2014
5469
+ }
5470
+ else
5471
+ {
5472
+ paste(false);
5473
+ }
44065474 }
44075475 else
44085476 {
44095477 boolean first = true;
44105478
4411
- if (GrafreeD.clipboardIsTempGroup)
5479
+ if (Grafreed.clipboardIsTempGroup)
44125480 {
4413
- Composite temp = (Composite)GrafreeD.clipboard;
5481
+ Composite temp = (Composite)Grafreed.clipboard;
44145482 Object3D copy;
44155483 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44165484 {
....@@ -4420,7 +5488,7 @@
44205488 }
44215489 } else
44225490 {
4423
- linkSomething(GrafreeD.clipboard); //.get(0));
5491
+ linkSomething(Grafreed.clipboard); //.get(0));
44245492 }
44255493 }
44265494 }
....@@ -4497,6 +5565,10 @@
44975565
44985566 void group(Object3D csg, boolean grab)
44995567 {
5568
+ if (Globals.REPLACEONMAKE)
5569
+ Save();
5570
+ boolean keep = Globals.REPLACEONMAKE;
5571
+ Globals.REPLACEONMAKE = false;
45005572 if (//false) // why??
45015573 !group.selection.isEmpty())
45025574 {
....@@ -4610,10 +5682,15 @@
46105682 //node.add(csg);
46115683 //makeSomething(node);
46125684 makeSomething(csg);
5685
+ Globals.REPLACEONMAKE = keep;
46135686 }
46145687
46155688 void Ungroup(Object3D g)
46165689 {
5690
+ if (Globals.REPLACEONMAKE)
5691
+ Save();
5692
+ boolean keep = Globals.REPLACEONMAKE;
5693
+ Globals.REPLACEONMAKE = false;
46175694 if (g instanceof HiddenObject)
46185695 {
46195696 HiddenObject h = (HiddenObject) g;
....@@ -4630,6 +5707,7 @@
46305707 objEditor.makeSomething(g.get(i), false);
46315708 }
46325709 }
5710
+ Globals.REPLACEONMAKE = keep;
46335711 }
46345712
46355713 void ungroup()
....@@ -4825,21 +5903,6 @@
48255903 }
48265904 */
48275905
4828
- void ImportGFD()
4829
- {
4830
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4831
- browser.show();
4832
- String filename = browser.getFile();
4833
- if (filename != null && filename.length() > 0)
4834
- {
4835
- String fullname = browser.getDirectory() + filename;
4836
-
4837
- //Object3D readobj =
4838
- objEditor.ReadGFD(fullname, objEditor);
4839
- //makeSomething(readobj);
4840
- }
4841
- }
4842
-
48435906 /*
48445907 public void Callback(Object obj)
48455908 {
....@@ -4863,26 +5926,9 @@
48635926 }
48645927 */
48655928
4866
- void ImportVRMLX3D()
4867
- {
4868
- if (GrafreeD.standAlone)
4869
- {
4870
- /**/
4871
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4872
- browser.show();
4873
- String filename = browser.getFile();
4874
- if (filename != null && filename.length() > 0)
4875
- {
4876
- String fullname = browser.getDirectory() + filename;
4877
- LoadVRMLX3D(fullname);
4878
- }
4879
- /**/
4880
- }
4881
- }
4882
-
48835929 String GetFile(String dialogName)
48845930 {
4885
- if (GrafreeD.standAlone)
5931
+ if (Grafreed.standAlone)
48865932 {
48875933 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48885934 browser.show();
....@@ -4950,6 +5996,45 @@
49505996 cButton clearpanelButton;
49515997 cButton unselectButton;
49525998
5999
+ cButton restoreCameraButton;
6000
+
6001
+ cButton saveButton;
6002
+ cButton oneStepButton;
6003
+
6004
+ cButton groupButton;
6005
+ cButton ungroupButton;
6006
+ cButton compositeButton;
6007
+ cButton switchButton;
6008
+ cButton loopButton;
6009
+ cButton textureButton;
6010
+
6011
+ cButton skybox1Button;
6012
+ cButton skybox2Button;
6013
+ cButton skybox3Button;
6014
+ cButton skybox4Button;
6015
+ cButton skybox5Button;
6016
+ cButton skybox6Button;
6017
+ cButton skybox7Button;
6018
+
6019
+ cButton skybox11Button;
6020
+ cButton skybox12Button;
6021
+ cButton skybox13Button;
6022
+ cButton skybox14Button;
6023
+ cButton skybox15Button;
6024
+ cButton skybox16Button;
6025
+ cButton skybox17Button;
6026
+
6027
+ cButton gridButton;
6028
+ cButton boxButton;
6029
+ cButton sphereButton;
6030
+ cButton coneButton;
6031
+ cButton torusButton;
6032
+ cButton superButton;
6033
+ cButton kleinButton;
6034
+ cButton particlesButton;
6035
+ cButton overlayButton;
6036
+ cButton lightButton;
6037
+
49536038 cButton screenfitButton;
49546039 cButton screenfitpointButton;
49556040 cButton snapobjectButton;
....@@ -4961,14 +6046,6 @@
49616046
49626047 cButton setsupportButton;
49636048
4964
- cButton twoButton;
4965
- cButton sixButton;
4966
- cButton threeButton;
4967
- cButton sevenButton;
4968
- cButton fourButton; // full panel
4969
- cButton oneButton; // full XYZ
4970
- //cButton currentLayout;
4971
-
49726049 //
49736050 //Composite
49746051 Object3D // to do !!
....@@ -4978,9 +6055,11 @@
49786055 //JTree jTree;
49796056 private MenuItem lookAtItem;
49806057 private MenuItem lookFromItem;
4981
- private MenuItem switchItem;
6058
+ private MenuItem switchViewItem;
49826059 private MenuItem cutItem;
4983
- private MenuItem duplicateItem;
6060
+ private MenuItem undoItem;
6061
+ private MenuItem redoItem;
6062
+ private JMenuItem duplicateItem;
49846063 private MenuItem cloneItem;
49856064 private MenuItem cloneSupportItem;
49866065 private MenuItem overwriteGeoItem;
....@@ -4993,7 +6072,7 @@
49936072 private MenuItem linkverticesItem;
49946073 private MenuItem relinkverticesItem;
49956074 private MenuItem setMasterItem;
4996
- private MenuItem resetMeshItem;
6075
+ private MenuItem resetAllItem;
49976076 private MenuItem stepAllItem;
49986077 private MenuItem revertMeshItem;
49996078 private MenuItem poseMeshItem;
....@@ -5004,10 +6083,11 @@
50046083 private MenuItem mergeGeometriesItem;
50056084 private MenuItem copyItem;
50066085 private MenuItem pasteItem;
6086
+ private MenuItem pasteIntoItem;
50076087 private MenuItem pasteLinkItem;
50086088 private MenuItem pasteCloneItem;
50096089 private MenuItem pasteExpandItem;
5010
- private MenuItem clearItem;
6090
+ private MenuItem deleteItem;
50116091 private MenuItem clearAllItem;
50126092 private MenuItem genUVItem;
50136093 private MenuItem genNormalsMESHItem;
....@@ -5042,6 +6122,10 @@
50426122 private MenuItem showleavesItem;
50436123 private MenuItem markleavesItem;
50446124 private MenuItem unmarkleavesItem;
6125
+ private MenuItem rewindleavesItem;
6126
+ private MenuItem unrewindleavesItem;
6127
+ private MenuItem randomleavesItem;
6128
+ private MenuItem unrandomleavesItem;
50456129
50466130 private MenuItem flipVItem;
50476131 private MenuItem unflipVItem;
....@@ -5053,15 +6137,17 @@
50536137 private MenuItem panoTexturesItem;
50546138
50556139 private MenuItem resetCentroidItem;
5056
- private MenuItem transformgeometryItem;
6140
+ private MenuItem resetCentroidXZItem;
50576141 private MenuItem resetTransformItem;
6142
+ private MenuItem transformGeometryItem;
6143
+ private MenuItem transformChildrenItem;
50586144 private MenuItem hideItem;
50596145 private MenuItem grabItem;
50606146 private MenuItem backItem;
50616147 private MenuItem frontItem;
50626148 private MenuItem cameraItem;
50636149 private MenuItem compositeItem;
5064
- private MenuItem randomItem;
6150
+ private MenuItem switchItem;
50656151 private MenuItem physicsItem;
50666152 private MenuItem frameselectorItem;
50676153 private MenuItem scriptNodeItem;
....@@ -5085,6 +6171,8 @@
50856171 private MenuItem attachBumpItem;
50866172 private MenuItem detachBumpItem;
50876173 private MenuItem pigmentBumpItem;
6174
+ private MenuItem embedTexturesItem;
6175
+ private MenuItem deEmbedTexturesItem;
50886176
50896177 private MenuItem particleItem;
50906178 private MenuItem ragdollItem;
....@@ -5101,7 +6189,7 @@
51016189 private MenuItem blobItem;
51026190 private MenuItem latheItem;
51036191 private MenuItem bezierItem;
5104
- private MenuItem checkerItem;
6192
+ private MenuItem overlayItem;
51056193 private MenuItem meshItem;
51066194 // private MenuItem meshGroupItem;
51076195 private MenuItem springItem;
....@@ -5123,11 +6211,6 @@
51236211 private MenuItem doubleItem;
51246212 private MenuItem tripleItem;
51256213
5126
- private MenuItem importGFDItem;
5127
- private MenuItem importVRMLX3DItem;
5128
- private MenuItem import3DSItem;
5129
- private MenuItem importOBJItem;
5130
-
51316214 private MenuItem computeAOItem;
51326215 private MenuItem recompileItem;
51336216 private MenuItem editScriptItem;
....@@ -5137,4 +6220,8 @@
51376220 private MenuItem analyzeItem;
51386221 private MenuItem dumpItem;
51396222 //boolean freezemodel = false;
6223
+
6224
+ Menu cameraMenu;
6225
+ MenuItem editCameraItem;
6226
+ MenuItem restoreCameraItem;
51406227 }