Normand Briere
2019-07-28 d7fd07756f4095cb87dc25d89fcffcbda092e2cf
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,237 @@
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 + "/" + s + ".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("default", "uffizi", row0);
62
+ AddSkyboxButton("default", "CloudyHills", row0);
63
+
64
+ AddSkyboxButton("default", "skycube", row1);
65
+ AddSkyboxButton("bridge", "Bridge", row1);
66
+ AddSkyboxButton("bridge", "Bridge2", row1);
67
+ AddSkyboxButton("urban", "GamlaStan2", row1);
68
+
69
+ AddSkyboxButton("urban", "Parliament", row2);
70
+ AddSkyboxButton("urban", "Roundabout", row2);
71
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
73
+
74
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
75
+ AddSkyboxButton("urban", "UnionSquare", row3);
76
+ AddSkyboxButton("park", "BerzeliiPark", row3);
77
+ AddSkyboxButton("park", "Buddha", row3);
78
+
79
+ AddSkyboxButton("park", "CNTower2", row4);
80
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
81
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
82
+ AddSkyboxButton("park", "Park", row4);
83
+
84
+ AddSkyboxButton("park", "Pond", row5);
85
+ AddSkyboxButton("park", "Skansen", row5);
86
+ AddSkyboxButton("park", "Skansen2", row5);
87
+ AddSkyboxButton("park", "Skansen3", row5);
88
+
89
+ AddSkyboxButton("park", "Skansen4", row6);
90
+ AddSkyboxButton("park", "Skansen5", row6);
91
+ AddSkyboxButton("park", "Stairs", row6);
92
+ AddSkyboxButton("park", "Tantolunden4", row6);
93
+
94
+ tab0.add(row0);
95
+ tab0.add(row1);
96
+ tab0.add(row2);
97
+ tab0.add(row3);
98
+ tab0.add(row4);
99
+ tab0.add(row5);
100
+ tab0.add(row6);
101
+
102
+ for (int i=5; --i>=0;)
103
+ {
104
+ //oe.toolboxPanel.Return();
105
+ //tab0.add(new cGridBag());
106
+ }
107
+ }
108
+
109
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
110
+ {
111
+ cGridBag tab0 = new cGridBag().setVertical(true);
112
+
113
+ tab0.setName("Nature");
114
+ skyboxpanel.add(tab0);
115
+
116
+ cGridBag row0 = new cGridBag();
117
+ cGridBag row1 = new cGridBag();
118
+ cGridBag row2 = new cGridBag();
119
+ cGridBag row3 = new cGridBag();
120
+ cGridBag row4 = new cGridBag();
121
+ cGridBag row5 = new cGridBag();
122
+ cGridBag row6 = new cGridBag();
123
+
124
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
125
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
126
+ AddSkyboxButton("beach", "PalmTrees", row0);
127
+ AddSkyboxButton("beach", "Tenerife", row0);
128
+
129
+ AddSkyboxButton("beach", "Tenerife2", row1);
130
+ AddSkyboxButton("beach", "Tenerife3", row1);
131
+ AddSkyboxButton("field", "FishPond", row1);
132
+ AddSkyboxButton("field", "Footballfield", row1);
133
+
134
+ AddSkyboxButton("field", "Meadow", row2);
135
+ AddSkyboxButton("field", "Sorsele", row2);
136
+ AddSkyboxButton("field", "Sorsele2", row2);
137
+ AddSkyboxButton("field", "Sorsele3", row2);
138
+
139
+ AddSkyboxButton("forest", "Brudslojan", row3);
140
+ AddSkyboxButton("forest", "Langholmen2", row3);
141
+ AddSkyboxButton("forest", "Plants", row3);
142
+ AddSkyboxButton("mountain", "Maskonaive", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
146
+ AddSkyboxButton("mountain", "Ryfjallet", row4);
147
+ AddSkyboxButton("mountain", "Teide", row4);
148
+
149
+ AddSkyboxButton("rocky", "Langholmen", row5);
150
+ AddSkyboxButton("rocky", "Riddarfjarden", row5);
151
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
152
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
153
+ /*
154
+Kastellholmen
155
+Langholmen
156
+Riddarfjarden
157
+Skinnarviksberget
158
+Tanto
159
+Tantolunden2
160
+Tantolunden6
161
+ */
162
+
163
+ tab0.add(row0);
164
+ tab0.add(row1);
165
+ tab0.add(row2);
166
+ tab0.add(row3);
167
+ tab0.add(row4);
168
+ tab0.add(row5);
169
+ tab0.add(row6);
170
+
171
+ for (int i=5; --i>=0;)
172
+ {
173
+ //oe.toolboxPanel.Return();
174
+ //tab0.add(new cGridBag());
175
+ }
176
+ }
177
+
178
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
179
+ {
180
+ cGridBag tab0 = new cGridBag().setVertical(true);
181
+
182
+ tab0.setName("Night");
183
+ skyboxpanel.add(tab0);
184
+
185
+ cGridBag row0 = new cGridBag();
186
+ cGridBag row1 = new cGridBag();
187
+ cGridBag row2 = new cGridBag();
188
+ cGridBag row3 = new cGridBag();
189
+ cGridBag row4 = new cGridBag();
190
+ cGridBag row5 = new cGridBag();
191
+ cGridBag row6 = new cGridBag();
192
+
193
+ AddSkyboxButton("night", "NightPath", row0);
194
+ AddSkyboxButton("night", "PondNight", row0);
195
+ AddSkyboxButton("night", "Powerlines", row0);
196
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
197
+
198
+ AddSkyboxButton("urban", "CNTower", row1);
199
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
200
+ AddSkyboxButton("indoors", "DallasW", row1);
201
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row1);
202
+
203
+ AddSkyboxButton("indoors", "Vasa", row2);
204
+ AddSkyboxButton("winter", "Backyard", row2);
205
+ AddSkyboxButton("winter", "Creek", row2);
206
+ AddSkyboxButton("winter", "FootballField3", row2);
207
+
208
+ AddSkyboxButton("winter", "Forest", row3);
209
+ AddSkyboxButton("winter", "HornstullsStrand2", row3);
210
+ AddSkyboxButton("winter", "House", row3);
211
+ AddSkyboxButton("winter", "IceLake", row3);
212
+
213
+ AddSkyboxButton("winter", "IceRiver", row4);
214
+ AddSkyboxButton("winter", "Park3", row4);
215
+ AddSkyboxButton("winter", "PondWinter", row4);
216
+
217
+ AddSkyboxButton("winter", "Tantolunden5", row5);
218
+ AddSkyboxButton("winter", "Vindelalven", row5);
219
+ /*
220
+Backyard
221
+Creek
222
+FootballField3
223
+Forest
224
+HornstullsStrand2
225
+House
226
+IceLake
227
+IceRiver
228
+Park3
229
+PondWinter
230
+Tantolunden5
231
+Vindelalven *
232
+ */
233
+
234
+ tab0.add(row0);
235
+ tab0.add(row1);
236
+ tab0.add(row2);
237
+ tab0.add(row3);
238
+ tab0.add(row4);
239
+ tab0.add(row5);
240
+ tab0.add(row6);
241
+
242
+ for (int i=5; --i>=0;)
243
+ {
244
+ //oe.toolboxPanel.Return();
245
+ //tab0.add(new cGridBag());
246
+ }
247
+ }
248
+
249
+ public void ChangeSkybox(String name)
250
+ {
251
+ cameraView.envyoff = false;
252
+ cameraView.skyboxname = name;
253
+ cameraView.skyboxext = "jpg";
254
+ cameraView.repaint();
255
+ }
256
+
25257 //ObjEditor objEditor;
26258 public void closeUI2()
27259 {
....@@ -59,6 +291,12 @@
59291 this.copy = this.group = group;
60292 //selectees = this.group.selectees;
61293
294
+ if (copy.versions == null)
295
+ {
296
+ copy.versions = new byte[100][];
297
+ copy.versionindex = -1;
298
+ }
299
+
62300 if(ui)
63301 SetupUI(objEditor);
64302 }
....@@ -73,16 +311,28 @@
73311 this.copy = this.group = copy;
74312 //selectees = this.group.selectees;
75313
76
- SetupMenu2(objEditor);
314
+ SetupMenu2(this); //objEditor);
77315 SetupUI2(objEditor);
78316 objEditor.SetupUI(true);
79317 SetupViews(objEditor);
80318
81319 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
320
+
321
+ if (copy.versions == null)
322
+ {
323
+ copy.versions = new byte[100][];
324
+ copy.versionindex = -1;
325
+
326
+ Save(true);
327
+ }
82328 }
83329
84330 void CloneSelection(boolean supports)
85331 {
332
+ if (Globals.REPLACEONMAKE)
333
+ Save();
334
+ boolean keep = Globals.REPLACEONMAKE;
335
+ Globals.REPLACEONMAKE = false;
86336 // Object3D keep = GrafreeD.clipboard;
87337 //Object3D obj;
88338 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +343,19 @@
93343
94344 makeSomething(clone, i==group.selection.size()-1);
95345 }
346
+ Globals.REPLACEONMAKE = keep;
96347 }
97348
98349 void CloneClipboard(boolean supports)
99350 {
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));
351
+ assert(Grafreed.clipboard.parent == null);
352
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
353
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
354
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
355
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105356 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
357
+ makeSomething(CloneObject(Grafreed.clipboard, false));
358
+ Grafreed.clipboard.get(0).parent = keepparent;
108359 }
109360
110361 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +369,7 @@
118369 // obj.support = null;
119370 if (!supports)
120371 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
372
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122373 obj.parent = parent;
123374 // obj.support = support;
124375 // clone.support = support; // aout 2013
....@@ -147,30 +398,29 @@
147398
148399 //JTextField nameField;
149400
150
- void SetupMenu2(ObjEditor oe)
401
+ void SetupMenu2(GroupEditor oe)
151402 {
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);
403
+ oe.jTree = new cTree();
404
+
163405 Menu menu;
164406 oe.menuBar.add(menu = new Menu("Edit"));
165407 //editItem = menu.add(new MenuItem("Edit"));
166408 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
409
+
410
+// undoItem = menu.add(new MenuItem("Undo"));
411
+// undoItem.addActionListener(this);
412
+// redoItem = menu.add(new MenuItem("Redo"));
413
+// redoItem.addActionListener(this);
414
+// menu.add("-");
415
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168416 duplicateItem.addActionListener(this);
169
- menu.add("-");
170417 cloneItem = menu.add(new MenuItem("Clone"));
171418 cloneItem.addActionListener(this);
419
+ if (Globals.ADVANCED)
420
+ {
172421 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173422 cloneSupportItem.addActionListener(this);
423
+ }
174424 menu.add("-");
175425 cutItem = menu.add(new MenuItem("Cut"));
176426 cutItem.addActionListener(this);
....@@ -178,27 +428,123 @@
178428 copyItem.addActionListener(this);
179429 pasteItem = menu.add(new MenuItem("Paste"));
180430 pasteItem.addActionListener(this);
431
+
432
+ menu.add("-");
433
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
434
+ pasteIntoItem.addActionListener(this);
181435 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182436 pasteLinkItem.addActionListener(this);
183437 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184438 pasteCloneItem.addActionListener(this);
185439 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186440 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
441
+ menu.add("-");
442
+ deleteItem = menu.add(new MenuItem("Delete"));
443
+ deleteItem.addActionListener(this);
444
+
445
+ if (Globals.ADVANCED)
446
+ {
447
+ // Deletes the cameras...
189448 clearAllItem = menu.add(new MenuItem("Clear All"));
190449 clearAllItem.addActionListener(this);
450
+ }
451
+
452
+ menuBar.add(cameraMenu = new Menu("View"));
453
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
454
+ //zBufferItem.addActionListener(this);
455
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
456
+ //normalLensItem.addActionListener(this);
457
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
458
+ restoreCameraItem.addActionListener(this);
459
+
460
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
461
+// toggleFullScreenItem.addItemListener(this);
462
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
463
+// cameraMenu.add("-");
464
+//
465
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
466
+// toggleTextureItem.addItemListener(this);
467
+// toggleTextureItem.setState(CameraPane.textureon);
468
+//
469
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
470
+// toggleSwitchItem.addItemListener(this);
471
+// toggleSwitchItem.setState(CameraPane.SWITCH);
472
+
473
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
474
+ toggleHandleItem.addItemListener(this);
475
+ toggleHandleItem.setState(CameraPane.HANDLES);
476
+
477
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
478
+ togglePaintItem.addItemListener(this);
479
+ togglePaintItem.setState(CameraPane.PAINTMODE);
480
+
481
+ if (Globals.ADVANCED)
482
+ {
483
+ cameraMenu.add("-");
484
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
485
+ toggleLiveItem.addItemListener(this);
486
+ toggleLiveItem.setState(Globals.isLIVE());
191487
488
+ cameraMenu.add(stepItem = new MenuItem("Step"));
489
+ stepItem.addActionListener(this);
490
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
491
+ // toggleDLItem.addItemListener(this);
492
+ // toggleDLItem.setState(false);
493
+
494
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
495
+ toggleRenderItem.addItemListener(this);
496
+ toggleRenderItem.setState(!CameraPane.frozen);
497
+
498
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
499
+ toggleDebugItem.addItemListener(this);
500
+ toggleDebugItem.setState(Globals.DEBUG);
501
+
502
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
503
+ toggleFrustumItem.addItemListener(this);
504
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
505
+
506
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
507
+ toggleFootContactItem.addItemListener(this);
508
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
509
+
510
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
511
+ toggleTimelineItem.addItemListener(this);
512
+ }
513
+
514
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
515
+// toggleRootItem.addItemListener(this);
516
+// toggleRootItem.setState(false);
517
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
518
+// animationItem.addItemListener(this);
519
+// animationItem.setState(CameraPane.ANIMATION);
520
+ cameraMenu.add("-");
521
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
522
+ editCameraItem.addActionListener(this);
523
+
524
+ if (Globals.ADVANCED)
525
+ {
526
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
527
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
528
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
529
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
530
+ oe.cameraMenu.add("-");
531
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
532
+ openWindowItem.addActionListener(this);
533
+ editLeafItem.addActionListener(this);
534
+ lookAtItem.addActionListener(this);
535
+ //lookFromItem.addActinoListener(this);
536
+ //switchViewItem.addActionListener(this);
537
+ }
538
+
192539 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);
540
+ if (Globals.ADVANCED)
541
+ {
197542 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198543 revertMeshItem.addActionListener(this);
199544 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200545 resetreferencesItem.addActionListener(this);
201546 menu.add("-");
547
+ }
202548 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203549 overwriteGeoItem.addActionListener(this);
204550 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,73 +556,104 @@
210556 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211557 overwriteUVItem.addActionListener(this);
212558 menu.add("-");
559
+ if (Globals.ADVANCED)
560
+ {
213561 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214562 generateMeshItem.addActionListener(this);
215563 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216564 poseMeshItem.addActionListener(this);
217565 menu.add("-");
566
+ }
218567 resetsupportItem = menu.add(new MenuItem("Reset support"));
219568 resetsupportItem.addActionListener(this);
220569 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221570 linkverticesItem.addActionListener(this);
571
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
572
+ relinkverticesItem.addActionListener(this);
573
+
574
+ if (Globals.ADVANCED)
575
+ {
222576 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223577 setMasterItem.addActionListener(this);
578
+ }
224579
225580 oe.menuBar.add(menu = new Menu("Group"));
226
- grabItem = menu.add(new MenuItem("Grab"));
227
- grabItem.addActionListener(this);
581
+// grabItem = menu.add(new MenuItem("Grab"));
582
+// grabItem.addActionListener(this);
228583 backItem = menu.add(new MenuItem("Back"));
229584 backItem.addActionListener(this);
230585 frontItem = menu.add(new MenuItem("Front"));
231586 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);
587
+// compositeItem = menu.add(new MenuItem("Composite"));
588
+// compositeItem.addActionListener(this);
589
+
590
+ if (Globals.ADVANCED)
591
+ {
592
+ hideItem = menu.add(new MenuItem("Hidden Group"));
593
+ hideItem.addActionListener(this);
594
+ }
595
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
596
+ ungroupItem.addActionListener(this);
597
+
598
+// menu.add("-");
599
+//
600
+// switchItem = menu.add(new MenuItem("Switch node"));
601
+// switchItem.addActionListener(this);
602
+ if (Globals.ADVANCED)
603
+ {
241604 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242605 switchGeoItem.addActionListener(this);
243606 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244607 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
608
+ morphItem = menu.add(new MenuItem("Morph Group"));
246609 morphItem.addActionListener(this);
610
+
611
+ menu.add("-");
612
+ physicsItem = menu.add(new MenuItem("Physics"));
613
+ physicsItem.addActionListener(this);
614
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
615
+ frameselectorItem.addActionListener(this);
247616 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248617 scriptNodeItem.addActionListener(this);
249
- cameraItem = menu.add(new MenuItem("Camera"));
250
- cameraItem.addActionListener(this);
618
+ }
251619
252620 oe.menuBar.add(menu = new Menu("Object"));
253
- textureItem = menu.add(new MenuItem("Texture"));
254
- textureItem.addActionListener(this);
621
+// textureItem = menu.add(new MenuItem("Texture"));
622
+// textureItem.addActionListener(this);
623
+ billboardItem = menu.add(new MenuItem("Billboard"));
624
+ billboardItem.addActionListener(this);
255625 csgItem = menu.add(new MenuItem("CSG"));
256626 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
627
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258628 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
629
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260630 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
631
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262632 shadowZItem.addActionListener(this);
633
+ attributeItem = menu.add(new MenuItem("Attribute"));
634
+ attributeItem.addActionListener(this);
635
+
636
+ if (Globals.ADVANCED)
637
+ {
638
+ menu.add("-");
263639 linkerItem = menu.add(new MenuItem("Linker"));
264640 linkerItem.addActionListener(this);
265641 templateItem = menu.add(new MenuItem("Template"));
266642 templateItem.addActionListener(this);
267
- attributeItem = menu.add(new MenuItem("Attribute"));
268
- attributeItem.addActionListener(this);
269643 pointflowItem = menu.add(new MenuItem("Point Flow"));
270644 pointflowItem.addActionListener(this);
645
+ }
271646 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274647 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275648 resetTransformItem.addActionListener(this);
276649 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277650 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
651
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
652
+ resetCentroidXZItem.addActionListener(this);
653
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
654
+ transformGeometryItem.addActionListener(this);
655
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
656
+ transformChildrenItem.addActionListener(this);
280657
281658 oe.menuBar.add(menu = new Menu("Geometry"));
282659 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -285,6 +662,13 @@
285662 genNormalsORGANItem.addActionListener(this);
286663 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
287664 genNormalsCADItem.addActionListener(this);
665
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
666
+ genNormalsMESHItem.addActionListener(this);
667
+ if (Globals.ADVANCED)
668
+ {
669
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
670
+ genNormalsMINEItem.addActionListener(this);
671
+ }
288672 stripifyItem = menu.add(new MenuItem("Stripify"));
289673 stripifyItem.addActionListener(this);
290674 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -306,23 +690,34 @@
306690 reduce34MeshItem.addActionListener(this);
307691 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308692 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311693 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312694 clipMeshItem.addActionListener(this);
695
+
696
+ if (Globals.ADVANCED)
697
+ {
698
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
699
+ smoothMeshItem.addActionListener(this);
700
+ }
313701
314702 oe.menuBar.add(menu = new Menu("Attributes"));
315703 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
316704 clearMaterialsItem.addActionListener(this);
705
+ resetAllItem = menu.add(new MenuItem("Reset All"));
706
+ resetAllItem.addActionListener(this);
707
+ stepAllItem = menu.add(new MenuItem("Step All"));
708
+ stepAllItem.addActionListener(this);
317709 menu.add("-");
318710 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
319711 liveleavesItem.addActionListener(this);
320712 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
321713 unliveleavesItem.addActionListener(this);
714
+ if (Globals.ADVANCED)
715
+ {
322716 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
323717 supportleavesItem.addActionListener(this);
324718 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
325719 unsupportleavesItem.addActionListener(this);
720
+ }
326721 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
327722 hideleavesItem.addActionListener(this);
328723 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -331,6 +726,14 @@
331726 markleavesItem.addActionListener(this);
332727 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
333728 unmarkleavesItem.addActionListener(this);
729
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
730
+ rewindleavesItem.addActionListener(this);
731
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
732
+ unrewindleavesItem.addActionListener(this);
733
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
734
+ randomleavesItem.addActionListener(this);
735
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
736
+ unrandomleavesItem.addActionListener(this);
334737 menu.add("-");
335738 flipVItem = menu.add(new MenuItem("Flip V"));
336739 flipVItem.addActionListener(this);
....@@ -356,45 +759,56 @@
356759 attachBumpItem.addActionListener(this);
357760 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
358761 pigmentBumpItem.addActionListener(this);
762
+ //embedTexturesItem
359763 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
360764 detachPigmentItem.addActionListener(this);
361765 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
362766 detachBumpItem.addActionListener(this);
767
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
768
+ embedTexturesItem.addActionListener(this);
769
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
770
+ deEmbedTexturesItem.addActionListener(this);
363771 menu.add("-");
364772 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
365773 sortbysizeItem.addActionListener(this);
366774 sortbynameItem = menu.add(new MenuItem("Sort by name"));
367775 sortbynameItem.addActionListener(this);
368776 menu.add("-");
777
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
778
+ shareGeometriesItem.addActionListener(this);
779
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
780
+ mergeGeometriesItem.addActionListener(this);
781
+ if (Globals.ADVANCED)
782
+ {
783
+ // Pretty much the same as duplicate and clone.
369784 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
370785 extractGeometriesItem.addActionListener(this);
371786 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
372787 cloneGeometriesItem.addActionListener(this);
373
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
374
- shareGeometriesItem.addActionListener(this);
375
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
376
- mergeGeometriesItem.addActionListener(this);
788
+ }
377789
378790 oe.menuBar.add(menu = new Menu("Insert"));
379791 buildCreateMenu(menu);
380792
381
-
382
- oe.menuBar.add(menu = new Menu("Include"));
383
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
384
- importGFDItem.addActionListener(this);
385
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
386
- importVRMLX3DItem.addActionListener(this);
387
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
388
- importOBJItem.addActionListener(this);
389
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
390
- import3DSItem.addActionListener(this);
391
-
392793 oe.menuBar.add(menu = new Menu("Tools"));
393794 buildToolsMenu(menu);
394795 }
395796
797
+
396798 void SetupUI2(ObjEditor oe)
397799 {
800
+ // June 2019
801
+ if (oe == null)
802
+ {
803
+ //super.SetupUI2(this);
804
+ //return;
805
+ }
806
+
807
+ if (copy != group)
808
+ {
809
+ //super.SetupUI2(this);
810
+ }
811
+
398812 //new Exception().printStackTrace();
399813
400814 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -423,150 +837,238 @@
423837 oe.radioPanel.add(dummyButton);
424838 oe.buttonGroup.add(dummyButton);
425839 */
426
- aConstraints.gridy += 1;
427
- oe.aConstraints.gridwidth = 1;
428
- oe.aConstraints.gridx = 0;
840
+ cGridBag copyOptionsPanel = new cGridBag();
841
+
842
+ copyOptionsPanel.preferredHeight = 2;
429843
430
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
844
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
845
+
846
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
847
+ //minButton.setToolTipText("Minimize window");
848
+ //minButton.addActionListener(this);
849
+
850
+ if (Globals.ADVANCED)
851
+ {
852
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
853
+ maxButton.setToolTipText("Maximize window");
854
+ maxButton.addActionListener(this);
855
+ }
856
+
857
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
858
+ fullButton.setToolTipText("Full-screen window");
859
+ fullButton.addActionListener(this);
860
+
861
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
862
+ screenfitButton.setToolTipText("Screen fit");
863
+ screenfitButton.addActionListener(this);
864
+
865
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
866
+ restoreCameraButton.setToolTipText("Restore viewpoint");
867
+ restoreCameraButton.addActionListener(this);
868
+
869
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
870
+ saveButton.setToolTipText("New version");
871
+ saveButton.addActionListener(this);
872
+
873
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
874
+ undoButton.setToolTipText("Previous version");
875
+ undoButton.addActionListener(this);
876
+ undoButton.setEnabled(false);
877
+
878
+ cGridBag updown = new cGridBag().setVertical(true);
879
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
880
+ restoreButton.setToolTipText("Restore current");
881
+ restoreButton.addActionListener(this);
882
+ restoreButton.setEnabled(false);
883
+
884
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
885
+ replaceButton.setToolTipText("Replace current");
886
+ replaceButton.addActionListener(this);
887
+ replaceButton.setEnabled(false);
888
+
889
+ copyOptionsPanel.add(updown);
890
+
891
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
892
+ redoButton.setToolTipText("Next version");
893
+ redoButton.addActionListener(this);
894
+ redoButton.setEnabled(false);
895
+
896
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
897
+ liveCB.setToolTipText("Enable animation");
431898 liveCB.addItemListener(this);
432899
433
- oe.aConstraints.gridx += 1;
434
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
435
- supportCB.addItemListener(this);
436
-
437
- // oe.aConstraints.gridx += 1;
438
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
439
- // localCB.addItemListener(this);
440
-
441
- oe.aConstraints.gridx += 1;
442
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
443
- crowdCB.addItemListener(this);
444
-
445
- oe.aConstraints.gridx += 1;
446
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
447
- smoothCB.addItemListener(this);
448
-
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
900
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
901
+ oneStepButton.setToolTipText("Animate one step forward");
902
+ oneStepButton.addActionListener(this);
903
+
904
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
905
+ fastCB.setToolTipText("Fast mode");
451906 fastCB.addItemListener(this);
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
454
- slowCB.addItemListener(this);
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
457
- boxCB.addItemListener(this);
907
+
908
+ //oe.toolboxPanel.Return();
909
+
910
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
911
+// trackCB.setToolTipText("Enable tracking");
912
+// trackCB.addItemListener(this);
458913
459
-// oe.aConstraints.gridx += 1;
460
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
461
-// speakerMocapCB.addItemListener(this);
462
-
463
- if (false)
464
- {
465
- // handled in scripts
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
468
- speakerCameraCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
472
- speakerFocusCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
476
- smoothfocusCB.addItemListener(this);
477
- }
478
-
479
-//oe.aConstraints.gridx += 1;
480
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
481
-// debugCB.addItemListener(this);
482
-
483
- oe.aConstraints.gridx += 1;
484
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
485
- oeilCB.addItemListener(this);
486
-
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
489
- lookAtCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
493
- trackCB.addItemListener(this);
494
-
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
497
- screenfitButton.addActionListener(this);
498
- oe.aConstraints.gridx += 1;
499914 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
500915 // screenfitpointButton.addActionListener(this);
501
-// oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
503
- snapobjectButton.addActionListener(this);
504
- oe.aConstraints.gridx += 1;
505916
506
- //aConstraints.gridx = 0;
507
- //aConstraints.gridy += 1;
508
- oe.aConstraints.weighty = 0;
509
- oe.aConstraints.gridwidth = 1;
510
-
511
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
512
- flashSelectionButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
516
-
517
- //
518
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
519
- twoButton.addActionListener(this);
520
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
917
+ if (Globals.ADVANCED)
918
+ {
919
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
920
+ snapobjectButton.addActionListener(this);
921
+ snapobjectButton.setToolTipText("Snap Object");
922
+
923
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521924 fourButton.addActionListener(this);
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
523
- sixButton.addActionListener(this);
524
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
925
+ fourButton.setToolTipText("Show control panel only");
926
+ }
927
+
928
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
929
+
930
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ twoButton.setToolTipText("Show 3D view only");
932
+ twoButton.addActionListener(this);
933
+ this.fullscreenLayout = twoButton;
934
+
935
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
936
+ threeButton.setToolTipText("Show controls and 3D view");
525937 threeButton.addActionListener(this);
526
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
527
- sevenButton.addActionListener(this);
938
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ sixButton.setToolTipText("Show 3D view and controls");
940
+ sixButton.addActionListener(this);
941
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
+// sevenButton.setToolTipText("3-column layout");
943
+// sevenButton.addActionListener(this);
528944 //
529945
530
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
946
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
947
+ rootButton.setToolTipText("Open selection in new tab");
531948 rootButton.addActionListener(this);
532
- oe.aConstraints.gridx += 1;
533
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
949
+
950
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
951
+ closeButton.setToolTipText("Close tab");
534952 closeButton.addActionListener(this);
535953 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
536954 //clearButton.addActionListener(this);
537
- oe.aConstraints.gridx += 1;
538
-
539
- oe.aConstraints.gridx = 1; //
540
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
541
- editButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
545955
546
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
956
+ cGridBag row1 = new cGridBag();
957
+
958
+ // INSERT
959
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
960
+ gridButton.setToolTipText("Create grid");
961
+ gridButton.addActionListener(this);
962
+
963
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
964
+ boxButton.setToolTipText("Create box");
965
+ boxButton.addActionListener(this);
966
+
967
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
968
+ sphereButton.setToolTipText("Create sphere");
969
+ sphereButton.addActionListener(this);
970
+
971
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
972
+ coneButton.setToolTipText("Create cone");
973
+ coneButton.addActionListener(this);
974
+
975
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
976
+ torusButton.setToolTipText("Create torus");
977
+ torusButton.addActionListener(this);
978
+
979
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
980
+ superButton.setToolTipText("Create superellipsoid");
981
+ superButton.addActionListener(this);
982
+
983
+ if (Globals.ADVANCED)
984
+ {
985
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
986
+ kleinButton.setToolTipText("Create Klein bottle");
987
+ kleinButton.addActionListener(this);
988
+ }
989
+
990
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
991
+ particlesButton.setToolTipText("Create particle system");
992
+ particlesButton.addActionListener(this);
993
+
994
+ oe.toolboxPanel.add(row1);
995
+
996
+ cGridBag row2 = new cGridBag();
997
+
998
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
999
+ groupButton.setToolTipText("Create group");
1000
+ groupButton.addActionListener(this);
1001
+
1002
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1003
+ compositeButton.setToolTipText("Create composite");
1004
+ compositeButton.addActionListener(this);
1005
+
1006
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
+ switchButton.setToolTipText("Create item switcher");
1008
+ switchButton.addActionListener(this);
1009
+
1010
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1011
+ loopButton.setToolTipText("Create loop");
1012
+ loopButton.addActionListener(this);
1013
+
1014
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1015
+ textureButton.setToolTipText("Create texture");
1016
+ textureButton.addActionListener(this);
1017
+
1018
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1019
+ overlayButton.setToolTipText("Create overlay");
1020
+ overlayButton.addActionListener(this);
1021
+
1022
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1023
+ lightButton.setToolTipText("Create light");
1024
+ lightButton.addActionListener(this);
1025
+
1026
+ oe.toolboxPanel.add(row2);
1027
+
1028
+ // ENVYMAPS
1029
+ cGridBag skyboxpane = new cGridBag();
1030
+ skyboxpane.preferredHeight = 100;
1031
+
1032
+ oe.toolboxPanel.add(skyboxpane);
1033
+
1034
+ JTabbedPane skyboxpanel = new JTabbedPane();
1035
+ skyboxpane.add(skyboxpanel);
1036
+
1037
+ AddSkyboxTab0(skyboxpanel);
1038
+ AddSkyboxTab1(skyboxpanel);
1039
+ AddSkyboxTab2(skyboxpanel);
1040
+
1041
+ // EDIT panel
1042
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1043
+ editButton.setToolTipText("Pin selection controls");
1044
+ editButton.addActionListener(this);
1045
+
1046
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1047
+ uneditButton.setToolTipText("Remove selection controls");
5471048 uneditButton.addActionListener(this);
5481049
549
- oe.aConstraints.gridx += 1;
550
- oe.aConstraints.weighty = 0;
551
- oe.aConstraints.gridwidth = 1;
552
-
553
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
554
- clearPanelButton.addActionListener(this);
555
-
556
- oe.aConstraints.gridx += 1;
557
- oe.aConstraints.weighty = 0;
558
- oe.aConstraints.gridwidth = 1;
559
-
560
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1050
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1051
+ allParamsButton.setToolTipText("Show all controle");
5611052 allParamsButton.addActionListener(this);
5621053
563
- oe.aConstraints.gridx += 1;
564
- oe.aConstraints.weighty = 0;
565
- oe.aConstraints.gridwidth = 1;
566
-
567
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
1054
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
+ clearPanelButton.setToolTipText("Clear edit panel");
1056
+ clearPanelButton.addActionListener(this);
1057
+
1058
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1059
+ unselectButton.setToolTipText("Unselect");
5681060 unselectButton.addActionListener(this);
5691061
1062
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1063
+ flashSelectionButton.setToolTipText("Highlight selection");
1064
+ flashSelectionButton.addActionListener(this);
1065
+
1066
+ editCommandsPanel.preferredHeight = 1;
1067
+
1068
+ SetPinStates(false);
1069
+// oe.treePanel.add(commandsPanel);
1070
+// oe.treePanel.Return();
1071
+
5701072 // oe.aConstraints.gridx += 1;
5711073 // oe.aConstraints.weighty = 0;
5721074 // oe.aConstraints.gridwidth = 1;
....@@ -578,47 +1080,32 @@
5781080 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5791081 // gcButton.addActionListener(this);
5801082
581
- oe.aConstraints.gridx = 0;
582
- oe.aConstraints.gridy += 1;
583
-
584
- //ctrlPanel.add(objList = new List(5, true));
585
- oe.aConstraints.gridwidth = 100;
586
- // oe.aConstraints.gridheight = 100;
587
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
588
- oe.aConstraints.gridheight = 1;
589
- oe.aConstraints.weighty = 0.5;
590
- oe.aConstraints.gridx = 0;
591
- JScrollPane jSP;
1083
+ cGridBag jSPPanel = new cGridBag();
1084
+
1085
+ JScrollPane jSP;
5921086 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
593
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1087
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5941088 ResetModel();
595
- oe.aConstraints.weighty = 0.5;
596
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
597
- oe.aConstraints.gridy += 1;
598
- oe.aConstraints.gridwidth = 1;
599
-
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 2;
602
-
603
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
604
- colorCB.addItemListener(this);
605
- oe.aConstraints.gridx += 2;
606
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
607
- materialCB.addItemListener(this);
608
- oe.aConstraints.gridx += 2;
609
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
610
- textureCB.addItemListener(this);
611
-
612
- oe.aConstraints.gridx = 0;
613
- oe.aConstraints.gridy += 1;
6141089
1090
+ oe.treePanel.add(jSPPanel);
1091
+ oe.treePanel.Return();
1092
+
1093
+ oe.treePanel.add(copyOptionsPanel);
1094
+ oe.treePanel.Return();
1095
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1096
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1097
+ sliderPane.preferredHeight = 1;
1098
+
1099
+// mainPanel.setDividerLocation(0.1); //1.0);
1100
+ mainPanel.setResizeWeight(0.4);
1101
+
6151102 //jList.addListSelectionListener(this);
6161103 oe.jTree.addTreeSelectionListener(this);
6171104 //jTree.setRootVisible(false);
6181105 //jTree.setEditable(true);
6191106 oe.jTree.setDragEnabled(true);
6201107 //jTree.setPreferredSize(new Dimension(10,10));
621
- jSP.setPreferredSize(new Dimension(100,200));
1108
+ //jSP.setPreferredSize(new Dimension(100,200));
6221109
6231110 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6241111
....@@ -630,23 +1117,160 @@
6301117 dgr.addDragGestureListener(this);
6311118 }catch(Exception e) {}
6321119 */
633
- radio.layout = sevenButton;
1120
+ radio.layout = sixButton; // sevenButton;
6341121 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6351122 }
1123
+
1124
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1125
+ {
1126
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1127
+ colorCB.setToolTipText("Copy color when dropped");
1128
+ colorCB.addItemListener(this);
1129
+
1130
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1131
+ materialCB.setToolTipText("Copy material when dropped");
1132
+ materialCB.addItemListener(this);
1133
+
1134
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1135
+ textureCB.setToolTipText("Copy texture when dropped");
1136
+ textureCB.addItemListener(this);
1137
+
1138
+ panel.Return();
1139
+
1140
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1141
+ boxCB.setToolTipText("Display bounding boxes");
1142
+ boxCB.addItemListener(this);
1143
+
1144
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1145
+ zoomBoxCB.setToolTipText("Display only for wheel");
1146
+ zoomBoxCB.addItemListener(this);
1147
+
1148
+ if (true) // Globals.ADVANCED)
1149
+ {
1150
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1151
+// supportCB.setToolTipText("Enable rigging");
1152
+// supportCB.addItemListener(this);
1153
+
1154
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1155
+ freezeCB.setToolTipText("Fast moving camera");
1156
+ freezeCB.addItemListener(this);
1157
+
1158
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1159
+ // localCB.addItemListener(this);
1160
+
1161
+ panel.Return();
1162
+
1163
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1164
+ crowdCB.setToolTipText("Used for crowds");
1165
+ crowdCB.addItemListener(this);
1166
+
1167
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1168
+ smoothCB.setToolTipText("Snapping delay");
1169
+ smoothCB.addItemListener(this);
1170
+
1171
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1172
+ slowCB.setToolTipText("Smooth interpolation");
1173
+ slowCB.addItemListener(this);
1174
+
1175
+// constraints.gridy += 1;
1176
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1177
+// speakerMocapCB.addItemListener(this);
1178
+
1179
+ panel.Return();
1180
+
1181
+ if (false)
1182
+ {
1183
+ // handled in scripts
1184
+ //constraints.gridy += 1;
1185
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1186
+ speakerCameraCB.addItemListener(this);
1187
+
1188
+ //constraints.gridy += 1;
1189
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1190
+ speakerFocusCB.addItemListener(this);
1191
+
1192
+ //constraints.gridy += 1;
1193
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1194
+ smoothfocusCB.addItemListener(this);
1195
+ panel.Return();
1196
+ }
1197
+
1198
+//constraints.gridx += 1;
1199
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1200
+// debugCB.addItemListener(this);
1201
+
1202
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1203
+ trackCB.setToolTipText("Enable tracking target");
1204
+ trackCB.addItemListener(this);
1205
+
1206
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1207
+ oeilCB.setToolTipText("Move camera when tracking");
1208
+ oeilCB.addItemListener(this);
1209
+
1210
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1211
+ shadowCB.setToolTipText("When live compute shadows");
1212
+ shadowCB.addItemListener(this);
1213
+
1214
+ panel.Return();
1215
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1216
+ toggleTextureCB.setToolTipText("Load textures");
1217
+ toggleTextureCB.addItemListener(this);
1218
+
1219
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1220
+ toggleSwitchCB.setToolTipText("Choose a single item");
1221
+ toggleSwitchCB.addItemListener(this);
1222
+
1223
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1224
+ autokeepCB.setToolTipText("On structure change");
1225
+ autokeepCB.addItemListener(this);
1226
+
1227
+ panel.Return();
1228
+ if (Globals.ADVANCED)
1229
+ {
1230
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1231
+ lookAtCB.setToolTipText("Look-at target");
1232
+ lookAtCB.addItemListener(this);
1233
+ }
1234
+
1235
+ }
1236
+
1237
+ cGridBag fill = new cGridBag();
1238
+ fill.preferredHeight = 200;
1239
+ cGridBag fill2 = new cGridBag();
1240
+ fill2.preferredHeight = 200;
1241
+ cGridBag fill3 = new cGridBag();
1242
+ fill3.preferredHeight = 200;
1243
+
1244
+ panel.add(fill);
1245
+ panel.add(fill2);
1246
+ panel.add(fill3);
1247
+
1248
+ }
6361249
6371250 void EditObject(Object3D obj)
6381251 {
639
- cRadio dummyButton = new cRadio(obj.name);
640
- dummyButton.SetObject(obj);
641
- dummyButton.layout = sevenButton;
642
- dummyButton.SetCamera(cameraView.renderCamera, false);
643
- dummyButton.addActionListener(this);
644
- radioPanel.add(dummyButton);
645
- buttonGroup.add(dummyButton);
646
- dummyButton.doClick();
1252
+ cRadio radioButton = new cRadio(obj.name);
1253
+
1254
+ // June 2019. Patch to avoid bug with transparency.
1255
+ radioButton.hadMaterial = obj.material != null;
1256
+ if (!radioButton.hadMaterial)
1257
+ {
1258
+ obj.material = new cMaterial();
1259
+ }
1260
+
1261
+ radioButton.SetObject(obj);
1262
+ radioButton.layout = sixButton; // sevenButton;
1263
+ radioButton.SetCamera(cameraView.renderCamera, false);
1264
+ radioButton.addActionListener(this);
1265
+ radioPanel.add(radioButton);
1266
+ buttonGroup.add(radioButton);
1267
+ radioButton.doClick();
6471268 }
1269
+
6481270 void SetupViews(ObjEditor oe)
6491271 {
1272
+ theFrame = this;
1273
+
6501274 oe.SetupViews();
6511275
6521276 System.out.println("SetupViews");
....@@ -655,22 +1279,28 @@
6551279 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6561280 }
6571281
658
- JCheckBox liveCB;
659
- JCheckBox supportCB;
660
- JCheckBox localCB;
661
- JCheckBox crowdCB;
662
- JCheckBox smoothCB;
663
- JCheckBox fastCB;
664
- JCheckBox slowCB;
665
- JCheckBox boxCB;
666
- JCheckBox trackCB;
667
- JCheckBox smoothfocusCB;
1282
+ cToggleButton liveCB;
1283
+ cCheckBox supportCB;
1284
+ cCheckBox localCB;
1285
+ cCheckBox crowdCB;
1286
+ cCheckBox smoothCB;
1287
+ cToggleButton fastCB;
1288
+ cCheckBox slowCB;
1289
+ cCheckBox boxCB;
1290
+ cCheckBox zoomBoxCB;
1291
+ cCheckBox freezeCB;
1292
+ //cToggleButton trackCB;
1293
+ cCheckBox trackCB;
1294
+ cCheckBox smoothfocusCB;
6681295 // JCheckBox speakerMocapCB;
669
- JCheckBox speakerCameraCB;
670
- JCheckBox speakerFocusCB;
671
- JCheckBox debugCB;
672
- JCheckBox oeilCB;
673
- JCheckBox lookAtCB;
1296
+ cCheckBox speakerCameraCB;
1297
+ cCheckBox speakerFocusCB;
1298
+ cCheckBox debugCB;
1299
+
1300
+ cCheckBox oeilCB;
1301
+ cCheckBox shadowCB;
1302
+ cCheckBox autokeepCB;
1303
+ cCheckBox lookAtCB;
6741304
6751305 // static int COLOR = 1;
6761306 // static int MATERIAL = 2;
....@@ -678,9 +1308,9 @@
6781308
6791309 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6801310
681
- JCheckBox colorCB;
682
- JCheckBox materialCB;
683
- JCheckBox textureCB;
1311
+ cCheckBox colorCB;
1312
+ cCheckBox materialCB;
1313
+ cCheckBox textureCB;
6841314
6851315 public void itemStateChanged(ItemEvent e)
6861316 {
....@@ -705,10 +1335,10 @@
7051335 dropAttributes |= Object3D.TEXTURE;
7061336 else
7071337 dropAttributes &= ~Object3D.TEXTURE;
708
- }
709
- else if(e.getSource() == liveCB)
1338
+ } else if(e.getSource() == liveCB)
7101339 {
7111340 cameraView.ToggleLive();
1341
+ refreshContents(false);
7121342 }
7131343 else if(e.getSource() == supportCB)
7141344 {
....@@ -744,6 +1374,10 @@
7441374 cameraView.repaint();
7451375 // refreshContents();
7461376 }
1377
+ else if(e.getSource() == zoomBoxCB)
1378
+ {
1379
+ cameraView.ToggleZoomBoxMode();
1380
+ }
7471381 else if(e.getSource() == smoothfocusCB)
7481382 {
7491383 cameraView.ToggleSmoothFocus();
....@@ -769,6 +1403,18 @@
7691403 {
7701404 cameraView.ToggleOeil();
7711405 }
1406
+ else if(e.getSource() == shadowCB)
1407
+ {
1408
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1409
+ }
1410
+ else if(e.getSource() == freezeCB)
1411
+ {
1412
+ Globals.FREEZEONMOVE ^= true;
1413
+ }
1414
+ else if(e.getSource() == autokeepCB)
1415
+ {
1416
+ Globals.REPLACEONMAKE ^= true;
1417
+ }
7721418 else if(e.getSource() == lookAtCB)
7731419 {
7741420 cameraView.ToggleLookAt();
....@@ -785,7 +1431,8 @@
7851431
7861432 /**/
7871433 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
788
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1434
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1435
+ TreePath path = objEditor.jTree.getSelectionPath();
7891436 if ((path == null) || (path.getPathCount() <= 1)) {
7901437 // We can't move the root node or an empty selection
7911438 return;
....@@ -848,8 +1495,6 @@
8481495 }
8491496 }
8501497
851
- String string = (String) object;
852
-
8531498 System.out.println("Transfer = " + object + "; drop : " + target);
8541499 // if( object instanceof java.io.File[])
8551500 // {
....@@ -857,7 +1502,11 @@
8571502 // objEditor.DropFile((java.io.File[]) object, true);
8581503 // return;
8591504 // }
860
- if (string.charAt(0) == '/')
1505
+
1506
+ String string = object.toString();
1507
+
1508
+ // File path for Mac and Windows
1509
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8611510 {
8621511 // file(s)
8631512 String[] names = string.split("\n");
....@@ -884,7 +1533,7 @@
8841533
8851534 flashIt = false;
8861535 CameraPane pane = (CameraPane) target;
887
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1536
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8881537 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8891538
8901539 if (group.selection.size() == 1)
....@@ -900,23 +1549,33 @@
9001549
9011550 assert target == objEditor.jTree;
9021551 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1552
+ Object3D destinationLeaf;
9031553 try {
904
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1554
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9051555 } catch (Exception e) {
9061556 System.out.println("destinationPath : " + destinationPath);
9071557 return;
9081558 }
9091559
910
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1560
+ for (int i=group.selection.size(); --i>=0;)
9111561 {
1562
+ Object3D child = (Object3D)group.selection.elementAt(i);
1563
+
1564
+ // Cannot move into itself
1565
+ if (child == destinationLeaf)
1566
+ return;
1567
+ }
1568
+
1569
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1570
+// {
9121571 loadClipboard(true);
9131572 objEditor.jTree.setSelectionPath(destinationPath);
914
- pasteInto(false);
915
- } else {
916
- loadClipboard(false);
917
- objEditor.jTree.setSelectionPath(destinationPath);
918
- pasteInto(false); // true); // ???
919
- }
1573
+ pasteInto(false, false);
1574
+// } else {
1575
+// loadClipboard(false);
1576
+// objEditor.jTree.setSelectionPath(destinationPath);
1577
+// pasteInto(false, false); // true); // ???
1578
+// }
9201579 }
9211580 public void dropActionChanged(DropTargetDragEvent dtde)
9221581 // Called if the user has modified the current drop gesture
....@@ -1021,83 +1680,107 @@
10211680 {
10221681 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10231682 //heightFieldItem.addActionListener(this);
1024
- gridItem = menu.add(new MenuItem("Grid"));
1025
- gridItem.addActionListener(this);
1026
- rectoidItem = menu.add(new MenuItem("Box"));
1027
- rectoidItem.addActionListener(this);
1028
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1029
- ellipsoidItem.addActionListener(this);
1030
- coneItem = menu.add(new MenuItem("Cone"));
1031
- coneItem.addActionListener(this);
1032
- torusItem = menu.add(new MenuItem("Torus"));
1033
- torusItem.addActionListener(this);
1034
- superItem = menu.add(new MenuItem("Superellipsoid"));
1035
- superItem.addActionListener(this);
1036
- particleItem = menu.add(new MenuItem("Particle system"));
1037
- particleItem.addActionListener(this);
1683
+// gridItem = menu.add(new MenuItem("Grid"));
1684
+// gridItem.addActionListener(this);
1685
+// rectoidItem = menu.add(new MenuItem("Box"));
1686
+// rectoidItem.addActionListener(this);
1687
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1688
+// ellipsoidItem.addActionListener(this);
1689
+// coneItem = menu.add(new MenuItem("Cone"));
1690
+// coneItem.addActionListener(this);
1691
+// torusItem = menu.add(new MenuItem("Torus"));
1692
+// torusItem.addActionListener(this);
1693
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1694
+// superItem.addActionListener(this);
1695
+
1696
+ cameraItem = menu.add(new MenuItem("Camera"));
1697
+ cameraItem.addActionListener(this);
1698
+
1699
+ if (!Globals.ADVANCED)
1700
+ {
1701
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1702
+ kleinItem.addActionListener(this);
1703
+ }
1704
+
1705
+// particleItem = menu.add(new MenuItem("Particle system"));
1706
+// particleItem.addActionListener(this);
1707
+ if (Globals.ADVANCED)
1708
+ {
10381709 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10391710 ragdollItem.addActionListener(this);
10401711 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10411712 ragdoll2Item.addActionListener(this);
1713
+ }
10421714 menu.add("-");
1043
- meshItem = menu.add(new MenuItem("Mesh"));
1715
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10441716 meshItem.addActionListener(this);
10451717 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10461718 // meshGroupItem.addActionListener(this);
1719
+ if (Globals.ADVANCED)
1720
+ {
10471721 springItem = menu.add(new MenuItem("Spring"));
10481722 springItem.addActionListener(this);
10491723 flagItem = menu.add(new MenuItem("Flag"));
10501724 flagItem.addActionListener(this);
1051
- bezierItem = menu.add(new MenuItem("Patch"));
1052
- bezierItem.addActionListener(this);
1053
- checkerItem = menu.add(new MenuItem("Checker"));
1054
- checkerItem.addActionListener(this);
10551725 blobItem = menu.add(new MenuItem("Blob"));
10561726 blobItem.addActionListener(this);
10571727 latheItem = menu.add(new MenuItem("Lathe"));
10581728 latheItem.addActionListener(this);
1059
- lightItem = menu.add(new MenuItem("Light"));
1060
- lightItem.addActionListener(this);
1729
+ }
1730
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1731
+ bezierItem.addActionListener(this);
1732
+// overlayItem = menu.add(new MenuItem("Overlay"));
1733
+// overlayItem.addActionListener(this);
1734
+// lightItem = menu.add(new MenuItem("Light"));
1735
+// lightItem.addActionListener(this);
10611736 menu.add("-");
10621737 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10631738 //superLoopItem.addActionListener(this);
1064
- loopItem = menu.add(new MenuItem("Loop"));
1065
- loopItem.addActionListener(this);
1739
+// loopItem = menu.add(new MenuItem("Loop"));
1740
+// loopItem.addActionListener(this);
10661741 doubleItem = menu.add(new MenuItem("Fork"));
10671742 doubleItem.addActionListener(this);
1743
+ if (Globals.ADVANCED)
1744
+ {
10681745 tripleItem = menu.add(new MenuItem("Trident"));
10691746 tripleItem.addActionListener(this);
1747
+ }
10701748 }
10711749
10721750 void buildToolsMenu(Menu menu)
10731751 {
10741752 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10751753 animationItem.addItemListener(this);
1076
- animationItem.setState(CameraPane.ANIMATION);
1754
+ animationItem.setState(Globals.ANIMATION);
1755
+
1756
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1757
+ archiveItem.addActionListener(this);
10771758
10781759 menu.add("-");
10791760 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10801761 parseverticesItem.addActionListener(this);
10811762 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10821763 textureFieldItem.addActionListener(this);
1083
- alignItem = menu.add(new MenuItem("Align"));
1764
+ alignItem = menu.add(new MenuItem("Align Objects"));
10841765 alignItem.addActionListener(this);
1085
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1086
- mirrorItem.addActionListener(this);
10871766 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10881767 reduceMorphItem.addActionListener(this);
10891768 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10901769 reduce34MorphItem.addActionListener(this);
1091
-
1092
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1093
- computeAOItem.addActionListener(this);
10941770 menu.add("-");
1095
-
10961771 menu.add(memoryItem = new MenuItem("Memory Usage"));
10971772 memoryItem.addActionListener(this);
1773
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1774
+ computeAOItem.addActionListener(this);
1775
+
1776
+ if (Globals.ADVANCED)
1777
+ {
1778
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1779
+ mirrorItem.addActionListener(this);
1780
+ menu.add("-");
10981781 menu.add(analyzeItem = new MenuItem("Analyze"));
10991782 analyzeItem.addActionListener(this);
1100
- menu.add(dumpItem = new MenuItem("Dump"));
1783
+ menu.add(dumpItem = new MenuItem("Print"));
11011784 dumpItem.addActionListener(this);
11021785 // menu.add(pathItem = new MenuItem("From-to path"));
11031786 // pathItem.addActionListener(this);
....@@ -1106,6 +1789,8 @@
11061789 resetParentItem.addActionListener(this);
11071790 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11081791 repairParentItem.addActionListener(this);
1792
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1793
+ repairShadowItem.addActionListener(this);
11091794 menu.add(invariantsItem = new MenuItem("Invariants"));
11101795 invariantsItem.addActionListener(this);
11111796 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1113,6 +1798,7 @@
11131798 menu.add("-");
11141799 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11151800 editScriptItem.addActionListener(this);
1801
+ }
11161802 }
11171803
11181804 void ScreenFit()
....@@ -1235,9 +1921,34 @@
12351921 shadow.material = new cMaterial(obj.material);
12361922 shadow.material.diffuse = 0.0001f;
12371923 shadow.material.specular = 0.0001f;
1924
+ //shadow.projectedVertices[1].x = 300;
12381925
12391926 makeSomething(shadow);
12401927 }
1928
+
1929
+ private void ClearUnpinned()
1930
+ {
1931
+ //for (Object3D obj : listUI)
1932
+ for (int i=listUI.size(); --i>=0;)
1933
+ {
1934
+ Object3D obj = listUI.elementAt(i);
1935
+ if (!obj.pinned)
1936
+ {
1937
+ obj.CloseUI();
1938
+ listUI.remove(i);
1939
+ }
1940
+ }
1941
+ }
1942
+
1943
+ private void EditElement(Object3D elem, boolean newWindow)
1944
+ {
1945
+ // if (!(elem instanceof Composite))
1946
+ // newWindow = false;
1947
+ listUI.add(elem);
1948
+ elem.openEditWindow(this, newWindow); //, false);
1949
+ System.out.println("edit : " + elem);
1950
+ elem.editWindow.refreshContents(true); // ? new
1951
+ }
12411952
12421953 /**
12431954 * applyExample
....@@ -1441,9 +2152,9 @@
14412152
14422153 void Overwrite(int mask)
14432154 {
1444
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2155
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14452156 {
1446
- Object3D content = GrafreeD.clipboard.get(0);
2157
+ Object3D content = Grafreed.clipboard.get(0);
14472158
14482159 if (content instanceof cGroup && ((cGroup)content).transientlink )
14492160 content = ((cGroup)content).get(0);
....@@ -1466,6 +2177,7 @@
14662177 //
14672178 public void actionPerformed(ActionEvent event) // , Object arg)
14682179 {
2180
+ Object source = event.getSource();
14692181 /*
14702182 if (event.getSource() == nameField)
14712183 {
....@@ -1477,11 +2189,11 @@
14772189 }
14782190 else
14792191 */
1480
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2192
+ if (source == lookAtItem || source == lookFromItem)
14812193 {
14822194 ScreenFit();
14832195 } else
1484
- if (event.getSource() == switchItem)
2196
+ if (source == switchViewItem)
14852197 {
14862198 cVector v1 = new cVector();
14872199 cVector v2 = new cVector();
....@@ -1490,11 +2202,11 @@
14902202 objEditor.cameraView.renderCamera.setAim(v2, v1);
14912203 objEditor.cameraView.repaint();
14922204 } else
1493
- if (event.getSource() == rectoidItem)
2205
+ if (source == rectoidItem || source == boxButton)
14942206 {
14952207 makeSomething(new Box());
14962208 } else
1497
- if (event.getSource() == particleItem)
2209
+ if (source == particleItem || source == particlesButton)
14982210 {
14992211 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15002212 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1515,9 +2227,9 @@
15152227 applyExample(particleGeom, "SMOKE");
15162228 makeSomething(particleGeom);
15172229 } else
1518
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2230
+ if (source == ragdollItem || source == ragdoll2Item)
15192231 {
1520
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2232
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15212233
15222234 ragdoll.toParent = LA.newMatrix();
15232235 ragdoll.fromParent = LA.newMatrix();
....@@ -1535,7 +2247,7 @@
15352247 } else
15362248 /*
15372249 */
1538
- if (event.getSource() == heightFieldItem)
2250
+ if (source == heightFieldItem)
15392251 {
15402252 Object3D obj = new Object3D();
15412253
....@@ -1573,27 +2285,31 @@
15732285
15742286 makeSomething(obj);
15752287 } else
1576
- if (event.getSource() == gridItem)
2288
+ if (source == gridItem || source == gridButton)
15772289 {
15782290 makeSomething(new Grid());
15792291 } else
1580
- if (event.getSource() == ellipsoidItem)
2292
+ if (source == ellipsoidItem || source == sphereButton)
15812293 {
15822294 makeSomething(new Sphere());
15832295 } else
1584
- if (event.getSource() == coneItem)
2296
+ if (source == coneItem || source == coneButton)
15852297 {
15862298 makeSomething(new Cone());
15872299 } else
1588
- if (event.getSource() == torusItem)
2300
+ if (source == torusItem || source == torusButton)
15892301 {
15902302 makeSomething(new Torus());
15912303 } else
1592
- if (event.getSource() == superItem)
2304
+ if (source == superItem || source == superButton)
15932305 {
15942306 makeSomething(new Superellipsoid());
15952307 } else
1596
- if (event.getSource() == blobItem)
2308
+ if (source == kleinItem || source == kleinButton)
2309
+ {
2310
+ makeSomething(new Klein());
2311
+ } else
2312
+ if (source == blobItem)
15972313 {
15982314 Blob blob = new Blob();
15992315 BlobComponent comp = new BlobComponent();
....@@ -1601,15 +2317,15 @@
16012317 //blob.retile();
16022318 makeSomething(blob);
16032319 } else
1604
- if (event.getSource() == latheItem)
2320
+ if (source == latheItem)
16052321 {
16062322 makeSomething(new Lathe());
16072323 } else
1608
- if (event.getSource() == bezierItem)
2324
+ if (source == bezierItem)
16092325 {
16102326 makeSomething(new BezierSurface());
16112327 } else
1612
- if (event.getSource() == checkerItem)
2328
+ if (source == overlayItem || source == overlayButton)
16132329 {
16142330 /*
16152331 Object3D obj = new BezierSurface(5,8);
....@@ -1624,7 +2340,7 @@
16242340 */
16252341 makeSomething(new Checker());
16262342 } else
1627
- if (event.getSource() == meshItem)
2343
+ if (source == meshItem)
16282344 {
16292345 Object3D itemtomake = new Object3D();
16302346 Object3D child;
....@@ -1645,35 +2361,52 @@
16452361 makeSomething(child);
16462362 }
16472363 } else
1648
- if (event.getSource() == springItem)
2364
+ if (source == springItem)
16492365 {
16502366 cSpring s = new cSpring();
16512367 s.setup();
16522368 makeSomething(s);
16532369 } else
1654
- if (event.getSource() == flagItem)
2370
+ if (source == flagItem)
16552371 {
16562372 cSpring s = new cFlag();
16572373 s.setup();
16582374 makeSomething(s);
16592375 } else
1660
- if (event.getSource() == lightItem)
2376
+ if (source == lightItem || source == lightButton)
16612377 {
16622378 makeSomething(new Light());
16632379 } else
1664
- if (event.getSource() == csgItem)
2380
+// if (source == skybox1Button ||
2381
+// source == skybox2Button ||
2382
+// source == skybox3Button ||
2383
+// source == skybox4Button ||
2384
+// source == skybox5Button ||
2385
+// source == skybox6Button ||
2386
+// source == skybox7Button ||
2387
+// source == skybox11Button ||
2388
+// source == skybox12Button ||
2389
+// source == skybox13Button ||
2390
+// source == skybox14Button ||
2391
+// source == skybox15Button ||
2392
+// source == skybox16Button ||
2393
+// source == skybox17Button)
2394
+// {
2395
+// ChangeSkybox(source);
2396
+// } else
2397
+ if (source == csgItem)
16652398 {
16662399 group(new CSG());
16672400 } else
1668
- if (event.getSource() == templateItem)
2401
+ if (source == templateItem)
16692402 {
16702403 group(new cTemplate());
16712404 } else
1672
- if (event.getSource() == attributeItem)
2405
+ if (source == attributeItem)
16732406 {
16742407 makeSomething(new Attribute());
16752408 } else
1676
- if (event.getSource() == pointflowItem)
2409
+ if (source == pointflowItem)
16772410 {
16782411 makeSomething(new PointFlow());
16792412 } else
....@@ -1685,7 +2418,7 @@
16852418 } else
16862419 */
16872420
1688
- if (event.getSource() == superLoopItem)
2421
+ if (source == superLoopItem)
16892422 {
16902423 Composite g = new cGroup();
16912424 for (int i=0; i<15; i++)
....@@ -1707,30 +2440,30 @@
17072440
17082441 group(g);
17092442 } else
1710
- if (event.getSource() == loopItem)
2443
+ if (source == loopItem || source == loopButton)
17112444 {
17122445 Composite csg = new GroupLeaf();
17132446 csg.count = 5;
17142447 group(csg);
1715
- Composite child = new cGroup();
2448
+ Composite child = new cGroup("Branch");
17162449 csg.addChild(child);
17172450 child.addChild(csg);
17182451 } else
1719
- if (event.getSource() == doubleItem)
2452
+ if (source == doubleItem)
17202453 {
1721
- Composite csg = new GroupLeaf();
2454
+ Composite csg = new GroupLeaf("Fork");
17222455 csg.count = 5;
17232456 group(csg);
1724
- Composite child = new cGroup();
2457
+ Composite child = new cGroup("Branch A");
17252458 csg.addChild(child);
17262459 child.addChild(csg);
1727
- child = new cGroup();
2460
+ child = new cGroup("Branch B");
17282461 csg.addChild(child);
17292462 child.addChild(csg);
17302463 } else
1731
- if (event.getSource() == tripleItem)
2464
+ if (source == tripleItem)
17322465 {
1733
- Composite csg = new GroupLeaf();
2466
+ Composite csg = new GroupLeaf("Trident");
17342467 csg.count = 4;
17352468 group(csg);
17362469 Composite child = new cGroup();
....@@ -1743,73 +2476,98 @@
17432476 csg.addChild(child);
17442477 child.addChild(csg);
17452478 } else
1746
-
1747
- if (event.getSource() == importGFDItem)
2479
+ if (source == computeAOItem)
17482480 {
1749
- ImportGFD();
2481
+ Globals.drawMode = CameraPane.OCCLUSION;
2482
+ cameraView.repaint();
17502483 } else
1751
- if (event.getSource() == importVRMLX3DItem)
1752
- {
1753
- ImportVRMLX3D();
1754
- } else
1755
- if (event.getSource() == import3DSItem)
1756
- {
1757
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1758
- } else
1759
- if (event.getSource() == importOBJItem)
1760
- {
1761
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1762
- } else
1763
- if (event.getSource() == computeAOItem)
1764
- {
1765
- CameraPane.drawMode = CameraPane.OCCLUSION;
1766
- CameraPane.theRenderer.repaint();
1767
- } else
1768
- if (event.getSource() == recompileItem)
2484
+ if (source == recompileItem)
17692485 {
17702486 Recompile();
17712487 refreshContents();
17722488 } else
1773
- if (event.getSource() == editScriptItem)
2489
+ if (source == editScriptItem)
17742490 {
17752491 OpenDialog();
17762492 refreshContents();
17772493 } else
1778
- if (event.getSource() == invariantsItem)
2494
+ if (source == invariantsItem)
17792495 {
17802496 System.out.println("Invariants:");
1781
- GrafreeD.theApplet3D.universe.invariants();
2497
+ Grafreed.grafreeD.universe.invariants();
17822498 } else
1783
- if (event.getSource() == memoryItem)
2499
+ if (source == memoryItem)
17842500 {
17852501 //System.out.println("Invariants:");
17862502 PrintMemory();
17872503 } else
1788
- if (event.getSource() == pathItem)
2504
+ if (source == pathItem)
17892505 {
17902506 PrintPath();
17912507 } else
1792
- if (event.getSource() == analyzeItem)
2508
+ if (source == analyzeItem)
17932509 {
17942510 AnalyzeObject();
17952511 } else
1796
- if (event.getSource() == dumpItem)
2512
+ if (source == dumpItem)
17972513 {
17982514 DumpObject();
17992515 } else
1800
- if (event.getSource() == screenfitButton)
2516
+ if (source == minButton)
18012517 {
1802
- //Reload(lastConverter, lastFilename, true);
2518
+ Minimize();
2519
+ } else
2520
+ if (source == maxButton)
2521
+ {
2522
+ Maximize();
2523
+ } else
2524
+ if (source == fullButton)
2525
+ {
2526
+ ToggleFullScreen();
2527
+ } else
2528
+ if (source == undoButton)
2529
+ {
2530
+ // Go to previous version
2531
+ //if (!Undo())
2532
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2533
+ Undo();
2534
+ } else
2535
+ if (source == restoreButton)
2536
+ {
2537
+ // Restore current version
2538
+ Restore();
2539
+ } else
2540
+ if (source == replaceButton)
2541
+ {
2542
+ // Overwrite current version
2543
+ Replace();
2544
+ } else
2545
+ if (source == redoButton)
2546
+ {
2547
+ // Go to next version
2548
+ Redo();
2549
+ } else
2550
+ if (source == saveButton)
2551
+ {
2552
+ // Save a new version
2553
+ if (!Save(true))
2554
+ java.awt.Toolkit.getDefaultToolkit().beep();
2555
+ } else
2556
+ if (source == oneStepButton)
2557
+ {
2558
+ Globals.ONESTEP = true;
2559
+ cameraView.repaint();
2560
+ } else
2561
+ if (source == screenfitButton)
2562
+ {
18032563 ScreenFit();
18042564 } else
1805
- if (event.getSource() == screenfitpointButton)
2565
+ if (source == screenfitpointButton)
18062566 {
1807
- //Reload(lastConverter, lastFilename, true);
18082567 ScreenFitPoint();
18092568 } else
1810
- if (event.getSource() == snapobjectButton)
2569
+ if (source == snapobjectButton)
18112570 {
1812
- //Reload(lastConverter, lastFilename, true);
18132571 SnapObject();
18142572 } else
18152573 // if (event.getSource() == recompileButton)
....@@ -1818,13 +2576,13 @@
18182576 // Recompile();
18192577 // refreshContents();
18202578 // } else
1821
- if (event.getSource() == gcButton)
2579
+ if (source == gcButton)
18222580 {
18232581 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18242582 System.gc();
18252583 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262584 } else
1827
- if (event.getSource() == editLeafItem)
2585
+ if (source == editLeafItem)
18282586 {
18292587 Object3D obj;
18302588 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1838,62 +2596,74 @@
18382596 }
18392597 refreshContents(true);
18402598 } else
1841
- if (event.getSource() == openWindowItem)
2599
+ if (source == openWindowItem)
18422600 {
18432601 EditSelection(true);
18442602 } else
1845
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2603
+ if (source == cutItem || source == clearButton)
18462604 {
18472605 loadClipboard(true);
18482606 } else
1849
- if (event.getSource() == duplicateItem)
2607
+ if (source == undoItem)
18502608 {
1851
- Object3D keep = GrafreeD.clipboard;
2609
+ Undo();
2610
+ } else
2611
+ if (source == redoItem)
2612
+ {
2613
+ Redo();
2614
+ } else
2615
+ if (source == duplicateItem)
2616
+ {
2617
+ Object3D keep = Grafreed.clipboard;
18522618 loadClipboard(false);
18532619 paste(false);
1854
- GrafreeD.clipboard = keep;
2620
+ Grafreed.clipboard = keep;
18552621 } else
1856
- if (event.getSource() == cloneItem)
2622
+ if (source == cloneItem)
18572623 {
18582624 CloneSelection(false);
18592625 } else
1860
- if (event.getSource() == cloneSupportItem)
2626
+ if (source == cloneSupportItem)
18612627 {
18622628 CloneSelection(true);
18632629 } else
1864
- if (event.getSource() == copyItem)
2630
+ if (source == copyItem)
18652631 {
18662632 loadClipboard(false);
18672633 } else
1868
- if (event.getSource() == pasteItem)
2634
+ if (source == pasteItem)
18692635 {
18702636 paste(false);
18712637 } else
1872
- if (event.getSource() == pasteLinkItem)
2638
+ if (source == pasteIntoItem)
18732639 {
1874
- pasteInto(false);
2640
+ pasteInto(true, false);
18752641 } else
1876
- if (event.getSource() == pasteCloneItem)
2642
+ if (source == pasteLinkItem)
18772643 {
1878
- pasteInto(true);
2644
+ pasteInto(false, false);
18792645 } else
1880
- if (event.getSource() == pasteExpandItem)
2646
+ if (source == pasteCloneItem)
2647
+ {
2648
+ pasteInto(true, true);
2649
+ } else
2650
+ if (source == pasteExpandItem)
18812651 {
18822652 paste(true);
18832653 } else
1884
- if (event.getSource() == synchronizeItem)
2654
+ if (source == synchronizeItem)
18852655 {
18862656 Overwrite(Object3D.TRANSFORM);
18872657 } else
1888
- if (event.getSource() == overwriteNameItem)
2658
+ if (source == overwriteNameItem)
18892659 {
18902660 Overwrite(Object3D.NAME);
18912661 } else
1892
- if (event.getSource() == overwriteUVItem)
2662
+ if (source == overwriteUVItem)
18932663 {
18942664 Overwrite(Object3D.UV);
18952665 } else
1896
- if (event.getSource() == overwriteMatItem)
2666
+ if (source == overwriteMatItem)
18972667 {
18982668 /* july 2015
18992669 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1913,7 +2683,7 @@
19132683
19142684 Overwrite(dropAttributes);
19152685 }
1916
- if (event.getSource() == overwriteGeoItem)
2686
+ if (source == overwriteGeoItem)
19172687 {
19182688 Overwrite(Object3D.GEOMETRY);
19192689 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1930,7 +2700,7 @@
19302700 // refreshContents();
19312701 // }
19322702 } else
1933
- if (event.getSource() == generateMeshItem)
2703
+ if (source == generateMeshItem)
19342704 {
19352705 //if (group.selection.size() == 1)
19362706 // for (int i=0; i<group.selection.size(); i++)
....@@ -1941,7 +2711,7 @@
19412711 ResetModel();
19422712 refreshContents();
19432713 } else
1944
- if (event.getSource() == extractGeometriesItem)
2714
+ if (source == extractGeometriesItem)
19452715 {
19462716 boolean one = false;
19472717
....@@ -1968,7 +2738,7 @@
19682738 ResetModel();
19692739 refreshContents();
19702740 } else
1971
- if (event.getSource() == cloneGeometriesItem)
2741
+ if (source == cloneGeometriesItem)
19722742 {
19732743 boolean one = false;
19742744
....@@ -1994,32 +2764,37 @@
19942764 ResetModel();
19952765 refreshContents();
19962766 } else
1997
- if (event.getSource() == shareGeometriesItem)
2767
+ if (source == shareGeometriesItem)
19982768 {
19992769 boolean one = false;
20002770
20012771 if (group.selection.size() == 1)
20022772 one = true;
20032773
2774
+ Object3D merge = null;
2775
+
20042776 Object3D content = new cGroup();
20052777
20062778 for (int i=0; i<group.selection.size(); i++)
20072779 {
2008
- Object3D sel = new Merge(group.selection.get(i));
2780
+ merge = new Merge(group.selection.get(i));
20092781
20102782 if (one)
2011
- makeSomething(sel, false);
2783
+ makeSomething(merge, false);
20122784 else
2013
- content.addChild(sel);
2785
+ content.addChild(merge);
20142786 }
20152787
20162788 if (!one)
2017
- makeSomething(content, false);
2018
-
2019
- ResetModel();
2020
- refreshContents();
2789
+ makeSomething(content, true);
2790
+ else
2791
+ {
2792
+ ResetModel();
2793
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2794
+ refreshContents();
2795
+ }
20212796 } else
2022
- if (event.getSource() == mergeGeometriesItem)
2797
+ if (source == mergeGeometriesItem)
20232798 {
20242799 boolean one = false;
20252800
....@@ -2049,7 +2824,7 @@
20492824 ResetModel();
20502825 refreshContents();
20512826 } else
2052
- if (event.getSource() == linkverticesItem)
2827
+ if (source == linkverticesItem)
20532828 {
20542829 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20552830 // {
....@@ -2062,39 +2837,48 @@
20622837 // group.selection.get(0).setMasterThis(content); // should be identity
20632838 // refreshContents();
20642839 // }
2065
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2840
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20662841 {
2067
- Object3D content = GrafreeD.clipboard.get(0);
2842
+ Object3D content = Grafreed.clipboard.get(0);
20682843
20692844 if (content instanceof cGroup && ((cGroup)content).transientlink )
20702845 content = ((cGroup)content).get(0);
20712846
2072
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2847
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20732848 for (int i=0; i<group.selection.size(); i++)
20742849 {
2075
- boolean random = CameraPane.RANDOM;
2076
- CameraPane.RANDOM = false; // parse all random nodes
2850
+ boolean random = CameraPane.SWITCH;
2851
+ CameraPane.SWITCH = false; // parse all random nodes
20772852 group.selection.get(i).linkVerticesThis(content);
20782853 // group.selection.get(i).setMasterThis(content); // should be identity
2079
- CameraPane.RANDOM = random;
2854
+ CameraPane.SWITCH = random;
20802855 }
2081
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2856
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20822857 refreshContents();
20832858 }
20842859 } else
2085
- if (event.getSource() == resetsupportItem)
2860
+ if (source == resetsupportItem)
20862861 {
20872862 for (int i=0; i<group.selection.size(); i++)
20882863 {
2089
- boolean random = CameraPane.RANDOM;
2090
- CameraPane.RANDOM = false; // parse all random nodes
2864
+ boolean random = CameraPane.SWITCH;
2865
+ CameraPane.SWITCH = false; // parse all random nodes
20912866 group.selection.get(i).linkVerticesThis(null);
2092
- CameraPane.RANDOM = random;
2867
+ CameraPane.SWITCH = random;
20932868 }
20942869
20952870 refreshContents();
20962871 } else
2097
- if (event.getSource() == resetreferencesItem)
2872
+ if (source == relinkverticesItem)
2873
+ {
2874
+ boolean random = CameraPane.SWITCH;
2875
+ CameraPane.SWITCH = false; // parse all random nodes
2876
+ group.selection.RelinkToSupport();
2877
+ CameraPane.SWITCH = random;
2878
+
2879
+ refreshContents();
2880
+ } else
2881
+ if (source == resetreferencesItem)
20982882 {
20992883 for (int i=0; i<group.selection.size(); i++)
21002884 {
....@@ -2103,11 +2887,11 @@
21032887
21042888 refreshContents();
21052889 } else
2106
- if (event.getSource() == setMasterItem)
2890
+ if (source == setMasterItem)
21072891 {
2108
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2892
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21092893 {
2110
- Object3D content = GrafreeD.clipboard.get(0);
2894
+ Object3D content = Grafreed.clipboard.get(0);
21112895
21122896 if (content instanceof cGroup && ((cGroup)content).transientlink )
21132897 content = ((cGroup)content).get(0);
....@@ -2116,13 +2900,13 @@
21162900 refreshContents();
21172901 }
21182902 } else
2119
- if (event.getSource() == poseMeshItem)
2903
+ if (source == poseMeshItem)
21202904 {
21212905 if (group.selection.size() == 1)
21222906 {
2123
- if (GrafreeD.clipboard.size() == 1)
2907
+ if (Grafreed.clipboard.size() == 1)
21242908 {
2125
- Object3D content = GrafreeD.clipboard.get(0);
2909
+ Object3D content = Grafreed.clipboard.get(0);
21262910
21272911 if (content instanceof cGroup && ((cGroup)content).transientlink )
21282912 content = ((cGroup)content).get(0);
....@@ -2135,19 +2919,19 @@
21352919 }
21362920
21372921 } else
2138
- if (event.getSource() == revertMeshItem)
2922
+ if (source == revertMeshItem)
21392923 {
21402924 RevertMeshes();
21412925 } else
2142
- if (event.getSource() == resetMeshItem)
2926
+ if (source == resetAllItem)
21432927 {
21442928 ResetAll();
21452929 } else
2146
- if (event.getSource() == stepAllItem)
2930
+ if (source == stepAllItem)
21472931 {
21482932 StepAll();
21492933 } else
2150
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2934
+ if (source == deleteItem) // || event.getSource() == clearButton)
21512935 {
21522936 //int indices[] = jList.getSelectedIndices();
21532937 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2155,42 +2939,46 @@
21552939
21562940 ClearSelection(false);
21572941 } else
2158
- if (event.getSource() == clearAllItem)
2942
+ if (source == clearAllItem)
21592943 {
21602944 ClearSelection(true);
21612945 } else
2162
- if (event.getSource() == grabItem)
2946
+ if (source == grabItem || source == groupButton)
21632947 {
2164
- group(new cGroup(), true);
2948
+ group(new cGroup(), false); // true);
21652949 } else
2166
- if (event.getSource() == frontItem)
2950
+ if (source == hideItem)
2951
+ {
2952
+ group(new HiddenObject());
2953
+ } else
2954
+ if (source == frontItem)
21672955 {
21682956 front();
21692957 } else
2170
- if (event.getSource() == backItem)
2958
+ if (source == backItem)
21712959 {
21722960 back();
21732961 } else
2174
- if (event.getSource() == cameraItem)
2962
+ if (source == cameraItem)
21752963 {
21762964 makeSomething(new Camera());
21772965 } else
2178
- if (event.getSource() == compositeItem)
2966
+ if (source == compositeItem || source == compositeButton)
21792967 {
21802968 group(new Composite());
21812969 } else
2182
- if (event.getSource() == randomItem)
2970
+ if (source == switchItem || source == switchButton)
21832971 {
21842972 RandomNode random = new RandomNode();
21852973 group(random);
21862974 if (random.size() > 0)
2187
- random.name = random.get(0).name + "Rnd";
2975
+ random.name = random.get(0).name + "Switch";
21882976 } else
2189
- if (event.getSource() == physicsItem)
2977
+ if (source == physicsItem)
21902978 {
21912979 group(new PhysicsNode());
21922980 } else
2193
- if (event.getSource() == frameselectorItem)
2981
+ if (source == frameselectorItem)
21942982 {
21952983 for (int i=0; i<group.selection.size(); i++)
21962984 {
....@@ -2202,7 +2990,7 @@
22022990 ResetModel();
22032991 refreshContents();
22042992 } else
2205
- if (event.getSource() == switchGeoItem)
2993
+ if (source == switchGeoItem)
22062994 {
22072995 for (int i=0; i<group.selection.size(); i++)
22082996 {
....@@ -2214,7 +3002,7 @@
22143002 ResetModel();
22153003 refreshContents();
22163004 } else
2217
- if (event.getSource() == switchTransfoItem)
3005
+ if (source == switchTransfoItem)
22183006 {
22193007 for (int i=0; i<group.selection.size(); i++)
22203008 {
....@@ -2226,7 +3014,7 @@
22263014 ResetModel();
22273015 refreshContents();
22283016 } else
2229
- if (event.getSource() == morphItem)
3017
+ if (source == morphItem)
22303018 {
22313019 for (int i=0; i<group.selection.size(); i++)
22323020 {
....@@ -2238,7 +3026,7 @@
22383026 ResetModel();
22393027 refreshContents();
22403028 } else
2241
- if (event.getSource() == scriptNodeItem)
3029
+ if (source == scriptNodeItem)
22423030 {
22433031 boolean atleastone = false;
22443032
....@@ -2277,195 +3065,252 @@
22773065 }
22783066 }
22793067 } else
2280
- if (event.getSource() == linkerItem)
3068
+ if (source == linkerItem)
22813069 {
22823070 group(new cLinker());
22833071 } else
2284
- if (event.getSource() == textureItem)
3072
+ if (source == textureItem || source == textureButton)
22853073 {
22863074 group(new TextureNode());
22873075 } else
2288
- if (event.getSource() == shadowXItem)
3076
+ if (source == billboardItem)
3077
+ {
3078
+ group(new BillboardNode());
3079
+ } else
3080
+ if (source == shadowXItem)
22893081 {
22903082 CastShadow(0);
22913083 } else
2292
- if (event.getSource() == shadowYItem)
3084
+ if (source == shadowYItem)
22933085 {
22943086 CastShadow(1);
22953087 } else
2296
- if (event.getSource() == shadowZItem)
3088
+ if (source == shadowZItem)
22973089 {
22983090 CastShadow(2);
22993091 } else
2300
- if (event.getSource() == ungroupItem)
3092
+ if (source == ungroupItem || source == ungroupButton)
23013093 {
2302
- ungroup();
3094
+ boolean hasRoot = false;
3095
+
3096
+ for (int i=0; i<group.selection.size(); i++)
3097
+ {
3098
+ if (group.selection.get(i) == group)
3099
+ {
3100
+ hasRoot = true;
3101
+ break;
3102
+ }
3103
+ }
3104
+
3105
+ if (!hasRoot)
3106
+ {
3107
+ for (int i=0; i<group.selection.size(); i++)
3108
+ {
3109
+ Ungroup(group.selection.get(i));
3110
+ }
3111
+
3112
+ ClearSelection(false);
3113
+
3114
+ refreshContents();
3115
+ }
23033116 } else
2304
- if (event.getSource() == genUVItem)
3117
+ if (source == genUVItem)
23053118 {
23063119 GenUV();
23073120 } else
2308
- if (event.getSource() == genNormalsCADItem)
3121
+ if (source == genNormalsCADItem)
23093122 {
23103123 GenNormals(true);
23113124 } else
2312
- if (event.getSource() == genNormalsORGANItem)
3125
+ if (source == genNormalsMESHItem)
3126
+ {
3127
+ GenNormalsMESH();
3128
+ } else
3129
+ if (source == genNormalsORGANItem)
23133130 {
23143131 GenNormals(false);
23153132 } else
2316
- if (event.getSource() == stripifyItem)
3133
+ if (source == genNormalsMINEItem)
3134
+ {
3135
+ GenNormalsMINE();
3136
+ } else
3137
+ if (source == stripifyItem)
23173138 {
23183139 Stripify();
23193140 } else
2320
- if (event.getSource() == unstripifyItem)
3141
+ if (source == unstripifyItem)
23213142 {
23223143 Unstripify();
23233144 } else
2324
- if (event.getSource() == trimItem)
3145
+ if (source == trimItem)
23253146 {
23263147 Trim();
23273148 } else
2328
- if (event.getSource() == untrimItem)
3149
+ if (source == untrimItem)
23293150 {
23303151 Untrim();
23313152 } else
2332
- if (event.getSource() == clearColorsItem)
3153
+ if (source == clearColorsItem)
23333154 {
23343155 ClearColors();
23353156 } else
2336
- if (event.getSource() == clearMaterialsItem)
3157
+ if (source == clearMaterialsItem)
23373158 {
23383159 ClearMaterials();
23393160 } else
2340
- if (event.getSource() == liveleavesItem)
3161
+ if (source == liveleavesItem)
23413162 {
23423163 LiveLeaves(true);
23433164 } else
2344
- if (event.getSource() == unliveleavesItem)
3165
+ if (source == unliveleavesItem)
23453166 {
23463167 LiveLeaves(false);
23473168 } else
2348
- if (event.getSource() == supportleavesItem)
3169
+ if (source == supportleavesItem)
23493170 {
23503171 SupportLeaves(true);
23513172 } else
2352
- if (event.getSource() == unsupportleavesItem)
3173
+ if (source == unsupportleavesItem)
23533174 {
23543175 SupportLeaves(false);
23553176 } else
2356
- if (event.getSource() == hideleavesItem)
3177
+ if (source == hideleavesItem)
23573178 {
23583179 HideLeaves(true);
23593180 } else
2360
- if (event.getSource() == showleavesItem)
3181
+ if (source == showleavesItem)
23613182 {
23623183 HideLeaves(false);
23633184 } else
2364
- if (event.getSource() == markleavesItem)
3185
+ if (source == markleavesItem)
23653186 {
23663187 MarkLeaves(true);
23673188 } else
2368
- if (event.getSource() == unmarkleavesItem)
3189
+ if (source == unmarkleavesItem)
23693190 {
23703191 MarkLeaves(false);
23713192 } else
2372
- if (event.getSource() == flipVItem)
3193
+ if (source == rewindleavesItem)
3194
+ {
3195
+ RewindLeaves(true);
3196
+ } else
3197
+ if (source == unrewindleavesItem)
3198
+ {
3199
+ RewindLeaves(false);
3200
+ } else
3201
+ if (source == randomleavesItem)
3202
+ {
3203
+ RandomLeaves(true);
3204
+ } else
3205
+ if (source == unrandomleavesItem)
3206
+ {
3207
+ RandomLeaves(false);
3208
+ } else
3209
+ if (source == flipVItem)
23733210 {
23743211 FlipV(true);
23753212 } else
2376
- if (event.getSource() == unflipVItem)
3213
+ if (source == unflipVItem)
23773214 {
23783215 FlipV(false);
23793216 } else
2380
- if (event.getSource() == lowTexturesItem)
3217
+ if (source == lowTexturesItem)
23813218 {
23823219 SetTexRes(0);
23833220 } else
2384
- if (event.getSource() == normalTexturesItem)
3221
+ if (source == normalTexturesItem)
23853222 {
23863223 SetTexRes(1);
23873224 } else
2388
- if (event.getSource() == highTexturesItem)
3225
+ if (source == highTexturesItem)
23893226 {
23903227 SetTexRes(2);
23913228 } else
2392
- if (event.getSource() == veryhighTexturesItem)
3229
+ if (source == veryhighTexturesItem)
23933230 {
23943231 SetTexRes(3);
23953232 } else
2396
- if (event.getSource() == maxTexturesItem)
3233
+ if (source == maxTexturesItem)
23973234 {
23983235 SetTexRes(4);
23993236 } else
2400
- if (event.getSource() == panoTexturesItem)
3237
+ if (source == panoTexturesItem)
24013238 {
24023239 SetTexRes(5);
24033240 } else
2404
- if (event.getSource() == reverseNormalsItem)
3241
+ if (source == reverseNormalsItem)
24053242 {
24063243 ReverseNormals();
24073244 } else
2408
- if (event.getSource() == parseverticesItem)
3245
+ if (source == parseverticesItem)
24093246 {
24103247 ParseVertices();
24113248 } else
2412
- if (event.getSource() == textureFieldItem)
3249
+ if (source == textureFieldItem)
24133250 {
24143251 TextureVertices();
24153252 } else
2416
- if (event.getSource() == alignItem)
3253
+ if (source == alignItem)
24173254 {
24183255 Align();
24193256 } else
2420
- if (event.getSource() == mirrorItem)
3257
+ if (source == mirrorItem)
24213258 {
24223259 MirrorPoses();
24233260 } else
2424
- if (event.getSource() == reduceMorphItem)
3261
+ if (source == reduceMorphItem)
24253262 {
24263263 MeshReduction(false);
24273264 } else
2428
- if (event.getSource() == reduce34MorphItem)
3265
+ if (source == reduce34MorphItem)
24293266 {
24303267 MeshReduction(true);
24313268 } else
2432
- if (event.getSource() == reverseTrianglesItem)
3269
+ if (source == reverseTrianglesItem)
24333270 {
24343271 ReverseTriangles();
24353272 } else
2436
- if (event.getSource() == reduceMeshItem)
3273
+ if (source == reduceMeshItem)
24373274 {
24383275 ReduceMesh(false);
24393276 } else
2440
- if (event.getSource() == reduce34MeshItem)
3277
+ if (source == reduce34MeshItem)
24413278 {
24423279 ReduceMesh(true);
24433280 } else
2444
- if (event.getSource() == increaseMeshItem)
3281
+ if (source == increaseMeshItem)
24453282 {
24463283 IncreaseMesh();
24473284 } else
2448
- if (event.getSource() == clipMeshItem)
3285
+ if (source == clipMeshItem)
24493286 {
24503287 ClipMesh();
24513288 } else
2452
- if (event.getSource() == smoothMeshItem)
3289
+ if (source == smoothMeshItem)
24533290 {
24543291 SmoothMesh();
24553292 } else
2456
- if (event.getSource() == transformgeometryItem)
3293
+ if (source == transformGeometryItem)
24573294 {
24583295 TransformGeometry();
24593296 } else
2460
- if (event.getSource() == resetTransformItem)
3297
+ if (source == transformChildrenItem)
3298
+ {
3299
+ TransformChildren();
3300
+ } else
3301
+ if (source == resetTransformItem)
24613302 {
24623303 ResetTransform();
24633304 } else
2464
- if (event.getSource() == resetCentroidItem)
3305
+ if (source == resetCentroidItem)
24653306 {
2466
- ResetCentroid();
3307
+ ResetCentroid(true);
24673308 } else
2468
- if (event.getSource() == resetParentItem)
3309
+ if (source == resetCentroidXZItem)
3310
+ {
3311
+ ResetCentroid(false);
3312
+ } else
3313
+ if (source == resetParentItem)
24693314 {
24703315 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24713316 {
....@@ -2475,7 +3320,7 @@
24753320
24763321 refreshContents();
24773322 } else
2478
- if (event.getSource() == repairParentItem)
3323
+ if (source == repairParentItem)
24793324 {
24803325 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24813326 {
....@@ -2489,7 +3334,21 @@
24893334
24903335 refreshContents();
24913336 } else
2492
- if (event.getSource() == sortbysizeItem)
3337
+ if (source == repairShadowItem)
3338
+ {
3339
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3340
+ {
3341
+ Object3D obj = (Object3D)e.nextElement();
3342
+ obj.RepairShadow();
3343
+// for (int i=0; i<obj.size(); i++)
3344
+// {
3345
+// obj.get(i).parent = obj;
3346
+// }
3347
+ }
3348
+
3349
+ refreshContents();
3350
+ } else
3351
+ if (source == sortbysizeItem)
24933352 {
24943353 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953354 {
....@@ -2501,7 +3360,7 @@
25013360 ResetModel();
25023361 refreshContents();
25033362 } else
2504
- if (event.getSource() == sortbynameItem)
3363
+ if (source == sortbynameItem)
25053364 {
25063365 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25073366 {
....@@ -2513,7 +3372,7 @@
25133372 ResetModel();
25143373 refreshContents();
25153374 } else
2516
- if (event.getSource() == attachPigmentItem)
3375
+ if (source == attachPigmentItem)
25173376 {
25183377 String texture = GetFile("Attach pigment");
25193378 Object3D obj;
....@@ -2525,7 +3384,7 @@
25253384
25263385 refreshContents();
25273386 } else
2528
- if (event.getSource() == detachPigmentItem)
3387
+ if (source == detachPigmentItem)
25293388 {
25303389 Object3D obj;
25313390 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2536,7 +3395,7 @@
25363395
25373396 refreshContents();
25383397 } else
2539
- if (event.getSource() == attachBumpItem)
3398
+ if (source == attachBumpItem)
25403399 {
25413400 String texture = GetFile("Attach bump");
25423401 Object3D obj;
....@@ -2548,18 +3407,18 @@
25483407
25493408 refreshContents();
25503409 } else
2551
- if (event.getSource() == detachBumpItem)
3410
+ if (source == detachBumpItem)
25523411 {
25533412 Object3D obj;
25543413 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25553414 {
25563415 obj = (Object3D)e.nextElement();
2557
- obj.SetBumpTexture(null);
3416
+ obj.ResetBumpTexture();
25583417 }
25593418
25603419 refreshContents();
25613420 } else
2562
- if (event.getSource() == pigmentBumpItem)
3421
+ if (source == pigmentBumpItem)
25633422 {
25643423 Object3D obj;
25653424 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2570,158 +3429,262 @@
25703429
25713430 refreshContents();
25723431 } else
2573
- if (event.getSource() == flashSelectionButton)
3432
+ if (source == embedTexturesItem)
3433
+ {
3434
+ Object3D obj;
3435
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3436
+ {
3437
+ obj = (Object3D)e.nextElement();
3438
+ obj.EmbedTextures(true);
3439
+ }
3440
+
3441
+ refreshContents();
3442
+ } else
3443
+ if (source == deEmbedTexturesItem)
3444
+ {
3445
+ Object3D obj;
3446
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3447
+ {
3448
+ obj = (Object3D)e.nextElement();
3449
+ obj.EmbedTextures(false);
3450
+ }
3451
+
3452
+ CameraPane.texturepigment.clear();
3453
+ CameraPane.texturebump.clear();
3454
+
3455
+ refreshContents();
3456
+ } else
3457
+ if (source == flashSelectionButton)
25743458 {
25753459 CameraPane.flash = true;
25763460 refreshContents();
25773461 } else
2578
- if (event.getSource() == oneButton)
3462
+ if (source == oneButton)
25793463 {
25803464 } else
2581
- if (event.getSource() == twoButton)
3465
+ if (source == twoButton)
25823466 {
25833467 radio.layout = twoButton;
3468
+
3469
+ if (CameraPane.FULLSCREEN)
3470
+ fullscreenLayout = radio.layout;
3471
+
25843472 // bug
25853473 //gridPanel.setDividerLocation(1.0);
25863474 //bigPanel.setDividerLocation(0.0);
2587
- bigThree.remove(jtp);
2588
- bigThree.remove(cameraPanel);
2589
- bigThree.remove(XYZPanel);
2590
- aWindowConstraints.gridx = 0;
2591
- aWindowConstraints.gridy = 0;
2592
- aWindowConstraints.gridwidth = 1;
2593
- // aConstraints.gridheight = 3;
2594
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2595
- aWindowConstraints.weightx = 0;
2596
- aWindowConstraints.weighty = 1;
2597
- //bigThree.add(jtp, aWindowConstraints);
2598
- aWindowConstraints.weightx = 1;
2599
- aWindowConstraints.gridwidth = 3;
2600
- // aConstraints.gridheight = 3;
2601
- aWindowConstraints.gridx = 1;
2602
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2603
- bigThree.add(cameraPanel, aWindowConstraints);
2604
- aWindowConstraints.weightx = 0;
2605
- aWindowConstraints.gridx = 4;
2606
- aWindowConstraints.gridwidth = 1;
2607
- // aConstraints.gridheight = 3;
2608
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2609
- //bigThree.add(XYZPanel, aWindowConstraints);
2610
- bigThree.revalidate();
3475
+// bigThree.remove(scenePanel);
3476
+// bigThree.remove(centralPanel);
3477
+// bigThree.remove(XYZPanel);
3478
+// aWindowConstraints.gridx = 0;
3479
+// aWindowConstraints.gridy = 0;
3480
+// aWindowConstraints.gridwidth = 1;
3481
+// // aConstraints.gridheight = 3;
3482
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3483
+// aWindowConstraints.weightx = 0;
3484
+// aWindowConstraints.weighty = 1;
3485
+// //bigThree.add(jtp, aWindowConstraints);
3486
+// aWindowConstraints.weightx = 1;
3487
+// aWindowConstraints.gridwidth = 3;
3488
+// // aConstraints.gridheight = 3;
3489
+// aWindowConstraints.gridx = 1;
3490
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3491
+// bigThree.add(centralPanel, aWindowConstraints);
3492
+// aWindowConstraints.weightx = 0;
3493
+// aWindowConstraints.gridx = 4;
3494
+// aWindowConstraints.gridwidth = 1;
3495
+// // aConstraints.gridheight = 3;
3496
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3497
+// //bigThree.add(XYZPanel, aWindowConstraints);
3498
+// scenePanel.setVisible(false);
3499
+// centralPanel.setVisible(true);
3500
+// XYZPanel.setVisible(false);
3501
+ bigThree.ClearUI();
3502
+ bigThree.add(centralPanel);
3503
+ bigThree.FlushUI();
3504
+
3505
+ cameraView.requestFocusInWindow();
3506
+
3507
+// refreshContents(true);
3508
+//
3509
+// try
3510
+// {
3511
+// java.awt.Robot bot = new java.awt.Robot();
3512
+// int mask = InputEvent.BUTTON1_MASK;
3513
+// bot.mouseMove(100, 100);
3514
+// bot.mousePress(mask);
3515
+// bot.mouseRelease(mask);
3516
+// }
3517
+// catch (Exception e)
3518
+// {
3519
+//
3520
+// }
3521
+
26113522 } else
2612
- if (event.getSource() == threeButton)
3523
+ if (source == threeButton)
26133524 {
26143525 radio.layout = threeButton;
2615
- bigThree.remove(jtp);
2616
- bigThree.remove(cameraPanel);
2617
- bigThree.remove(XYZPanel);
2618
- aWindowConstraints.gridx = 0;
2619
- aWindowConstraints.gridy = 0;
2620
- aWindowConstraints.gridwidth = 1;
2621
- // aConstraints.gridheight = 3;
2622
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2623
- aWindowConstraints.weightx = 0;
2624
- aWindowConstraints.weighty = 1;
2625
- //bigThree.add(jtp, aWindowConstraints);
2626
- aWindowConstraints.weightx = 1;
2627
- aWindowConstraints.gridwidth = 3;
2628
- // aConstraints.gridheight = 3;
2629
- aWindowConstraints.gridx = 1;
2630
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2631
- bigThree.add(cameraPanel, aWindowConstraints);
2632
- aWindowConstraints.weightx = 0;
2633
- aWindowConstraints.gridx = 4;
2634
- aWindowConstraints.gridwidth = 1;
2635
- // aConstraints.gridheight = 3;
2636
- aConstraints.fill = GridBagConstraints.VERTICAL;
2637
- bigThree.add(XYZPanel, aWindowConstraints);
2638
- bigThree.revalidate();
3526
+
3527
+ if (CameraPane.FULLSCREEN)
3528
+ fullscreenLayout = radio.layout;
3529
+
3530
+// bigThree.remove(scenePanel);
3531
+// bigThree.remove(centralPanel);
3532
+// bigThree.remove(XYZPanel);
3533
+// aWindowConstraints.gridx = 0;
3534
+// aWindowConstraints.gridy = 0;
3535
+// aWindowConstraints.gridwidth = 1;
3536
+// // aConstraints.gridheight = 3;
3537
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3538
+// aWindowConstraints.weightx = 0;
3539
+// aWindowConstraints.weighty = 1;
3540
+// //bigThree.add(jtp, aWindowConstraints);
3541
+// aWindowConstraints.weightx = 1;
3542
+// aWindowConstraints.gridwidth = 3;
3543
+// // aConstraints.gridheight = 3;
3544
+// aWindowConstraints.gridx = 1;
3545
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3546
+// bigThree.add(centralPanel, aWindowConstraints);
3547
+// aWindowConstraints.weightx = 0;
3548
+// aWindowConstraints.gridx = 4;
3549
+// aWindowConstraints.gridwidth = 1;
3550
+// // aConstraints.gridheight = 3;
3551
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3552
+// bigThree.add(XYZPanel, aWindowConstraints);
3553
+// bigThree.validate();
3554
+// scenePanel.setVisible(false);
3555
+// centralPanel.setVisible(true);
3556
+// XYZPanel.setVisible(true);
3557
+ bigThree.ClearUI();
3558
+ bigThree.add(scenePanel);
3559
+ bigThree.add(centralPanel);
3560
+ bigThree.FlushUI();
3561
+
3562
+ cameraView.requestFocusInWindow();
26393563 } else
2640
- if (event.getSource() == fourButton)
3564
+ if (source == fourButton)
26413565 {
26423566 radio.layout = fourButton;
2643
- bigThree.remove(jtp);
2644
- bigThree.remove(cameraPanel);
2645
- bigThree.remove(XYZPanel);
2646
- aWindowConstraints.gridx = 0;
2647
- aWindowConstraints.gridy = 0;
2648
- aWindowConstraints.gridwidth = 1;
2649
- // aWindowConstraints.gridheight = 3;
2650
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2651
- aWindowConstraints.weightx = 1;
2652
- aWindowConstraints.weighty = 1;
2653
- bigThree.add(jtp, aWindowConstraints);
2654
- aWindowConstraints.weightx = 1;
2655
- aWindowConstraints.gridwidth = 3;
2656
- // aConstraints.gridheight = 3;
2657
- aWindowConstraints.gridx = 1;
2658
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2659
- //bigThree.add(cameraPanel, aWindowConstraints);
2660
- aWindowConstraints.weightx = 0;
2661
- aWindowConstraints.gridx = 4;
2662
- aWindowConstraints.gridwidth = 1;
2663
- // aWindowConstraints.gridheight = 3;
2664
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2665
- //bigThree.add(XYZPanel, aWindowConstraints);
2666
- bigThree.revalidate();
3567
+
3568
+ if (CameraPane.FULLSCREEN)
3569
+ fullscreenLayout = radio.layout;
3570
+
3571
+// bigThree.remove(scenePanel);
3572
+// bigThree.remove(centralPanel);
3573
+// bigThree.remove(XYZPanel);
3574
+// aWindowConstraints.gridx = 0;
3575
+// aWindowConstraints.gridy = 0;
3576
+// aWindowConstraints.gridwidth = 1;
3577
+// // aWindowConstraints.gridheight = 3;
3578
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3579
+// aWindowConstraints.weightx = 1;
3580
+// aWindowConstraints.weighty = 1;
3581
+// bigThree.add(scenePanel, aWindowConstraints);
3582
+// aWindowConstraints.weightx = 1;
3583
+// aWindowConstraints.gridwidth = 3;
3584
+// // aConstraints.gridheight = 3;
3585
+// aWindowConstraints.gridx = 1;
3586
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3587
+// //bigThree.add(cameraPanel, aWindowConstraints);
3588
+// aWindowConstraints.weightx = 0;
3589
+// aWindowConstraints.gridx = 4;
3590
+// aWindowConstraints.gridwidth = 1;
3591
+// // aWindowConstraints.gridheight = 3;
3592
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3593
+// //bigThree.add(XYZPanel, aWindowConstraints);
3594
+// bigThree.validate();
3595
+// scenePanel.setVisible(true);
3596
+// centralPanel.setVisible(false);
3597
+// XYZPanel.setVisible(false);
3598
+ bigThree.ClearUI();
3599
+ bigThree.add(scenePanel);
3600
+ bigThree.FlushUI();
3601
+
3602
+ cameraView.requestFocusInWindow();
26673603 } else
2668
- if (event.getSource() == sixButton)
3604
+ if (source == sixButton)
26693605 {
26703606 radio.layout = sixButton;
2671
- bigThree.remove(jtp);
2672
- bigThree.remove(cameraPanel);
2673
- bigThree.remove(XYZPanel);
2674
- aWindowConstraints.gridx = 0;
2675
- aWindowConstraints.gridy = 0;
2676
- aWindowConstraints.gridwidth = 1;
2677
- // aConstraints.gridheight = 3;
2678
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2679
- aWindowConstraints.weightx = 0;
2680
- aWindowConstraints.weighty = 1;
2681
- bigThree.add(jtp, aWindowConstraints);
2682
- aWindowConstraints.weightx = 1;
2683
- aWindowConstraints.gridwidth = 3;
2684
- // aWindowConstraints.gridheight = 3;
2685
- aWindowConstraints.gridx = 1;
2686
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2687
- bigThree.add(cameraPanel, aWindowConstraints);
2688
- aWindowConstraints.weightx = 0;
2689
- aWindowConstraints.gridx = 4;
2690
- aWindowConstraints.gridwidth = 1;
2691
- // aWindowConstraints.gridheight = 3;
2692
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2693
- //bigThree.add(XYZPanel, aConstraints);
2694
- bigThree.revalidate();
3607
+
3608
+ if (CameraPane.FULLSCREEN)
3609
+ fullscreenLayout = radio.layout;
3610
+
3611
+// bigThree.remove(scenePanel);
3612
+// bigThree.remove(centralPanel);
3613
+// bigThree.remove(XYZPanel);
3614
+// aWindowConstraints.gridx = 0;
3615
+// aWindowConstraints.gridy = 0;
3616
+// aWindowConstraints.gridwidth = 1;
3617
+// // aConstraints.gridheight = 3;
3618
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3619
+// aWindowConstraints.weightx = 0;
3620
+// aWindowConstraints.weighty = 1;
3621
+// bigThree.add(scenePanel, aWindowConstraints);
3622
+// aWindowConstraints.weightx = 1;
3623
+// aWindowConstraints.gridwidth = 3;
3624
+// // aWindowConstraints.gridheight = 3;
3625
+// aWindowConstraints.gridx = 1;
3626
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3627
+// bigThree.add(centralPanel, aWindowConstraints);
3628
+// aWindowConstraints.weightx = 0;
3629
+// aWindowConstraints.gridx = 4;
3630
+// aWindowConstraints.gridwidth = 1;
3631
+// // aWindowConstraints.gridheight = 3;
3632
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3633
+// //bigThree.add(XYZPanel, aConstraints);
3634
+// bigThree.validate();
3635
+// scenePanel.setVisible(true);
3636
+// centralPanel.setVisible(true);
3637
+// XYZPanel.setVisible(false);
3638
+ bigThree.ClearUI();
3639
+ bigThree.add(centralPanel);
3640
+ bigThree.add(scenePanel);
3641
+ bigThree.FlushUI();
3642
+
3643
+ cameraView.requestFocusInWindow();
26953644 } else
2696
- if (event.getSource() == sevenButton)
3645
+ if (source == sevenButton)
26973646 {
26983647 radio.layout = sevenButton;
2699
- bigThree.remove(jtp);
2700
- bigThree.remove(cameraPanel);
2701
- bigThree.remove(XYZPanel);
2702
- aWindowConstraints.gridx = 0;
2703
- aWindowConstraints.gridy = 0;
2704
- aWindowConstraints.gridwidth = 1;
2705
- // aWindowConstraints.gridheight = 3;
2706
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2707
- aWindowConstraints.weightx = 0;
2708
- aWindowConstraints.weighty = 1;
2709
- bigThree.add(jtp, aWindowConstraints);
2710
- aWindowConstraints.weightx = 1;
2711
- aWindowConstraints.gridwidth = 3;
2712
- // aWindowConstraints.gridheight = 3;
2713
- aWindowConstraints.gridx = 1;
2714
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2715
- bigThree.add(cameraPanel, aWindowConstraints);
2716
- aWindowConstraints.weightx = 0;
2717
- aWindowConstraints.gridx = 4;
2718
- aWindowConstraints.gridwidth = 1;
2719
- // aConstraints.gridheight = 3;
2720
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2721
- bigThree.add(XYZPanel, aWindowConstraints);
2722
- bigThree.revalidate();
3648
+
3649
+ if (CameraPane.FULLSCREEN)
3650
+ fullscreenLayout = radio.layout;
3651
+
3652
+// bigThree.remove(scenePanel);
3653
+// bigThree.remove(centralPanel);
3654
+// bigThree.remove(XYZPanel);
3655
+// aWindowConstraints.gridx = 0;
3656
+// aWindowConstraints.gridy = 0;
3657
+// aWindowConstraints.gridwidth = 1;
3658
+// // aWindowConstraints.gridheight = 3;
3659
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3660
+// aWindowConstraints.weightx = 0;
3661
+// aWindowConstraints.weighty = 1;
3662
+// bigThree.add(scenePanel, aWindowConstraints);
3663
+// aWindowConstraints.weightx = 1;
3664
+// aWindowConstraints.gridwidth = 3;
3665
+// // aWindowConstraints.gridheight = 3;
3666
+// aWindowConstraints.gridx = 1;
3667
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3668
+// bigThree.add(centralPanel, aWindowConstraints);
3669
+// aWindowConstraints.weightx = 0;
3670
+// aWindowConstraints.gridx = 4;
3671
+// aWindowConstraints.gridwidth = 1;
3672
+// // aConstraints.gridheight = 3;
3673
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3674
+// bigThree.add(XYZPanel, aWindowConstraints);
3675
+// bigThree.validate();
3676
+// scenePanel.setVisible(true);
3677
+// centralPanel.setVisible(true);
3678
+// XYZPanel.setVisible(true);
3679
+ bigThree.ClearUI();
3680
+ bigThree.add(scenePanel);
3681
+ bigThree.add(centralPanel);
3682
+ bigThree.add(XYZPanel);
3683
+ bigThree.FlushUI();
3684
+
3685
+ cameraView.requestFocusInWindow();
27233686 } else
2724
- if (event.getSource() == rootButton)
3687
+ if (source == rootButton)
27253688 {
27263689 Object3D obj;
27273690 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2731,66 +3694,84 @@
27313694 EditObject(obj);
27323695 }
27333696
3697
+ cameraView.requestFocusInWindow();
27343698 refreshContents(true);
27353699 } else
2736
- if (event.getSource() == closeButton)
3700
+ if (source == closeButton)
27373701 {
27383702 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27393703 cRadio ab;
27403704 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27413705 {
27423706 ab = (cRadio)e.nextElement();
2743
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3707
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27443708 {
3709
+ // Patch to avoid bug with transparency.
3710
+ if (!ab.hadMaterial)
3711
+ {
3712
+ ab.object.material = null;
3713
+ }
3714
+
27453715 buttonGroup.remove(ab);
27463716 radioPanel.remove(ab);
27473717
2748
- ab.GetObject().editWindow = null;
3718
+ //ab.GetObject().editWindow = null;
3719
+ ab.GetObject().manipWindow = null;
27493720 // ab.GetObject().objectUI = null; // ?????????
27503721
27513722 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27523723 break;
27533724 }
27543725 }
3726
+
3727
+ cameraView.requestFocusInWindow();
27553728 refreshContents(true);
27563729 } else
2757
- if (event.getSource() == editItem || event.getSource() == editButton)
3730
+ if (source == editItem || source == editButton)
27583731 {
3732
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3733
+ {
3734
+ Object3D child = (Object3D)e.nextElement();
3735
+ child.pinned = true;
3736
+ }
3737
+
27593738 EditSelection(false);
27603739 } else
2761
- if (event.getSource() == uneditButton)
3740
+ if (source == uneditButton)
27623741 {
27633742 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27643743 {
27653744 Object3D child = (Object3D)e.nextElement();
27663745 if(child.editWindow != null)
27673746 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3747
+ child.pinned = false;
27683748 child.CloseUI();
27693749 listUI.remove(child);
27703750
2771
- child.editWindow = null; // ???????????
3751
+ //child.editWindow = null; // ???????????
27723752 }
2773
- objEditor.ctrlPanel.revalidate();
3753
+ objEditor.ctrlPanel.FlushUI();
27743754 //objEditor.jTree.clearSelection();
27753755 //objEditor.ResetSliders();
27763756 refreshContents(true);
27773757 } else
2778
- if (event.getSource() == clearPanelButton)
3758
+ if (source == clearPanelButton)
27793759 {
27803760 assert(copy == group);
27813761 //copy.ClearUI();
27823762 for (Object3D obj : listUI)
27833763 {
3764
+ obj.pinned = false;
27843765 obj.CloseUI();
27853766 }
27863767 listUI.clear();
27873768 refreshContents(true);
27883769 } else
2789
- if (event.getSource() == allParamsButton)
3770
+ if (source == allParamsButton)
27903771 {
27913772 assert(copy == group);
27923773
2793
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3774
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27943775
27953776 for (Object3D obj : listUI)
27963777 {
....@@ -2807,19 +3788,19 @@
28073788
28083789 refreshContents(true);
28093790 } else
2810
- if (event.getSource() == unselectButton)
3791
+ if (source == unselectButton)
28113792 {
28123793 objEditor.jTree.clearSelection();
28133794 // ?? oct 2012 GrafreeD.clipboard.clear();
28143795 objEditor.ResetSliders();
28153796 refreshContents(true);
28163797 } else
2817
- if(event.getSource() instanceof cRadio)
3798
+ if(source instanceof cRadio)
28183799 {
28193800 group.parent = keepparent;
28203801 group.attributes = 0;
28213802 //group.editWindow = null;
2822
- /*cRadio*/ radio = (cRadio)event.getSource();
3803
+ /*cRadio*/ radio = (cRadio)source;
28233804 Object3D obj = radio.GetObject();
28243805 System.out.println("Edit " + obj);
28253806 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2839,7 +3820,10 @@
28393820 }
28403821
28413822 copy = group;
2842
- //CameraPane.theRenderer.object = group;
3823
+
3824
+ SetUndoStates();
3825
+
3826
+ //Globals.theRenderer.object = group;
28433827 if(!useclient)
28443828 {
28453829 cameraView.renderCamera = radio.camera;
....@@ -2848,25 +3832,52 @@
28483832 cameraView.cameras[cameraView.cameracount] = radio.camera;
28493833 cameraView.targetLookAt.set(radio.camera.lookAt);
28503834 cameraView.object = group;
2851
- cameraView.lighttouched = true;
3835
+ //cameraView.lighttouched = true;
3836
+ Globals.lighttouched = true;
28523837 topView.object = group;
28533838 frontView.object = group;
28543839 sideView.object = group;
28553840 }
2856
- group.editWindow = this;
3841
+
3842
+// fix "+" issue
3843
+ //group.editWindow = this;
3844
+ group.manipWindow = this;
3845
+
28573846 /*
28583847 currentLayout = radio.layout;
28593848 if (currentLayout == null)
28603849 currentLayout = sevenButton;
28613850 */
28623851 radio.layout.doClick();
3852
+
3853
+ ClearUnpinned();
3854
+ //Grafreed.Assert(group != null);
3855
+ //Grafreed.Assert(group.selection != null);
3856
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3857
+ if (group.selection == null || group.selection.size() == 1)
3858
+ EditSelection(false);
28633859 keepparent = group.parent;
28643860 // PARENT = NULL or not???
28653861 //group.parent = null; // ROOT
28663862 //group.attributes = -1;
28673863 ResetModel();
3864
+
3865
+ cameraView.requestFocusInWindow();
28683866 refreshContents(true);
2869
- }
3867
+ } else if (event.getSource() == editCameraItem)
3868
+ {
3869
+ cameraView.ProtectCamera();
3870
+ cameraView.repaint();
3871
+ return;
3872
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3873
+ {
3874
+ cameraView.RevertCamera();
3875
+ cameraView.repaint();
3876
+ return;
3877
+ // } else if (event.getSource() == textureButton)
3878
+ // {
3879
+ // return; // true;
3880
+ }
28703881 else
28713882 {
28723883 //return super.action(event, arg);
....@@ -2875,7 +3886,6 @@
28753886 }
28763887
28773888 boolean useclient = false;
2878
- cRadio radio;
28793889
28803890 void ToggleRoot()
28813891 {
....@@ -2884,7 +3894,7 @@
28843894 if (useclient)
28853895 {
28863896 cameraView.object = client;
2887
- cameraView.lighttouched = true;
3897
+ Globals.lighttouched = true;
28883898 //topView.object = client;
28893899 //frontView.object = client;
28903900 //sideView.object = client;
....@@ -2892,7 +3902,7 @@
28923902 else
28933903 {
28943904 cameraView.object = group;
2895
- cameraView.lighttouched = true;
3905
+ Globals.lighttouched = true;
28963906 //topView.object = group;
28973907 //frontView.object = group;
28983908 //sideView.object = group;
....@@ -2927,6 +3937,28 @@
29273937 refreshContents();
29283938 }
29293939
3940
+ void TransformChildren()
3941
+ {
3942
+ Object3D obj;
3943
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3944
+ {
3945
+ obj = (Object3D)e.nextElement();
3946
+ obj.KeepTextureMatrices();
3947
+ obj.TransformChildren();
3948
+ obj.RestoreTextureMatrices();
3949
+
3950
+// if (obj.parent == null)
3951
+// {
3952
+// System.out.println("NULL PARENT!");
3953
+// new Exception().printStackTrace();
3954
+// }
3955
+// else
3956
+// TouchTransform(obj);
3957
+// //obj.parent.Touch();
3958
+ }
3959
+
3960
+ refreshContents();
3961
+ }
29303962
29313963 void ResetTransform()
29323964 {
....@@ -3039,7 +4071,7 @@
30394071 refreshContents();
30404072 }
30414073
3042
- void ResetCentroid()
4074
+ void ResetCentroid(boolean full)
30434075 {
30444076 Object3D obj;
30454077 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3054,12 +4086,16 @@
30544086 LA.matIdentity(Object3D.mat);
30554087 obj.getBounds(minima, maxima, false);
30564088 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3057
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4089
+ if (full)
4090
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30584091 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30594092 obj.TransformMesh(Object3D.mat);
4093
+
30604094 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3061
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4095
+ if (full)
4096
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30624097 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4098
+
30634099 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30644100 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30654101 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3088,7 +4124,8 @@
30884124
30894125 int size = obj.MemorySize();
30904126
3091
- System.err.println((size/1024) + " KB is the size of " + obj);
4127
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4128
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30924129 }
30934130 }
30944131 catch (Exception e)
....@@ -3125,9 +4162,9 @@
31254162 obj = (Object3D)e.nextElement();
31264163
31274164 System.out.println("Object is: " + obj);
3128
- GrafreeD.AnalyzeObject(obj);
4165
+ Grafreed.AnalyzeObject(obj);
31294166 System.out.println("Boundary rep: " + obj.bRep);
3130
- GrafreeD.AnalyzeObject(obj.bRep);
4167
+ Grafreed.AnalyzeObject(obj.bRep);
31314168
31324169 // System.err.println((size/1024) + " KB is the size of " + obj);
31334170 }
....@@ -3169,6 +4206,20 @@
31694206 void GenNormals(boolean crease)
31704207 {
31714208 group.GenNormalsS(crease);
4209
+
4210
+ refreshContents();
4211
+ }
4212
+
4213
+ void GenNormalsMESH()
4214
+ {
4215
+ group.GenNormalsMeshS();
4216
+
4217
+ refreshContents();
4218
+ }
4219
+
4220
+ void GenNormalsMINE()
4221
+ {
4222
+ group.selection.GenNormalsMINE();
31724223
31734224 refreshContents();
31744225 }
....@@ -3334,8 +4385,8 @@
33344385
33354386 void ParseVertices()
33364387 {
3337
- boolean epsequal = GrafreeD.epsequal;
3338
- GrafreeD.epsequal = true;
4388
+ boolean epsequal = Grafreed.epsequal;
4389
+ Grafreed.epsequal = true;
33394390
33404391 for (int i=0; i<group.selection.size(); i++)
33414392 {
....@@ -3360,7 +4411,7 @@
33604411 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33614412 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33624413
3363
- g.add(GrafreeD.clipboard);
4414
+ g.add(Grafreed.clipboard);
33644415
33654416 buffer.add(g);
33664417 }
....@@ -3375,7 +4426,7 @@
33754426 makeSomething(buffer, i==group.selection.size()-1);
33764427 }
33774428
3378
- GrafreeD.epsequal = epsequal;
4429
+ Grafreed.epsequal = epsequal;
33794430
33804431 refreshContents();
33814432 }
....@@ -3393,7 +4444,16 @@
33934444 String pigment = Object3D.GetPigment(tex);
33944445 //String bump = Object3D.GetBump(tex);
33954446
3396
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4447
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4448
+
4449
+ try
4450
+ {
4451
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4452
+ }
4453
+ catch (Exception e)
4454
+ {
4455
+ System.err.println("FAIL: " + node);
4456
+ }
33974457
33984458 double s = v.s;
33994459
....@@ -3441,12 +4501,26 @@
34414501
34424502 void Align()
34434503 {
4504
+ if (group.selection.size() == 0)
4505
+ return;
4506
+
4507
+ cVector bbmin = new cVector();
4508
+ cVector bbmax = new cVector();
4509
+
4510
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4511
+
4512
+ double dx = bbmax.x - bbmin.x;
4513
+ double dy = bbmax.y - bbmin.y;
4514
+ double dz = bbmax.z - bbmin.z;
4515
+
4516
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4517
+
34444518 for (int i=0; i<group.selection.size(); i++)
34454519 {
34464520 Object3D obj = group.selection.get(i);
34474521
3448
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3449
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4522
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4523
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34504524 }
34514525
34524526 refreshContents();
....@@ -3467,11 +4541,11 @@
34674541
34684542 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34694543
3470
- boolean random = CameraPane.RANDOM;
3471
- CameraPane.RANDOM = false; // parse all random nodes
4544
+ boolean random = CameraPane.SWITCH;
4545
+ CameraPane.SWITCH = false; // parse all random nodes
34724546 lowres.linkVerticesThis(null);
34734547 lowres.linkVerticesThis(sn);
3474
- CameraPane.RANDOM = random;
4548
+ CameraPane.SWITCH = random;
34754549
34764550 System.err.flush();
34774551
....@@ -3511,7 +4585,7 @@
35114585 return;
35124586
35134587 Object3D poses = group.selection.get(0);
3514
- Object3D ref = GrafreeD.clipboard.get(0);
4588
+ Object3D ref = Grafreed.clipboard.get(0);
35154589
35164590 Object3D newgroup = new Object3D("Po:" + poses.name);
35174591
....@@ -3680,7 +4754,7 @@
36804754 group.selection.RelinkToSupport(); // july 2014
36814755 System.out.println("DONE.");
36824756 refreshContents();
3683
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4757
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36844758 }
36854759
36864760 void ReduceMesh(boolean reduction34)
....@@ -3705,9 +4779,9 @@
37054779
37064780 void ClipMesh()
37074781 {
3708
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4782
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37094783 {
3710
- Object3D content = GrafreeD.clipboard.get(0);
4784
+ Object3D content = Grafreed.clipboard.get(0);
37114785
37124786 if (content instanceof cGroup && ((cGroup)content).transientlink )
37134787 content = ((cGroup)content).get(0);
....@@ -3716,7 +4790,7 @@
37164790 // {
37174791 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37184792 // }
3719
- group.selection.ClipMesh(GrafreeD.clipboard);
4793
+ group.selection.ClipMesh(Grafreed.clipboard);
37204794 }
37214795 // group.selection.ClipMesh(GrafreeD.clipboard);
37224796 System.out.println("DONE.");
....@@ -3763,6 +4837,18 @@
37634837 void MarkLeaves(boolean hide)
37644838 {
37654839 group.selection.MarkLeaves(hide);
4840
+ refreshContents();
4841
+ }
4842
+
4843
+ void RewindLeaves(boolean hide)
4844
+ {
4845
+ group.selection.RewindLeaves(hide);
4846
+ refreshContents();
4847
+ }
4848
+
4849
+ void RandomLeaves(boolean hide)
4850
+ {
4851
+ group.selection.RandomLeaves(hide);
37664852 refreshContents();
37674853 }
37684854
....@@ -3837,28 +4923,25 @@
38374923 // }
38384924 // }
38394925
3840
- static boolean allparams = true;
3841
-
3842
- static Vector<Object3D> listUI = new Vector<Object3D>();
3843
-
38444926 void EditSelection(boolean newWindow)
38454927 {
4928
+ if (group.selection == null)
4929
+ {
4930
+ EditElement(group, newWindow); // ? new
4931
+ return;
4932
+ }
4933
+
38464934 // aConstraints.gridy = 0;
38474935 for (int i=0; i<group.selection.size(); i++)
38484936 {
38494937 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38504938 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3851
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4939
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38524940
38534941 Object3D elem = (Object3D)group.selection.elementAt(i);
3854
- if(elem != group)
4942
+ if(elem != group || !newWindow)
38554943 {
3856
- // if (!(elem instanceof Composite))
3857
- // newWindow = false;
3858
- listUI.add(elem);
3859
- elem.openEditWindow(this, newWindow); //, false);
3860
- System.out.println("edit : " + elem);
3861
- elem.editWindow.refreshContents(true); // ? new
4944
+ EditElement(elem, newWindow); // ? new
38624945 }
38634946 }
38644947 }
....@@ -3933,7 +5016,8 @@
39335016 //new Exception().printStackTrace();
39345017
39355018 freezemodel = true;
3936
-
5019
+ ClearUnpinned();
5020
+
39375021 /**/
39385022 //switch (event.id)
39395023 {
....@@ -3941,7 +5025,6 @@
39415025 //case 702: // Event.LIST_DESELECT
39425026 group.deselectAll();
39435027 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3944
- objEditor.ClearInfo(); // .GetMaterial());
39455028 if (tps != null)
39465029 {
39475030 for (int i=0; i < tps.length; i++)
....@@ -3950,33 +5033,39 @@
39505033
39515034 //if (child.parent != null)
39525035 //child.parent.addSelectee(child);
5036
+ objEditor.SetMaterial(child);
39535037 group.addSelectee(child);
3954
- objEditor.SetMaterial(child); // .GetMaterial());
3955
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3956
- System.err.println("info : " + child.GetPath());
39575038 }
39585039 }
3959
- else
3960
- {
3961
- objEditor.SetMaterial(group); // .GetMaterial());
3962
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3963
- System.err.println("info : " + group.GetPath());
3964
- }
5040
+// else
5041
+// {
5042
+// objEditor.SetMaterial(group); // .GetMaterial());
5043
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5044
+// System.err.println("info : " + group.GetPath());
5045
+// }
39655046
3966
- objEditor.SetText(); // jan 2014
3967
-
3968
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5047
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39695048 CameraPane.flash = true;
39705049
3971
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5050
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39725051 // a camera
39735052 {
3974
- CameraPane.camerachangeframe = 0; // don't refuse it
3975
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3976
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3977
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
5053
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5054
+ {
5055
+ CameraPane.camerachangeframe = 0; // don't refuse it
5056
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5057
+ }
5058
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5059
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39785060 }
39795061
5062
+ if (tps != null && tps.length == 1)
5063
+ {
5064
+ EditSelection(false);
5065
+ }
5066
+
5067
+ SetPinStates(tps != null && tps.length > 0);
5068
+
39805069 refreshContents();
39815070 //return true;
39825071 }
....@@ -3985,6 +5074,35 @@
39855074
39865075 freezemodel = false;
39875076 }
5077
+
5078
+ void SetPinStates(boolean enabled)
5079
+ {
5080
+ editButton.setEnabled(enabled);
5081
+ uneditButton.setEnabled(enabled);
5082
+ unselectButton.setEnabled(enabled);
5083
+ flashSelectionButton.setEnabled(enabled);
5084
+ }
5085
+
5086
+ void refreshContents(boolean cp)
5087
+ {
5088
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5089
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5090
+ {
5091
+ objEditor.ClearInfo(); // .GetMaterial());
5092
+
5093
+ for (int i=0; i < group.selection.Size(); i++)
5094
+ {
5095
+ Object3D child = (Object3D) group.selection.get(i);
5096
+
5097
+ objEditor.AddInfo(child, this, true);
5098
+ System.err.println("info : " + child.GetPath());
5099
+ }
5100
+
5101
+ objEditor.SetText(); // jan 2014
5102
+ }
5103
+
5104
+ super.refreshContents(cp);
5105
+ }
39885106
39895107 void linkSomething(Object3D thing)
39905108 {
....@@ -4056,16 +5174,19 @@
40565174 {
40575175 if (group.selection.isEmpty())
40585176 return;
4059
- GrafreeD.clipboardIsTempGroup = false;
5177
+
5178
+ Grafreed.clipboardIsTempGroup = false;
40605179 Composite tGroup = null;
40615180 if (group.selection.size() > 0) // 1)
40625181 {
40635182 tGroup = new cGroup();
4064
- GrafreeD.clipboardIsTempGroup = true;
5183
+ Grafreed.clipboardIsTempGroup = true;
40655184 }
40665185
40675186 if (cut)
40685187 {
5188
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5189
+// Save();
40695190 //int indices[] = jList.getSelectedIndices();
40705191 //for (int i = indices.length - 1; i >= 0; i--)
40715192 //jList.remove(indices[i]);
....@@ -4101,16 +5222,16 @@
41015222 //System.out.println("cut " + child);
41025223 //System.out.println("parent = " + child.parent);
41035224 // tmp.addChild(child);
4104
- if (GrafreeD.clipboardIsTempGroup)
5225
+ if (Grafreed.clipboardIsTempGroup)
41055226 tGroup.add/*Child*/(tmp);
41065227 else
4107
- GrafreeD.clipboard = tmp;
5228
+ Grafreed.clipboard = tmp;
41085229 }
41095230 else
4110
- if (GrafreeD.clipboardIsTempGroup)
5231
+ if (Grafreed.clipboardIsTempGroup)
41115232 tGroup.add/*Child*/(child);
41125233 else
4113
- GrafreeD.clipboard = child;
5234
+ Grafreed.clipboard = child;
41145235 }
41155236
41165237 //ResetModel();
....@@ -4142,21 +5263,23 @@
41425263 //System.out.println("cut " + elem);
41435264 //System.out.println("parent = " + elem.parent);
41445265 // tmp.addChild(elem);
4145
- if (GrafreeD.clipboardIsTempGroup)
5266
+ if (Grafreed.clipboardIsTempGroup)
41465267 tGroup.add/*Child*/(tmp);
41475268 else
4148
- GrafreeD.clipboard = tmp;
5269
+ Grafreed.clipboard = tmp;
41495270 }
41505271 else
4151
- if (GrafreeD.clipboardIsTempGroup)
5272
+ if (Grafreed.clipboardIsTempGroup)
41525273 tGroup.add/*Child*/(child);
41535274 else
4154
- GrafreeD.clipboard = child;
5275
+ Grafreed.clipboard = child;
41555276 }
41565277
41575278 }
4158
- if (GrafreeD.clipboardIsTempGroup)
4159
- GrafreeD.clipboard = tGroup;
5279
+
5280
+ if (Grafreed.clipboardIsTempGroup)
5281
+ Grafreed.clipboard = tGroup;
5282
+
41605283 if (cut)
41615284 {
41625285 ResetModel();
....@@ -4166,11 +5289,15 @@
41665289
41675290 void paste(boolean expand)
41685291 {
5292
+ if (Globals.REPLACEONMAKE)
5293
+ Save();
5294
+ boolean keep = Globals.REPLACEONMAKE;
5295
+ Globals.REPLACEONMAKE = false;
41695296 // if (GrafreeD.clipboard == null)
41705297 // return;
41715298 boolean first = true;
41725299
4173
- if (GrafreeD.clipboardIsTempGroup)
5300
+ if (Grafreed.clipboardIsTempGroup)
41745301 {
41755302 Composite temp;
41765303
....@@ -4181,7 +5308,7 @@
41815308 temp = (Composite)Applet3D.clipboard.deepCopy();
41825309 */
41835310 Object3D elem;
4184
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5311
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41855312 {
41865313 Object3D child = (Object3D)e.nextElement();
41875314
....@@ -4215,21 +5342,22 @@
42155342 //Object3D cb = Applet3D.clipboard;
42165343 //temp.addChild(cb);
42175344 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4218
- assert(GrafreeD.clipboard.parent == null);
4219
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4220
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4221
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4222
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5345
+ assert(Grafreed.clipboard.parent == null);
5346
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5347
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5348
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5349
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42235350 else
4224
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4225
- GrafreeD.clipboard.get(0).parent = keepparent;
5351
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5352
+ Grafreed.clipboard.get(0).parent = keepparent;
42265353 }
42275354
5355
+ Globals.REPLACEONMAKE = keep;
42285356 ResetModel();
42295357 refreshContents();
42305358 }
42315359
4232
- void pasteInto(boolean copyit)
5360
+ void pasteInto(boolean copyit, boolean clone)
42335361 {
42345362 // if (GrafreeD.clipboard == null)
42355363 // return;
....@@ -4258,15 +5386,22 @@
42585386 if (copyit)
42595387 {
42605388 // paste(false);
4261
- CloneClipboard(false); // sept 2014
5389
+ if (clone)
5390
+ {
5391
+ CloneClipboard(false); // sept 2014
5392
+ }
5393
+ else
5394
+ {
5395
+ paste(false);
5396
+ }
42625397 }
42635398 else
42645399 {
42655400 boolean first = true;
42665401
4267
- if (GrafreeD.clipboardIsTempGroup)
5402
+ if (Grafreed.clipboardIsTempGroup)
42685403 {
4269
- Composite temp = (Composite)GrafreeD.clipboard;
5404
+ Composite temp = (Composite)Grafreed.clipboard;
42705405 Object3D copy;
42715406 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42725407 {
....@@ -4276,7 +5411,7 @@
42765411 }
42775412 } else
42785413 {
4279
- linkSomething(GrafreeD.clipboard); //.get(0));
5414
+ linkSomething(Grafreed.clipboard); //.get(0));
42805415 }
42815416 }
42825417 }
....@@ -4353,6 +5488,10 @@
43535488
43545489 void group(Object3D csg, boolean grab)
43555490 {
5491
+ if (Globals.REPLACEONMAKE)
5492
+ Save();
5493
+ boolean keep = Globals.REPLACEONMAKE;
5494
+ Globals.REPLACEONMAKE = false;
43565495 if (//false) // why??
43575496 !group.selection.isEmpty())
43585497 {
....@@ -4466,8 +5605,34 @@
44665605 //node.add(csg);
44675606 //makeSomething(node);
44685607 makeSomething(csg);
5608
+ Globals.REPLACEONMAKE = keep;
44695609 }
44705610
5611
+ void Ungroup(Object3D g)
5612
+ {
5613
+ if (Globals.REPLACEONMAKE)
5614
+ Save();
5615
+ boolean keep = Globals.REPLACEONMAKE;
5616
+ Globals.REPLACEONMAKE = false;
5617
+ if (g instanceof HiddenObject)
5618
+ {
5619
+ HiddenObject h = (HiddenObject) g;
5620
+
5621
+ for (int i=0; i<h.ActualSize(); i++)
5622
+ {
5623
+ objEditor.makeSomething(h.get(i), false);
5624
+ }
5625
+ }
5626
+ else
5627
+ {
5628
+ for (int i=0; i<g.Size(); i++)
5629
+ {
5630
+ objEditor.makeSomething(g.get(i), false);
5631
+ }
5632
+ }
5633
+ Globals.REPLACEONMAKE = keep;
5634
+ }
5635
+
44715636 void ungroup()
44725637 {
44735638 /*
....@@ -4661,21 +5826,6 @@
46615826 }
46625827 */
46635828
4664
- void ImportGFD()
4665
- {
4666
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4667
- browser.show();
4668
- String filename = browser.getFile();
4669
- if (filename != null && filename.length() > 0)
4670
- {
4671
- String fullname = browser.getDirectory() + filename;
4672
-
4673
- //Object3D readobj =
4674
- objEditor.ReadGFD(fullname, objEditor);
4675
- //makeSomething(readobj);
4676
- }
4677
- }
4678
-
46795829 /*
46805830 public void Callback(Object obj)
46815831 {
....@@ -4699,26 +5849,9 @@
46995849 }
47005850 */
47015851
4702
- void ImportVRMLX3D()
4703
- {
4704
- if (GrafreeD.standAlone)
4705
- {
4706
- /**/
4707
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4708
- browser.show();
4709
- String filename = browser.getFile();
4710
- if (filename != null && filename.length() > 0)
4711
- {
4712
- String fullname = browser.getDirectory() + filename;
4713
- LoadVRMLX3D(fullname);
4714
- }
4715
- /**/
4716
- }
4717
- }
4718
-
47195852 String GetFile(String dialogName)
47205853 {
4721
- if (GrafreeD.standAlone)
5854
+ if (Grafreed.standAlone)
47225855 {
47235856 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47245857 browser.show();
....@@ -4782,10 +5915,49 @@
47825915 cButton flashSelectionButton;
47835916 cButton editButton;
47845917 cButton uneditButton;
5918
+ JCheckBox allParamsButton;
47855919 cButton clearpanelButton;
4786
- cButton allParamsButton;
47875920 cButton unselectButton;
47885921
5922
+ cButton restoreCameraButton;
5923
+
5924
+ cButton saveButton;
5925
+ cButton oneStepButton;
5926
+
5927
+ cButton groupButton;
5928
+ cButton ungroupButton;
5929
+ cButton compositeButton;
5930
+ cButton switchButton;
5931
+ cButton loopButton;
5932
+ cButton textureButton;
5933
+
5934
+ cButton skybox1Button;
5935
+ cButton skybox2Button;
5936
+ cButton skybox3Button;
5937
+ cButton skybox4Button;
5938
+ cButton skybox5Button;
5939
+ cButton skybox6Button;
5940
+ cButton skybox7Button;
5941
+
5942
+ cButton skybox11Button;
5943
+ cButton skybox12Button;
5944
+ cButton skybox13Button;
5945
+ cButton skybox14Button;
5946
+ cButton skybox15Button;
5947
+ cButton skybox16Button;
5948
+ cButton skybox17Button;
5949
+
5950
+ cButton gridButton;
5951
+ cButton boxButton;
5952
+ cButton sphereButton;
5953
+ cButton coneButton;
5954
+ cButton torusButton;
5955
+ cButton superButton;
5956
+ cButton kleinButton;
5957
+ cButton particlesButton;
5958
+ cButton overlayButton;
5959
+ cButton lightButton;
5960
+
47895961 cButton screenfitButton;
47905962 cButton screenfitpointButton;
47915963 cButton snapobjectButton;
....@@ -4797,14 +5969,6 @@
47975969
47985970 cButton setsupportButton;
47995971
4800
- cButton twoButton;
4801
- cButton sixButton;
4802
- cButton threeButton;
4803
- cButton sevenButton;
4804
- cButton fourButton; // full panel
4805
- cButton oneButton; // full XYZ
4806
- //cButton currentLayout;
4807
-
48085972 //
48095973 //Composite
48105974 Object3D // to do !!
....@@ -4814,9 +5978,11 @@
48145978 //JTree jTree;
48155979 private MenuItem lookAtItem;
48165980 private MenuItem lookFromItem;
4817
- private MenuItem switchItem;
5981
+ private MenuItem switchViewItem;
48185982 private MenuItem cutItem;
4819
- private MenuItem duplicateItem;
5983
+ private MenuItem undoItem;
5984
+ private MenuItem redoItem;
5985
+ private JMenuItem duplicateItem;
48205986 private MenuItem cloneItem;
48215987 private MenuItem cloneSupportItem;
48225988 private MenuItem overwriteGeoItem;
....@@ -4827,8 +5993,9 @@
48275993 private MenuItem resetsupportItem;
48285994 private MenuItem resetreferencesItem;
48295995 private MenuItem linkverticesItem;
5996
+ private MenuItem relinkverticesItem;
48305997 private MenuItem setMasterItem;
4831
- private MenuItem resetMeshItem;
5998
+ private MenuItem resetAllItem;
48325999 private MenuItem stepAllItem;
48336000 private MenuItem revertMeshItem;
48346001 private MenuItem poseMeshItem;
....@@ -4839,14 +6006,17 @@
48396006 private MenuItem mergeGeometriesItem;
48406007 private MenuItem copyItem;
48416008 private MenuItem pasteItem;
6009
+ private MenuItem pasteIntoItem;
48426010 private MenuItem pasteLinkItem;
48436011 private MenuItem pasteCloneItem;
48446012 private MenuItem pasteExpandItem;
4845
- private MenuItem clearItem;
6013
+ private MenuItem deleteItem;
48466014 private MenuItem clearAllItem;
48476015 private MenuItem genUVItem;
6016
+ private MenuItem genNormalsMESHItem;
48486017 private MenuItem genNormalsCADItem;
48496018 private MenuItem genNormalsORGANItem;
6019
+ private MenuItem genNormalsMINEItem;
48506020 private MenuItem stripifyItem;
48516021 private MenuItem unstripifyItem;
48526022 private MenuItem trimItem;
....@@ -4875,6 +6045,10 @@
48756045 private MenuItem showleavesItem;
48766046 private MenuItem markleavesItem;
48776047 private MenuItem unmarkleavesItem;
6048
+ private MenuItem rewindleavesItem;
6049
+ private MenuItem unrewindleavesItem;
6050
+ private MenuItem randomleavesItem;
6051
+ private MenuItem unrandomleavesItem;
48786052
48796053 private MenuItem flipVItem;
48806054 private MenuItem unflipVItem;
....@@ -4886,14 +6060,17 @@
48866060 private MenuItem panoTexturesItem;
48876061
48886062 private MenuItem resetCentroidItem;
4889
- private MenuItem transformgeometryItem;
6063
+ private MenuItem resetCentroidXZItem;
48906064 private MenuItem resetTransformItem;
6065
+ private MenuItem transformGeometryItem;
6066
+ private MenuItem transformChildrenItem;
6067
+ private MenuItem hideItem;
48916068 private MenuItem grabItem;
48926069 private MenuItem backItem;
48936070 private MenuItem frontItem;
48946071 private MenuItem cameraItem;
48956072 private MenuItem compositeItem;
4896
- private MenuItem randomItem;
6073
+ private MenuItem switchItem;
48976074 private MenuItem physicsItem;
48986075 private MenuItem frameselectorItem;
48996076 private MenuItem scriptNodeItem;
....@@ -4908,6 +6085,7 @@
49086085
49096086 private MenuItem resetParentItem;
49106087 private MenuItem repairParentItem;
6088
+ private MenuItem repairShadowItem;
49116089 private MenuItem sortbysizeItem;
49126090 private MenuItem sortbynameItem;
49136091
....@@ -4916,6 +6094,8 @@
49166094 private MenuItem attachBumpItem;
49176095 private MenuItem detachBumpItem;
49186096 private MenuItem pigmentBumpItem;
6097
+ private MenuItem embedTexturesItem;
6098
+ private MenuItem deEmbedTexturesItem;
49196099
49206100 private MenuItem particleItem;
49216101 private MenuItem ragdollItem;
....@@ -4928,10 +6108,11 @@
49286108 private MenuItem coneItem;
49296109 private MenuItem torusItem;
49306110 private MenuItem superItem;
6111
+ private MenuItem kleinItem;
49316112 private MenuItem blobItem;
49326113 private MenuItem latheItem;
49336114 private MenuItem bezierItem;
4934
- private MenuItem checkerItem;
6115
+ private MenuItem overlayItem;
49356116 private MenuItem meshItem;
49366117 // private MenuItem meshGroupItem;
49376118 private MenuItem springItem;
....@@ -4940,6 +6121,7 @@
49406121 private MenuItem csgItem;
49416122 private MenuItem templateItem;
49426123 private MenuItem textureItem;
6124
+ private MenuItem billboardItem;
49436125 private MenuItem shadowXItem;
49446126 private MenuItem shadowYItem;
49456127 private MenuItem shadowZItem;
....@@ -4952,11 +6134,6 @@
49526134 private MenuItem doubleItem;
49536135 private MenuItem tripleItem;
49546136
4955
- private MenuItem importGFDItem;
4956
- private MenuItem importVRMLX3DItem;
4957
- private MenuItem import3DSItem;
4958
- private MenuItem importOBJItem;
4959
-
49606137 private MenuItem computeAOItem;
49616138 private MenuItem recompileItem;
49626139 private MenuItem editScriptItem;
....@@ -4966,4 +6143,8 @@
49666143 private MenuItem analyzeItem;
49676144 private MenuItem dumpItem;
49686145 //boolean freezemodel = false;
6146
+
6147
+ Menu cameraMenu;
6148
+ MenuItem editCameraItem;
6149
+ MenuItem restoreCameraItem;
49696150 }