Normand Briere
2019-07-30 475f8cbdbd96fdbf8f5b216ffebb31a51f25c2f9
GroupEditor.java
....@@ -12,6 +12,7 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
....@@ -22,6 +23,240 @@
2223 DragGestureListener, DragSourceListener, DropTargetListener,
2324 ItemListener // ListSelectionListener
2425 {
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("default", "skycube", 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("park", "Stairs", 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", "Ryfjallet", row4);
148
+ AddSkyboxButton("mountain", "Teide", row4);
149
+ AddSkyboxButton("park", "Tantolunden4", row4);
150
+
151
+ AddSkyboxButton("penguins", "wrath", row5);
152
+ AddSkyboxButton("penguins", "yonder", row5);
153
+ AddSkyboxButton("rocky", "Langholmen", row5);
154
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
155
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
156
+
157
+ AddSkyboxButton("default", "CloudyHills", row6);
158
+ AddSkyboxButton("daz", "Autumn", row6);
159
+ AddSkyboxButton("daz", "Greenlands", row6);
160
+ AddSkyboxButton("daz", "MountainTrail", row6);
161
+ AddSkyboxButton("daz", "Oasis", row6);
162
+ /*
163
+Autumn
164
+Greenlands
165
+MountainTrail
166
+Oasis
167
+TheRock
168
+TopOfTheWorld
169
+Winter
170
+ */
171
+
172
+ tab0.add(row0);
173
+ tab0.add(row1);
174
+ tab0.add(row2);
175
+ tab0.add(row3);
176
+ tab0.add(row4);
177
+ tab0.add(row5);
178
+ tab0.add(row6);
179
+
180
+ for (int i=5; --i>=0;)
181
+ {
182
+ //oe.toolboxPanel.Return();
183
+ //tab0.add(new cGridBag());
184
+ }
185
+ }
186
+
187
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
188
+ {
189
+ cGridBag tab0 = new cGridBag().setVertical(true);
190
+
191
+ tab0.setName("Night");
192
+ skyboxpanel.add(tab0);
193
+
194
+ cGridBag row0 = new cGridBag();
195
+ cGridBag row1 = new cGridBag();
196
+ cGridBag row2 = new cGridBag();
197
+ cGridBag row3 = new cGridBag();
198
+ cGridBag row4 = new cGridBag();
199
+ cGridBag row5 = new cGridBag();
200
+ cGridBag row6 = new cGridBag();
201
+
202
+ AddSkyboxButton("night", "NightPath", row0);
203
+ AddSkyboxButton("night", "PondNight", row0);
204
+ AddSkyboxButton("night", "Powerlines", row0);
205
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
206
+
207
+ AddSkyboxButton("urban", "CNTower", row1);
208
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
209
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
210
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
211
+
212
+ AddSkyboxButton("penguins", "kenon_star", row2);
213
+ AddSkyboxButton("indoors", "DallasW", row2);
214
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row2);
215
+ AddSkyboxButton("indoors", "Vasa", row2);
216
+
217
+ AddSkyboxButton("winter", "Backyard", row3);
218
+ AddSkyboxButton("winter", "Creek", row3);
219
+ AddSkyboxButton("winter", "FootballField3", row3);
220
+ AddSkyboxButton("winter", "Forest", row3);
221
+
222
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
223
+ AddSkyboxButton("winter", "House", row4);
224
+ AddSkyboxButton("winter", "IceLake", row4);
225
+ AddSkyboxButton("winter", "IceRiver", row4);
226
+
227
+ AddSkyboxButton("winter", "Park3", row5);
228
+ AddSkyboxButton("winter", "PondWinter", row5);
229
+ AddSkyboxButton("winter", "Tantolunden5", row5);
230
+ AddSkyboxButton("winter", "Vindelalven", row5);
231
+
232
+ AddSkyboxButton("daz", "TheRock", row6);
233
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
234
+ AddSkyboxButton("daz", "Winter", row6);
235
+ AddSkyboxButton("penguins", "desertdawn", row6);
236
+
237
+ tab0.add(row0);
238
+ tab0.add(row1);
239
+ tab0.add(row2);
240
+ tab0.add(row3);
241
+ tab0.add(row4);
242
+ tab0.add(row5);
243
+ tab0.add(row6);
244
+
245
+ for (int i=5; --i>=0;)
246
+ {
247
+ //oe.toolboxPanel.Return();
248
+ //tab0.add(new cGridBag());
249
+ }
250
+ }
251
+
252
+ public void ChangeSkybox(String name)
253
+ {
254
+ //cameraView.envyoff = false;
255
+ group.skyboxname = name;
256
+ group.skyboxext = "jpg";
257
+ cameraView.repaint();
258
+ }
259
+
25260 //ObjEditor objEditor;
26261 public void closeUI2()
27262 {
....@@ -59,6 +294,12 @@
59294 this.copy = this.group = group;
60295 //selectees = this.group.selectees;
61296
297
+ if (copy.versions == null)
298
+ {
299
+ copy.versions = new byte[100][];
300
+ copy.versionindex = -1;
301
+ }
302
+
62303 if(ui)
63304 SetupUI(objEditor);
64305 }
....@@ -73,16 +314,28 @@
73314 this.copy = this.group = copy;
74315 //selectees = this.group.selectees;
75316
76
- SetupMenu2(objEditor);
317
+ SetupMenu2(this); //objEditor);
77318 SetupUI2(objEditor);
78319 objEditor.SetupUI(true);
79320 SetupViews(objEditor);
80321
81322 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
323
+
324
+ if (copy.versions == null)
325
+ {
326
+ copy.versions = new byte[100][];
327
+ copy.versionindex = -1;
328
+
329
+ Save(true);
330
+ }
82331 }
83332
84333 void CloneSelection(boolean supports)
85334 {
335
+ if (Globals.REPLACEONMAKE)
336
+ Save();
337
+ boolean keep = Globals.REPLACEONMAKE;
338
+ Globals.REPLACEONMAKE = false;
86339 // Object3D keep = GrafreeD.clipboard;
87340 //Object3D obj;
88341 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +346,19 @@
93346
94347 makeSomething(clone, i==group.selection.size()-1);
95348 }
349
+ Globals.REPLACEONMAKE = keep;
96350 }
97351
98352 void CloneClipboard(boolean supports)
99353 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
354
+ assert(Grafreed.clipboard.parent == null);
355
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
356
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
357
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
358
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105359 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
360
+ makeSomething(CloneObject(Grafreed.clipboard, false));
361
+ Grafreed.clipboard.get(0).parent = keepparent;
108362 }
109363
110364 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +372,7 @@
118372 // obj.support = null;
119373 if (!supports)
120374 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
375
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122376 obj.parent = parent;
123377 // obj.support = support;
124378 // clone.support = support; // aout 2013
....@@ -147,30 +401,29 @@
147401
148402 //JTextField nameField;
149403
150
- void SetupMenu2(ObjEditor oe)
404
+ void SetupMenu2(GroupEditor oe)
151405 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
406
+ oe.jTree = new cTree();
407
+
163408 Menu menu;
164409 oe.menuBar.add(menu = new Menu("Edit"));
165410 //editItem = menu.add(new MenuItem("Edit"));
166411 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
412
+
413
+// undoItem = menu.add(new MenuItem("Undo"));
414
+// undoItem.addActionListener(this);
415
+// redoItem = menu.add(new MenuItem("Redo"));
416
+// redoItem.addActionListener(this);
417
+// menu.add("-");
418
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168419 duplicateItem.addActionListener(this);
169
- menu.add("-");
170420 cloneItem = menu.add(new MenuItem("Clone"));
171421 cloneItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
172424 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173425 cloneSupportItem.addActionListener(this);
426
+ }
174427 menu.add("-");
175428 cutItem = menu.add(new MenuItem("Cut"));
176429 cutItem.addActionListener(this);
....@@ -178,27 +431,123 @@
178431 copyItem.addActionListener(this);
179432 pasteItem = menu.add(new MenuItem("Paste"));
180433 pasteItem.addActionListener(this);
434
+
435
+ menu.add("-");
436
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
437
+ pasteIntoItem.addActionListener(this);
181438 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182439 pasteLinkItem.addActionListener(this);
183440 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184441 pasteCloneItem.addActionListener(this);
185442 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186443 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
444
+ menu.add("-");
445
+ deleteItem = menu.add(new MenuItem("Delete"));
446
+ deleteItem.addActionListener(this);
447
+
448
+ if (Globals.ADVANCED)
449
+ {
450
+ // Deletes the cameras...
189451 clearAllItem = menu.add(new MenuItem("Clear All"));
190452 clearAllItem.addActionListener(this);
453
+ }
454
+
455
+ menuBar.add(cameraMenu = new Menu("View"));
456
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
457
+ //zBufferItem.addActionListener(this);
458
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
459
+ //normalLensItem.addActionListener(this);
460
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
461
+ restoreCameraItem.addActionListener(this);
462
+
463
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
464
+// toggleFullScreenItem.addItemListener(this);
465
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
466
+// cameraMenu.add("-");
467
+//
468
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
469
+// toggleTextureItem.addItemListener(this);
470
+// toggleTextureItem.setState(CameraPane.textureon);
471
+//
472
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
473
+// toggleSwitchItem.addItemListener(this);
474
+// toggleSwitchItem.setState(CameraPane.SWITCH);
475
+
476
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
477
+ toggleHandleItem.addItemListener(this);
478
+ toggleHandleItem.setState(CameraPane.HANDLES);
479
+
480
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
481
+ togglePaintItem.addItemListener(this);
482
+ togglePaintItem.setState(CameraPane.PAINTMODE);
483
+
484
+ if (Globals.ADVANCED)
485
+ {
486
+ cameraMenu.add("-");
487
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
488
+ toggleLiveItem.addItemListener(this);
489
+ toggleLiveItem.setState(Globals.isLIVE());
191490
491
+ cameraMenu.add(stepItem = new MenuItem("Step"));
492
+ stepItem.addActionListener(this);
493
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
494
+ // toggleDLItem.addItemListener(this);
495
+ // toggleDLItem.setState(false);
496
+
497
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
498
+ toggleRenderItem.addItemListener(this);
499
+ toggleRenderItem.setState(!CameraPane.frozen);
500
+
501
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
502
+ toggleDebugItem.addItemListener(this);
503
+ toggleDebugItem.setState(Globals.DEBUG);
504
+
505
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
506
+ toggleFrustumItem.addItemListener(this);
507
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
508
+
509
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
510
+ toggleFootContactItem.addItemListener(this);
511
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
512
+
513
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
514
+ toggleTimelineItem.addItemListener(this);
515
+ }
516
+
517
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
518
+// toggleRootItem.addItemListener(this);
519
+// toggleRootItem.setState(false);
520
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
521
+// animationItem.addItemListener(this);
522
+// animationItem.setState(CameraPane.ANIMATION);
523
+ cameraMenu.add("-");
524
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
525
+ editCameraItem.addActionListener(this);
526
+
527
+ if (Globals.ADVANCED)
528
+ {
529
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
530
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
531
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
532
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
533
+ oe.cameraMenu.add("-");
534
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
535
+ openWindowItem.addActionListener(this);
536
+ editLeafItem.addActionListener(this);
537
+ lookAtItem.addActionListener(this);
538
+ //lookFromItem.addActinoListener(this);
539
+ //switchViewItem.addActionListener(this);
540
+ }
541
+
192542 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
543
+ if (Globals.ADVANCED)
544
+ {
197545 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198546 revertMeshItem.addActionListener(this);
199547 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200548 resetreferencesItem.addActionListener(this);
201549 menu.add("-");
550
+ }
202551 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203552 overwriteGeoItem.addActionListener(this);
204553 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,73 +559,104 @@
210559 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211560 overwriteUVItem.addActionListener(this);
212561 menu.add("-");
562
+ if (Globals.ADVANCED)
563
+ {
213564 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214565 generateMeshItem.addActionListener(this);
215566 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216567 poseMeshItem.addActionListener(this);
217568 menu.add("-");
569
+ }
218570 resetsupportItem = menu.add(new MenuItem("Reset support"));
219571 resetsupportItem.addActionListener(this);
220572 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221573 linkverticesItem.addActionListener(this);
574
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
575
+ relinkverticesItem.addActionListener(this);
576
+
577
+ if (Globals.ADVANCED)
578
+ {
222579 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223580 setMasterItem.addActionListener(this);
581
+ }
224582
225583 oe.menuBar.add(menu = new Menu("Group"));
226
- grabItem = menu.add(new MenuItem("Grab"));
227
- grabItem.addActionListener(this);
584
+// grabItem = menu.add(new MenuItem("Grab"));
585
+// grabItem.addActionListener(this);
228586 backItem = menu.add(new MenuItem("Back"));
229587 backItem.addActionListener(this);
230588 frontItem = menu.add(new MenuItem("Front"));
231589 frontItem.addActionListener(this);
232
- compositeItem = menu.add(new MenuItem("Composite"));
233
- compositeItem.addActionListener(this);
234
- menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
236
- randomItem.addActionListener(this);
237
- physicsItem = menu.add(new MenuItem("Physics"));
238
- physicsItem.addActionListener(this);
239
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
240
- frameselectorItem.addActionListener(this);
590
+// compositeItem = menu.add(new MenuItem("Composite"));
591
+// compositeItem.addActionListener(this);
592
+
593
+ if (Globals.ADVANCED)
594
+ {
595
+ hideItem = menu.add(new MenuItem("Hidden Group"));
596
+ hideItem.addActionListener(this);
597
+ }
598
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
599
+ ungroupItem.addActionListener(this);
600
+
601
+// menu.add("-");
602
+//
603
+// switchItem = menu.add(new MenuItem("Switch node"));
604
+// switchItem.addActionListener(this);
605
+ if (Globals.ADVANCED)
606
+ {
241607 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242608 switchGeoItem.addActionListener(this);
243609 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244610 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
611
+ morphItem = menu.add(new MenuItem("Morph Group"));
246612 morphItem.addActionListener(this);
613
+
614
+ menu.add("-");
615
+ physicsItem = menu.add(new MenuItem("Physics"));
616
+ physicsItem.addActionListener(this);
617
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
618
+ frameselectorItem.addActionListener(this);
247619 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248620 scriptNodeItem.addActionListener(this);
249
- cameraItem = menu.add(new MenuItem("Camera"));
250
- cameraItem.addActionListener(this);
621
+ }
251622
252623 oe.menuBar.add(menu = new Menu("Object"));
253
- textureItem = menu.add(new MenuItem("Texture"));
254
- textureItem.addActionListener(this);
624
+// textureItem = menu.add(new MenuItem("Texture"));
625
+// textureItem.addActionListener(this);
626
+ billboardItem = menu.add(new MenuItem("Billboard"));
627
+ billboardItem.addActionListener(this);
255628 csgItem = menu.add(new MenuItem("CSG"));
256629 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
630
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258631 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
632
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260633 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
634
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262635 shadowZItem.addActionListener(this);
636
+ attributeItem = menu.add(new MenuItem("Attribute"));
637
+ attributeItem.addActionListener(this);
638
+
639
+ if (Globals.ADVANCED)
640
+ {
641
+ menu.add("-");
263642 linkerItem = menu.add(new MenuItem("Linker"));
264643 linkerItem.addActionListener(this);
265644 templateItem = menu.add(new MenuItem("Template"));
266645 templateItem.addActionListener(this);
267
- attributeItem = menu.add(new MenuItem("Attribute"));
268
- attributeItem.addActionListener(this);
269646 pointflowItem = menu.add(new MenuItem("Point Flow"));
270647 pointflowItem.addActionListener(this);
648
+ }
271649 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274650 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275651 resetTransformItem.addActionListener(this);
276652 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277653 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
654
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
655
+ resetCentroidXZItem.addActionListener(this);
656
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
657
+ transformGeometryItem.addActionListener(this);
658
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
659
+ transformChildrenItem.addActionListener(this);
280660
281661 oe.menuBar.add(menu = new Menu("Geometry"));
282662 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -287,6 +667,11 @@
287667 genNormalsCADItem.addActionListener(this);
288668 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
289669 genNormalsMESHItem.addActionListener(this);
670
+ if (Globals.ADVANCED)
671
+ {
672
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
673
+ genNormalsMINEItem.addActionListener(this);
674
+ }
290675 stripifyItem = menu.add(new MenuItem("Stripify"));
291676 stripifyItem.addActionListener(this);
292677 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -308,23 +693,34 @@
308693 reduce34MeshItem.addActionListener(this);
309694 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
310695 increaseMeshItem.addActionListener(this);
311
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
312
- smoothMeshItem.addActionListener(this);
313696 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
314697 clipMeshItem.addActionListener(this);
698
+
699
+ if (Globals.ADVANCED)
700
+ {
701
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
702
+ smoothMeshItem.addActionListener(this);
703
+ }
315704
316705 oe.menuBar.add(menu = new Menu("Attributes"));
317706 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
318707 clearMaterialsItem.addActionListener(this);
708
+ resetAllItem = menu.add(new MenuItem("Reset All"));
709
+ resetAllItem.addActionListener(this);
710
+ stepAllItem = menu.add(new MenuItem("Step All"));
711
+ stepAllItem.addActionListener(this);
319712 menu.add("-");
320713 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
321714 liveleavesItem.addActionListener(this);
322715 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
323716 unliveleavesItem.addActionListener(this);
717
+ if (Globals.ADVANCED)
718
+ {
324719 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
325720 supportleavesItem.addActionListener(this);
326721 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
327722 unsupportleavesItem.addActionListener(this);
723
+ }
328724 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
329725 hideleavesItem.addActionListener(this);
330726 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -333,6 +729,14 @@
333729 markleavesItem.addActionListener(this);
334730 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
335731 unmarkleavesItem.addActionListener(this);
732
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
733
+ rewindleavesItem.addActionListener(this);
734
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
735
+ unrewindleavesItem.addActionListener(this);
736
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
737
+ randomleavesItem.addActionListener(this);
738
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
739
+ unrandomleavesItem.addActionListener(this);
336740 menu.add("-");
337741 flipVItem = menu.add(new MenuItem("Flip V"));
338742 flipVItem.addActionListener(this);
....@@ -358,45 +762,56 @@
358762 attachBumpItem.addActionListener(this);
359763 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
360764 pigmentBumpItem.addActionListener(this);
765
+ //embedTexturesItem
361766 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
362767 detachPigmentItem.addActionListener(this);
363768 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
364769 detachBumpItem.addActionListener(this);
770
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
771
+ embedTexturesItem.addActionListener(this);
772
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
773
+ deEmbedTexturesItem.addActionListener(this);
365774 menu.add("-");
366775 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
367776 sortbysizeItem.addActionListener(this);
368777 sortbynameItem = menu.add(new MenuItem("Sort by name"));
369778 sortbynameItem.addActionListener(this);
370779 menu.add("-");
780
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
781
+ shareGeometriesItem.addActionListener(this);
782
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
783
+ mergeGeometriesItem.addActionListener(this);
784
+ if (Globals.ADVANCED)
785
+ {
786
+ // Pretty much the same as duplicate and clone.
371787 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
372788 extractGeometriesItem.addActionListener(this);
373789 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
374790 cloneGeometriesItem.addActionListener(this);
375
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
376
- shareGeometriesItem.addActionListener(this);
377
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
378
- mergeGeometriesItem.addActionListener(this);
791
+ }
379792
380793 oe.menuBar.add(menu = new Menu("Insert"));
381794 buildCreateMenu(menu);
382795
383
-
384
- oe.menuBar.add(menu = new Menu("Include"));
385
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
386
- importGFDItem.addActionListener(this);
387
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
388
- importVRMLX3DItem.addActionListener(this);
389
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
390
- importOBJItem.addActionListener(this);
391
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
392
- import3DSItem.addActionListener(this);
393
-
394796 oe.menuBar.add(menu = new Menu("Tools"));
395797 buildToolsMenu(menu);
396798 }
397799
800
+
398801 void SetupUI2(ObjEditor oe)
399802 {
803
+ // June 2019
804
+ if (oe == null)
805
+ {
806
+ //super.SetupUI2(this);
807
+ //return;
808
+ }
809
+
810
+ if (copy != group)
811
+ {
812
+ //super.SetupUI2(this);
813
+ }
814
+
400815 //new Exception().printStackTrace();
401816
402817 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -425,150 +840,238 @@
425840 oe.radioPanel.add(dummyButton);
426841 oe.buttonGroup.add(dummyButton);
427842 */
428
- aConstraints.gridy += 1;
429
- oe.aConstraints.gridwidth = 1;
430
- oe.aConstraints.gridx = 0;
843
+ cGridBag copyOptionsPanel = new cGridBag();
844
+
845
+ copyOptionsPanel.preferredHeight = 2;
431846
432
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
847
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
848
+
849
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
850
+ //minButton.setToolTipText("Minimize window");
851
+ //minButton.addActionListener(this);
852
+
853
+ if (Globals.ADVANCED)
854
+ {
855
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
856
+ maxButton.setToolTipText("Maximize window");
857
+ maxButton.addActionListener(this);
858
+ }
859
+
860
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
861
+ fullButton.setToolTipText("Full-screen window");
862
+ fullButton.addActionListener(this);
863
+
864
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
865
+ screenfitButton.setToolTipText("Screen fit");
866
+ screenfitButton.addActionListener(this);
867
+
868
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
869
+ restoreCameraButton.setToolTipText("Restore viewpoint");
870
+ restoreCameraButton.addActionListener(this);
871
+
872
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
873
+ saveButton.setToolTipText("New version");
874
+ saveButton.addActionListener(this);
875
+
876
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
877
+ undoButton.setToolTipText("Previous version");
878
+ undoButton.addActionListener(this);
879
+ undoButton.setEnabled(false);
880
+
881
+ cGridBag updown = new cGridBag().setVertical(true);
882
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
883
+ restoreButton.setToolTipText("Restore current");
884
+ restoreButton.addActionListener(this);
885
+ restoreButton.setEnabled(false);
886
+
887
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
888
+ replaceButton.setToolTipText("Replace current");
889
+ replaceButton.addActionListener(this);
890
+ replaceButton.setEnabled(false);
891
+
892
+ copyOptionsPanel.add(updown);
893
+
894
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
895
+ redoButton.setToolTipText("Next version");
896
+ redoButton.addActionListener(this);
897
+ redoButton.setEnabled(false);
898
+
899
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
900
+ liveCB.setToolTipText("Enable animation");
433901 liveCB.addItemListener(this);
434902
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
437
- supportCB.addItemListener(this);
438
-
439
- // oe.aConstraints.gridx += 1;
440
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
441
- // localCB.addItemListener(this);
442
-
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
445
- crowdCB.addItemListener(this);
446
-
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
449
- smoothCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
903
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
904
+ oneStepButton.setToolTipText("Animate one step forward");
905
+ oneStepButton.addActionListener(this);
906
+
907
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
908
+ fastCB.setToolTipText("Fast mode");
453909 fastCB.addItemListener(this);
454
- oe.aConstraints.gridx += 1;
455
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
456
- slowCB.addItemListener(this);
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
459
- boxCB.addItemListener(this);
910
+
911
+ //oe.toolboxPanel.Return();
912
+
913
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
914
+// trackCB.setToolTipText("Enable tracking");
915
+// trackCB.addItemListener(this);
460916
461
-// oe.aConstraints.gridx += 1;
462
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
463
-// speakerMocapCB.addItemListener(this);
464
-
465
- if (false)
466
- {
467
- // handled in scripts
468
- oe.aConstraints.gridx += 1;
469
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
470
- speakerCameraCB.addItemListener(this);
471
-
472
- oe.aConstraints.gridx += 1;
473
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
474
- speakerFocusCB.addItemListener(this);
475
-
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
478
- smoothfocusCB.addItemListener(this);
479
- }
480
-
481
-//oe.aConstraints.gridx += 1;
482
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
483
-// debugCB.addItemListener(this);
484
-
485
- oe.aConstraints.gridx += 1;
486
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
487
- oeilCB.addItemListener(this);
488
-
489
- oe.aConstraints.gridx += 1;
490
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
491
- lookAtCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
495
- trackCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
499
- screenfitButton.addActionListener(this);
500
- oe.aConstraints.gridx += 1;
501917 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
502918 // screenfitpointButton.addActionListener(this);
503
-// oe.aConstraints.gridx += 1;
504
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
505
- snapobjectButton.addActionListener(this);
506
- oe.aConstraints.gridx += 1;
507919
508
- //aConstraints.gridx = 0;
509
- //aConstraints.gridy += 1;
510
- oe.aConstraints.weighty = 0;
511
- oe.aConstraints.gridwidth = 1;
512
-
513
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
514
- flashSelectionButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.aConstraints.weighty = 0;
517
- oe.aConstraints.gridwidth = 1;
518
-
519
- //
520
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
521
- twoButton.addActionListener(this);
522
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
920
+ if (Globals.ADVANCED)
921
+ {
922
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
923
+ snapobjectButton.addActionListener(this);
924
+ snapobjectButton.setToolTipText("Snap Object");
925
+
926
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523927 fourButton.addActionListener(this);
524
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
525
- sixButton.addActionListener(this);
526
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
928
+ fourButton.setToolTipText("Show control panel only");
929
+ }
930
+
931
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
932
+
933
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
934
+ twoButton.setToolTipText("Show 3D view only");
935
+ twoButton.addActionListener(this);
936
+ this.fullscreenLayout = twoButton;
937
+
938
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ threeButton.setToolTipText("Show controls and 3D view");
527940 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
529
- sevenButton.addActionListener(this);
941
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
+ sixButton.setToolTipText("Show 3D view and controls");
943
+ sixButton.addActionListener(this);
944
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
+// sevenButton.setToolTipText("3-column layout");
946
+// sevenButton.addActionListener(this);
530947 //
531948
532
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
949
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ rootButton.setToolTipText("Open selection in new tab");
533951 rootButton.addActionListener(this);
534
- oe.aConstraints.gridx += 1;
535
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
952
+
953
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
954
+ closeButton.setToolTipText("Close tab");
536955 closeButton.addActionListener(this);
537956 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
538957 //clearButton.addActionListener(this);
539
- oe.aConstraints.gridx += 1;
540
-
541
- oe.aConstraints.gridx = 1; //
542
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
543
- editButton.addActionListener(this);
544
- oe.aConstraints.gridx += 1;
545
- oe.aConstraints.weighty = 0;
546
- oe.aConstraints.gridwidth = 1;
547958
548
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
959
+ cGridBag row1 = new cGridBag();
960
+
961
+ // INSERT
962
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
963
+ gridButton.setToolTipText("Create grid");
964
+ gridButton.addActionListener(this);
965
+
966
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
967
+ boxButton.setToolTipText("Create box");
968
+ boxButton.addActionListener(this);
969
+
970
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
971
+ sphereButton.setToolTipText("Create sphere");
972
+ sphereButton.addActionListener(this);
973
+
974
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
975
+ coneButton.setToolTipText("Create cone");
976
+ coneButton.addActionListener(this);
977
+
978
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
979
+ torusButton.setToolTipText("Create torus");
980
+ torusButton.addActionListener(this);
981
+
982
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
983
+ superButton.setToolTipText("Create superellipsoid");
984
+ superButton.addActionListener(this);
985
+
986
+ if (Globals.ADVANCED)
987
+ {
988
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
989
+ kleinButton.setToolTipText("Create Klein bottle");
990
+ kleinButton.addActionListener(this);
991
+ }
992
+
993
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
994
+ particlesButton.setToolTipText("Create particle system");
995
+ particlesButton.addActionListener(this);
996
+
997
+ oe.toolboxPanel.add(row1);
998
+
999
+ cGridBag row2 = new cGridBag();
1000
+
1001
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1002
+ groupButton.setToolTipText("Create group");
1003
+ groupButton.addActionListener(this);
1004
+
1005
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1006
+ compositeButton.setToolTipText("Create composite");
1007
+ compositeButton.addActionListener(this);
1008
+
1009
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1010
+ switchButton.setToolTipText("Create item switcher");
1011
+ switchButton.addActionListener(this);
1012
+
1013
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1014
+ loopButton.setToolTipText("Create loop");
1015
+ loopButton.addActionListener(this);
1016
+
1017
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ textureButton.setToolTipText("Create texture");
1019
+ textureButton.addActionListener(this);
1020
+
1021
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1022
+ overlayButton.setToolTipText("Create overlay");
1023
+ overlayButton.addActionListener(this);
1024
+
1025
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1026
+ lightButton.setToolTipText("Create light");
1027
+ lightButton.addActionListener(this);
1028
+
1029
+ oe.toolboxPanel.add(row2);
1030
+
1031
+ // ENVYMAPS
1032
+ cGridBag skyboxpane = new cGridBag();
1033
+ skyboxpane.preferredHeight = 100;
1034
+
1035
+ oe.toolboxPanel.add(skyboxpane);
1036
+
1037
+ JTabbedPane skyboxpanel = new JTabbedPane();
1038
+ skyboxpane.add(skyboxpanel);
1039
+
1040
+ AddSkyboxTab0(skyboxpanel);
1041
+ AddSkyboxTab1(skyboxpanel);
1042
+ AddSkyboxTab2(skyboxpanel);
1043
+
1044
+ // EDIT panel
1045
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1046
+ editButton.setToolTipText("Pin selection controls");
1047
+ editButton.addActionListener(this);
1048
+
1049
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ uneditButton.setToolTipText("Remove selection controls");
5491051 uneditButton.addActionListener(this);
5501052
551
- oe.aConstraints.gridx += 1;
552
- oe.aConstraints.weighty = 0;
553
- oe.aConstraints.gridwidth = 1;
554
-
555
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
556
- clearPanelButton.addActionListener(this);
557
-
558
- oe.aConstraints.gridx += 1;
559
- oe.aConstraints.weighty = 0;
560
- oe.aConstraints.gridwidth = 1;
561
-
562
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1053
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1054
+ allParamsButton.setToolTipText("Show all controle");
5631055 allParamsButton.addActionListener(this);
5641056
565
- oe.aConstraints.gridx += 1;
566
- oe.aConstraints.weighty = 0;
567
- oe.aConstraints.gridwidth = 1;
568
-
569
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
1057
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ clearPanelButton.setToolTipText("Clear edit panel");
1059
+ clearPanelButton.addActionListener(this);
1060
+
1061
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1062
+ unselectButton.setToolTipText("Unselect");
5701063 unselectButton.addActionListener(this);
5711064
1065
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1066
+ flashSelectionButton.setToolTipText("Highlight selection");
1067
+ flashSelectionButton.addActionListener(this);
1068
+
1069
+ editCommandsPanel.preferredHeight = 1;
1070
+
1071
+ SetPinStates(false);
1072
+// oe.treePanel.add(commandsPanel);
1073
+// oe.treePanel.Return();
1074
+
5721075 // oe.aConstraints.gridx += 1;
5731076 // oe.aConstraints.weighty = 0;
5741077 // oe.aConstraints.gridwidth = 1;
....@@ -580,47 +1083,32 @@
5801083 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5811084 // gcButton.addActionListener(this);
5821085
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
585
-
586
- //ctrlPanel.add(objList = new List(5, true));
587
- oe.aConstraints.gridwidth = 100;
588
- // oe.aConstraints.gridheight = 100;
589
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
590
- oe.aConstraints.gridheight = 1;
591
- oe.aConstraints.weighty = 0.5;
592
- oe.aConstraints.gridx = 0;
593
- JScrollPane jSP;
1086
+ cGridBag jSPPanel = new cGridBag();
1087
+
1088
+ JScrollPane jSP;
5941089 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
595
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1090
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5961091 ResetModel();
597
- oe.aConstraints.weighty = 0.5;
598
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
599
- oe.aConstraints.gridy += 1;
600
- oe.aConstraints.gridwidth = 1;
601
-
602
- oe.aConstraints.weighty = 0;
603
- oe.aConstraints.gridwidth = 2;
604
-
605
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
606
- colorCB.addItemListener(this);
607
- oe.aConstraints.gridx += 2;
608
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
609
- materialCB.addItemListener(this);
610
- oe.aConstraints.gridx += 2;
611
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
612
- textureCB.addItemListener(this);
613
-
614
- oe.aConstraints.gridx = 0;
615
- oe.aConstraints.gridy += 1;
6161092
1093
+ oe.treePanel.add(jSPPanel);
1094
+ oe.treePanel.Return();
1095
+
1096
+ oe.treePanel.add(copyOptionsPanel);
1097
+ oe.treePanel.Return();
1098
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1099
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1100
+ sliderPane.preferredHeight = 1;
1101
+
1102
+// mainPanel.setDividerLocation(0.1); //1.0);
1103
+ mainPanel.setResizeWeight(0.4);
1104
+
6171105 //jList.addListSelectionListener(this);
6181106 oe.jTree.addTreeSelectionListener(this);
6191107 //jTree.setRootVisible(false);
6201108 //jTree.setEditable(true);
6211109 oe.jTree.setDragEnabled(true);
6221110 //jTree.setPreferredSize(new Dimension(10,10));
623
- jSP.setPreferredSize(new Dimension(100,200));
1111
+ //jSP.setPreferredSize(new Dimension(100,200));
6241112
6251113 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6261114
....@@ -632,23 +1120,160 @@
6321120 dgr.addDragGestureListener(this);
6331121 }catch(Exception e) {}
6341122 */
635
- radio.layout = sevenButton;
1123
+ radio.layout = sixButton; // sevenButton;
6361124 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6371125 }
1126
+
1127
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1128
+ {
1129
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1130
+ colorCB.setToolTipText("Copy color when dropped");
1131
+ colorCB.addItemListener(this);
1132
+
1133
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1134
+ materialCB.setToolTipText("Copy material when dropped");
1135
+ materialCB.addItemListener(this);
1136
+
1137
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1138
+ textureCB.setToolTipText("Copy texture when dropped");
1139
+ textureCB.addItemListener(this);
1140
+
1141
+ panel.Return();
1142
+
1143
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1144
+ boxCB.setToolTipText("Display bounding boxes");
1145
+ boxCB.addItemListener(this);
1146
+
1147
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1148
+ zoomBoxCB.setToolTipText("Display only for wheel");
1149
+ zoomBoxCB.addItemListener(this);
1150
+
1151
+ if (true) // Globals.ADVANCED)
1152
+ {
1153
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1154
+// supportCB.setToolTipText("Enable rigging");
1155
+// supportCB.addItemListener(this);
1156
+
1157
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1158
+ freezeCB.setToolTipText("Fast moving camera");
1159
+ freezeCB.addItemListener(this);
1160
+
1161
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1162
+ // localCB.addItemListener(this);
1163
+
1164
+ panel.Return();
1165
+
1166
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1167
+ crowdCB.setToolTipText("Used for crowds");
1168
+ crowdCB.addItemListener(this);
1169
+
1170
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1171
+ smoothCB.setToolTipText("Snapping delay");
1172
+ smoothCB.addItemListener(this);
1173
+
1174
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1175
+ slowCB.setToolTipText("Smooth interpolation");
1176
+ slowCB.addItemListener(this);
1177
+
1178
+// constraints.gridy += 1;
1179
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1180
+// speakerMocapCB.addItemListener(this);
1181
+
1182
+ panel.Return();
1183
+
1184
+ if (false)
1185
+ {
1186
+ // handled in scripts
1187
+ //constraints.gridy += 1;
1188
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1189
+ speakerCameraCB.addItemListener(this);
1190
+
1191
+ //constraints.gridy += 1;
1192
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1193
+ speakerFocusCB.addItemListener(this);
1194
+
1195
+ //constraints.gridy += 1;
1196
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1197
+ smoothfocusCB.addItemListener(this);
1198
+ panel.Return();
1199
+ }
1200
+
1201
+//constraints.gridx += 1;
1202
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1203
+// debugCB.addItemListener(this);
1204
+
1205
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1206
+ trackCB.setToolTipText("Enable tracking target");
1207
+ trackCB.addItemListener(this);
1208
+
1209
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1210
+ oeilCB.setToolTipText("Move camera when tracking");
1211
+ oeilCB.addItemListener(this);
1212
+
1213
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1214
+ shadowCB.setToolTipText("When live compute shadows");
1215
+ shadowCB.addItemListener(this);
1216
+
1217
+ panel.Return();
1218
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1219
+ toggleTextureCB.setToolTipText("Load textures");
1220
+ toggleTextureCB.addItemListener(this);
1221
+
1222
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1223
+ toggleSwitchCB.setToolTipText("Choose a single item");
1224
+ toggleSwitchCB.addItemListener(this);
1225
+
1226
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1227
+ autokeepCB.setToolTipText("On structure change");
1228
+ autokeepCB.addItemListener(this);
1229
+
1230
+ panel.Return();
1231
+ if (Globals.ADVANCED)
1232
+ {
1233
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1234
+ lookAtCB.setToolTipText("Look-at target");
1235
+ lookAtCB.addItemListener(this);
1236
+ }
1237
+
1238
+ }
1239
+
1240
+ cGridBag fill = new cGridBag();
1241
+ fill.preferredHeight = 200;
1242
+ cGridBag fill2 = new cGridBag();
1243
+ fill2.preferredHeight = 200;
1244
+ cGridBag fill3 = new cGridBag();
1245
+ fill3.preferredHeight = 200;
1246
+
1247
+ panel.add(fill);
1248
+ panel.add(fill2);
1249
+ panel.add(fill3);
1250
+
1251
+ }
6381252
6391253 void EditObject(Object3D obj)
6401254 {
641
- cRadio dummyButton = new cRadio(obj.name);
642
- dummyButton.SetObject(obj);
643
- dummyButton.layout = sevenButton;
644
- dummyButton.SetCamera(cameraView.renderCamera, false);
645
- dummyButton.addActionListener(this);
646
- radioPanel.add(dummyButton);
647
- buttonGroup.add(dummyButton);
648
- dummyButton.doClick();
1255
+ cRadio radioButton = new cRadio(obj.name);
1256
+
1257
+ // June 2019. Patch to avoid bug with transparency.
1258
+ radioButton.hadMaterial = obj.material != null;
1259
+ if (!radioButton.hadMaterial)
1260
+ {
1261
+ obj.material = new cMaterial();
1262
+ }
1263
+
1264
+ radioButton.SetObject(obj);
1265
+ radioButton.layout = sixButton; // sevenButton;
1266
+ radioButton.SetCamera(cameraView.renderCamera, false);
1267
+ radioButton.addActionListener(this);
1268
+ radioPanel.add(radioButton);
1269
+ buttonGroup.add(radioButton);
1270
+ radioButton.doClick();
6491271 }
1272
+
6501273 void SetupViews(ObjEditor oe)
6511274 {
1275
+ theFrame = this;
1276
+
6521277 oe.SetupViews();
6531278
6541279 System.out.println("SetupViews");
....@@ -657,22 +1282,28 @@
6571282 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6581283 }
6591284
660
- JCheckBox liveCB;
661
- JCheckBox supportCB;
662
- JCheckBox localCB;
663
- JCheckBox crowdCB;
664
- JCheckBox smoothCB;
665
- JCheckBox fastCB;
666
- JCheckBox slowCB;
667
- JCheckBox boxCB;
668
- JCheckBox trackCB;
669
- JCheckBox smoothfocusCB;
1285
+ cToggleButton liveCB;
1286
+ cCheckBox supportCB;
1287
+ cCheckBox localCB;
1288
+ cCheckBox crowdCB;
1289
+ cCheckBox smoothCB;
1290
+ cToggleButton fastCB;
1291
+ cCheckBox slowCB;
1292
+ cCheckBox boxCB;
1293
+ cCheckBox zoomBoxCB;
1294
+ cCheckBox freezeCB;
1295
+ //cToggleButton trackCB;
1296
+ cCheckBox trackCB;
1297
+ cCheckBox smoothfocusCB;
6701298 // JCheckBox speakerMocapCB;
671
- JCheckBox speakerCameraCB;
672
- JCheckBox speakerFocusCB;
673
- JCheckBox debugCB;
674
- JCheckBox oeilCB;
675
- JCheckBox lookAtCB;
1299
+ cCheckBox speakerCameraCB;
1300
+ cCheckBox speakerFocusCB;
1301
+ cCheckBox debugCB;
1302
+
1303
+ cCheckBox oeilCB;
1304
+ cCheckBox shadowCB;
1305
+ cCheckBox autokeepCB;
1306
+ cCheckBox lookAtCB;
6761307
6771308 // static int COLOR = 1;
6781309 // static int MATERIAL = 2;
....@@ -680,9 +1311,9 @@
6801311
6811312 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6821313
683
- JCheckBox colorCB;
684
- JCheckBox materialCB;
685
- JCheckBox textureCB;
1314
+ cCheckBox colorCB;
1315
+ cCheckBox materialCB;
1316
+ cCheckBox textureCB;
6861317
6871318 public void itemStateChanged(ItemEvent e)
6881319 {
....@@ -707,10 +1338,10 @@
7071338 dropAttributes |= Object3D.TEXTURE;
7081339 else
7091340 dropAttributes &= ~Object3D.TEXTURE;
710
- }
711
- else if(e.getSource() == liveCB)
1341
+ } else if(e.getSource() == liveCB)
7121342 {
7131343 cameraView.ToggleLive();
1344
+ refreshContents(false);
7141345 }
7151346 else if(e.getSource() == supportCB)
7161347 {
....@@ -746,6 +1377,10 @@
7461377 cameraView.repaint();
7471378 // refreshContents();
7481379 }
1380
+ else if(e.getSource() == zoomBoxCB)
1381
+ {
1382
+ cameraView.ToggleZoomBoxMode();
1383
+ }
7491384 else if(e.getSource() == smoothfocusCB)
7501385 {
7511386 cameraView.ToggleSmoothFocus();
....@@ -771,6 +1406,18 @@
7711406 {
7721407 cameraView.ToggleOeil();
7731408 }
1409
+ else if(e.getSource() == shadowCB)
1410
+ {
1411
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1412
+ }
1413
+ else if(e.getSource() == freezeCB)
1414
+ {
1415
+ Globals.FREEZEONMOVE ^= true;
1416
+ }
1417
+ else if(e.getSource() == autokeepCB)
1418
+ {
1419
+ Globals.REPLACEONMAKE ^= true;
1420
+ }
7741421 else if(e.getSource() == lookAtCB)
7751422 {
7761423 cameraView.ToggleLookAt();
....@@ -787,7 +1434,8 @@
7871434
7881435 /**/
7891436 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
790
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1437
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1438
+ TreePath path = objEditor.jTree.getSelectionPath();
7911439 if ((path == null) || (path.getPathCount() <= 1)) {
7921440 // We can't move the root node or an empty selection
7931441 return;
....@@ -850,8 +1498,6 @@
8501498 }
8511499 }
8521500
853
- String string = (String) object;
854
-
8551501 System.out.println("Transfer = " + object + "; drop : " + target);
8561502 // if( object instanceof java.io.File[])
8571503 // {
....@@ -859,7 +1505,11 @@
8591505 // objEditor.DropFile((java.io.File[]) object, true);
8601506 // return;
8611507 // }
862
- if (string.charAt(0) == '/')
1508
+
1509
+ String string = object.toString();
1510
+
1511
+ // File path for Mac and Windows
1512
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8631513 {
8641514 // file(s)
8651515 String[] names = string.split("\n");
....@@ -886,7 +1536,7 @@
8861536
8871537 flashIt = false;
8881538 CameraPane pane = (CameraPane) target;
889
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1539
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8901540 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8911541
8921542 if (group.selection.size() == 1)
....@@ -902,23 +1552,33 @@
9021552
9031553 assert target == objEditor.jTree;
9041554 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1555
+ Object3D destinationLeaf;
9051556 try {
906
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1557
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9071558 } catch (Exception e) {
9081559 System.out.println("destinationPath : " + destinationPath);
9091560 return;
9101561 }
9111562
912
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1563
+ for (int i=group.selection.size(); --i>=0;)
9131564 {
1565
+ Object3D child = (Object3D)group.selection.elementAt(i);
1566
+
1567
+ // Cannot move into itself
1568
+ if (child == destinationLeaf)
1569
+ return;
1570
+ }
1571
+
1572
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1573
+// {
9141574 loadClipboard(true);
9151575 objEditor.jTree.setSelectionPath(destinationPath);
916
- pasteInto(false);
917
- } else {
918
- loadClipboard(false);
919
- objEditor.jTree.setSelectionPath(destinationPath);
920
- pasteInto(false); // true); // ???
921
- }
1576
+ pasteInto(false, false);
1577
+// } else {
1578
+// loadClipboard(false);
1579
+// objEditor.jTree.setSelectionPath(destinationPath);
1580
+// pasteInto(false, false); // true); // ???
1581
+// }
9221582 }
9231583 public void dropActionChanged(DropTargetDragEvent dtde)
9241584 // Called if the user has modified the current drop gesture
....@@ -1023,83 +1683,107 @@
10231683 {
10241684 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10251685 //heightFieldItem.addActionListener(this);
1026
- gridItem = menu.add(new MenuItem("Grid"));
1027
- gridItem.addActionListener(this);
1028
- rectoidItem = menu.add(new MenuItem("Box"));
1029
- rectoidItem.addActionListener(this);
1030
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1031
- ellipsoidItem.addActionListener(this);
1032
- coneItem = menu.add(new MenuItem("Cone"));
1033
- coneItem.addActionListener(this);
1034
- torusItem = menu.add(new MenuItem("Torus"));
1035
- torusItem.addActionListener(this);
1036
- superItem = menu.add(new MenuItem("Superellipsoid"));
1037
- superItem.addActionListener(this);
1038
- particleItem = menu.add(new MenuItem("Particle system"));
1039
- particleItem.addActionListener(this);
1686
+// gridItem = menu.add(new MenuItem("Grid"));
1687
+// gridItem.addActionListener(this);
1688
+// rectoidItem = menu.add(new MenuItem("Box"));
1689
+// rectoidItem.addActionListener(this);
1690
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1691
+// ellipsoidItem.addActionListener(this);
1692
+// coneItem = menu.add(new MenuItem("Cone"));
1693
+// coneItem.addActionListener(this);
1694
+// torusItem = menu.add(new MenuItem("Torus"));
1695
+// torusItem.addActionListener(this);
1696
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1697
+// superItem.addActionListener(this);
1698
+
1699
+ cameraItem = menu.add(new MenuItem("Camera"));
1700
+ cameraItem.addActionListener(this);
1701
+
1702
+ if (!Globals.ADVANCED)
1703
+ {
1704
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1705
+ kleinItem.addActionListener(this);
1706
+ }
1707
+
1708
+// particleItem = menu.add(new MenuItem("Particle system"));
1709
+// particleItem.addActionListener(this);
1710
+ if (Globals.ADVANCED)
1711
+ {
10401712 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10411713 ragdollItem.addActionListener(this);
10421714 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10431715 ragdoll2Item.addActionListener(this);
1716
+ }
10441717 menu.add("-");
1045
- meshItem = menu.add(new MenuItem("Mesh"));
1718
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10461719 meshItem.addActionListener(this);
10471720 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10481721 // meshGroupItem.addActionListener(this);
1722
+ if (Globals.ADVANCED)
1723
+ {
10491724 springItem = menu.add(new MenuItem("Spring"));
10501725 springItem.addActionListener(this);
10511726 flagItem = menu.add(new MenuItem("Flag"));
10521727 flagItem.addActionListener(this);
1053
- bezierItem = menu.add(new MenuItem("Patch"));
1054
- bezierItem.addActionListener(this);
1055
- checkerItem = menu.add(new MenuItem("Checker"));
1056
- checkerItem.addActionListener(this);
10571728 blobItem = menu.add(new MenuItem("Blob"));
10581729 blobItem.addActionListener(this);
10591730 latheItem = menu.add(new MenuItem("Lathe"));
10601731 latheItem.addActionListener(this);
1061
- lightItem = menu.add(new MenuItem("Light"));
1062
- lightItem.addActionListener(this);
1732
+ }
1733
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1734
+ bezierItem.addActionListener(this);
1735
+// overlayItem = menu.add(new MenuItem("Overlay"));
1736
+// overlayItem.addActionListener(this);
1737
+// lightItem = menu.add(new MenuItem("Light"));
1738
+// lightItem.addActionListener(this);
10631739 menu.add("-");
10641740 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10651741 //superLoopItem.addActionListener(this);
1066
- loopItem = menu.add(new MenuItem("Loop"));
1067
- loopItem.addActionListener(this);
1742
+// loopItem = menu.add(new MenuItem("Loop"));
1743
+// loopItem.addActionListener(this);
10681744 doubleItem = menu.add(new MenuItem("Fork"));
10691745 doubleItem.addActionListener(this);
1746
+ if (Globals.ADVANCED)
1747
+ {
10701748 tripleItem = menu.add(new MenuItem("Trident"));
10711749 tripleItem.addActionListener(this);
1750
+ }
10721751 }
10731752
10741753 void buildToolsMenu(Menu menu)
10751754 {
10761755 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10771756 animationItem.addItemListener(this);
1078
- animationItem.setState(CameraPane.ANIMATION);
1757
+ animationItem.setState(Globals.ANIMATION);
1758
+
1759
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1760
+ archiveItem.addActionListener(this);
10791761
10801762 menu.add("-");
10811763 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10821764 parseverticesItem.addActionListener(this);
10831765 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10841766 textureFieldItem.addActionListener(this);
1085
- alignItem = menu.add(new MenuItem("Align"));
1767
+ alignItem = menu.add(new MenuItem("Align Objects"));
10861768 alignItem.addActionListener(this);
1087
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1088
- mirrorItem.addActionListener(this);
10891769 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10901770 reduceMorphItem.addActionListener(this);
10911771 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10921772 reduce34MorphItem.addActionListener(this);
1093
-
1094
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1095
- computeAOItem.addActionListener(this);
10961773 menu.add("-");
1097
-
10981774 menu.add(memoryItem = new MenuItem("Memory Usage"));
10991775 memoryItem.addActionListener(this);
1776
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1777
+ computeAOItem.addActionListener(this);
1778
+
1779
+ if (Globals.ADVANCED)
1780
+ {
1781
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1782
+ mirrorItem.addActionListener(this);
1783
+ menu.add("-");
11001784 menu.add(analyzeItem = new MenuItem("Analyze"));
11011785 analyzeItem.addActionListener(this);
1102
- menu.add(dumpItem = new MenuItem("Dump"));
1786
+ menu.add(dumpItem = new MenuItem("Print"));
11031787 dumpItem.addActionListener(this);
11041788 // menu.add(pathItem = new MenuItem("From-to path"));
11051789 // pathItem.addActionListener(this);
....@@ -1108,6 +1792,8 @@
11081792 resetParentItem.addActionListener(this);
11091793 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11101794 repairParentItem.addActionListener(this);
1795
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1796
+ repairShadowItem.addActionListener(this);
11111797 menu.add(invariantsItem = new MenuItem("Invariants"));
11121798 invariantsItem.addActionListener(this);
11131799 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1115,6 +1801,7 @@
11151801 menu.add("-");
11161802 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11171803 editScriptItem.addActionListener(this);
1804
+ }
11181805 }
11191806
11201807 void ScreenFit()
....@@ -1237,9 +1924,34 @@
12371924 shadow.material = new cMaterial(obj.material);
12381925 shadow.material.diffuse = 0.0001f;
12391926 shadow.material.specular = 0.0001f;
1927
+ //shadow.projectedVertices[1].x = 300;
12401928
12411929 makeSomething(shadow);
12421930 }
1931
+
1932
+ private void ClearUnpinned()
1933
+ {
1934
+ //for (Object3D obj : listUI)
1935
+ for (int i=listUI.size(); --i>=0;)
1936
+ {
1937
+ Object3D obj = listUI.elementAt(i);
1938
+ if (!obj.pinned)
1939
+ {
1940
+ obj.CloseUI();
1941
+ listUI.remove(i);
1942
+ }
1943
+ }
1944
+ }
1945
+
1946
+ private void EditElement(Object3D elem, boolean newWindow)
1947
+ {
1948
+ // if (!(elem instanceof Composite))
1949
+ // newWindow = false;
1950
+ listUI.add(elem);
1951
+ elem.openEditWindow(this, newWindow); //, false);
1952
+ System.out.println("edit : " + elem);
1953
+ elem.editWindow.refreshContents(true); // ? new
1954
+ }
12431955
12441956 /**
12451957 * applyExample
....@@ -1443,9 +2155,9 @@
14432155
14442156 void Overwrite(int mask)
14452157 {
1446
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2158
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14472159 {
1448
- Object3D content = GrafreeD.clipboard.get(0);
2160
+ Object3D content = Grafreed.clipboard.get(0);
14492161
14502162 if (content instanceof cGroup && ((cGroup)content).transientlink )
14512163 content = ((cGroup)content).get(0);
....@@ -1468,6 +2180,7 @@
14682180 //
14692181 public void actionPerformed(ActionEvent event) // , Object arg)
14702182 {
2183
+ Object source = event.getSource();
14712184 /*
14722185 if (event.getSource() == nameField)
14732186 {
....@@ -1479,11 +2192,11 @@
14792192 }
14802193 else
14812194 */
1482
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2195
+ if (source == lookAtItem || source == lookFromItem)
14832196 {
14842197 ScreenFit();
14852198 } else
1486
- if (event.getSource() == switchItem)
2199
+ if (source == switchViewItem)
14872200 {
14882201 cVector v1 = new cVector();
14892202 cVector v2 = new cVector();
....@@ -1492,11 +2205,11 @@
14922205 objEditor.cameraView.renderCamera.setAim(v2, v1);
14932206 objEditor.cameraView.repaint();
14942207 } else
1495
- if (event.getSource() == rectoidItem)
2208
+ if (source == rectoidItem || source == boxButton)
14962209 {
14972210 makeSomething(new Box());
14982211 } else
1499
- if (event.getSource() == particleItem)
2212
+ if (source == particleItem || source == particlesButton)
15002213 {
15012214 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15022215 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1517,9 +2230,9 @@
15172230 applyExample(particleGeom, "SMOKE");
15182231 makeSomething(particleGeom);
15192232 } else
1520
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2233
+ if (source == ragdollItem || source == ragdoll2Item)
15212234 {
1522
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2235
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15232236
15242237 ragdoll.toParent = LA.newMatrix();
15252238 ragdoll.fromParent = LA.newMatrix();
....@@ -1537,7 +2250,7 @@
15372250 } else
15382251 /*
15392252 */
1540
- if (event.getSource() == heightFieldItem)
2253
+ if (source == heightFieldItem)
15412254 {
15422255 Object3D obj = new Object3D();
15432256
....@@ -1575,27 +2288,31 @@
15752288
15762289 makeSomething(obj);
15772290 } else
1578
- if (event.getSource() == gridItem)
2291
+ if (source == gridItem || source == gridButton)
15792292 {
15802293 makeSomething(new Grid());
15812294 } else
1582
- if (event.getSource() == ellipsoidItem)
2295
+ if (source == ellipsoidItem || source == sphereButton)
15832296 {
15842297 makeSomething(new Sphere());
15852298 } else
1586
- if (event.getSource() == coneItem)
2299
+ if (source == coneItem || source == coneButton)
15872300 {
15882301 makeSomething(new Cone());
15892302 } else
1590
- if (event.getSource() == torusItem)
2303
+ if (source == torusItem || source == torusButton)
15912304 {
15922305 makeSomething(new Torus());
15932306 } else
1594
- if (event.getSource() == superItem)
2307
+ if (source == superItem || source == superButton)
15952308 {
15962309 makeSomething(new Superellipsoid());
15972310 } else
1598
- if (event.getSource() == blobItem)
2311
+ if (source == kleinItem || source == kleinButton)
2312
+ {
2313
+ makeSomething(new Klein());
2314
+ } else
2315
+ if (source == blobItem)
15992316 {
16002317 Blob blob = new Blob();
16012318 BlobComponent comp = new BlobComponent();
....@@ -1603,15 +2320,15 @@
16032320 //blob.retile();
16042321 makeSomething(blob);
16052322 } else
1606
- if (event.getSource() == latheItem)
2323
+ if (source == latheItem)
16072324 {
16082325 makeSomething(new Lathe());
16092326 } else
1610
- if (event.getSource() == bezierItem)
2327
+ if (source == bezierItem)
16112328 {
16122329 makeSomething(new BezierSurface());
16132330 } else
1614
- if (event.getSource() == checkerItem)
2331
+ if (source == overlayItem || source == overlayButton)
16152332 {
16162333 /*
16172334 Object3D obj = new BezierSurface(5,8);
....@@ -1626,7 +2343,7 @@
16262343 */
16272344 makeSomething(new Checker());
16282345 } else
1629
- if (event.getSource() == meshItem)
2346
+ if (source == meshItem)
16302347 {
16312348 Object3D itemtomake = new Object3D();
16322349 Object3D child;
....@@ -1647,35 +2364,52 @@
16472364 makeSomething(child);
16482365 }
16492366 } else
1650
- if (event.getSource() == springItem)
2367
+ if (source == springItem)
16512368 {
16522369 cSpring s = new cSpring();
16532370 s.setup();
16542371 makeSomething(s);
16552372 } else
1656
- if (event.getSource() == flagItem)
2373
+ if (source == flagItem)
16572374 {
16582375 cSpring s = new cFlag();
16592376 s.setup();
16602377 makeSomething(s);
16612378 } else
1662
- if (event.getSource() == lightItem)
2379
+ if (source == lightItem || source == lightButton)
16632380 {
16642381 makeSomething(new Light());
16652382 } else
1666
- if (event.getSource() == csgItem)
2383
+// if (source == skybox1Button ||
2384
+// source == skybox2Button ||
2385
+// source == skybox3Button ||
2386
+// source == skybox4Button ||
2387
+// source == skybox5Button ||
2388
+// source == skybox6Button ||
2389
+// source == skybox7Button ||
2390
+// source == skybox11Button ||
2391
+// source == skybox12Button ||
2392
+// source == skybox13Button ||
2393
+// source == skybox14Button ||
2394
+// source == skybox15Button ||
2395
+// source == skybox16Button ||
2396
+// source == skybox17Button)
2397
+// {
2398
+// ChangeSkybox(source);
2399
+// } else
2400
+ if (source == csgItem)
16672401 {
16682402 group(new CSG());
16692403 } else
1670
- if (event.getSource() == templateItem)
2404
+ if (source == templateItem)
16712405 {
16722406 group(new cTemplate());
16732407 } else
1674
- if (event.getSource() == attributeItem)
2408
+ if (source == attributeItem)
16752409 {
16762410 makeSomething(new Attribute());
16772411 } else
1678
- if (event.getSource() == pointflowItem)
2412
+ if (source == pointflowItem)
16792413 {
16802414 makeSomething(new PointFlow());
16812415 } else
....@@ -1687,7 +2421,7 @@
16872421 } else
16882422 */
16892423
1690
- if (event.getSource() == superLoopItem)
2424
+ if (source == superLoopItem)
16912425 {
16922426 Composite g = new cGroup();
16932427 for (int i=0; i<15; i++)
....@@ -1709,30 +2443,30 @@
17092443
17102444 group(g);
17112445 } else
1712
- if (event.getSource() == loopItem)
2446
+ if (source == loopItem || source == loopButton)
17132447 {
17142448 Composite csg = new GroupLeaf();
17152449 csg.count = 5;
17162450 group(csg);
1717
- Composite child = new cGroup();
2451
+ Composite child = new cGroup("Branch");
17182452 csg.addChild(child);
17192453 child.addChild(csg);
17202454 } else
1721
- if (event.getSource() == doubleItem)
2455
+ if (source == doubleItem)
17222456 {
1723
- Composite csg = new GroupLeaf();
2457
+ Composite csg = new GroupLeaf("Fork");
17242458 csg.count = 5;
17252459 group(csg);
1726
- Composite child = new cGroup();
2460
+ Composite child = new cGroup("Branch A");
17272461 csg.addChild(child);
17282462 child.addChild(csg);
1729
- child = new cGroup();
2463
+ child = new cGroup("Branch B");
17302464 csg.addChild(child);
17312465 child.addChild(csg);
17322466 } else
1733
- if (event.getSource() == tripleItem)
2467
+ if (source == tripleItem)
17342468 {
1735
- Composite csg = new GroupLeaf();
2469
+ Composite csg = new GroupLeaf("Trident");
17362470 csg.count = 4;
17372471 group(csg);
17382472 Composite child = new cGroup();
....@@ -1745,73 +2479,98 @@
17452479 csg.addChild(child);
17462480 child.addChild(csg);
17472481 } else
1748
-
1749
- if (event.getSource() == importGFDItem)
2482
+ if (source == computeAOItem)
17502483 {
1751
- ImportGFD();
2484
+ Globals.drawMode = CameraPane.OCCLUSION;
2485
+ cameraView.repaint();
17522486 } else
1753
- if (event.getSource() == importVRMLX3DItem)
1754
- {
1755
- ImportVRMLX3D();
1756
- } else
1757
- if (event.getSource() == import3DSItem)
1758
- {
1759
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1760
- } else
1761
- if (event.getSource() == importOBJItem)
1762
- {
1763
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1764
- } else
1765
- if (event.getSource() == computeAOItem)
1766
- {
1767
- CameraPane.drawMode = CameraPane.OCCLUSION;
1768
- CameraPane.theRenderer.repaint();
1769
- } else
1770
- if (event.getSource() == recompileItem)
2487
+ if (source == recompileItem)
17712488 {
17722489 Recompile();
17732490 refreshContents();
17742491 } else
1775
- if (event.getSource() == editScriptItem)
2492
+ if (source == editScriptItem)
17762493 {
17772494 OpenDialog();
17782495 refreshContents();
17792496 } else
1780
- if (event.getSource() == invariantsItem)
2497
+ if (source == invariantsItem)
17812498 {
17822499 System.out.println("Invariants:");
1783
- GrafreeD.theApplet3D.universe.invariants();
2500
+ Grafreed.grafreeD.universe.invariants();
17842501 } else
1785
- if (event.getSource() == memoryItem)
2502
+ if (source == memoryItem)
17862503 {
17872504 //System.out.println("Invariants:");
17882505 PrintMemory();
17892506 } else
1790
- if (event.getSource() == pathItem)
2507
+ if (source == pathItem)
17912508 {
17922509 PrintPath();
17932510 } else
1794
- if (event.getSource() == analyzeItem)
2511
+ if (source == analyzeItem)
17952512 {
17962513 AnalyzeObject();
17972514 } else
1798
- if (event.getSource() == dumpItem)
2515
+ if (source == dumpItem)
17992516 {
18002517 DumpObject();
18012518 } else
1802
- if (event.getSource() == screenfitButton)
2519
+ if (source == minButton)
18032520 {
1804
- //Reload(lastConverter, lastFilename, true);
2521
+ Minimize();
2522
+ } else
2523
+ if (source == maxButton)
2524
+ {
2525
+ Maximize();
2526
+ } else
2527
+ if (source == fullButton)
2528
+ {
2529
+ ToggleFullScreen();
2530
+ } else
2531
+ if (source == undoButton)
2532
+ {
2533
+ // Go to previous version
2534
+ //if (!Undo())
2535
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2536
+ Undo();
2537
+ } else
2538
+ if (source == restoreButton)
2539
+ {
2540
+ // Restore current version
2541
+ Restore();
2542
+ } else
2543
+ if (source == replaceButton)
2544
+ {
2545
+ // Overwrite current version
2546
+ Replace();
2547
+ } else
2548
+ if (source == redoButton)
2549
+ {
2550
+ // Go to next version
2551
+ Redo();
2552
+ } else
2553
+ if (source == saveButton)
2554
+ {
2555
+ // Save a new version
2556
+ if (!Save(true))
2557
+ java.awt.Toolkit.getDefaultToolkit().beep();
2558
+ } else
2559
+ if (source == oneStepButton)
2560
+ {
2561
+ Globals.ONESTEP = true;
2562
+ cameraView.repaint();
2563
+ } else
2564
+ if (source == screenfitButton)
2565
+ {
18052566 ScreenFit();
18062567 } else
1807
- if (event.getSource() == screenfitpointButton)
2568
+ if (source == screenfitpointButton)
18082569 {
1809
- //Reload(lastConverter, lastFilename, true);
18102570 ScreenFitPoint();
18112571 } else
1812
- if (event.getSource() == snapobjectButton)
2572
+ if (source == snapobjectButton)
18132573 {
1814
- //Reload(lastConverter, lastFilename, true);
18152574 SnapObject();
18162575 } else
18172576 // if (event.getSource() == recompileButton)
....@@ -1820,13 +2579,13 @@
18202579 // Recompile();
18212580 // refreshContents();
18222581 // } else
1823
- if (event.getSource() == gcButton)
2582
+ if (source == gcButton)
18242583 {
18252584 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262585 System.gc();
18272586 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18282587 } else
1829
- if (event.getSource() == editLeafItem)
2588
+ if (source == editLeafItem)
18302589 {
18312590 Object3D obj;
18322591 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1840,62 +2599,74 @@
18402599 }
18412600 refreshContents(true);
18422601 } else
1843
- if (event.getSource() == openWindowItem)
2602
+ if (source == openWindowItem)
18442603 {
18452604 EditSelection(true);
18462605 } else
1847
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2606
+ if (source == cutItem || source == clearButton)
18482607 {
18492608 loadClipboard(true);
18502609 } else
1851
- if (event.getSource() == duplicateItem)
2610
+ if (source == undoItem)
18522611 {
1853
- Object3D keep = GrafreeD.clipboard;
2612
+ Undo();
2613
+ } else
2614
+ if (source == redoItem)
2615
+ {
2616
+ Redo();
2617
+ } else
2618
+ if (source == duplicateItem)
2619
+ {
2620
+ Object3D keep = Grafreed.clipboard;
18542621 loadClipboard(false);
18552622 paste(false);
1856
- GrafreeD.clipboard = keep;
2623
+ Grafreed.clipboard = keep;
18572624 } else
1858
- if (event.getSource() == cloneItem)
2625
+ if (source == cloneItem)
18592626 {
18602627 CloneSelection(false);
18612628 } else
1862
- if (event.getSource() == cloneSupportItem)
2629
+ if (source == cloneSupportItem)
18632630 {
18642631 CloneSelection(true);
18652632 } else
1866
- if (event.getSource() == copyItem)
2633
+ if (source == copyItem)
18672634 {
18682635 loadClipboard(false);
18692636 } else
1870
- if (event.getSource() == pasteItem)
2637
+ if (source == pasteItem)
18712638 {
18722639 paste(false);
18732640 } else
1874
- if (event.getSource() == pasteLinkItem)
2641
+ if (source == pasteIntoItem)
18752642 {
1876
- pasteInto(false);
2643
+ pasteInto(true, false);
18772644 } else
1878
- if (event.getSource() == pasteCloneItem)
2645
+ if (source == pasteLinkItem)
18792646 {
1880
- pasteInto(true);
2647
+ pasteInto(false, false);
18812648 } else
1882
- if (event.getSource() == pasteExpandItem)
2649
+ if (source == pasteCloneItem)
2650
+ {
2651
+ pasteInto(true, true);
2652
+ } else
2653
+ if (source == pasteExpandItem)
18832654 {
18842655 paste(true);
18852656 } else
1886
- if (event.getSource() == synchronizeItem)
2657
+ if (source == synchronizeItem)
18872658 {
18882659 Overwrite(Object3D.TRANSFORM);
18892660 } else
1890
- if (event.getSource() == overwriteNameItem)
2661
+ if (source == overwriteNameItem)
18912662 {
18922663 Overwrite(Object3D.NAME);
18932664 } else
1894
- if (event.getSource() == overwriteUVItem)
2665
+ if (source == overwriteUVItem)
18952666 {
18962667 Overwrite(Object3D.UV);
18972668 } else
1898
- if (event.getSource() == overwriteMatItem)
2669
+ if (source == overwriteMatItem)
18992670 {
19002671 /* july 2015
19012672 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1915,7 +2686,7 @@
19152686
19162687 Overwrite(dropAttributes);
19172688 }
1918
- if (event.getSource() == overwriteGeoItem)
2689
+ if (source == overwriteGeoItem)
19192690 {
19202691 Overwrite(Object3D.GEOMETRY);
19212692 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1932,7 +2703,7 @@
19322703 // refreshContents();
19332704 // }
19342705 } else
1935
- if (event.getSource() == generateMeshItem)
2706
+ if (source == generateMeshItem)
19362707 {
19372708 //if (group.selection.size() == 1)
19382709 // for (int i=0; i<group.selection.size(); i++)
....@@ -1943,7 +2714,7 @@
19432714 ResetModel();
19442715 refreshContents();
19452716 } else
1946
- if (event.getSource() == extractGeometriesItem)
2717
+ if (source == extractGeometriesItem)
19472718 {
19482719 boolean one = false;
19492720
....@@ -1970,7 +2741,7 @@
19702741 ResetModel();
19712742 refreshContents();
19722743 } else
1973
- if (event.getSource() == cloneGeometriesItem)
2744
+ if (source == cloneGeometriesItem)
19742745 {
19752746 boolean one = false;
19762747
....@@ -1996,32 +2767,37 @@
19962767 ResetModel();
19972768 refreshContents();
19982769 } else
1999
- if (event.getSource() == shareGeometriesItem)
2770
+ if (source == shareGeometriesItem)
20002771 {
20012772 boolean one = false;
20022773
20032774 if (group.selection.size() == 1)
20042775 one = true;
20052776
2777
+ Object3D merge = null;
2778
+
20062779 Object3D content = new cGroup();
20072780
20082781 for (int i=0; i<group.selection.size(); i++)
20092782 {
2010
- Object3D sel = new Merge(group.selection.get(i));
2783
+ merge = new Merge(group.selection.get(i));
20112784
20122785 if (one)
2013
- makeSomething(sel, false);
2786
+ makeSomething(merge, false);
20142787 else
2015
- content.addChild(sel);
2788
+ content.addChild(merge);
20162789 }
20172790
20182791 if (!one)
2019
- makeSomething(content, false);
2020
-
2021
- ResetModel();
2022
- refreshContents();
2792
+ makeSomething(content, true);
2793
+ else
2794
+ {
2795
+ ResetModel();
2796
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2797
+ refreshContents();
2798
+ }
20232799 } else
2024
- if (event.getSource() == mergeGeometriesItem)
2800
+ if (source == mergeGeometriesItem)
20252801 {
20262802 boolean one = false;
20272803
....@@ -2051,7 +2827,7 @@
20512827 ResetModel();
20522828 refreshContents();
20532829 } else
2054
- if (event.getSource() == linkverticesItem)
2830
+ if (source == linkverticesItem)
20552831 {
20562832 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20572833 // {
....@@ -2064,39 +2840,48 @@
20642840 // group.selection.get(0).setMasterThis(content); // should be identity
20652841 // refreshContents();
20662842 // }
2067
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2843
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20682844 {
2069
- Object3D content = GrafreeD.clipboard.get(0);
2845
+ Object3D content = Grafreed.clipboard.get(0);
20702846
20712847 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722848 content = ((cGroup)content).get(0);
20732849
2074
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2850
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20752851 for (int i=0; i<group.selection.size(); i++)
20762852 {
2077
- boolean random = CameraPane.RANDOM;
2078
- CameraPane.RANDOM = false; // parse all random nodes
2853
+ boolean random = CameraPane.SWITCH;
2854
+ CameraPane.SWITCH = false; // parse all random nodes
20792855 group.selection.get(i).linkVerticesThis(content);
20802856 // group.selection.get(i).setMasterThis(content); // should be identity
2081
- CameraPane.RANDOM = random;
2857
+ CameraPane.SWITCH = random;
20822858 }
2083
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2859
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20842860 refreshContents();
20852861 }
20862862 } else
2087
- if (event.getSource() == resetsupportItem)
2863
+ if (source == resetsupportItem)
20882864 {
20892865 for (int i=0; i<group.selection.size(); i++)
20902866 {
2091
- boolean random = CameraPane.RANDOM;
2092
- CameraPane.RANDOM = false; // parse all random nodes
2867
+ boolean random = CameraPane.SWITCH;
2868
+ CameraPane.SWITCH = false; // parse all random nodes
20932869 group.selection.get(i).linkVerticesThis(null);
2094
- CameraPane.RANDOM = random;
2870
+ CameraPane.SWITCH = random;
20952871 }
20962872
20972873 refreshContents();
20982874 } else
2099
- if (event.getSource() == resetreferencesItem)
2875
+ if (source == relinkverticesItem)
2876
+ {
2877
+ boolean random = CameraPane.SWITCH;
2878
+ CameraPane.SWITCH = false; // parse all random nodes
2879
+ group.selection.RelinkToSupport();
2880
+ CameraPane.SWITCH = random;
2881
+
2882
+ refreshContents();
2883
+ } else
2884
+ if (source == resetreferencesItem)
21002885 {
21012886 for (int i=0; i<group.selection.size(); i++)
21022887 {
....@@ -2105,11 +2890,11 @@
21052890
21062891 refreshContents();
21072892 } else
2108
- if (event.getSource() == setMasterItem)
2893
+ if (source == setMasterItem)
21092894 {
2110
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2895
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21112896 {
2112
- Object3D content = GrafreeD.clipboard.get(0);
2897
+ Object3D content = Grafreed.clipboard.get(0);
21132898
21142899 if (content instanceof cGroup && ((cGroup)content).transientlink )
21152900 content = ((cGroup)content).get(0);
....@@ -2118,13 +2903,13 @@
21182903 refreshContents();
21192904 }
21202905 } else
2121
- if (event.getSource() == poseMeshItem)
2906
+ if (source == poseMeshItem)
21222907 {
21232908 if (group.selection.size() == 1)
21242909 {
2125
- if (GrafreeD.clipboard.size() == 1)
2910
+ if (Grafreed.clipboard.size() == 1)
21262911 {
2127
- Object3D content = GrafreeD.clipboard.get(0);
2912
+ Object3D content = Grafreed.clipboard.get(0);
21282913
21292914 if (content instanceof cGroup && ((cGroup)content).transientlink )
21302915 content = ((cGroup)content).get(0);
....@@ -2137,19 +2922,19 @@
21372922 }
21382923
21392924 } else
2140
- if (event.getSource() == revertMeshItem)
2925
+ if (source == revertMeshItem)
21412926 {
21422927 RevertMeshes();
21432928 } else
2144
- if (event.getSource() == resetMeshItem)
2929
+ if (source == resetAllItem)
21452930 {
21462931 ResetAll();
21472932 } else
2148
- if (event.getSource() == stepAllItem)
2933
+ if (source == stepAllItem)
21492934 {
21502935 StepAll();
21512936 } else
2152
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2937
+ if (source == deleteItem) // || event.getSource() == clearButton)
21532938 {
21542939 //int indices[] = jList.getSelectedIndices();
21552940 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2157,42 +2942,46 @@
21572942
21582943 ClearSelection(false);
21592944 } else
2160
- if (event.getSource() == clearAllItem)
2945
+ if (source == clearAllItem)
21612946 {
21622947 ClearSelection(true);
21632948 } else
2164
- if (event.getSource() == grabItem)
2949
+ if (source == grabItem || source == groupButton)
21652950 {
2166
- group(new cGroup(), true);
2951
+ group(new cGroup(), false); // true);
21672952 } else
2168
- if (event.getSource() == frontItem)
2953
+ if (source == hideItem)
2954
+ {
2955
+ group(new HiddenObject());
2956
+ } else
2957
+ if (source == frontItem)
21692958 {
21702959 front();
21712960 } else
2172
- if (event.getSource() == backItem)
2961
+ if (source == backItem)
21732962 {
21742963 back();
21752964 } else
2176
- if (event.getSource() == cameraItem)
2965
+ if (source == cameraItem)
21772966 {
21782967 makeSomething(new Camera());
21792968 } else
2180
- if (event.getSource() == compositeItem)
2969
+ if (source == compositeItem || source == compositeButton)
21812970 {
21822971 group(new Composite());
21832972 } else
2184
- if (event.getSource() == randomItem)
2973
+ if (source == switchItem || source == switchButton)
21852974 {
21862975 RandomNode random = new RandomNode();
21872976 group(random);
21882977 if (random.size() > 0)
2189
- random.name = random.get(0).name + "Rnd";
2978
+ random.name = random.get(0).name + "Switch";
21902979 } else
2191
- if (event.getSource() == physicsItem)
2980
+ if (source == physicsItem)
21922981 {
21932982 group(new PhysicsNode());
21942983 } else
2195
- if (event.getSource() == frameselectorItem)
2984
+ if (source == frameselectorItem)
21962985 {
21972986 for (int i=0; i<group.selection.size(); i++)
21982987 {
....@@ -2204,7 +2993,7 @@
22042993 ResetModel();
22052994 refreshContents();
22062995 } else
2207
- if (event.getSource() == switchGeoItem)
2996
+ if (source == switchGeoItem)
22082997 {
22092998 for (int i=0; i<group.selection.size(); i++)
22102999 {
....@@ -2216,7 +3005,7 @@
22163005 ResetModel();
22173006 refreshContents();
22183007 } else
2219
- if (event.getSource() == switchTransfoItem)
3008
+ if (source == switchTransfoItem)
22203009 {
22213010 for (int i=0; i<group.selection.size(); i++)
22223011 {
....@@ -2228,7 +3017,7 @@
22283017 ResetModel();
22293018 refreshContents();
22303019 } else
2231
- if (event.getSource() == morphItem)
3020
+ if (source == morphItem)
22323021 {
22333022 for (int i=0; i<group.selection.size(); i++)
22343023 {
....@@ -2240,7 +3029,7 @@
22403029 ResetModel();
22413030 refreshContents();
22423031 } else
2243
- if (event.getSource() == scriptNodeItem)
3032
+ if (source == scriptNodeItem)
22443033 {
22453034 boolean atleastone = false;
22463035
....@@ -2279,199 +3068,252 @@
22793068 }
22803069 }
22813070 } else
2282
- if (event.getSource() == linkerItem)
3071
+ if (source == linkerItem)
22833072 {
22843073 group(new cLinker());
22853074 } else
2286
- if (event.getSource() == textureItem)
3075
+ if (source == textureItem || source == textureButton)
22873076 {
22883077 group(new TextureNode());
22893078 } else
2290
- if (event.getSource() == shadowXItem)
3079
+ if (source == billboardItem)
3080
+ {
3081
+ group(new BillboardNode());
3082
+ } else
3083
+ if (source == shadowXItem)
22913084 {
22923085 CastShadow(0);
22933086 } else
2294
- if (event.getSource() == shadowYItem)
3087
+ if (source == shadowYItem)
22953088 {
22963089 CastShadow(1);
22973090 } else
2298
- if (event.getSource() == shadowZItem)
3091
+ if (source == shadowZItem)
22993092 {
23003093 CastShadow(2);
23013094 } else
2302
- if (event.getSource() == ungroupItem)
3095
+ if (source == ungroupItem || source == ungroupButton)
23033096 {
2304
- ungroup();
3097
+ boolean hasRoot = false;
3098
+
3099
+ for (int i=0; i<group.selection.size(); i++)
3100
+ {
3101
+ if (group.selection.get(i) == group)
3102
+ {
3103
+ hasRoot = true;
3104
+ break;
3105
+ }
3106
+ }
3107
+
3108
+ if (!hasRoot)
3109
+ {
3110
+ for (int i=0; i<group.selection.size(); i++)
3111
+ {
3112
+ Ungroup(group.selection.get(i));
3113
+ }
3114
+
3115
+ ClearSelection(false);
3116
+
3117
+ refreshContents();
3118
+ }
23053119 } else
2306
- if (event.getSource() == genUVItem)
3120
+ if (source == genUVItem)
23073121 {
23083122 GenUV();
23093123 } else
2310
- if (event.getSource() == genNormalsCADItem)
3124
+ if (source == genNormalsCADItem)
23113125 {
23123126 GenNormals(true);
23133127 } else
2314
- if (event.getSource() == genNormalsMESHItem)
3128
+ if (source == genNormalsMESHItem)
23153129 {
2316
- GenNormals(true); // TODO
3130
+ GenNormalsMESH();
23173131 } else
2318
- if (event.getSource() == genNormalsORGANItem)
3132
+ if (source == genNormalsORGANItem)
23193133 {
23203134 GenNormals(false);
23213135 } else
2322
- if (event.getSource() == stripifyItem)
3136
+ if (source == genNormalsMINEItem)
3137
+ {
3138
+ GenNormalsMINE();
3139
+ } else
3140
+ if (source == stripifyItem)
23233141 {
23243142 Stripify();
23253143 } else
2326
- if (event.getSource() == unstripifyItem)
3144
+ if (source == unstripifyItem)
23273145 {
23283146 Unstripify();
23293147 } else
2330
- if (event.getSource() == trimItem)
3148
+ if (source == trimItem)
23313149 {
23323150 Trim();
23333151 } else
2334
- if (event.getSource() == untrimItem)
3152
+ if (source == untrimItem)
23353153 {
23363154 Untrim();
23373155 } else
2338
- if (event.getSource() == clearColorsItem)
3156
+ if (source == clearColorsItem)
23393157 {
23403158 ClearColors();
23413159 } else
2342
- if (event.getSource() == clearMaterialsItem)
3160
+ if (source == clearMaterialsItem)
23433161 {
23443162 ClearMaterials();
23453163 } else
2346
- if (event.getSource() == liveleavesItem)
3164
+ if (source == liveleavesItem)
23473165 {
23483166 LiveLeaves(true);
23493167 } else
2350
- if (event.getSource() == unliveleavesItem)
3168
+ if (source == unliveleavesItem)
23513169 {
23523170 LiveLeaves(false);
23533171 } else
2354
- if (event.getSource() == supportleavesItem)
3172
+ if (source == supportleavesItem)
23553173 {
23563174 SupportLeaves(true);
23573175 } else
2358
- if (event.getSource() == unsupportleavesItem)
3176
+ if (source == unsupportleavesItem)
23593177 {
23603178 SupportLeaves(false);
23613179 } else
2362
- if (event.getSource() == hideleavesItem)
3180
+ if (source == hideleavesItem)
23633181 {
23643182 HideLeaves(true);
23653183 } else
2366
- if (event.getSource() == showleavesItem)
3184
+ if (source == showleavesItem)
23673185 {
23683186 HideLeaves(false);
23693187 } else
2370
- if (event.getSource() == markleavesItem)
3188
+ if (source == markleavesItem)
23713189 {
23723190 MarkLeaves(true);
23733191 } else
2374
- if (event.getSource() == unmarkleavesItem)
3192
+ if (source == unmarkleavesItem)
23753193 {
23763194 MarkLeaves(false);
23773195 } else
2378
- if (event.getSource() == flipVItem)
3196
+ if (source == rewindleavesItem)
3197
+ {
3198
+ RewindLeaves(true);
3199
+ } else
3200
+ if (source == unrewindleavesItem)
3201
+ {
3202
+ RewindLeaves(false);
3203
+ } else
3204
+ if (source == randomleavesItem)
3205
+ {
3206
+ RandomLeaves(true);
3207
+ } else
3208
+ if (source == unrandomleavesItem)
3209
+ {
3210
+ RandomLeaves(false);
3211
+ } else
3212
+ if (source == flipVItem)
23793213 {
23803214 FlipV(true);
23813215 } else
2382
- if (event.getSource() == unflipVItem)
3216
+ if (source == unflipVItem)
23833217 {
23843218 FlipV(false);
23853219 } else
2386
- if (event.getSource() == lowTexturesItem)
3220
+ if (source == lowTexturesItem)
23873221 {
23883222 SetTexRes(0);
23893223 } else
2390
- if (event.getSource() == normalTexturesItem)
3224
+ if (source == normalTexturesItem)
23913225 {
23923226 SetTexRes(1);
23933227 } else
2394
- if (event.getSource() == highTexturesItem)
3228
+ if (source == highTexturesItem)
23953229 {
23963230 SetTexRes(2);
23973231 } else
2398
- if (event.getSource() == veryhighTexturesItem)
3232
+ if (source == veryhighTexturesItem)
23993233 {
24003234 SetTexRes(3);
24013235 } else
2402
- if (event.getSource() == maxTexturesItem)
3236
+ if (source == maxTexturesItem)
24033237 {
24043238 SetTexRes(4);
24053239 } else
2406
- if (event.getSource() == panoTexturesItem)
3240
+ if (source == panoTexturesItem)
24073241 {
24083242 SetTexRes(5);
24093243 } else
2410
- if (event.getSource() == reverseNormalsItem)
3244
+ if (source == reverseNormalsItem)
24113245 {
24123246 ReverseNormals();
24133247 } else
2414
- if (event.getSource() == parseverticesItem)
3248
+ if (source == parseverticesItem)
24153249 {
24163250 ParseVertices();
24173251 } else
2418
- if (event.getSource() == textureFieldItem)
3252
+ if (source == textureFieldItem)
24193253 {
24203254 TextureVertices();
24213255 } else
2422
- if (event.getSource() == alignItem)
3256
+ if (source == alignItem)
24233257 {
24243258 Align();
24253259 } else
2426
- if (event.getSource() == mirrorItem)
3260
+ if (source == mirrorItem)
24273261 {
24283262 MirrorPoses();
24293263 } else
2430
- if (event.getSource() == reduceMorphItem)
3264
+ if (source == reduceMorphItem)
24313265 {
24323266 MeshReduction(false);
24333267 } else
2434
- if (event.getSource() == reduce34MorphItem)
3268
+ if (source == reduce34MorphItem)
24353269 {
24363270 MeshReduction(true);
24373271 } else
2438
- if (event.getSource() == reverseTrianglesItem)
3272
+ if (source == reverseTrianglesItem)
24393273 {
24403274 ReverseTriangles();
24413275 } else
2442
- if (event.getSource() == reduceMeshItem)
3276
+ if (source == reduceMeshItem)
24433277 {
24443278 ReduceMesh(false);
24453279 } else
2446
- if (event.getSource() == reduce34MeshItem)
3280
+ if (source == reduce34MeshItem)
24473281 {
24483282 ReduceMesh(true);
24493283 } else
2450
- if (event.getSource() == increaseMeshItem)
3284
+ if (source == increaseMeshItem)
24513285 {
24523286 IncreaseMesh();
24533287 } else
2454
- if (event.getSource() == clipMeshItem)
3288
+ if (source == clipMeshItem)
24553289 {
24563290 ClipMesh();
24573291 } else
2458
- if (event.getSource() == smoothMeshItem)
3292
+ if (source == smoothMeshItem)
24593293 {
24603294 SmoothMesh();
24613295 } else
2462
- if (event.getSource() == transformgeometryItem)
3296
+ if (source == transformGeometryItem)
24633297 {
24643298 TransformGeometry();
24653299 } else
2466
- if (event.getSource() == resetTransformItem)
3300
+ if (source == transformChildrenItem)
3301
+ {
3302
+ TransformChildren();
3303
+ } else
3304
+ if (source == resetTransformItem)
24673305 {
24683306 ResetTransform();
24693307 } else
2470
- if (event.getSource() == resetCentroidItem)
3308
+ if (source == resetCentroidItem)
24713309 {
2472
- ResetCentroid();
3310
+ ResetCentroid(true);
24733311 } else
2474
- if (event.getSource() == resetParentItem)
3312
+ if (source == resetCentroidXZItem)
3313
+ {
3314
+ ResetCentroid(false);
3315
+ } else
3316
+ if (source == resetParentItem)
24753317 {
24763318 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24773319 {
....@@ -2481,7 +3323,7 @@
24813323
24823324 refreshContents();
24833325 } else
2484
- if (event.getSource() == repairParentItem)
3326
+ if (source == repairParentItem)
24853327 {
24863328 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24873329 {
....@@ -2495,7 +3337,21 @@
24953337
24963338 refreshContents();
24973339 } else
2498
- if (event.getSource() == sortbysizeItem)
3340
+ if (source == repairShadowItem)
3341
+ {
3342
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3343
+ {
3344
+ Object3D obj = (Object3D)e.nextElement();
3345
+ obj.RepairShadow();
3346
+// for (int i=0; i<obj.size(); i++)
3347
+// {
3348
+// obj.get(i).parent = obj;
3349
+// }
3350
+ }
3351
+
3352
+ refreshContents();
3353
+ } else
3354
+ if (source == sortbysizeItem)
24993355 {
25003356 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25013357 {
....@@ -2507,7 +3363,7 @@
25073363 ResetModel();
25083364 refreshContents();
25093365 } else
2510
- if (event.getSource() == sortbynameItem)
3366
+ if (source == sortbynameItem)
25113367 {
25123368 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25133369 {
....@@ -2519,7 +3375,7 @@
25193375 ResetModel();
25203376 refreshContents();
25213377 } else
2522
- if (event.getSource() == attachPigmentItem)
3378
+ if (source == attachPigmentItem)
25233379 {
25243380 String texture = GetFile("Attach pigment");
25253381 Object3D obj;
....@@ -2531,7 +3387,7 @@
25313387
25323388 refreshContents();
25333389 } else
2534
- if (event.getSource() == detachPigmentItem)
3390
+ if (source == detachPigmentItem)
25353391 {
25363392 Object3D obj;
25373393 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2542,7 +3398,7 @@
25423398
25433399 refreshContents();
25443400 } else
2545
- if (event.getSource() == attachBumpItem)
3401
+ if (source == attachBumpItem)
25463402 {
25473403 String texture = GetFile("Attach bump");
25483404 Object3D obj;
....@@ -2554,18 +3410,18 @@
25543410
25553411 refreshContents();
25563412 } else
2557
- if (event.getSource() == detachBumpItem)
3413
+ if (source == detachBumpItem)
25583414 {
25593415 Object3D obj;
25603416 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25613417 {
25623418 obj = (Object3D)e.nextElement();
2563
- obj.SetBumpTexture(null);
3419
+ obj.ResetBumpTexture();
25643420 }
25653421
25663422 refreshContents();
25673423 } else
2568
- if (event.getSource() == pigmentBumpItem)
3424
+ if (source == pigmentBumpItem)
25693425 {
25703426 Object3D obj;
25713427 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2576,158 +3432,262 @@
25763432
25773433 refreshContents();
25783434 } else
2579
- if (event.getSource() == flashSelectionButton)
3435
+ if (source == embedTexturesItem)
3436
+ {
3437
+ Object3D obj;
3438
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3439
+ {
3440
+ obj = (Object3D)e.nextElement();
3441
+ obj.EmbedTextures(true);
3442
+ }
3443
+
3444
+ refreshContents();
3445
+ } else
3446
+ if (source == deEmbedTexturesItem)
3447
+ {
3448
+ Object3D obj;
3449
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3450
+ {
3451
+ obj = (Object3D)e.nextElement();
3452
+ obj.EmbedTextures(false);
3453
+ }
3454
+
3455
+ CameraPane.texturepigment.clear();
3456
+ CameraPane.texturebump.clear();
3457
+
3458
+ refreshContents();
3459
+ } else
3460
+ if (source == flashSelectionButton)
25803461 {
25813462 CameraPane.flash = true;
25823463 refreshContents();
25833464 } else
2584
- if (event.getSource() == oneButton)
3465
+ if (source == oneButton)
25853466 {
25863467 } else
2587
- if (event.getSource() == twoButton)
3468
+ if (source == twoButton)
25883469 {
25893470 radio.layout = twoButton;
3471
+
3472
+ if (CameraPane.FULLSCREEN)
3473
+ fullscreenLayout = radio.layout;
3474
+
25903475 // bug
25913476 //gridPanel.setDividerLocation(1.0);
25923477 //bigPanel.setDividerLocation(0.0);
2593
- bigThree.remove(jtp);
2594
- bigThree.remove(cameraPanel);
2595
- bigThree.remove(XYZPanel);
2596
- aWindowConstraints.gridx = 0;
2597
- aWindowConstraints.gridy = 0;
2598
- aWindowConstraints.gridwidth = 1;
2599
- // aConstraints.gridheight = 3;
2600
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2601
- aWindowConstraints.weightx = 0;
2602
- aWindowConstraints.weighty = 1;
2603
- //bigThree.add(jtp, aWindowConstraints);
2604
- aWindowConstraints.weightx = 1;
2605
- aWindowConstraints.gridwidth = 3;
2606
- // aConstraints.gridheight = 3;
2607
- aWindowConstraints.gridx = 1;
2608
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2609
- bigThree.add(cameraPanel, aWindowConstraints);
2610
- aWindowConstraints.weightx = 0;
2611
- aWindowConstraints.gridx = 4;
2612
- aWindowConstraints.gridwidth = 1;
2613
- // aConstraints.gridheight = 3;
2614
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2615
- //bigThree.add(XYZPanel, aWindowConstraints);
2616
- bigThree.revalidate();
3478
+// bigThree.remove(scenePanel);
3479
+// bigThree.remove(centralPanel);
3480
+// bigThree.remove(XYZPanel);
3481
+// aWindowConstraints.gridx = 0;
3482
+// aWindowConstraints.gridy = 0;
3483
+// aWindowConstraints.gridwidth = 1;
3484
+// // aConstraints.gridheight = 3;
3485
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3486
+// aWindowConstraints.weightx = 0;
3487
+// aWindowConstraints.weighty = 1;
3488
+// //bigThree.add(jtp, aWindowConstraints);
3489
+// aWindowConstraints.weightx = 1;
3490
+// aWindowConstraints.gridwidth = 3;
3491
+// // aConstraints.gridheight = 3;
3492
+// aWindowConstraints.gridx = 1;
3493
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3494
+// bigThree.add(centralPanel, aWindowConstraints);
3495
+// aWindowConstraints.weightx = 0;
3496
+// aWindowConstraints.gridx = 4;
3497
+// aWindowConstraints.gridwidth = 1;
3498
+// // aConstraints.gridheight = 3;
3499
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3500
+// //bigThree.add(XYZPanel, aWindowConstraints);
3501
+// scenePanel.setVisible(false);
3502
+// centralPanel.setVisible(true);
3503
+// XYZPanel.setVisible(false);
3504
+ bigThree.ClearUI();
3505
+ bigThree.add(centralPanel);
3506
+ bigThree.FlushUI();
3507
+
3508
+ cameraView.requestFocusInWindow();
3509
+
3510
+// refreshContents(true);
3511
+//
3512
+// try
3513
+// {
3514
+// java.awt.Robot bot = new java.awt.Robot();
3515
+// int mask = InputEvent.BUTTON1_MASK;
3516
+// bot.mouseMove(100, 100);
3517
+// bot.mousePress(mask);
3518
+// bot.mouseRelease(mask);
3519
+// }
3520
+// catch (Exception e)
3521
+// {
3522
+//
3523
+// }
3524
+
26173525 } else
2618
- if (event.getSource() == threeButton)
3526
+ if (source == threeButton)
26193527 {
26203528 radio.layout = threeButton;
2621
- bigThree.remove(jtp);
2622
- bigThree.remove(cameraPanel);
2623
- bigThree.remove(XYZPanel);
2624
- aWindowConstraints.gridx = 0;
2625
- aWindowConstraints.gridy = 0;
2626
- aWindowConstraints.gridwidth = 1;
2627
- // aConstraints.gridheight = 3;
2628
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2629
- aWindowConstraints.weightx = 0;
2630
- aWindowConstraints.weighty = 1;
2631
- //bigThree.add(jtp, aWindowConstraints);
2632
- aWindowConstraints.weightx = 1;
2633
- aWindowConstraints.gridwidth = 3;
2634
- // aConstraints.gridheight = 3;
2635
- aWindowConstraints.gridx = 1;
2636
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2637
- bigThree.add(cameraPanel, aWindowConstraints);
2638
- aWindowConstraints.weightx = 0;
2639
- aWindowConstraints.gridx = 4;
2640
- aWindowConstraints.gridwidth = 1;
2641
- // aConstraints.gridheight = 3;
2642
- aConstraints.fill = GridBagConstraints.VERTICAL;
2643
- bigThree.add(XYZPanel, aWindowConstraints);
2644
- bigThree.revalidate();
3529
+
3530
+ if (CameraPane.FULLSCREEN)
3531
+ fullscreenLayout = radio.layout;
3532
+
3533
+// bigThree.remove(scenePanel);
3534
+// bigThree.remove(centralPanel);
3535
+// bigThree.remove(XYZPanel);
3536
+// aWindowConstraints.gridx = 0;
3537
+// aWindowConstraints.gridy = 0;
3538
+// aWindowConstraints.gridwidth = 1;
3539
+// // aConstraints.gridheight = 3;
3540
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3541
+// aWindowConstraints.weightx = 0;
3542
+// aWindowConstraints.weighty = 1;
3543
+// //bigThree.add(jtp, aWindowConstraints);
3544
+// aWindowConstraints.weightx = 1;
3545
+// aWindowConstraints.gridwidth = 3;
3546
+// // aConstraints.gridheight = 3;
3547
+// aWindowConstraints.gridx = 1;
3548
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3549
+// bigThree.add(centralPanel, aWindowConstraints);
3550
+// aWindowConstraints.weightx = 0;
3551
+// aWindowConstraints.gridx = 4;
3552
+// aWindowConstraints.gridwidth = 1;
3553
+// // aConstraints.gridheight = 3;
3554
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3555
+// bigThree.add(XYZPanel, aWindowConstraints);
3556
+// bigThree.validate();
3557
+// scenePanel.setVisible(false);
3558
+// centralPanel.setVisible(true);
3559
+// XYZPanel.setVisible(true);
3560
+ bigThree.ClearUI();
3561
+ bigThree.add(scenePanel);
3562
+ bigThree.add(centralPanel);
3563
+ bigThree.FlushUI();
3564
+
3565
+ cameraView.requestFocusInWindow();
26453566 } else
2646
- if (event.getSource() == fourButton)
3567
+ if (source == fourButton)
26473568 {
26483569 radio.layout = fourButton;
2649
- bigThree.remove(jtp);
2650
- bigThree.remove(cameraPanel);
2651
- bigThree.remove(XYZPanel);
2652
- aWindowConstraints.gridx = 0;
2653
- aWindowConstraints.gridy = 0;
2654
- aWindowConstraints.gridwidth = 1;
2655
- // aWindowConstraints.gridheight = 3;
2656
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2657
- aWindowConstraints.weightx = 1;
2658
- aWindowConstraints.weighty = 1;
2659
- bigThree.add(jtp, aWindowConstraints);
2660
- aWindowConstraints.weightx = 1;
2661
- aWindowConstraints.gridwidth = 3;
2662
- // aConstraints.gridheight = 3;
2663
- aWindowConstraints.gridx = 1;
2664
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2665
- //bigThree.add(cameraPanel, aWindowConstraints);
2666
- aWindowConstraints.weightx = 0;
2667
- aWindowConstraints.gridx = 4;
2668
- aWindowConstraints.gridwidth = 1;
2669
- // aWindowConstraints.gridheight = 3;
2670
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2671
- //bigThree.add(XYZPanel, aWindowConstraints);
2672
- bigThree.revalidate();
3570
+
3571
+ if (CameraPane.FULLSCREEN)
3572
+ fullscreenLayout = radio.layout;
3573
+
3574
+// bigThree.remove(scenePanel);
3575
+// bigThree.remove(centralPanel);
3576
+// bigThree.remove(XYZPanel);
3577
+// aWindowConstraints.gridx = 0;
3578
+// aWindowConstraints.gridy = 0;
3579
+// aWindowConstraints.gridwidth = 1;
3580
+// // aWindowConstraints.gridheight = 3;
3581
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3582
+// aWindowConstraints.weightx = 1;
3583
+// aWindowConstraints.weighty = 1;
3584
+// bigThree.add(scenePanel, aWindowConstraints);
3585
+// aWindowConstraints.weightx = 1;
3586
+// aWindowConstraints.gridwidth = 3;
3587
+// // aConstraints.gridheight = 3;
3588
+// aWindowConstraints.gridx = 1;
3589
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3590
+// //bigThree.add(cameraPanel, aWindowConstraints);
3591
+// aWindowConstraints.weightx = 0;
3592
+// aWindowConstraints.gridx = 4;
3593
+// aWindowConstraints.gridwidth = 1;
3594
+// // aWindowConstraints.gridheight = 3;
3595
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3596
+// //bigThree.add(XYZPanel, aWindowConstraints);
3597
+// bigThree.validate();
3598
+// scenePanel.setVisible(true);
3599
+// centralPanel.setVisible(false);
3600
+// XYZPanel.setVisible(false);
3601
+ bigThree.ClearUI();
3602
+ bigThree.add(scenePanel);
3603
+ bigThree.FlushUI();
3604
+
3605
+ cameraView.requestFocusInWindow();
26733606 } else
2674
- if (event.getSource() == sixButton)
3607
+ if (source == sixButton)
26753608 {
26763609 radio.layout = sixButton;
2677
- bigThree.remove(jtp);
2678
- bigThree.remove(cameraPanel);
2679
- bigThree.remove(XYZPanel);
2680
- aWindowConstraints.gridx = 0;
2681
- aWindowConstraints.gridy = 0;
2682
- aWindowConstraints.gridwidth = 1;
2683
- // aConstraints.gridheight = 3;
2684
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2685
- aWindowConstraints.weightx = 0;
2686
- aWindowConstraints.weighty = 1;
2687
- bigThree.add(jtp, aWindowConstraints);
2688
- aWindowConstraints.weightx = 1;
2689
- aWindowConstraints.gridwidth = 3;
2690
- // aWindowConstraints.gridheight = 3;
2691
- aWindowConstraints.gridx = 1;
2692
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2693
- bigThree.add(cameraPanel, aWindowConstraints);
2694
- aWindowConstraints.weightx = 0;
2695
- aWindowConstraints.gridx = 4;
2696
- aWindowConstraints.gridwidth = 1;
2697
- // aWindowConstraints.gridheight = 3;
2698
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2699
- //bigThree.add(XYZPanel, aConstraints);
2700
- bigThree.revalidate();
3610
+
3611
+ if (CameraPane.FULLSCREEN)
3612
+ fullscreenLayout = radio.layout;
3613
+
3614
+// bigThree.remove(scenePanel);
3615
+// bigThree.remove(centralPanel);
3616
+// bigThree.remove(XYZPanel);
3617
+// aWindowConstraints.gridx = 0;
3618
+// aWindowConstraints.gridy = 0;
3619
+// aWindowConstraints.gridwidth = 1;
3620
+// // aConstraints.gridheight = 3;
3621
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3622
+// aWindowConstraints.weightx = 0;
3623
+// aWindowConstraints.weighty = 1;
3624
+// bigThree.add(scenePanel, aWindowConstraints);
3625
+// aWindowConstraints.weightx = 1;
3626
+// aWindowConstraints.gridwidth = 3;
3627
+// // aWindowConstraints.gridheight = 3;
3628
+// aWindowConstraints.gridx = 1;
3629
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3630
+// bigThree.add(centralPanel, aWindowConstraints);
3631
+// aWindowConstraints.weightx = 0;
3632
+// aWindowConstraints.gridx = 4;
3633
+// aWindowConstraints.gridwidth = 1;
3634
+// // aWindowConstraints.gridheight = 3;
3635
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3636
+// //bigThree.add(XYZPanel, aConstraints);
3637
+// bigThree.validate();
3638
+// scenePanel.setVisible(true);
3639
+// centralPanel.setVisible(true);
3640
+// XYZPanel.setVisible(false);
3641
+ bigThree.ClearUI();
3642
+ bigThree.add(centralPanel);
3643
+ bigThree.add(scenePanel);
3644
+ bigThree.FlushUI();
3645
+
3646
+ cameraView.requestFocusInWindow();
27013647 } else
2702
- if (event.getSource() == sevenButton)
3648
+ if (source == sevenButton)
27033649 {
27043650 radio.layout = sevenButton;
2705
- bigThree.remove(jtp);
2706
- bigThree.remove(cameraPanel);
2707
- bigThree.remove(XYZPanel);
2708
- aWindowConstraints.gridx = 0;
2709
- aWindowConstraints.gridy = 0;
2710
- aWindowConstraints.gridwidth = 1;
2711
- // aWindowConstraints.gridheight = 3;
2712
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2713
- aWindowConstraints.weightx = 0;
2714
- aWindowConstraints.weighty = 1;
2715
- bigThree.add(jtp, aWindowConstraints);
2716
- aWindowConstraints.weightx = 1;
2717
- aWindowConstraints.gridwidth = 3;
2718
- // aWindowConstraints.gridheight = 3;
2719
- aWindowConstraints.gridx = 1;
2720
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2721
- bigThree.add(cameraPanel, aWindowConstraints);
2722
- aWindowConstraints.weightx = 0;
2723
- aWindowConstraints.gridx = 4;
2724
- aWindowConstraints.gridwidth = 1;
2725
- // aConstraints.gridheight = 3;
2726
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2727
- bigThree.add(XYZPanel, aWindowConstraints);
2728
- bigThree.revalidate();
3651
+
3652
+ if (CameraPane.FULLSCREEN)
3653
+ fullscreenLayout = radio.layout;
3654
+
3655
+// bigThree.remove(scenePanel);
3656
+// bigThree.remove(centralPanel);
3657
+// bigThree.remove(XYZPanel);
3658
+// aWindowConstraints.gridx = 0;
3659
+// aWindowConstraints.gridy = 0;
3660
+// aWindowConstraints.gridwidth = 1;
3661
+// // aWindowConstraints.gridheight = 3;
3662
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3663
+// aWindowConstraints.weightx = 0;
3664
+// aWindowConstraints.weighty = 1;
3665
+// bigThree.add(scenePanel, aWindowConstraints);
3666
+// aWindowConstraints.weightx = 1;
3667
+// aWindowConstraints.gridwidth = 3;
3668
+// // aWindowConstraints.gridheight = 3;
3669
+// aWindowConstraints.gridx = 1;
3670
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3671
+// bigThree.add(centralPanel, aWindowConstraints);
3672
+// aWindowConstraints.weightx = 0;
3673
+// aWindowConstraints.gridx = 4;
3674
+// aWindowConstraints.gridwidth = 1;
3675
+// // aConstraints.gridheight = 3;
3676
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3677
+// bigThree.add(XYZPanel, aWindowConstraints);
3678
+// bigThree.validate();
3679
+// scenePanel.setVisible(true);
3680
+// centralPanel.setVisible(true);
3681
+// XYZPanel.setVisible(true);
3682
+ bigThree.ClearUI();
3683
+ bigThree.add(scenePanel);
3684
+ bigThree.add(centralPanel);
3685
+ bigThree.add(XYZPanel);
3686
+ bigThree.FlushUI();
3687
+
3688
+ cameraView.requestFocusInWindow();
27293689 } else
2730
- if (event.getSource() == rootButton)
3690
+ if (source == rootButton)
27313691 {
27323692 Object3D obj;
27333693 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2737,66 +3697,84 @@
27373697 EditObject(obj);
27383698 }
27393699
3700
+ cameraView.requestFocusInWindow();
27403701 refreshContents(true);
27413702 } else
2742
- if (event.getSource() == closeButton)
3703
+ if (source == closeButton)
27433704 {
27443705 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27453706 cRadio ab;
27463707 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27473708 {
27483709 ab = (cRadio)e.nextElement();
2749
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3710
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27503711 {
3712
+ // Patch to avoid bug with transparency.
3713
+ if (!ab.hadMaterial)
3714
+ {
3715
+ ab.object.material = null;
3716
+ }
3717
+
27513718 buttonGroup.remove(ab);
27523719 radioPanel.remove(ab);
27533720
2754
- ab.GetObject().editWindow = null;
3721
+ //ab.GetObject().editWindow = null;
3722
+ ab.GetObject().manipWindow = null;
27553723 // ab.GetObject().objectUI = null; // ?????????
27563724
27573725 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27583726 break;
27593727 }
27603728 }
3729
+
3730
+ cameraView.requestFocusInWindow();
27613731 refreshContents(true);
27623732 } else
2763
- if (event.getSource() == editItem || event.getSource() == editButton)
3733
+ if (source == editItem || source == editButton)
27643734 {
3735
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3736
+ {
3737
+ Object3D child = (Object3D)e.nextElement();
3738
+ child.pinned = true;
3739
+ }
3740
+
27653741 EditSelection(false);
27663742 } else
2767
- if (event.getSource() == uneditButton)
3743
+ if (source == uneditButton)
27683744 {
27693745 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27703746 {
27713747 Object3D child = (Object3D)e.nextElement();
27723748 if(child.editWindow != null)
27733749 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3750
+ child.pinned = false;
27743751 child.CloseUI();
27753752 listUI.remove(child);
27763753
2777
- child.editWindow = null; // ???????????
3754
+ //child.editWindow = null; // ???????????
27783755 }
2779
- objEditor.ctrlPanel.revalidate();
3756
+ objEditor.ctrlPanel.FlushUI();
27803757 //objEditor.jTree.clearSelection();
27813758 //objEditor.ResetSliders();
27823759 refreshContents(true);
27833760 } else
2784
- if (event.getSource() == clearPanelButton)
3761
+ if (source == clearPanelButton)
27853762 {
27863763 assert(copy == group);
27873764 //copy.ClearUI();
27883765 for (Object3D obj : listUI)
27893766 {
3767
+ obj.pinned = false;
27903768 obj.CloseUI();
27913769 }
27923770 listUI.clear();
27933771 refreshContents(true);
27943772 } else
2795
- if (event.getSource() == allParamsButton)
3773
+ if (source == allParamsButton)
27963774 {
27973775 assert(copy == group);
27983776
2799
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3777
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28003778
28013779 for (Object3D obj : listUI)
28023780 {
....@@ -2813,19 +3791,19 @@
28133791
28143792 refreshContents(true);
28153793 } else
2816
- if (event.getSource() == unselectButton)
3794
+ if (source == unselectButton)
28173795 {
28183796 objEditor.jTree.clearSelection();
28193797 // ?? oct 2012 GrafreeD.clipboard.clear();
28203798 objEditor.ResetSliders();
28213799 refreshContents(true);
28223800 } else
2823
- if(event.getSource() instanceof cRadio)
3801
+ if(source instanceof cRadio)
28243802 {
28253803 group.parent = keepparent;
28263804 group.attributes = 0;
28273805 //group.editWindow = null;
2828
- /*cRadio*/ radio = (cRadio)event.getSource();
3806
+ /*cRadio*/ radio = (cRadio)source;
28293807 Object3D obj = radio.GetObject();
28303808 System.out.println("Edit " + obj);
28313809 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2845,7 +3823,10 @@
28453823 }
28463824
28473825 copy = group;
2848
- //CameraPane.theRenderer.object = group;
3826
+
3827
+ SetUndoStates();
3828
+
3829
+ //Globals.theRenderer.object = group;
28493830 if(!useclient)
28503831 {
28513832 cameraView.renderCamera = radio.camera;
....@@ -2854,25 +3835,52 @@
28543835 cameraView.cameras[cameraView.cameracount] = radio.camera;
28553836 cameraView.targetLookAt.set(radio.camera.lookAt);
28563837 cameraView.object = group;
2857
- cameraView.lighttouched = true;
3838
+ //cameraView.lighttouched = true;
3839
+ Globals.lighttouched = true;
28583840 topView.object = group;
28593841 frontView.object = group;
28603842 sideView.object = group;
28613843 }
2862
- group.editWindow = this;
3844
+
3845
+// fix "+" issue
3846
+ //group.editWindow = this;
3847
+ group.manipWindow = this;
3848
+
28633849 /*
28643850 currentLayout = radio.layout;
28653851 if (currentLayout == null)
28663852 currentLayout = sevenButton;
28673853 */
28683854 radio.layout.doClick();
3855
+
3856
+ ClearUnpinned();
3857
+ //Grafreed.Assert(group != null);
3858
+ //Grafreed.Assert(group.selection != null);
3859
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3860
+ if (group.selection == null || group.selection.size() == 1)
3861
+ EditSelection(false);
28693862 keepparent = group.parent;
28703863 // PARENT = NULL or not???
28713864 //group.parent = null; // ROOT
28723865 //group.attributes = -1;
28733866 ResetModel();
3867
+
3868
+ cameraView.requestFocusInWindow();
28743869 refreshContents(true);
2875
- }
3870
+ } else if (event.getSource() == editCameraItem)
3871
+ {
3872
+ cameraView.ProtectCamera();
3873
+ cameraView.repaint();
3874
+ return;
3875
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3876
+ {
3877
+ cameraView.RevertCamera();
3878
+ cameraView.repaint();
3879
+ return;
3880
+ // } else if (event.getSource() == textureButton)
3881
+ // {
3882
+ // return; // true;
3883
+ }
28763884 else
28773885 {
28783886 //return super.action(event, arg);
....@@ -2881,7 +3889,6 @@
28813889 }
28823890
28833891 boolean useclient = false;
2884
- cRadio radio;
28853892
28863893 void ToggleRoot()
28873894 {
....@@ -2890,7 +3897,7 @@
28903897 if (useclient)
28913898 {
28923899 cameraView.object = client;
2893
- cameraView.lighttouched = true;
3900
+ Globals.lighttouched = true;
28943901 //topView.object = client;
28953902 //frontView.object = client;
28963903 //sideView.object = client;
....@@ -2898,7 +3905,7 @@
28983905 else
28993906 {
29003907 cameraView.object = group;
2901
- cameraView.lighttouched = true;
3908
+ Globals.lighttouched = true;
29023909 //topView.object = group;
29033910 //frontView.object = group;
29043911 //sideView.object = group;
....@@ -2933,6 +3940,28 @@
29333940 refreshContents();
29343941 }
29353942
3943
+ void TransformChildren()
3944
+ {
3945
+ Object3D obj;
3946
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3947
+ {
3948
+ obj = (Object3D)e.nextElement();
3949
+ obj.KeepTextureMatrices();
3950
+ obj.TransformChildren();
3951
+ obj.RestoreTextureMatrices();
3952
+
3953
+// if (obj.parent == null)
3954
+// {
3955
+// System.out.println("NULL PARENT!");
3956
+// new Exception().printStackTrace();
3957
+// }
3958
+// else
3959
+// TouchTransform(obj);
3960
+// //obj.parent.Touch();
3961
+ }
3962
+
3963
+ refreshContents();
3964
+ }
29363965
29373966 void ResetTransform()
29383967 {
....@@ -3045,7 +4074,7 @@
30454074 refreshContents();
30464075 }
30474076
3048
- void ResetCentroid()
4077
+ void ResetCentroid(boolean full)
30494078 {
30504079 Object3D obj;
30514080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3060,12 +4089,16 @@
30604089 LA.matIdentity(Object3D.mat);
30614090 obj.getBounds(minima, maxima, false);
30624091 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3063
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4092
+ if (full)
4093
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30644094 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30654095 obj.TransformMesh(Object3D.mat);
4096
+
30664097 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3067
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4098
+ if (full)
4099
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30684100 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4101
+
30694102 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30704103 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30714104 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3094,7 +4127,8 @@
30944127
30954128 int size = obj.MemorySize();
30964129
3097
- System.err.println((size/1024) + " KB is the size of " + obj);
4130
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4131
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30984132 }
30994133 }
31004134 catch (Exception e)
....@@ -3131,9 +4165,9 @@
31314165 obj = (Object3D)e.nextElement();
31324166
31334167 System.out.println("Object is: " + obj);
3134
- GrafreeD.AnalyzeObject(obj);
4168
+ Grafreed.AnalyzeObject(obj);
31354169 System.out.println("Boundary rep: " + obj.bRep);
3136
- GrafreeD.AnalyzeObject(obj.bRep);
4170
+ Grafreed.AnalyzeObject(obj.bRep);
31374171
31384172 // System.err.println((size/1024) + " KB is the size of " + obj);
31394173 }
....@@ -3175,6 +4209,20 @@
31754209 void GenNormals(boolean crease)
31764210 {
31774211 group.GenNormalsS(crease);
4212
+
4213
+ refreshContents();
4214
+ }
4215
+
4216
+ void GenNormalsMESH()
4217
+ {
4218
+ group.GenNormalsMeshS();
4219
+
4220
+ refreshContents();
4221
+ }
4222
+
4223
+ void GenNormalsMINE()
4224
+ {
4225
+ group.selection.GenNormalsMINE();
31784226
31794227 refreshContents();
31804228 }
....@@ -3340,8 +4388,8 @@
33404388
33414389 void ParseVertices()
33424390 {
3343
- boolean epsequal = GrafreeD.epsequal;
3344
- GrafreeD.epsequal = true;
4391
+ boolean epsequal = Grafreed.epsequal;
4392
+ Grafreed.epsequal = true;
33454393
33464394 for (int i=0; i<group.selection.size(); i++)
33474395 {
....@@ -3366,7 +4414,7 @@
33664414 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33674415 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33684416
3369
- g.add(GrafreeD.clipboard);
4417
+ g.add(Grafreed.clipboard);
33704418
33714419 buffer.add(g);
33724420 }
....@@ -3381,7 +4429,7 @@
33814429 makeSomething(buffer, i==group.selection.size()-1);
33824430 }
33834431
3384
- GrafreeD.epsequal = epsequal;
4432
+ Grafreed.epsequal = epsequal;
33854433
33864434 refreshContents();
33874435 }
....@@ -3399,7 +4447,16 @@
33994447 String pigment = Object3D.GetPigment(tex);
34004448 //String bump = Object3D.GetBump(tex);
34014449
3402
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4450
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4451
+
4452
+ try
4453
+ {
4454
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4455
+ }
4456
+ catch (Exception e)
4457
+ {
4458
+ System.err.println("FAIL: " + node);
4459
+ }
34034460
34044461 double s = v.s;
34054462
....@@ -3447,12 +4504,26 @@
34474504
34484505 void Align()
34494506 {
4507
+ if (group.selection.size() == 0)
4508
+ return;
4509
+
4510
+ cVector bbmin = new cVector();
4511
+ cVector bbmax = new cVector();
4512
+
4513
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4514
+
4515
+ double dx = bbmax.x - bbmin.x;
4516
+ double dy = bbmax.y - bbmin.y;
4517
+ double dz = bbmax.z - bbmin.z;
4518
+
4519
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4520
+
34504521 for (int i=0; i<group.selection.size(); i++)
34514522 {
34524523 Object3D obj = group.selection.get(i);
34534524
3454
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3455
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4525
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4526
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34564527 }
34574528
34584529 refreshContents();
....@@ -3473,11 +4544,11 @@
34734544
34744545 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34754546
3476
- boolean random = CameraPane.RANDOM;
3477
- CameraPane.RANDOM = false; // parse all random nodes
4547
+ boolean random = CameraPane.SWITCH;
4548
+ CameraPane.SWITCH = false; // parse all random nodes
34784549 lowres.linkVerticesThis(null);
34794550 lowres.linkVerticesThis(sn);
3480
- CameraPane.RANDOM = random;
4551
+ CameraPane.SWITCH = random;
34814552
34824553 System.err.flush();
34834554
....@@ -3517,7 +4588,7 @@
35174588 return;
35184589
35194590 Object3D poses = group.selection.get(0);
3520
- Object3D ref = GrafreeD.clipboard.get(0);
4591
+ Object3D ref = Grafreed.clipboard.get(0);
35214592
35224593 Object3D newgroup = new Object3D("Po:" + poses.name);
35234594
....@@ -3686,7 +4757,7 @@
36864757 group.selection.RelinkToSupport(); // july 2014
36874758 System.out.println("DONE.");
36884759 refreshContents();
3689
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4760
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36904761 }
36914762
36924763 void ReduceMesh(boolean reduction34)
....@@ -3711,9 +4782,9 @@
37114782
37124783 void ClipMesh()
37134784 {
3714
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4785
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37154786 {
3716
- Object3D content = GrafreeD.clipboard.get(0);
4787
+ Object3D content = Grafreed.clipboard.get(0);
37174788
37184789 if (content instanceof cGroup && ((cGroup)content).transientlink )
37194790 content = ((cGroup)content).get(0);
....@@ -3722,7 +4793,7 @@
37224793 // {
37234794 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37244795 // }
3725
- group.selection.ClipMesh(GrafreeD.clipboard);
4796
+ group.selection.ClipMesh(Grafreed.clipboard);
37264797 }
37274798 // group.selection.ClipMesh(GrafreeD.clipboard);
37284799 System.out.println("DONE.");
....@@ -3769,6 +4840,18 @@
37694840 void MarkLeaves(boolean hide)
37704841 {
37714842 group.selection.MarkLeaves(hide);
4843
+ refreshContents();
4844
+ }
4845
+
4846
+ void RewindLeaves(boolean hide)
4847
+ {
4848
+ group.selection.RewindLeaves(hide);
4849
+ refreshContents();
4850
+ }
4851
+
4852
+ void RandomLeaves(boolean hide)
4853
+ {
4854
+ group.selection.RandomLeaves(hide);
37724855 refreshContents();
37734856 }
37744857
....@@ -3843,28 +4926,25 @@
38434926 // }
38444927 // }
38454928
3846
- static boolean allparams = true;
3847
-
3848
- static Vector<Object3D> listUI = new Vector<Object3D>();
3849
-
38504929 void EditSelection(boolean newWindow)
38514930 {
4931
+ if (group.selection == null)
4932
+ {
4933
+ EditElement(group, newWindow); // ? new
4934
+ return;
4935
+ }
4936
+
38524937 // aConstraints.gridy = 0;
38534938 for (int i=0; i<group.selection.size(); i++)
38544939 {
38554940 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38564941 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3857
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4942
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38584943
38594944 Object3D elem = (Object3D)group.selection.elementAt(i);
3860
- if(elem != group)
4945
+ if(elem != group || !newWindow)
38614946 {
3862
- // if (!(elem instanceof Composite))
3863
- // newWindow = false;
3864
- listUI.add(elem);
3865
- elem.openEditWindow(this, newWindow); //, false);
3866
- System.out.println("edit : " + elem);
3867
- elem.editWindow.refreshContents(true); // ? new
4947
+ EditElement(elem, newWindow); // ? new
38684948 }
38694949 }
38704950 }
....@@ -3939,7 +5019,8 @@
39395019 //new Exception().printStackTrace();
39405020
39415021 freezemodel = true;
3942
-
5022
+ ClearUnpinned();
5023
+
39435024 /**/
39445025 //switch (event.id)
39455026 {
....@@ -3947,7 +5028,6 @@
39475028 //case 702: // Event.LIST_DESELECT
39485029 group.deselectAll();
39495030 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3950
- objEditor.ClearInfo(); // .GetMaterial());
39515031 if (tps != null)
39525032 {
39535033 for (int i=0; i < tps.length; i++)
....@@ -3956,33 +5036,39 @@
39565036
39575037 //if (child.parent != null)
39585038 //child.parent.addSelectee(child);
5039
+ objEditor.SetMaterial(child);
39595040 group.addSelectee(child);
3960
- objEditor.SetMaterial(child); // .GetMaterial());
3961
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3962
- System.err.println("info : " + child.GetPath());
39635041 }
39645042 }
3965
- else
3966
- {
3967
- objEditor.SetMaterial(group); // .GetMaterial());
3968
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3969
- System.err.println("info : " + group.GetPath());
3970
- }
5043
+// else
5044
+// {
5045
+// objEditor.SetMaterial(group); // .GetMaterial());
5046
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5047
+// System.err.println("info : " + group.GetPath());
5048
+// }
39715049
3972
- objEditor.SetText(); // jan 2014
3973
-
3974
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5050
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39755051 CameraPane.flash = true;
39765052
3977
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5053
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39785054 // a camera
39795055 {
3980
- CameraPane.camerachangeframe = 0; // don't refuse it
3981
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3982
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3983
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
5056
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5057
+ {
5058
+ CameraPane.camerachangeframe = 0; // don't refuse it
5059
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5060
+ }
5061
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5062
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39845063 }
39855064
5065
+ if (tps != null && tps.length == 1)
5066
+ {
5067
+ EditSelection(false);
5068
+ }
5069
+
5070
+ SetPinStates(tps != null && tps.length > 0);
5071
+
39865072 refreshContents();
39875073 //return true;
39885074 }
....@@ -3991,6 +5077,35 @@
39915077
39925078 freezemodel = false;
39935079 }
5080
+
5081
+ void SetPinStates(boolean enabled)
5082
+ {
5083
+ editButton.setEnabled(enabled);
5084
+ uneditButton.setEnabled(enabled);
5085
+ unselectButton.setEnabled(enabled);
5086
+ flashSelectionButton.setEnabled(enabled);
5087
+ }
5088
+
5089
+ void refreshContents(boolean cp)
5090
+ {
5091
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5092
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5093
+ {
5094
+ objEditor.ClearInfo(); // .GetMaterial());
5095
+
5096
+ for (int i=0; i < group.selection.Size(); i++)
5097
+ {
5098
+ Object3D child = (Object3D) group.selection.get(i);
5099
+
5100
+ objEditor.AddInfo(child, this, true);
5101
+ System.err.println("info : " + child.GetPath());
5102
+ }
5103
+
5104
+ objEditor.SetText(); // jan 2014
5105
+ }
5106
+
5107
+ super.refreshContents(cp);
5108
+ }
39945109
39955110 void linkSomething(Object3D thing)
39965111 {
....@@ -4062,16 +5177,19 @@
40625177 {
40635178 if (group.selection.isEmpty())
40645179 return;
4065
- GrafreeD.clipboardIsTempGroup = false;
5180
+
5181
+ Grafreed.clipboardIsTempGroup = false;
40665182 Composite tGroup = null;
40675183 if (group.selection.size() > 0) // 1)
40685184 {
40695185 tGroup = new cGroup();
4070
- GrafreeD.clipboardIsTempGroup = true;
5186
+ Grafreed.clipboardIsTempGroup = true;
40715187 }
40725188
40735189 if (cut)
40745190 {
5191
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5192
+// Save();
40755193 //int indices[] = jList.getSelectedIndices();
40765194 //for (int i = indices.length - 1; i >= 0; i--)
40775195 //jList.remove(indices[i]);
....@@ -4107,16 +5225,16 @@
41075225 //System.out.println("cut " + child);
41085226 //System.out.println("parent = " + child.parent);
41095227 // tmp.addChild(child);
4110
- if (GrafreeD.clipboardIsTempGroup)
5228
+ if (Grafreed.clipboardIsTempGroup)
41115229 tGroup.add/*Child*/(tmp);
41125230 else
4113
- GrafreeD.clipboard = tmp;
5231
+ Grafreed.clipboard = tmp;
41145232 }
41155233 else
4116
- if (GrafreeD.clipboardIsTempGroup)
5234
+ if (Grafreed.clipboardIsTempGroup)
41175235 tGroup.add/*Child*/(child);
41185236 else
4119
- GrafreeD.clipboard = child;
5237
+ Grafreed.clipboard = child;
41205238 }
41215239
41225240 //ResetModel();
....@@ -4148,21 +5266,23 @@
41485266 //System.out.println("cut " + elem);
41495267 //System.out.println("parent = " + elem.parent);
41505268 // tmp.addChild(elem);
4151
- if (GrafreeD.clipboardIsTempGroup)
5269
+ if (Grafreed.clipboardIsTempGroup)
41525270 tGroup.add/*Child*/(tmp);
41535271 else
4154
- GrafreeD.clipboard = tmp;
5272
+ Grafreed.clipboard = tmp;
41555273 }
41565274 else
4157
- if (GrafreeD.clipboardIsTempGroup)
5275
+ if (Grafreed.clipboardIsTempGroup)
41585276 tGroup.add/*Child*/(child);
41595277 else
4160
- GrafreeD.clipboard = child;
5278
+ Grafreed.clipboard = child;
41615279 }
41625280
41635281 }
4164
- if (GrafreeD.clipboardIsTempGroup)
4165
- GrafreeD.clipboard = tGroup;
5282
+
5283
+ if (Grafreed.clipboardIsTempGroup)
5284
+ Grafreed.clipboard = tGroup;
5285
+
41665286 if (cut)
41675287 {
41685288 ResetModel();
....@@ -4172,11 +5292,15 @@
41725292
41735293 void paste(boolean expand)
41745294 {
5295
+ if (Globals.REPLACEONMAKE)
5296
+ Save();
5297
+ boolean keep = Globals.REPLACEONMAKE;
5298
+ Globals.REPLACEONMAKE = false;
41755299 // if (GrafreeD.clipboard == null)
41765300 // return;
41775301 boolean first = true;
41785302
4179
- if (GrafreeD.clipboardIsTempGroup)
5303
+ if (Grafreed.clipboardIsTempGroup)
41805304 {
41815305 Composite temp;
41825306
....@@ -4187,7 +5311,7 @@
41875311 temp = (Composite)Applet3D.clipboard.deepCopy();
41885312 */
41895313 Object3D elem;
4190
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5314
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41915315 {
41925316 Object3D child = (Object3D)e.nextElement();
41935317
....@@ -4221,21 +5345,22 @@
42215345 //Object3D cb = Applet3D.clipboard;
42225346 //temp.addChild(cb);
42235347 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4224
- assert(GrafreeD.clipboard.parent == null);
4225
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4226
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4227
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4228
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5348
+ assert(Grafreed.clipboard.parent == null);
5349
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5350
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5351
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5352
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42295353 else
4230
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4231
- GrafreeD.clipboard.get(0).parent = keepparent;
5354
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5355
+ Grafreed.clipboard.get(0).parent = keepparent;
42325356 }
42335357
5358
+ Globals.REPLACEONMAKE = keep;
42345359 ResetModel();
42355360 refreshContents();
42365361 }
42375362
4238
- void pasteInto(boolean copyit)
5363
+ void pasteInto(boolean copyit, boolean clone)
42395364 {
42405365 // if (GrafreeD.clipboard == null)
42415366 // return;
....@@ -4264,15 +5389,22 @@
42645389 if (copyit)
42655390 {
42665391 // paste(false);
4267
- CloneClipboard(false); // sept 2014
5392
+ if (clone)
5393
+ {
5394
+ CloneClipboard(false); // sept 2014
5395
+ }
5396
+ else
5397
+ {
5398
+ paste(false);
5399
+ }
42685400 }
42695401 else
42705402 {
42715403 boolean first = true;
42725404
4273
- if (GrafreeD.clipboardIsTempGroup)
5405
+ if (Grafreed.clipboardIsTempGroup)
42745406 {
4275
- Composite temp = (Composite)GrafreeD.clipboard;
5407
+ Composite temp = (Composite)Grafreed.clipboard;
42765408 Object3D copy;
42775409 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42785410 {
....@@ -4282,7 +5414,7 @@
42825414 }
42835415 } else
42845416 {
4285
- linkSomething(GrafreeD.clipboard); //.get(0));
5417
+ linkSomething(Grafreed.clipboard); //.get(0));
42865418 }
42875419 }
42885420 }
....@@ -4359,6 +5491,10 @@
43595491
43605492 void group(Object3D csg, boolean grab)
43615493 {
5494
+ if (Globals.REPLACEONMAKE)
5495
+ Save();
5496
+ boolean keep = Globals.REPLACEONMAKE;
5497
+ Globals.REPLACEONMAKE = false;
43625498 if (//false) // why??
43635499 !group.selection.isEmpty())
43645500 {
....@@ -4472,8 +5608,34 @@
44725608 //node.add(csg);
44735609 //makeSomething(node);
44745610 makeSomething(csg);
5611
+ Globals.REPLACEONMAKE = keep;
44755612 }
44765613
5614
+ void Ungroup(Object3D g)
5615
+ {
5616
+ if (Globals.REPLACEONMAKE)
5617
+ Save();
5618
+ boolean keep = Globals.REPLACEONMAKE;
5619
+ Globals.REPLACEONMAKE = false;
5620
+ if (g instanceof HiddenObject)
5621
+ {
5622
+ HiddenObject h = (HiddenObject) g;
5623
+
5624
+ for (int i=0; i<h.ActualSize(); i++)
5625
+ {
5626
+ objEditor.makeSomething(h.get(i), false);
5627
+ }
5628
+ }
5629
+ else
5630
+ {
5631
+ for (int i=0; i<g.Size(); i++)
5632
+ {
5633
+ objEditor.makeSomething(g.get(i), false);
5634
+ }
5635
+ }
5636
+ Globals.REPLACEONMAKE = keep;
5637
+ }
5638
+
44775639 void ungroup()
44785640 {
44795641 /*
....@@ -4667,21 +5829,6 @@
46675829 }
46685830 */
46695831
4670
- void ImportGFD()
4671
- {
4672
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4673
- browser.show();
4674
- String filename = browser.getFile();
4675
- if (filename != null && filename.length() > 0)
4676
- {
4677
- String fullname = browser.getDirectory() + filename;
4678
-
4679
- //Object3D readobj =
4680
- objEditor.ReadGFD(fullname, objEditor);
4681
- //makeSomething(readobj);
4682
- }
4683
- }
4684
-
46855832 /*
46865833 public void Callback(Object obj)
46875834 {
....@@ -4705,26 +5852,9 @@
47055852 }
47065853 */
47075854
4708
- void ImportVRMLX3D()
4709
- {
4710
- if (GrafreeD.standAlone)
4711
- {
4712
- /**/
4713
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4714
- browser.show();
4715
- String filename = browser.getFile();
4716
- if (filename != null && filename.length() > 0)
4717
- {
4718
- String fullname = browser.getDirectory() + filename;
4719
- LoadVRMLX3D(fullname);
4720
- }
4721
- /**/
4722
- }
4723
- }
4724
-
47255855 String GetFile(String dialogName)
47265856 {
4727
- if (GrafreeD.standAlone)
5857
+ if (Grafreed.standAlone)
47285858 {
47295859 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47305860 browser.show();
....@@ -4788,10 +5918,49 @@
47885918 cButton flashSelectionButton;
47895919 cButton editButton;
47905920 cButton uneditButton;
5921
+ JCheckBox allParamsButton;
47915922 cButton clearpanelButton;
4792
- cButton allParamsButton;
47935923 cButton unselectButton;
47945924
5925
+ cButton restoreCameraButton;
5926
+
5927
+ cButton saveButton;
5928
+ cButton oneStepButton;
5929
+
5930
+ cButton groupButton;
5931
+ cButton ungroupButton;
5932
+ cButton compositeButton;
5933
+ cButton switchButton;
5934
+ cButton loopButton;
5935
+ cButton textureButton;
5936
+
5937
+ cButton skybox1Button;
5938
+ cButton skybox2Button;
5939
+ cButton skybox3Button;
5940
+ cButton skybox4Button;
5941
+ cButton skybox5Button;
5942
+ cButton skybox6Button;
5943
+ cButton skybox7Button;
5944
+
5945
+ cButton skybox11Button;
5946
+ cButton skybox12Button;
5947
+ cButton skybox13Button;
5948
+ cButton skybox14Button;
5949
+ cButton skybox15Button;
5950
+ cButton skybox16Button;
5951
+ cButton skybox17Button;
5952
+
5953
+ cButton gridButton;
5954
+ cButton boxButton;
5955
+ cButton sphereButton;
5956
+ cButton coneButton;
5957
+ cButton torusButton;
5958
+ cButton superButton;
5959
+ cButton kleinButton;
5960
+ cButton particlesButton;
5961
+ cButton overlayButton;
5962
+ cButton lightButton;
5963
+
47955964 cButton screenfitButton;
47965965 cButton screenfitpointButton;
47975966 cButton snapobjectButton;
....@@ -4803,14 +5972,6 @@
48035972
48045973 cButton setsupportButton;
48055974
4806
- cButton twoButton;
4807
- cButton sixButton;
4808
- cButton threeButton;
4809
- cButton sevenButton;
4810
- cButton fourButton; // full panel
4811
- cButton oneButton; // full XYZ
4812
- //cButton currentLayout;
4813
-
48145975 //
48155976 //Composite
48165977 Object3D // to do !!
....@@ -4820,9 +5981,11 @@
48205981 //JTree jTree;
48215982 private MenuItem lookAtItem;
48225983 private MenuItem lookFromItem;
4823
- private MenuItem switchItem;
5984
+ private MenuItem switchViewItem;
48245985 private MenuItem cutItem;
4825
- private MenuItem duplicateItem;
5986
+ private MenuItem undoItem;
5987
+ private MenuItem redoItem;
5988
+ private JMenuItem duplicateItem;
48265989 private MenuItem cloneItem;
48275990 private MenuItem cloneSupportItem;
48285991 private MenuItem overwriteGeoItem;
....@@ -4833,8 +5996,9 @@
48335996 private MenuItem resetsupportItem;
48345997 private MenuItem resetreferencesItem;
48355998 private MenuItem linkverticesItem;
5999
+ private MenuItem relinkverticesItem;
48366000 private MenuItem setMasterItem;
4837
- private MenuItem resetMeshItem;
6001
+ private MenuItem resetAllItem;
48386002 private MenuItem stepAllItem;
48396003 private MenuItem revertMeshItem;
48406004 private MenuItem poseMeshItem;
....@@ -4845,15 +6009,17 @@
48456009 private MenuItem mergeGeometriesItem;
48466010 private MenuItem copyItem;
48476011 private MenuItem pasteItem;
6012
+ private MenuItem pasteIntoItem;
48486013 private MenuItem pasteLinkItem;
48496014 private MenuItem pasteCloneItem;
48506015 private MenuItem pasteExpandItem;
4851
- private MenuItem clearItem;
6016
+ private MenuItem deleteItem;
48526017 private MenuItem clearAllItem;
48536018 private MenuItem genUVItem;
48546019 private MenuItem genNormalsMESHItem;
48556020 private MenuItem genNormalsCADItem;
48566021 private MenuItem genNormalsORGANItem;
6022
+ private MenuItem genNormalsMINEItem;
48576023 private MenuItem stripifyItem;
48586024 private MenuItem unstripifyItem;
48596025 private MenuItem trimItem;
....@@ -4882,6 +6048,10 @@
48826048 private MenuItem showleavesItem;
48836049 private MenuItem markleavesItem;
48846050 private MenuItem unmarkleavesItem;
6051
+ private MenuItem rewindleavesItem;
6052
+ private MenuItem unrewindleavesItem;
6053
+ private MenuItem randomleavesItem;
6054
+ private MenuItem unrandomleavesItem;
48856055
48866056 private MenuItem flipVItem;
48876057 private MenuItem unflipVItem;
....@@ -4893,14 +6063,17 @@
48936063 private MenuItem panoTexturesItem;
48946064
48956065 private MenuItem resetCentroidItem;
4896
- private MenuItem transformgeometryItem;
6066
+ private MenuItem resetCentroidXZItem;
48976067 private MenuItem resetTransformItem;
6068
+ private MenuItem transformGeometryItem;
6069
+ private MenuItem transformChildrenItem;
6070
+ private MenuItem hideItem;
48986071 private MenuItem grabItem;
48996072 private MenuItem backItem;
49006073 private MenuItem frontItem;
49016074 private MenuItem cameraItem;
49026075 private MenuItem compositeItem;
4903
- private MenuItem randomItem;
6076
+ private MenuItem switchItem;
49046077 private MenuItem physicsItem;
49056078 private MenuItem frameselectorItem;
49066079 private MenuItem scriptNodeItem;
....@@ -4915,6 +6088,7 @@
49156088
49166089 private MenuItem resetParentItem;
49176090 private MenuItem repairParentItem;
6091
+ private MenuItem repairShadowItem;
49186092 private MenuItem sortbysizeItem;
49196093 private MenuItem sortbynameItem;
49206094
....@@ -4923,6 +6097,8 @@
49236097 private MenuItem attachBumpItem;
49246098 private MenuItem detachBumpItem;
49256099 private MenuItem pigmentBumpItem;
6100
+ private MenuItem embedTexturesItem;
6101
+ private MenuItem deEmbedTexturesItem;
49266102
49276103 private MenuItem particleItem;
49286104 private MenuItem ragdollItem;
....@@ -4935,10 +6111,11 @@
49356111 private MenuItem coneItem;
49366112 private MenuItem torusItem;
49376113 private MenuItem superItem;
6114
+ private MenuItem kleinItem;
49386115 private MenuItem blobItem;
49396116 private MenuItem latheItem;
49406117 private MenuItem bezierItem;
4941
- private MenuItem checkerItem;
6118
+ private MenuItem overlayItem;
49426119 private MenuItem meshItem;
49436120 // private MenuItem meshGroupItem;
49446121 private MenuItem springItem;
....@@ -4947,6 +6124,7 @@
49476124 private MenuItem csgItem;
49486125 private MenuItem templateItem;
49496126 private MenuItem textureItem;
6127
+ private MenuItem billboardItem;
49506128 private MenuItem shadowXItem;
49516129 private MenuItem shadowYItem;
49526130 private MenuItem shadowZItem;
....@@ -4959,11 +6137,6 @@
49596137 private MenuItem doubleItem;
49606138 private MenuItem tripleItem;
49616139
4962
- private MenuItem importGFDItem;
4963
- private MenuItem importVRMLX3DItem;
4964
- private MenuItem import3DSItem;
4965
- private MenuItem importOBJItem;
4966
-
49676140 private MenuItem computeAOItem;
49686141 private MenuItem recompileItem;
49696142 private MenuItem editScriptItem;
....@@ -4973,4 +6146,8 @@
49736146 private MenuItem analyzeItem;
49746147 private MenuItem dumpItem;
49756148 //boolean freezemodel = false;
6149
+
6150
+ Menu cameraMenu;
6151
+ MenuItem editCameraItem;
6152
+ MenuItem restoreCameraItem;
49766153 }