Normand Briere
2019-07-30 475f8cbdbd96fdbf8f5b216ffebb31a51f25c2f9
GroupEditor.java
....@@ -12,6 +12,7 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
....@@ -22,6 +23,240 @@
2223 DragGestureListener, DragSourceListener, DropTargetListener,
2324 ItemListener // ListSelectionListener
2425 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
+ skyboxButton.setToolTipText(s);
34
+ skyboxButton.addActionListener(new ActionListener()
35
+ {
36
+ @Override
37
+ public void actionPerformed(ActionEvent e)
38
+ {
39
+ ChangeSkybox(path);
40
+ }
41
+ });
42
+ }
43
+
44
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
45
+ {
46
+ cGridBag tab0 = new cGridBag().setVertical(true);
47
+
48
+ tab0.setName("Urban");
49
+ skyboxpanel.add(tab0);
50
+
51
+ cGridBag row0 = new cGridBag();
52
+ cGridBag row1 = new cGridBag();
53
+ cGridBag row2 = new cGridBag();
54
+ cGridBag row3 = new cGridBag();
55
+ cGridBag row4 = new cGridBag();
56
+ cGridBag row5 = new cGridBag();
57
+ cGridBag row6 = new cGridBag();
58
+
59
+ AddSkyboxButton("default", "rgb", row0);
60
+ //AddSkyboxButton("default", "cornell", row0);
61
+ AddSkyboxButton("penguins", "dust", row0);
62
+ AddSkyboxButton("penguins", "tropic", row0);
63
+ AddSkyboxButton("default", "skycube", row0);
64
+
65
+ AddSkyboxButton("default", "uffizi", row1);
66
+ AddSkyboxButton("bridge", "Bridge", row1);
67
+ AddSkyboxButton("bridge", "Bridge2", row1);
68
+ AddSkyboxButton("urban", "GamlaStan2", row1);
69
+
70
+ AddSkyboxButton("urban", "Parliament", row2);
71
+ AddSkyboxButton("urban", "Roundabout", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
74
+
75
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
76
+ AddSkyboxButton("urban", "UnionSquare", row3);
77
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
78
+ AddSkyboxButton("park", "BerzeliiPark", row3);
79
+
80
+ AddSkyboxButton("park", "Buddha", row4);
81
+ AddSkyboxButton("park", "CNTower2", row4);
82
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
84
+
85
+ AddSkyboxButton("park", "Park", row5);
86
+ AddSkyboxButton("park", "Pond", row5);
87
+ AddSkyboxButton("park", "Skansen", row5);
88
+ AddSkyboxButton("park", "Skansen2", row5);
89
+
90
+ AddSkyboxButton("park", "Skansen3", row6);
91
+ AddSkyboxButton("park", "Skansen4", row6);
92
+ AddSkyboxButton("park", "Skansen5", row6);
93
+ AddSkyboxButton("park", "Stairs", row6);
94
+
95
+ tab0.add(row0);
96
+ tab0.add(row1);
97
+ tab0.add(row2);
98
+ tab0.add(row3);
99
+ tab0.add(row4);
100
+ tab0.add(row5);
101
+ tab0.add(row6);
102
+
103
+ for (int i=5; --i>=0;)
104
+ {
105
+ //oe.toolboxPanel.Return();
106
+ //tab0.add(new cGridBag());
107
+ }
108
+ }
109
+
110
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
111
+ {
112
+ cGridBag tab0 = new cGridBag().setVertical(true);
113
+
114
+ tab0.setName("Nature");
115
+ skyboxpanel.add(tab0);
116
+
117
+ cGridBag row0 = new cGridBag();
118
+ cGridBag row1 = new cGridBag();
119
+ cGridBag row2 = new cGridBag();
120
+ cGridBag row3 = new cGridBag();
121
+ cGridBag row4 = new cGridBag();
122
+ cGridBag row5 = new cGridBag();
123
+ cGridBag row6 = new cGridBag();
124
+
125
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
126
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
127
+ AddSkyboxButton("beach", "PalmTrees", row0);
128
+ AddSkyboxButton("beach", "Tenerife", row0);
129
+
130
+ AddSkyboxButton("beach", "Tenerife2", row1);
131
+ AddSkyboxButton("beach", "Tenerife3", row1);
132
+ AddSkyboxButton("field", "FishPond", row1);
133
+ AddSkyboxButton("field", "Footballfield", row1);
134
+
135
+ AddSkyboxButton("field", "Meadow", row2);
136
+ AddSkyboxButton("field", "Sorsele", row2);
137
+ AddSkyboxButton("field", "Sorsele2", row2);
138
+ AddSkyboxButton("field", "Sorsele3", row2);
139
+
140
+ AddSkyboxButton("forest", "Brudslojan", row3);
141
+ AddSkyboxButton("forest", "Langholmen2", row3);
142
+ AddSkyboxButton("forest", "Plants", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive", row3);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
146
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
147
+ AddSkyboxButton("mountain", "Ryfjallet", row4);
148
+ AddSkyboxButton("mountain", "Teide", row4);
149
+ AddSkyboxButton("park", "Tantolunden4", row4);
150
+
151
+ AddSkyboxButton("penguins", "wrath", row5);
152
+ AddSkyboxButton("penguins", "yonder", row5);
153
+ AddSkyboxButton("rocky", "Langholmen", row5);
154
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
155
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
156
+
157
+ AddSkyboxButton("default", "CloudyHills", row6);
158
+ AddSkyboxButton("daz", "Autumn", row6);
159
+ AddSkyboxButton("daz", "Greenlands", row6);
160
+ AddSkyboxButton("daz", "MountainTrail", row6);
161
+ AddSkyboxButton("daz", "Oasis", row6);
162
+ /*
163
+Autumn
164
+Greenlands
165
+MountainTrail
166
+Oasis
167
+TheRock
168
+TopOfTheWorld
169
+Winter
170
+ */
171
+
172
+ tab0.add(row0);
173
+ tab0.add(row1);
174
+ tab0.add(row2);
175
+ tab0.add(row3);
176
+ tab0.add(row4);
177
+ tab0.add(row5);
178
+ tab0.add(row6);
179
+
180
+ for (int i=5; --i>=0;)
181
+ {
182
+ //oe.toolboxPanel.Return();
183
+ //tab0.add(new cGridBag());
184
+ }
185
+ }
186
+
187
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
188
+ {
189
+ cGridBag tab0 = new cGridBag().setVertical(true);
190
+
191
+ tab0.setName("Night");
192
+ skyboxpanel.add(tab0);
193
+
194
+ cGridBag row0 = new cGridBag();
195
+ cGridBag row1 = new cGridBag();
196
+ cGridBag row2 = new cGridBag();
197
+ cGridBag row3 = new cGridBag();
198
+ cGridBag row4 = new cGridBag();
199
+ cGridBag row5 = new cGridBag();
200
+ cGridBag row6 = new cGridBag();
201
+
202
+ AddSkyboxButton("night", "NightPath", row0);
203
+ AddSkyboxButton("night", "PondNight", row0);
204
+ AddSkyboxButton("night", "Powerlines", row0);
205
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
206
+
207
+ AddSkyboxButton("urban", "CNTower", row1);
208
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
209
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
210
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
211
+
212
+ AddSkyboxButton("penguins", "kenon_star", row2);
213
+ AddSkyboxButton("indoors", "DallasW", row2);
214
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row2);
215
+ AddSkyboxButton("indoors", "Vasa", row2);
216
+
217
+ AddSkyboxButton("winter", "Backyard", row3);
218
+ AddSkyboxButton("winter", "Creek", row3);
219
+ AddSkyboxButton("winter", "FootballField3", row3);
220
+ AddSkyboxButton("winter", "Forest", row3);
221
+
222
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
223
+ AddSkyboxButton("winter", "House", row4);
224
+ AddSkyboxButton("winter", "IceLake", row4);
225
+ AddSkyboxButton("winter", "IceRiver", row4);
226
+
227
+ AddSkyboxButton("winter", "Park3", row5);
228
+ AddSkyboxButton("winter", "PondWinter", row5);
229
+ AddSkyboxButton("winter", "Tantolunden5", row5);
230
+ AddSkyboxButton("winter", "Vindelalven", row5);
231
+
232
+ AddSkyboxButton("daz", "TheRock", row6);
233
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
234
+ AddSkyboxButton("daz", "Winter", row6);
235
+ AddSkyboxButton("penguins", "desertdawn", row6);
236
+
237
+ tab0.add(row0);
238
+ tab0.add(row1);
239
+ tab0.add(row2);
240
+ tab0.add(row3);
241
+ tab0.add(row4);
242
+ tab0.add(row5);
243
+ tab0.add(row6);
244
+
245
+ for (int i=5; --i>=0;)
246
+ {
247
+ //oe.toolboxPanel.Return();
248
+ //tab0.add(new cGridBag());
249
+ }
250
+ }
251
+
252
+ public void ChangeSkybox(String name)
253
+ {
254
+ //cameraView.envyoff = false;
255
+ group.skyboxname = name;
256
+ group.skyboxext = "jpg";
257
+ cameraView.repaint();
258
+ }
259
+
25260 //ObjEditor objEditor;
26261 public void closeUI2()
27262 {
....@@ -59,6 +294,12 @@
59294 this.copy = this.group = group;
60295 //selectees = this.group.selectees;
61296
297
+ if (copy.versions == null)
298
+ {
299
+ copy.versions = new byte[100][];
300
+ copy.versionindex = -1;
301
+ }
302
+
62303 if(ui)
63304 SetupUI(objEditor);
64305 }
....@@ -73,16 +314,28 @@
73314 this.copy = this.group = copy;
74315 //selectees = this.group.selectees;
75316
76
- SetupMenu2(objEditor);
317
+ SetupMenu2(this); //objEditor);
77318 SetupUI2(objEditor);
78319 objEditor.SetupUI(true);
79320 SetupViews(objEditor);
80321
81322 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
323
+
324
+ if (copy.versions == null)
325
+ {
326
+ copy.versions = new byte[100][];
327
+ copy.versionindex = -1;
328
+
329
+ Save(true);
330
+ }
82331 }
83332
84333 void CloneSelection(boolean supports)
85334 {
335
+ if (Globals.REPLACEONMAKE)
336
+ Save();
337
+ boolean keep = Globals.REPLACEONMAKE;
338
+ Globals.REPLACEONMAKE = false;
86339 // Object3D keep = GrafreeD.clipboard;
87340 //Object3D obj;
88341 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +346,19 @@
93346
94347 makeSomething(clone, i==group.selection.size()-1);
95348 }
349
+ Globals.REPLACEONMAKE = keep;
96350 }
97351
98352 void CloneClipboard(boolean supports)
99353 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
354
+ assert(Grafreed.clipboard.parent == null);
355
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
356
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
357
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
358
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105359 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
360
+ makeSomething(CloneObject(Grafreed.clipboard, false));
361
+ Grafreed.clipboard.get(0).parent = keepparent;
108362 }
109363
110364 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +372,7 @@
118372 // obj.support = null;
119373 if (!supports)
120374 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
375
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122376 obj.parent = parent;
123377 // obj.support = support;
124378 // clone.support = support; // aout 2013
....@@ -147,30 +401,29 @@
147401
148402 //JTextField nameField;
149403
150
- void SetupMenu2(ObjEditor oe)
404
+ void SetupMenu2(GroupEditor oe)
151405 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
406
+ oe.jTree = new cTree();
407
+
163408 Menu menu;
164409 oe.menuBar.add(menu = new Menu("Edit"));
165410 //editItem = menu.add(new MenuItem("Edit"));
166411 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
412
+
413
+// undoItem = menu.add(new MenuItem("Undo"));
414
+// undoItem.addActionListener(this);
415
+// redoItem = menu.add(new MenuItem("Redo"));
416
+// redoItem.addActionListener(this);
417
+// menu.add("-");
418
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168419 duplicateItem.addActionListener(this);
169
- menu.add("-");
170420 cloneItem = menu.add(new MenuItem("Clone"));
171421 cloneItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
172424 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173425 cloneSupportItem.addActionListener(this);
426
+ }
174427 menu.add("-");
175428 cutItem = menu.add(new MenuItem("Cut"));
176429 cutItem.addActionListener(this);
....@@ -178,27 +431,123 @@
178431 copyItem.addActionListener(this);
179432 pasteItem = menu.add(new MenuItem("Paste"));
180433 pasteItem.addActionListener(this);
434
+
435
+ menu.add("-");
436
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
437
+ pasteIntoItem.addActionListener(this);
181438 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182439 pasteLinkItem.addActionListener(this);
183440 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184441 pasteCloneItem.addActionListener(this);
185442 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186443 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
444
+ menu.add("-");
445
+ deleteItem = menu.add(new MenuItem("Delete"));
446
+ deleteItem.addActionListener(this);
447
+
448
+ if (Globals.ADVANCED)
449
+ {
450
+ // Deletes the cameras...
189451 clearAllItem = menu.add(new MenuItem("Clear All"));
190452 clearAllItem.addActionListener(this);
453
+ }
454
+
455
+ menuBar.add(cameraMenu = new Menu("View"));
456
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
457
+ //zBufferItem.addActionListener(this);
458
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
459
+ //normalLensItem.addActionListener(this);
460
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
461
+ restoreCameraItem.addActionListener(this);
462
+
463
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
464
+// toggleFullScreenItem.addItemListener(this);
465
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
466
+// cameraMenu.add("-");
467
+//
468
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
469
+// toggleTextureItem.addItemListener(this);
470
+// toggleTextureItem.setState(CameraPane.textureon);
471
+//
472
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
473
+// toggleSwitchItem.addItemListener(this);
474
+// toggleSwitchItem.setState(CameraPane.SWITCH);
475
+
476
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
477
+ toggleHandleItem.addItemListener(this);
478
+ toggleHandleItem.setState(CameraPane.HANDLES);
479
+
480
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
481
+ togglePaintItem.addItemListener(this);
482
+ togglePaintItem.setState(CameraPane.PAINTMODE);
483
+
484
+ if (Globals.ADVANCED)
485
+ {
486
+ cameraMenu.add("-");
487
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
488
+ toggleLiveItem.addItemListener(this);
489
+ toggleLiveItem.setState(Globals.isLIVE());
191490
491
+ cameraMenu.add(stepItem = new MenuItem("Step"));
492
+ stepItem.addActionListener(this);
493
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
494
+ // toggleDLItem.addItemListener(this);
495
+ // toggleDLItem.setState(false);
496
+
497
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
498
+ toggleRenderItem.addItemListener(this);
499
+ toggleRenderItem.setState(!CameraPane.frozen);
500
+
501
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
502
+ toggleDebugItem.addItemListener(this);
503
+ toggleDebugItem.setState(Globals.DEBUG);
504
+
505
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
506
+ toggleFrustumItem.addItemListener(this);
507
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
508
+
509
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
510
+ toggleFootContactItem.addItemListener(this);
511
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
512
+
513
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
514
+ toggleTimelineItem.addItemListener(this);
515
+ }
516
+
517
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
518
+// toggleRootItem.addItemListener(this);
519
+// toggleRootItem.setState(false);
520
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
521
+// animationItem.addItemListener(this);
522
+// animationItem.setState(CameraPane.ANIMATION);
523
+ cameraMenu.add("-");
524
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
525
+ editCameraItem.addActionListener(this);
526
+
527
+ if (Globals.ADVANCED)
528
+ {
529
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
530
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
531
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
532
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
533
+ oe.cameraMenu.add("-");
534
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
535
+ openWindowItem.addActionListener(this);
536
+ editLeafItem.addActionListener(this);
537
+ lookAtItem.addActionListener(this);
538
+ //lookFromItem.addActinoListener(this);
539
+ //switchViewItem.addActionListener(this);
540
+ }
541
+
192542 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
543
+ if (Globals.ADVANCED)
544
+ {
197545 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198546 revertMeshItem.addActionListener(this);
199547 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200548 resetreferencesItem.addActionListener(this);
201549 menu.add("-");
550
+ }
202551 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203552 overwriteGeoItem.addActionListener(this);
204553 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,79 +559,104 @@
210559 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211560 overwriteUVItem.addActionListener(this);
212561 menu.add("-");
562
+ if (Globals.ADVANCED)
563
+ {
213564 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214565 generateMeshItem.addActionListener(this);
215566 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216567 poseMeshItem.addActionListener(this);
217568 menu.add("-");
569
+ }
218570 resetsupportItem = menu.add(new MenuItem("Reset support"));
219571 resetsupportItem.addActionListener(this);
220572 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221573 linkverticesItem.addActionListener(this);
222574 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223575 relinkverticesItem.addActionListener(this);
576
+
577
+ if (Globals.ADVANCED)
578
+ {
224579 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225580 setMasterItem.addActionListener(this);
581
+ }
226582
227583 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
584
+// grabItem = menu.add(new MenuItem("Grab"));
585
+// grabItem.addActionListener(this);
230586 backItem = menu.add(new MenuItem("Back"));
231587 backItem.addActionListener(this);
232588 frontItem = menu.add(new MenuItem("Front"));
233589 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
590
+// compositeItem = menu.add(new MenuItem("Composite"));
591
+// compositeItem.addActionListener(this);
592
+
593
+ if (Globals.ADVANCED)
594
+ {
595
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237596 hideItem.addActionListener(this);
597
+ }
238598 ungroupItem = menu.add(new MenuItem("Ungroup"));
239599 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
600
+
601
+// menu.add("-");
602
+//
603
+// switchItem = menu.add(new MenuItem("Switch node"));
604
+// switchItem.addActionListener(this);
605
+ if (Globals.ADVANCED)
606
+ {
247607 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248608 switchGeoItem.addActionListener(this);
249609 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250610 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
611
+ morphItem = menu.add(new MenuItem("Morph Group"));
252612 morphItem.addActionListener(this);
613
+
614
+ menu.add("-");
615
+ physicsItem = menu.add(new MenuItem("Physics"));
616
+ physicsItem.addActionListener(this);
617
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
618
+ frameselectorItem.addActionListener(this);
253619 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254620 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
621
+ }
257622
258623 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
624
+// textureItem = menu.add(new MenuItem("Texture"));
625
+// textureItem.addActionListener(this);
261626 billboardItem = menu.add(new MenuItem("Billboard"));
262627 billboardItem.addActionListener(this);
263628 csgItem = menu.add(new MenuItem("CSG"));
264629 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
630
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266631 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
632
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268633 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
634
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270635 shadowZItem.addActionListener(this);
636
+ attributeItem = menu.add(new MenuItem("Attribute"));
637
+ attributeItem.addActionListener(this);
638
+
639
+ if (Globals.ADVANCED)
640
+ {
641
+ menu.add("-");
271642 linkerItem = menu.add(new MenuItem("Linker"));
272643 linkerItem.addActionListener(this);
273644 templateItem = menu.add(new MenuItem("Template"));
274645 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277646 pointflowItem = menu.add(new MenuItem("Point Flow"));
278647 pointflowItem.addActionListener(this);
648
+ }
279649 menu.add("-");
280650 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281651 resetTransformItem.addActionListener(this);
282652 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283653 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.addActionListener(this);
654
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
655
+ resetCentroidXZItem.addActionListener(this);
656
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
657
+ transformGeometryItem.addActionListener(this);
658
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
659
+ transformChildrenItem.addActionListener(this);
286660
287661 oe.menuBar.add(menu = new Menu("Geometry"));
288662 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +667,11 @@
293667 genNormalsCADItem.addActionListener(this);
294668 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295669 genNormalsMESHItem.addActionListener(this);
296
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
670
+ if (Globals.ADVANCED)
671
+ {
672
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
297673 genNormalsMINEItem.addActionListener(this);
674
+ }
298675 stripifyItem = menu.add(new MenuItem("Stripify"));
299676 stripifyItem.addActionListener(this);
300677 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +693,34 @@
316693 reduce34MeshItem.addActionListener(this);
317694 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318695 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321696 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322697 clipMeshItem.addActionListener(this);
698
+
699
+ if (Globals.ADVANCED)
700
+ {
701
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
702
+ smoothMeshItem.addActionListener(this);
703
+ }
323704
324705 oe.menuBar.add(menu = new Menu("Attributes"));
325706 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326707 clearMaterialsItem.addActionListener(this);
708
+ resetAllItem = menu.add(new MenuItem("Reset All"));
709
+ resetAllItem.addActionListener(this);
710
+ stepAllItem = menu.add(new MenuItem("Step All"));
711
+ stepAllItem.addActionListener(this);
327712 menu.add("-");
328713 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329714 liveleavesItem.addActionListener(this);
330715 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331716 unliveleavesItem.addActionListener(this);
717
+ if (Globals.ADVANCED)
718
+ {
332719 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333720 supportleavesItem.addActionListener(this);
334721 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335722 unsupportleavesItem.addActionListener(this);
723
+ }
336724 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337725 hideleavesItem.addActionListener(this);
338726 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +729,14 @@
341729 markleavesItem.addActionListener(this);
342730 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343731 unmarkleavesItem.addActionListener(this);
732
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
733
+ rewindleavesItem.addActionListener(this);
734
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
735
+ unrewindleavesItem.addActionListener(this);
736
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
737
+ randomleavesItem.addActionListener(this);
738
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
739
+ unrandomleavesItem.addActionListener(this);
344740 menu.add("-");
345741 flipVItem = menu.add(new MenuItem("Flip V"));
346742 flipVItem.addActionListener(this);
....@@ -366,45 +762,56 @@
366762 attachBumpItem.addActionListener(this);
367763 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
368764 pigmentBumpItem.addActionListener(this);
765
+ //embedTexturesItem
369766 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
370767 detachPigmentItem.addActionListener(this);
371768 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
372769 detachBumpItem.addActionListener(this);
770
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
771
+ embedTexturesItem.addActionListener(this);
772
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
773
+ deEmbedTexturesItem.addActionListener(this);
373774 menu.add("-");
374775 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
375776 sortbysizeItem.addActionListener(this);
376777 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377778 sortbynameItem.addActionListener(this);
378779 menu.add("-");
780
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
781
+ shareGeometriesItem.addActionListener(this);
782
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
783
+ mergeGeometriesItem.addActionListener(this);
784
+ if (Globals.ADVANCED)
785
+ {
786
+ // Pretty much the same as duplicate and clone.
379787 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380788 extractGeometriesItem.addActionListener(this);
381789 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382790 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
791
+ }
387792
388793 oe.menuBar.add(menu = new Menu("Insert"));
389794 buildCreateMenu(menu);
390795
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402796 oe.menuBar.add(menu = new Menu("Tools"));
403797 buildToolsMenu(menu);
404798 }
405799
800
+
406801 void SetupUI2(ObjEditor oe)
407802 {
803
+ // June 2019
804
+ if (oe == null)
805
+ {
806
+ //super.SetupUI2(this);
807
+ //return;
808
+ }
809
+
810
+ if (copy != group)
811
+ {
812
+ //super.SetupUI2(this);
813
+ }
814
+
408815 //new Exception().printStackTrace();
409816
410817 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,153 +840,238 @@
433840 oe.radioPanel.add(dummyButton);
434841 oe.buttonGroup.add(dummyButton);
435842 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
843
+ cGridBag copyOptionsPanel = new cGridBag();
844
+
845
+ copyOptionsPanel.preferredHeight = 2;
439846
440
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
847
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
848
+
849
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
850
+ //minButton.setToolTipText("Minimize window");
851
+ //minButton.addActionListener(this);
852
+
853
+ if (Globals.ADVANCED)
854
+ {
855
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
856
+ maxButton.setToolTipText("Maximize window");
857
+ maxButton.addActionListener(this);
858
+ }
859
+
860
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
861
+ fullButton.setToolTipText("Full-screen window");
862
+ fullButton.addActionListener(this);
863
+
864
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
865
+ screenfitButton.setToolTipText("Screen fit");
866
+ screenfitButton.addActionListener(this);
867
+
868
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
869
+ restoreCameraButton.setToolTipText("Restore viewpoint");
870
+ restoreCameraButton.addActionListener(this);
871
+
872
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
873
+ saveButton.setToolTipText("New version");
874
+ saveButton.addActionListener(this);
875
+
876
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
877
+ undoButton.setToolTipText("Previous version");
878
+ undoButton.addActionListener(this);
879
+ undoButton.setEnabled(false);
880
+
881
+ cGridBag updown = new cGridBag().setVertical(true);
882
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
883
+ restoreButton.setToolTipText("Restore current");
884
+ restoreButton.addActionListener(this);
885
+ restoreButton.setEnabled(false);
886
+
887
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
888
+ replaceButton.setToolTipText("Replace current");
889
+ replaceButton.addActionListener(this);
890
+ replaceButton.setEnabled(false);
891
+
892
+ copyOptionsPanel.add(updown);
893
+
894
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
895
+ redoButton.setToolTipText("Next version");
896
+ redoButton.addActionListener(this);
897
+ redoButton.setEnabled(false);
898
+
899
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
900
+ liveCB.setToolTipText("Enable animation");
441901 liveCB.addItemListener(this);
442902
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
445
- supportCB.addItemListener(this);
446
-
447
- // oe.aConstraints.gridx += 1;
448
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
449
- // localCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
453
- crowdCB.addItemListener(this);
454
-
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
457
- smoothCB.addItemListener(this);
458
-
459
- oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
903
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
904
+ oneStepButton.setToolTipText("Animate one step forward");
905
+ oneStepButton.addActionListener(this);
906
+
907
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
908
+ fastCB.setToolTipText("Fast mode");
461909 fastCB.addItemListener(this);
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
464
- slowCB.addItemListener(this);
465
- oe.aConstraints.gridx += 1;
466
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
467
- boxCB.addItemListener(this);
910
+
911
+ //oe.toolboxPanel.Return();
912
+
913
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
914
+// trackCB.setToolTipText("Enable tracking");
915
+// trackCB.addItemListener(this);
468916
469
-// oe.aConstraints.gridx += 1;
470
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
471
-// speakerMocapCB.addItemListener(this);
472
-
473
- if (false)
474
- {
475
- // handled in scripts
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
478
- speakerCameraCB.addItemListener(this);
479
-
480
- oe.aConstraints.gridx += 1;
481
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
482
- speakerFocusCB.addItemListener(this);
483
-
484
- oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
486
- smoothfocusCB.addItemListener(this);
487
- }
488
-
489
-//oe.aConstraints.gridx += 1;
490
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
491
-// debugCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
495
- oeilCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
499
- lookAtCB.addItemListener(this);
500
-
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
503
- trackCB.addItemListener(this);
504
-
505
- oe.aConstraints.gridx += 1;
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
507
- screenfitButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509917 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
510918 // screenfitpointButton.addActionListener(this);
511
-// oe.aConstraints.gridx += 1;
512
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
513
- snapobjectButton.addActionListener(this);
514
- oe.aConstraints.gridx += 1;
515919
516
- //aConstraints.gridx = 0;
517
- //aConstraints.gridy += 1;
518
- oe.aConstraints.weighty = 0;
519
- oe.aConstraints.gridwidth = 1;
520
-
521
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
522
- flashSelectionButton.addActionListener(this);
523
-
524
- oe.toolbarPanel.add(new cButton(" ", false));
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- //
531
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
532
- twoButton.addActionListener(this);
533
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
920
+ if (Globals.ADVANCED)
921
+ {
922
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
923
+ snapobjectButton.addActionListener(this);
924
+ snapobjectButton.setToolTipText("Snap Object");
925
+
926
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
534927 fourButton.addActionListener(this);
535
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
536
- sixButton.addActionListener(this);
537
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
928
+ fourButton.setToolTipText("Show control panel only");
929
+ }
930
+
931
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
932
+
933
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
934
+ twoButton.setToolTipText("Show 3D view only");
935
+ twoButton.addActionListener(this);
936
+ this.fullscreenLayout = twoButton;
937
+
938
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ threeButton.setToolTipText("Show controls and 3D view");
538940 threeButton.addActionListener(this);
539
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
540
- sevenButton.addActionListener(this);
941
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
+ sixButton.setToolTipText("Show 3D view and controls");
943
+ sixButton.addActionListener(this);
944
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
+// sevenButton.setToolTipText("3-column layout");
946
+// sevenButton.addActionListener(this);
541947 //
542948
543
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
949
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ rootButton.setToolTipText("Open selection in new tab");
544951 rootButton.addActionListener(this);
545
- oe.aConstraints.gridx += 1;
546
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
952
+
953
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
954
+ closeButton.setToolTipText("Close tab");
547955 closeButton.addActionListener(this);
548956 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
549957 //clearButton.addActionListener(this);
550
- oe.aConstraints.gridx += 1;
551
-
552
- oe.aConstraints.gridx = 1; //
553
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
554
- editButton.addActionListener(this);
555
- oe.aConstraints.gridx += 1;
556
- oe.aConstraints.weighty = 0;
557
- oe.aConstraints.gridwidth = 1;
558958
559
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
959
+ cGridBag row1 = new cGridBag();
960
+
961
+ // INSERT
962
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
963
+ gridButton.setToolTipText("Create grid");
964
+ gridButton.addActionListener(this);
965
+
966
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
967
+ boxButton.setToolTipText("Create box");
968
+ boxButton.addActionListener(this);
969
+
970
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
971
+ sphereButton.setToolTipText("Create sphere");
972
+ sphereButton.addActionListener(this);
973
+
974
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
975
+ coneButton.setToolTipText("Create cone");
976
+ coneButton.addActionListener(this);
977
+
978
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
979
+ torusButton.setToolTipText("Create torus");
980
+ torusButton.addActionListener(this);
981
+
982
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
983
+ superButton.setToolTipText("Create superellipsoid");
984
+ superButton.addActionListener(this);
985
+
986
+ if (Globals.ADVANCED)
987
+ {
988
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
989
+ kleinButton.setToolTipText("Create Klein bottle");
990
+ kleinButton.addActionListener(this);
991
+ }
992
+
993
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
994
+ particlesButton.setToolTipText("Create particle system");
995
+ particlesButton.addActionListener(this);
996
+
997
+ oe.toolboxPanel.add(row1);
998
+
999
+ cGridBag row2 = new cGridBag();
1000
+
1001
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1002
+ groupButton.setToolTipText("Create group");
1003
+ groupButton.addActionListener(this);
1004
+
1005
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1006
+ compositeButton.setToolTipText("Create composite");
1007
+ compositeButton.addActionListener(this);
1008
+
1009
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1010
+ switchButton.setToolTipText("Create item switcher");
1011
+ switchButton.addActionListener(this);
1012
+
1013
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1014
+ loopButton.setToolTipText("Create loop");
1015
+ loopButton.addActionListener(this);
1016
+
1017
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ textureButton.setToolTipText("Create texture");
1019
+ textureButton.addActionListener(this);
1020
+
1021
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1022
+ overlayButton.setToolTipText("Create overlay");
1023
+ overlayButton.addActionListener(this);
1024
+
1025
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1026
+ lightButton.setToolTipText("Create light");
1027
+ lightButton.addActionListener(this);
1028
+
1029
+ oe.toolboxPanel.add(row2);
1030
+
1031
+ // ENVYMAPS
1032
+ cGridBag skyboxpane = new cGridBag();
1033
+ skyboxpane.preferredHeight = 100;
1034
+
1035
+ oe.toolboxPanel.add(skyboxpane);
1036
+
1037
+ JTabbedPane skyboxpanel = new JTabbedPane();
1038
+ skyboxpane.add(skyboxpanel);
1039
+
1040
+ AddSkyboxTab0(skyboxpanel);
1041
+ AddSkyboxTab1(skyboxpanel);
1042
+ AddSkyboxTab2(skyboxpanel);
1043
+
1044
+ // EDIT panel
1045
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1046
+ editButton.setToolTipText("Pin selection controls");
1047
+ editButton.addActionListener(this);
1048
+
1049
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ uneditButton.setToolTipText("Remove selection controls");
5601051 uneditButton.addActionListener(this);
5611052
562
- oe.aConstraints.gridx += 1;
563
- oe.aConstraints.weighty = 0;
564
- oe.aConstraints.gridwidth = 1;
565
-
566
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
567
- clearPanelButton.addActionListener(this);
568
-
569
- oe.aConstraints.gridx += 1;
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 1;
572
-
573
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1053
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1054
+ allParamsButton.setToolTipText("Show all controle");
5741055 allParamsButton.addActionListener(this);
5751056
576
- oe.aConstraints.gridx += 1;
577
- oe.aConstraints.weighty = 0;
578
- oe.aConstraints.gridwidth = 1;
579
-
580
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
1057
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ clearPanelButton.setToolTipText("Clear edit panel");
1059
+ clearPanelButton.addActionListener(this);
1060
+
1061
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1062
+ unselectButton.setToolTipText("Unselect");
5811063 unselectButton.addActionListener(this);
5821064
1065
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1066
+ flashSelectionButton.setToolTipText("Highlight selection");
1067
+ flashSelectionButton.addActionListener(this);
1068
+
1069
+ editCommandsPanel.preferredHeight = 1;
1070
+
1071
+ SetPinStates(false);
1072
+// oe.treePanel.add(commandsPanel);
1073
+// oe.treePanel.Return();
1074
+
5831075 // oe.aConstraints.gridx += 1;
5841076 // oe.aConstraints.weighty = 0;
5851077 // oe.aConstraints.gridwidth = 1;
....@@ -591,47 +1083,32 @@
5911083 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5921084 // gcButton.addActionListener(this);
5931085
594
- oe.aConstraints.gridx = 0;
595
- oe.aConstraints.gridy += 1;
596
-
597
- //ctrlPanel.add(objList = new List(5, true));
598
- oe.aConstraints.gridwidth = 100;
599
- // oe.aConstraints.gridheight = 100;
600
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
601
- oe.aConstraints.gridheight = 1;
602
- oe.aConstraints.weighty = 0.5;
603
- oe.aConstraints.gridx = 0;
604
- JScrollPane jSP;
1086
+ cGridBag jSPPanel = new cGridBag();
1087
+
1088
+ JScrollPane jSP;
6051089 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
606
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1090
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6071091 ResetModel();
608
- oe.aConstraints.weighty = 0.5;
609
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
610
- oe.aConstraints.gridy += 1;
611
- oe.aConstraints.gridwidth = 1;
612
-
613
- oe.aConstraints.weighty = 0;
614
- oe.aConstraints.gridwidth = 2;
615
-
616
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
617
- colorCB.addItemListener(this);
618
- oe.aConstraints.gridx += 2;
619
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
620
- materialCB.addItemListener(this);
621
- oe.aConstraints.gridx += 2;
622
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
623
- textureCB.addItemListener(this);
624
-
625
- oe.aConstraints.gridx = 0;
626
- oe.aConstraints.gridy += 1;
6271092
1093
+ oe.treePanel.add(jSPPanel);
1094
+ oe.treePanel.Return();
1095
+
1096
+ oe.treePanel.add(copyOptionsPanel);
1097
+ oe.treePanel.Return();
1098
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1099
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1100
+ sliderPane.preferredHeight = 1;
1101
+
1102
+// mainPanel.setDividerLocation(0.1); //1.0);
1103
+ mainPanel.setResizeWeight(0.4);
1104
+
6281105 //jList.addListSelectionListener(this);
6291106 oe.jTree.addTreeSelectionListener(this);
6301107 //jTree.setRootVisible(false);
6311108 //jTree.setEditable(true);
6321109 oe.jTree.setDragEnabled(true);
6331110 //jTree.setPreferredSize(new Dimension(10,10));
634
- jSP.setPreferredSize(new Dimension(100,200));
1111
+ //jSP.setPreferredSize(new Dimension(100,200));
6351112
6361113 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6371114
....@@ -643,23 +1120,160 @@
6431120 dgr.addDragGestureListener(this);
6441121 }catch(Exception e) {}
6451122 */
646
- radio.layout = sevenButton;
1123
+ radio.layout = sixButton; // sevenButton;
6471124 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6481125 }
1126
+
1127
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1128
+ {
1129
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1130
+ colorCB.setToolTipText("Copy color when dropped");
1131
+ colorCB.addItemListener(this);
1132
+
1133
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1134
+ materialCB.setToolTipText("Copy material when dropped");
1135
+ materialCB.addItemListener(this);
1136
+
1137
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1138
+ textureCB.setToolTipText("Copy texture when dropped");
1139
+ textureCB.addItemListener(this);
1140
+
1141
+ panel.Return();
1142
+
1143
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1144
+ boxCB.setToolTipText("Display bounding boxes");
1145
+ boxCB.addItemListener(this);
1146
+
1147
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1148
+ zoomBoxCB.setToolTipText("Display only for wheel");
1149
+ zoomBoxCB.addItemListener(this);
1150
+
1151
+ if (true) // Globals.ADVANCED)
1152
+ {
1153
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1154
+// supportCB.setToolTipText("Enable rigging");
1155
+// supportCB.addItemListener(this);
1156
+
1157
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1158
+ freezeCB.setToolTipText("Fast moving camera");
1159
+ freezeCB.addItemListener(this);
1160
+
1161
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1162
+ // localCB.addItemListener(this);
1163
+
1164
+ panel.Return();
1165
+
1166
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1167
+ crowdCB.setToolTipText("Used for crowds");
1168
+ crowdCB.addItemListener(this);
1169
+
1170
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1171
+ smoothCB.setToolTipText("Snapping delay");
1172
+ smoothCB.addItemListener(this);
1173
+
1174
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1175
+ slowCB.setToolTipText("Smooth interpolation");
1176
+ slowCB.addItemListener(this);
1177
+
1178
+// constraints.gridy += 1;
1179
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1180
+// speakerMocapCB.addItemListener(this);
1181
+
1182
+ panel.Return();
1183
+
1184
+ if (false)
1185
+ {
1186
+ // handled in scripts
1187
+ //constraints.gridy += 1;
1188
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1189
+ speakerCameraCB.addItemListener(this);
1190
+
1191
+ //constraints.gridy += 1;
1192
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1193
+ speakerFocusCB.addItemListener(this);
1194
+
1195
+ //constraints.gridy += 1;
1196
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1197
+ smoothfocusCB.addItemListener(this);
1198
+ panel.Return();
1199
+ }
1200
+
1201
+//constraints.gridx += 1;
1202
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1203
+// debugCB.addItemListener(this);
1204
+
1205
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1206
+ trackCB.setToolTipText("Enable tracking target");
1207
+ trackCB.addItemListener(this);
1208
+
1209
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1210
+ oeilCB.setToolTipText("Move camera when tracking");
1211
+ oeilCB.addItemListener(this);
1212
+
1213
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1214
+ shadowCB.setToolTipText("When live compute shadows");
1215
+ shadowCB.addItemListener(this);
1216
+
1217
+ panel.Return();
1218
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1219
+ toggleTextureCB.setToolTipText("Load textures");
1220
+ toggleTextureCB.addItemListener(this);
1221
+
1222
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1223
+ toggleSwitchCB.setToolTipText("Choose a single item");
1224
+ toggleSwitchCB.addItemListener(this);
1225
+
1226
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1227
+ autokeepCB.setToolTipText("On structure change");
1228
+ autokeepCB.addItemListener(this);
1229
+
1230
+ panel.Return();
1231
+ if (Globals.ADVANCED)
1232
+ {
1233
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1234
+ lookAtCB.setToolTipText("Look-at target");
1235
+ lookAtCB.addItemListener(this);
1236
+ }
1237
+
1238
+ }
1239
+
1240
+ cGridBag fill = new cGridBag();
1241
+ fill.preferredHeight = 200;
1242
+ cGridBag fill2 = new cGridBag();
1243
+ fill2.preferredHeight = 200;
1244
+ cGridBag fill3 = new cGridBag();
1245
+ fill3.preferredHeight = 200;
1246
+
1247
+ panel.add(fill);
1248
+ panel.add(fill2);
1249
+ panel.add(fill3);
1250
+
1251
+ }
6491252
6501253 void EditObject(Object3D obj)
6511254 {
6521255 cRadio radioButton = new cRadio(obj.name);
1256
+
1257
+ // June 2019. Patch to avoid bug with transparency.
1258
+ radioButton.hadMaterial = obj.material != null;
1259
+ if (!radioButton.hadMaterial)
1260
+ {
1261
+ obj.material = new cMaterial();
1262
+ }
1263
+
6531264 radioButton.SetObject(obj);
654
- radioButton.layout = sevenButton;
1265
+ radioButton.layout = sixButton; // sevenButton;
6551266 radioButton.SetCamera(cameraView.renderCamera, false);
6561267 radioButton.addActionListener(this);
6571268 radioPanel.add(radioButton);
6581269 buttonGroup.add(radioButton);
6591270 radioButton.doClick();
6601271 }
1272
+
6611273 void SetupViews(ObjEditor oe)
6621274 {
1275
+ theFrame = this;
1276
+
6631277 oe.SetupViews();
6641278
6651279 System.out.println("SetupViews");
....@@ -668,22 +1282,28 @@
6681282 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6691283 }
6701284
671
- JCheckBox liveCB;
672
- JCheckBox supportCB;
673
- JCheckBox localCB;
674
- JCheckBox crowdCB;
675
- JCheckBox smoothCB;
676
- JCheckBox fastCB;
677
- JCheckBox slowCB;
678
- JCheckBox boxCB;
679
- JCheckBox trackCB;
680
- JCheckBox smoothfocusCB;
1285
+ cToggleButton liveCB;
1286
+ cCheckBox supportCB;
1287
+ cCheckBox localCB;
1288
+ cCheckBox crowdCB;
1289
+ cCheckBox smoothCB;
1290
+ cToggleButton fastCB;
1291
+ cCheckBox slowCB;
1292
+ cCheckBox boxCB;
1293
+ cCheckBox zoomBoxCB;
1294
+ cCheckBox freezeCB;
1295
+ //cToggleButton trackCB;
1296
+ cCheckBox trackCB;
1297
+ cCheckBox smoothfocusCB;
6811298 // JCheckBox speakerMocapCB;
682
- JCheckBox speakerCameraCB;
683
- JCheckBox speakerFocusCB;
684
- JCheckBox debugCB;
685
- JCheckBox oeilCB;
686
- JCheckBox lookAtCB;
1299
+ cCheckBox speakerCameraCB;
1300
+ cCheckBox speakerFocusCB;
1301
+ cCheckBox debugCB;
1302
+
1303
+ cCheckBox oeilCB;
1304
+ cCheckBox shadowCB;
1305
+ cCheckBox autokeepCB;
1306
+ cCheckBox lookAtCB;
6871307
6881308 // static int COLOR = 1;
6891309 // static int MATERIAL = 2;
....@@ -691,9 +1311,9 @@
6911311
6921312 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6931313
694
- JCheckBox colorCB;
695
- JCheckBox materialCB;
696
- JCheckBox textureCB;
1314
+ cCheckBox colorCB;
1315
+ cCheckBox materialCB;
1316
+ cCheckBox textureCB;
6971317
6981318 public void itemStateChanged(ItemEvent e)
6991319 {
....@@ -721,6 +1341,7 @@
7211341 } else if(e.getSource() == liveCB)
7221342 {
7231343 cameraView.ToggleLive();
1344
+ refreshContents(false);
7241345 }
7251346 else if(e.getSource() == supportCB)
7261347 {
....@@ -756,6 +1377,10 @@
7561377 cameraView.repaint();
7571378 // refreshContents();
7581379 }
1380
+ else if(e.getSource() == zoomBoxCB)
1381
+ {
1382
+ cameraView.ToggleZoomBoxMode();
1383
+ }
7591384 else if(e.getSource() == smoothfocusCB)
7601385 {
7611386 cameraView.ToggleSmoothFocus();
....@@ -781,6 +1406,18 @@
7811406 {
7821407 cameraView.ToggleOeil();
7831408 }
1409
+ else if(e.getSource() == shadowCB)
1410
+ {
1411
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1412
+ }
1413
+ else if(e.getSource() == freezeCB)
1414
+ {
1415
+ Globals.FREEZEONMOVE ^= true;
1416
+ }
1417
+ else if(e.getSource() == autokeepCB)
1418
+ {
1419
+ Globals.REPLACEONMAKE ^= true;
1420
+ }
7841421 else if(e.getSource() == lookAtCB)
7851422 {
7861423 cameraView.ToggleLookAt();
....@@ -797,7 +1434,8 @@
7971434
7981435 /**/
7991436 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
800
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1437
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1438
+ TreePath path = objEditor.jTree.getSelectionPath();
8011439 if ((path == null) || (path.getPathCount() <= 1)) {
8021440 // We can't move the root node or an empty selection
8031441 return;
....@@ -860,8 +1498,6 @@
8601498 }
8611499 }
8621500
863
- String string = (String) object;
864
-
8651501 System.out.println("Transfer = " + object + "; drop : " + target);
8661502 // if( object instanceof java.io.File[])
8671503 // {
....@@ -869,7 +1505,11 @@
8691505 // objEditor.DropFile((java.io.File[]) object, true);
8701506 // return;
8711507 // }
872
- if (string.charAt(0) == '/')
1508
+
1509
+ String string = object.toString();
1510
+
1511
+ // File path for Mac and Windows
1512
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8731513 {
8741514 // file(s)
8751515 String[] names = string.split("\n");
....@@ -896,7 +1536,7 @@
8961536
8971537 flashIt = false;
8981538 CameraPane pane = (CameraPane) target;
899
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1539
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9001540 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9011541
9021542 if (group.selection.size() == 1)
....@@ -912,23 +1552,33 @@
9121552
9131553 assert target == objEditor.jTree;
9141554 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1555
+ Object3D destinationLeaf;
9151556 try {
916
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1557
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9171558 } catch (Exception e) {
9181559 System.out.println("destinationPath : " + destinationPath);
9191560 return;
9201561 }
9211562
922
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1563
+ for (int i=group.selection.size(); --i>=0;)
9231564 {
1565
+ Object3D child = (Object3D)group.selection.elementAt(i);
1566
+
1567
+ // Cannot move into itself
1568
+ if (child == destinationLeaf)
1569
+ return;
1570
+ }
1571
+
1572
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1573
+// {
9241574 loadClipboard(true);
9251575 objEditor.jTree.setSelectionPath(destinationPath);
926
- pasteInto(false);
927
- } else {
928
- loadClipboard(false);
929
- objEditor.jTree.setSelectionPath(destinationPath);
930
- pasteInto(false); // true); // ???
931
- }
1576
+ pasteInto(false, false);
1577
+// } else {
1578
+// loadClipboard(false);
1579
+// objEditor.jTree.setSelectionPath(destinationPath);
1580
+// pasteInto(false, false); // true); // ???
1581
+// }
9321582 }
9331583 public void dropActionChanged(DropTargetDragEvent dtde)
9341584 // Called if the user has modified the current drop gesture
....@@ -1033,85 +1683,107 @@
10331683 {
10341684 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10351685 //heightFieldItem.addActionListener(this);
1036
- gridItem = menu.add(new MenuItem("Grid"));
1037
- gridItem.addActionListener(this);
1038
- rectoidItem = menu.add(new MenuItem("Box"));
1039
- rectoidItem.addActionListener(this);
1040
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1041
- ellipsoidItem.addActionListener(this);
1042
- coneItem = menu.add(new MenuItem("Cone"));
1043
- coneItem.addActionListener(this);
1044
- torusItem = menu.add(new MenuItem("Torus"));
1045
- torusItem.addActionListener(this);
1046
- superItem = menu.add(new MenuItem("Superellipsoid"));
1047
- superItem.addActionListener(this);
1686
+// gridItem = menu.add(new MenuItem("Grid"));
1687
+// gridItem.addActionListener(this);
1688
+// rectoidItem = menu.add(new MenuItem("Box"));
1689
+// rectoidItem.addActionListener(this);
1690
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1691
+// ellipsoidItem.addActionListener(this);
1692
+// coneItem = menu.add(new MenuItem("Cone"));
1693
+// coneItem.addActionListener(this);
1694
+// torusItem = menu.add(new MenuItem("Torus"));
1695
+// torusItem.addActionListener(this);
1696
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1697
+// superItem.addActionListener(this);
1698
+
1699
+ cameraItem = menu.add(new MenuItem("Camera"));
1700
+ cameraItem.addActionListener(this);
1701
+
1702
+ if (!Globals.ADVANCED)
1703
+ {
10481704 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10491705 kleinItem.addActionListener(this);
1050
- particleItem = menu.add(new MenuItem("Particle system"));
1051
- particleItem.addActionListener(this);
1706
+ }
1707
+
1708
+// particleItem = menu.add(new MenuItem("Particle system"));
1709
+// particleItem.addActionListener(this);
1710
+ if (Globals.ADVANCED)
1711
+ {
10521712 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10531713 ragdollItem.addActionListener(this);
10541714 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10551715 ragdoll2Item.addActionListener(this);
1716
+ }
10561717 menu.add("-");
1057
- meshItem = menu.add(new MenuItem("Mesh"));
1718
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10581719 meshItem.addActionListener(this);
10591720 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10601721 // meshGroupItem.addActionListener(this);
1722
+ if (Globals.ADVANCED)
1723
+ {
10611724 springItem = menu.add(new MenuItem("Spring"));
10621725 springItem.addActionListener(this);
10631726 flagItem = menu.add(new MenuItem("Flag"));
10641727 flagItem.addActionListener(this);
1065
- bezierItem = menu.add(new MenuItem("Patch"));
1066
- bezierItem.addActionListener(this);
1067
- checkerItem = menu.add(new MenuItem("Checker"));
1068
- checkerItem.addActionListener(this);
10691728 blobItem = menu.add(new MenuItem("Blob"));
10701729 blobItem.addActionListener(this);
10711730 latheItem = menu.add(new MenuItem("Lathe"));
10721731 latheItem.addActionListener(this);
1073
- lightItem = menu.add(new MenuItem("Light"));
1074
- lightItem.addActionListener(this);
1732
+ }
1733
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1734
+ bezierItem.addActionListener(this);
1735
+// overlayItem = menu.add(new MenuItem("Overlay"));
1736
+// overlayItem.addActionListener(this);
1737
+// lightItem = menu.add(new MenuItem("Light"));
1738
+// lightItem.addActionListener(this);
10751739 menu.add("-");
10761740 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10771741 //superLoopItem.addActionListener(this);
1078
- loopItem = menu.add(new MenuItem("Loop"));
1079
- loopItem.addActionListener(this);
1742
+// loopItem = menu.add(new MenuItem("Loop"));
1743
+// loopItem.addActionListener(this);
10801744 doubleItem = menu.add(new MenuItem("Fork"));
10811745 doubleItem.addActionListener(this);
1746
+ if (Globals.ADVANCED)
1747
+ {
10821748 tripleItem = menu.add(new MenuItem("Trident"));
10831749 tripleItem.addActionListener(this);
1750
+ }
10841751 }
10851752
10861753 void buildToolsMenu(Menu menu)
10871754 {
10881755 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10891756 animationItem.addItemListener(this);
1090
- animationItem.setState(CameraPane.ANIMATION);
1757
+ animationItem.setState(Globals.ANIMATION);
1758
+
1759
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1760
+ archiveItem.addActionListener(this);
10911761
10921762 menu.add("-");
10931763 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10941764 parseverticesItem.addActionListener(this);
10951765 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10961766 textureFieldItem.addActionListener(this);
1097
- alignItem = menu.add(new MenuItem("Align"));
1767
+ alignItem = menu.add(new MenuItem("Align Objects"));
10981768 alignItem.addActionListener(this);
1099
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1100
- mirrorItem.addActionListener(this);
11011769 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11021770 reduceMorphItem.addActionListener(this);
11031771 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11041772 reduce34MorphItem.addActionListener(this);
1105
-
1106
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1107
- computeAOItem.addActionListener(this);
11081773 menu.add("-");
1109
-
11101774 menu.add(memoryItem = new MenuItem("Memory Usage"));
11111775 memoryItem.addActionListener(this);
1776
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1777
+ computeAOItem.addActionListener(this);
1778
+
1779
+ if (Globals.ADVANCED)
1780
+ {
1781
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1782
+ mirrorItem.addActionListener(this);
1783
+ menu.add("-");
11121784 menu.add(analyzeItem = new MenuItem("Analyze"));
11131785 analyzeItem.addActionListener(this);
1114
- menu.add(dumpItem = new MenuItem("Dump"));
1786
+ menu.add(dumpItem = new MenuItem("Print"));
11151787 dumpItem.addActionListener(this);
11161788 // menu.add(pathItem = new MenuItem("From-to path"));
11171789 // pathItem.addActionListener(this);
....@@ -1120,6 +1792,8 @@
11201792 resetParentItem.addActionListener(this);
11211793 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11221794 repairParentItem.addActionListener(this);
1795
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1796
+ repairShadowItem.addActionListener(this);
11231797 menu.add(invariantsItem = new MenuItem("Invariants"));
11241798 invariantsItem.addActionListener(this);
11251799 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1127,6 +1801,7 @@
11271801 menu.add("-");
11281802 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11291803 editScriptItem.addActionListener(this);
1804
+ }
11301805 }
11311806
11321807 void ScreenFit()
....@@ -1249,9 +1924,34 @@
12491924 shadow.material = new cMaterial(obj.material);
12501925 shadow.material.diffuse = 0.0001f;
12511926 shadow.material.specular = 0.0001f;
1927
+ //shadow.projectedVertices[1].x = 300;
12521928
12531929 makeSomething(shadow);
12541930 }
1931
+
1932
+ private void ClearUnpinned()
1933
+ {
1934
+ //for (Object3D obj : listUI)
1935
+ for (int i=listUI.size(); --i>=0;)
1936
+ {
1937
+ Object3D obj = listUI.elementAt(i);
1938
+ if (!obj.pinned)
1939
+ {
1940
+ obj.CloseUI();
1941
+ listUI.remove(i);
1942
+ }
1943
+ }
1944
+ }
1945
+
1946
+ private void EditElement(Object3D elem, boolean newWindow)
1947
+ {
1948
+ // if (!(elem instanceof Composite))
1949
+ // newWindow = false;
1950
+ listUI.add(elem);
1951
+ elem.openEditWindow(this, newWindow); //, false);
1952
+ System.out.println("edit : " + elem);
1953
+ elem.editWindow.refreshContents(true); // ? new
1954
+ }
12551955
12561956 /**
12571957 * applyExample
....@@ -1455,9 +2155,9 @@
14552155
14562156 void Overwrite(int mask)
14572157 {
1458
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2158
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14592159 {
1460
- Object3D content = GrafreeD.clipboard.get(0);
2160
+ Object3D content = Grafreed.clipboard.get(0);
14612161
14622162 if (content instanceof cGroup && ((cGroup)content).transientlink )
14632163 content = ((cGroup)content).get(0);
....@@ -1480,6 +2180,7 @@
14802180 //
14812181 public void actionPerformed(ActionEvent event) // , Object arg)
14822182 {
2183
+ Object source = event.getSource();
14832184 /*
14842185 if (event.getSource() == nameField)
14852186 {
....@@ -1491,11 +2192,11 @@
14912192 }
14922193 else
14932194 */
1494
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2195
+ if (source == lookAtItem || source == lookFromItem)
14952196 {
14962197 ScreenFit();
14972198 } else
1498
- if (event.getSource() == switchItem)
2199
+ if (source == switchViewItem)
14992200 {
15002201 cVector v1 = new cVector();
15012202 cVector v2 = new cVector();
....@@ -1504,11 +2205,11 @@
15042205 objEditor.cameraView.renderCamera.setAim(v2, v1);
15052206 objEditor.cameraView.repaint();
15062207 } else
1507
- if (event.getSource() == rectoidItem)
2208
+ if (source == rectoidItem || source == boxButton)
15082209 {
15092210 makeSomething(new Box());
15102211 } else
1511
- if (event.getSource() == particleItem)
2212
+ if (source == particleItem || source == particlesButton)
15122213 {
15132214 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15142215 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1529,9 +2230,9 @@
15292230 applyExample(particleGeom, "SMOKE");
15302231 makeSomething(particleGeom);
15312232 } else
1532
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2233
+ if (source == ragdollItem || source == ragdoll2Item)
15332234 {
1534
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2235
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15352236
15362237 ragdoll.toParent = LA.newMatrix();
15372238 ragdoll.fromParent = LA.newMatrix();
....@@ -1549,7 +2250,7 @@
15492250 } else
15502251 /*
15512252 */
1552
- if (event.getSource() == heightFieldItem)
2253
+ if (source == heightFieldItem)
15532254 {
15542255 Object3D obj = new Object3D();
15552256
....@@ -1587,31 +2288,31 @@
15872288
15882289 makeSomething(obj);
15892290 } else
1590
- if (event.getSource() == gridItem)
2291
+ if (source == gridItem || source == gridButton)
15912292 {
15922293 makeSomething(new Grid());
15932294 } else
1594
- if (event.getSource() == ellipsoidItem)
2295
+ if (source == ellipsoidItem || source == sphereButton)
15952296 {
15962297 makeSomething(new Sphere());
15972298 } else
1598
- if (event.getSource() == coneItem)
2299
+ if (source == coneItem || source == coneButton)
15992300 {
16002301 makeSomething(new Cone());
16012302 } else
1602
- if (event.getSource() == torusItem)
2303
+ if (source == torusItem || source == torusButton)
16032304 {
16042305 makeSomething(new Torus());
16052306 } else
1606
- if (event.getSource() == superItem)
2307
+ if (source == superItem || source == superButton)
16072308 {
16082309 makeSomething(new Superellipsoid());
16092310 } else
1610
- if (event.getSource() == kleinItem)
2311
+ if (source == kleinItem || source == kleinButton)
16112312 {
16122313 makeSomething(new Klein());
16132314 } else
1614
- if (event.getSource() == blobItem)
2315
+ if (source == blobItem)
16152316 {
16162317 Blob blob = new Blob();
16172318 BlobComponent comp = new BlobComponent();
....@@ -1619,15 +2320,15 @@
16192320 //blob.retile();
16202321 makeSomething(blob);
16212322 } else
1622
- if (event.getSource() == latheItem)
2323
+ if (source == latheItem)
16232324 {
16242325 makeSomething(new Lathe());
16252326 } else
1626
- if (event.getSource() == bezierItem)
2327
+ if (source == bezierItem)
16272328 {
16282329 makeSomething(new BezierSurface());
16292330 } else
1630
- if (event.getSource() == checkerItem)
2331
+ if (source == overlayItem || source == overlayButton)
16312332 {
16322333 /*
16332334 Object3D obj = new BezierSurface(5,8);
....@@ -1642,7 +2343,7 @@
16422343 */
16432344 makeSomething(new Checker());
16442345 } else
1645
- if (event.getSource() == meshItem)
2346
+ if (source == meshItem)
16462347 {
16472348 Object3D itemtomake = new Object3D();
16482349 Object3D child;
....@@ -1663,35 +2364,52 @@
16632364 makeSomething(child);
16642365 }
16652366 } else
1666
- if (event.getSource() == springItem)
2367
+ if (source == springItem)
16672368 {
16682369 cSpring s = new cSpring();
16692370 s.setup();
16702371 makeSomething(s);
16712372 } else
1672
- if (event.getSource() == flagItem)
2373
+ if (source == flagItem)
16732374 {
16742375 cSpring s = new cFlag();
16752376 s.setup();
16762377 makeSomething(s);
16772378 } else
1678
- if (event.getSource() == lightItem)
2379
+ if (source == lightItem || source == lightButton)
16792380 {
16802381 makeSomething(new Light());
16812382 } else
1682
- if (event.getSource() == csgItem)
2383
+// if (source == skybox1Button ||
2384
+// source == skybox2Button ||
2385
+// source == skybox3Button ||
2386
+// source == skybox4Button ||
2387
+// source == skybox5Button ||
2388
+// source == skybox6Button ||
2389
+// source == skybox7Button ||
2390
+// source == skybox11Button ||
2391
+// source == skybox12Button ||
2392
+// source == skybox13Button ||
2393
+// source == skybox14Button ||
2394
+// source == skybox15Button ||
2395
+// source == skybox16Button ||
2396
+// source == skybox17Button)
2397
+// {
2398
+// ChangeSkybox(source);
2399
+// } else
2400
+ if (source == csgItem)
16832401 {
16842402 group(new CSG());
16852403 } else
1686
- if (event.getSource() == templateItem)
2404
+ if (source == templateItem)
16872405 {
16882406 group(new cTemplate());
16892407 } else
1690
- if (event.getSource() == attributeItem)
2408
+ if (source == attributeItem)
16912409 {
16922410 makeSomething(new Attribute());
16932411 } else
1694
- if (event.getSource() == pointflowItem)
2412
+ if (source == pointflowItem)
16952413 {
16962414 makeSomething(new PointFlow());
16972415 } else
....@@ -1703,7 +2421,7 @@
17032421 } else
17042422 */
17052423
1706
- if (event.getSource() == superLoopItem)
2424
+ if (source == superLoopItem)
17072425 {
17082426 Composite g = new cGroup();
17092427 for (int i=0; i<15; i++)
....@@ -1725,30 +2443,30 @@
17252443
17262444 group(g);
17272445 } else
1728
- if (event.getSource() == loopItem)
2446
+ if (source == loopItem || source == loopButton)
17292447 {
17302448 Composite csg = new GroupLeaf();
17312449 csg.count = 5;
17322450 group(csg);
1733
- Composite child = new cGroup();
2451
+ Composite child = new cGroup("Branch");
17342452 csg.addChild(child);
17352453 child.addChild(csg);
17362454 } else
1737
- if (event.getSource() == doubleItem)
2455
+ if (source == doubleItem)
17382456 {
1739
- Composite csg = new GroupLeaf();
2457
+ Composite csg = new GroupLeaf("Fork");
17402458 csg.count = 5;
17412459 group(csg);
1742
- Composite child = new cGroup();
2460
+ Composite child = new cGroup("Branch A");
17432461 csg.addChild(child);
17442462 child.addChild(csg);
1745
- child = new cGroup();
2463
+ child = new cGroup("Branch B");
17462464 csg.addChild(child);
17472465 child.addChild(csg);
17482466 } else
1749
- if (event.getSource() == tripleItem)
2467
+ if (source == tripleItem)
17502468 {
1751
- Composite csg = new GroupLeaf();
2469
+ Composite csg = new GroupLeaf("Trident");
17522470 csg.count = 4;
17532471 group(csg);
17542472 Composite child = new cGroup();
....@@ -1761,73 +2479,98 @@
17612479 csg.addChild(child);
17622480 child.addChild(csg);
17632481 } else
1764
-
1765
- if (event.getSource() == importGFDItem)
2482
+ if (source == computeAOItem)
17662483 {
1767
- ImportGFD();
2484
+ Globals.drawMode = CameraPane.OCCLUSION;
2485
+ cameraView.repaint();
17682486 } else
1769
- if (event.getSource() == importVRMLX3DItem)
1770
- {
1771
- ImportVRMLX3D();
1772
- } else
1773
- if (event.getSource() == import3DSItem)
1774
- {
1775
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1776
- } else
1777
- if (event.getSource() == importOBJItem)
1778
- {
1779
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1780
- } else
1781
- if (event.getSource() == computeAOItem)
1782
- {
1783
- CameraPane.drawMode = CameraPane.OCCLUSION;
1784
- CameraPane.theRenderer.repaint();
1785
- } else
1786
- if (event.getSource() == recompileItem)
2487
+ if (source == recompileItem)
17872488 {
17882489 Recompile();
17892490 refreshContents();
17902491 } else
1791
- if (event.getSource() == editScriptItem)
2492
+ if (source == editScriptItem)
17922493 {
17932494 OpenDialog();
17942495 refreshContents();
17952496 } else
1796
- if (event.getSource() == invariantsItem)
2497
+ if (source == invariantsItem)
17972498 {
17982499 System.out.println("Invariants:");
1799
- GrafreeD.grafreeD.universe.invariants();
2500
+ Grafreed.grafreeD.universe.invariants();
18002501 } else
1801
- if (event.getSource() == memoryItem)
2502
+ if (source == memoryItem)
18022503 {
18032504 //System.out.println("Invariants:");
18042505 PrintMemory();
18052506 } else
1806
- if (event.getSource() == pathItem)
2507
+ if (source == pathItem)
18072508 {
18082509 PrintPath();
18092510 } else
1810
- if (event.getSource() == analyzeItem)
2511
+ if (source == analyzeItem)
18112512 {
18122513 AnalyzeObject();
18132514 } else
1814
- if (event.getSource() == dumpItem)
2515
+ if (source == dumpItem)
18152516 {
18162517 DumpObject();
18172518 } else
1818
- if (event.getSource() == screenfitButton)
2519
+ if (source == minButton)
18192520 {
1820
- //Reload(lastConverter, lastFilename, true);
2521
+ Minimize();
2522
+ } else
2523
+ if (source == maxButton)
2524
+ {
2525
+ Maximize();
2526
+ } else
2527
+ if (source == fullButton)
2528
+ {
2529
+ ToggleFullScreen();
2530
+ } else
2531
+ if (source == undoButton)
2532
+ {
2533
+ // Go to previous version
2534
+ //if (!Undo())
2535
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2536
+ Undo();
2537
+ } else
2538
+ if (source == restoreButton)
2539
+ {
2540
+ // Restore current version
2541
+ Restore();
2542
+ } else
2543
+ if (source == replaceButton)
2544
+ {
2545
+ // Overwrite current version
2546
+ Replace();
2547
+ } else
2548
+ if (source == redoButton)
2549
+ {
2550
+ // Go to next version
2551
+ Redo();
2552
+ } else
2553
+ if (source == saveButton)
2554
+ {
2555
+ // Save a new version
2556
+ if (!Save(true))
2557
+ java.awt.Toolkit.getDefaultToolkit().beep();
2558
+ } else
2559
+ if (source == oneStepButton)
2560
+ {
2561
+ Globals.ONESTEP = true;
2562
+ cameraView.repaint();
2563
+ } else
2564
+ if (source == screenfitButton)
2565
+ {
18212566 ScreenFit();
18222567 } else
1823
- if (event.getSource() == screenfitpointButton)
2568
+ if (source == screenfitpointButton)
18242569 {
1825
- //Reload(lastConverter, lastFilename, true);
18262570 ScreenFitPoint();
18272571 } else
1828
- if (event.getSource() == snapobjectButton)
2572
+ if (source == snapobjectButton)
18292573 {
1830
- //Reload(lastConverter, lastFilename, true);
18312574 SnapObject();
18322575 } else
18332576 // if (event.getSource() == recompileButton)
....@@ -1836,13 +2579,13 @@
18362579 // Recompile();
18372580 // refreshContents();
18382581 // } else
1839
- if (event.getSource() == gcButton)
2582
+ if (source == gcButton)
18402583 {
18412584 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18422585 System.gc();
18432586 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18442587 } else
1845
- if (event.getSource() == editLeafItem)
2588
+ if (source == editLeafItem)
18462589 {
18472590 Object3D obj;
18482591 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1856,62 +2599,74 @@
18562599 }
18572600 refreshContents(true);
18582601 } else
1859
- if (event.getSource() == openWindowItem)
2602
+ if (source == openWindowItem)
18602603 {
18612604 EditSelection(true);
18622605 } else
1863
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2606
+ if (source == cutItem || source == clearButton)
18642607 {
18652608 loadClipboard(true);
18662609 } else
1867
- if (event.getSource() == duplicateItem)
2610
+ if (source == undoItem)
18682611 {
1869
- Object3D keep = GrafreeD.clipboard;
2612
+ Undo();
2613
+ } else
2614
+ if (source == redoItem)
2615
+ {
2616
+ Redo();
2617
+ } else
2618
+ if (source == duplicateItem)
2619
+ {
2620
+ Object3D keep = Grafreed.clipboard;
18702621 loadClipboard(false);
18712622 paste(false);
1872
- GrafreeD.clipboard = keep;
2623
+ Grafreed.clipboard = keep;
18732624 } else
1874
- if (event.getSource() == cloneItem)
2625
+ if (source == cloneItem)
18752626 {
18762627 CloneSelection(false);
18772628 } else
1878
- if (event.getSource() == cloneSupportItem)
2629
+ if (source == cloneSupportItem)
18792630 {
18802631 CloneSelection(true);
18812632 } else
1882
- if (event.getSource() == copyItem)
2633
+ if (source == copyItem)
18832634 {
18842635 loadClipboard(false);
18852636 } else
1886
- if (event.getSource() == pasteItem)
2637
+ if (source == pasteItem)
18872638 {
18882639 paste(false);
18892640 } else
1890
- if (event.getSource() == pasteLinkItem)
2641
+ if (source == pasteIntoItem)
18912642 {
1892
- pasteInto(false);
2643
+ pasteInto(true, false);
18932644 } else
1894
- if (event.getSource() == pasteCloneItem)
2645
+ if (source == pasteLinkItem)
18952646 {
1896
- pasteInto(true);
2647
+ pasteInto(false, false);
18972648 } else
1898
- if (event.getSource() == pasteExpandItem)
2649
+ if (source == pasteCloneItem)
2650
+ {
2651
+ pasteInto(true, true);
2652
+ } else
2653
+ if (source == pasteExpandItem)
18992654 {
19002655 paste(true);
19012656 } else
1902
- if (event.getSource() == synchronizeItem)
2657
+ if (source == synchronizeItem)
19032658 {
19042659 Overwrite(Object3D.TRANSFORM);
19052660 } else
1906
- if (event.getSource() == overwriteNameItem)
2661
+ if (source == overwriteNameItem)
19072662 {
19082663 Overwrite(Object3D.NAME);
19092664 } else
1910
- if (event.getSource() == overwriteUVItem)
2665
+ if (source == overwriteUVItem)
19112666 {
19122667 Overwrite(Object3D.UV);
19132668 } else
1914
- if (event.getSource() == overwriteMatItem)
2669
+ if (source == overwriteMatItem)
19152670 {
19162671 /* july 2015
19172672 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1931,7 +2686,7 @@
19312686
19322687 Overwrite(dropAttributes);
19332688 }
1934
- if (event.getSource() == overwriteGeoItem)
2689
+ if (source == overwriteGeoItem)
19352690 {
19362691 Overwrite(Object3D.GEOMETRY);
19372692 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1948,7 +2703,7 @@
19482703 // refreshContents();
19492704 // }
19502705 } else
1951
- if (event.getSource() == generateMeshItem)
2706
+ if (source == generateMeshItem)
19522707 {
19532708 //if (group.selection.size() == 1)
19542709 // for (int i=0; i<group.selection.size(); i++)
....@@ -1959,7 +2714,7 @@
19592714 ResetModel();
19602715 refreshContents();
19612716 } else
1962
- if (event.getSource() == extractGeometriesItem)
2717
+ if (source == extractGeometriesItem)
19632718 {
19642719 boolean one = false;
19652720
....@@ -1986,7 +2741,7 @@
19862741 ResetModel();
19872742 refreshContents();
19882743 } else
1989
- if (event.getSource() == cloneGeometriesItem)
2744
+ if (source == cloneGeometriesItem)
19902745 {
19912746 boolean one = false;
19922747
....@@ -2012,7 +2767,7 @@
20122767 ResetModel();
20132768 refreshContents();
20142769 } else
2015
- if (event.getSource() == shareGeometriesItem)
2770
+ if (source == shareGeometriesItem)
20162771 {
20172772 boolean one = false;
20182773
....@@ -2042,7 +2797,7 @@
20422797 refreshContents();
20432798 }
20442799 } else
2045
- if (event.getSource() == mergeGeometriesItem)
2800
+ if (source == mergeGeometriesItem)
20462801 {
20472802 boolean one = false;
20482803
....@@ -2072,7 +2827,7 @@
20722827 ResetModel();
20732828 refreshContents();
20742829 } else
2075
- if (event.getSource() == linkverticesItem)
2830
+ if (source == linkverticesItem)
20762831 {
20772832 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20782833 // {
....@@ -2085,48 +2840,48 @@
20852840 // group.selection.get(0).setMasterThis(content); // should be identity
20862841 // refreshContents();
20872842 // }
2088
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2843
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20892844 {
2090
- Object3D content = GrafreeD.clipboard.get(0);
2845
+ Object3D content = Grafreed.clipboard.get(0);
20912846
20922847 if (content instanceof cGroup && ((cGroup)content).transientlink )
20932848 content = ((cGroup)content).get(0);
20942849
2095
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2850
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20962851 for (int i=0; i<group.selection.size(); i++)
20972852 {
2098
- boolean random = CameraPane.RANDOM;
2099
- CameraPane.RANDOM = false; // parse all random nodes
2853
+ boolean random = CameraPane.SWITCH;
2854
+ CameraPane.SWITCH = false; // parse all random nodes
21002855 group.selection.get(i).linkVerticesThis(content);
21012856 // group.selection.get(i).setMasterThis(content); // should be identity
2102
- CameraPane.RANDOM = random;
2857
+ CameraPane.SWITCH = random;
21032858 }
2104
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2859
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21052860 refreshContents();
21062861 }
21072862 } else
2108
- if (event.getSource() == resetsupportItem)
2863
+ if (source == resetsupportItem)
21092864 {
21102865 for (int i=0; i<group.selection.size(); i++)
21112866 {
2112
- boolean random = CameraPane.RANDOM;
2113
- CameraPane.RANDOM = false; // parse all random nodes
2867
+ boolean random = CameraPane.SWITCH;
2868
+ CameraPane.SWITCH = false; // parse all random nodes
21142869 group.selection.get(i).linkVerticesThis(null);
2115
- CameraPane.RANDOM = random;
2870
+ CameraPane.SWITCH = random;
21162871 }
21172872
21182873 refreshContents();
21192874 } else
2120
- if (event.getSource() == relinkverticesItem)
2875
+ if (source == relinkverticesItem)
21212876 {
2122
- boolean random = CameraPane.RANDOM;
2123
- CameraPane.RANDOM = false; // parse all random nodes
2877
+ boolean random = CameraPane.SWITCH;
2878
+ CameraPane.SWITCH = false; // parse all random nodes
21242879 group.selection.RelinkToSupport();
2125
- CameraPane.RANDOM = random;
2880
+ CameraPane.SWITCH = random;
21262881
21272882 refreshContents();
21282883 } else
2129
- if (event.getSource() == resetreferencesItem)
2884
+ if (source == resetreferencesItem)
21302885 {
21312886 for (int i=0; i<group.selection.size(); i++)
21322887 {
....@@ -2135,11 +2890,11 @@
21352890
21362891 refreshContents();
21372892 } else
2138
- if (event.getSource() == setMasterItem)
2893
+ if (source == setMasterItem)
21392894 {
2140
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2895
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21412896 {
2142
- Object3D content = GrafreeD.clipboard.get(0);
2897
+ Object3D content = Grafreed.clipboard.get(0);
21432898
21442899 if (content instanceof cGroup && ((cGroup)content).transientlink )
21452900 content = ((cGroup)content).get(0);
....@@ -2148,13 +2903,13 @@
21482903 refreshContents();
21492904 }
21502905 } else
2151
- if (event.getSource() == poseMeshItem)
2906
+ if (source == poseMeshItem)
21522907 {
21532908 if (group.selection.size() == 1)
21542909 {
2155
- if (GrafreeD.clipboard.size() == 1)
2910
+ if (Grafreed.clipboard.size() == 1)
21562911 {
2157
- Object3D content = GrafreeD.clipboard.get(0);
2912
+ Object3D content = Grafreed.clipboard.get(0);
21582913
21592914 if (content instanceof cGroup && ((cGroup)content).transientlink )
21602915 content = ((cGroup)content).get(0);
....@@ -2167,19 +2922,19 @@
21672922 }
21682923
21692924 } else
2170
- if (event.getSource() == revertMeshItem)
2925
+ if (source == revertMeshItem)
21712926 {
21722927 RevertMeshes();
21732928 } else
2174
- if (event.getSource() == resetMeshItem)
2929
+ if (source == resetAllItem)
21752930 {
21762931 ResetAll();
21772932 } else
2178
- if (event.getSource() == stepAllItem)
2933
+ if (source == stepAllItem)
21792934 {
21802935 StepAll();
21812936 } else
2182
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2937
+ if (source == deleteItem) // || event.getSource() == clearButton)
21832938 {
21842939 //int indices[] = jList.getSelectedIndices();
21852940 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2187,46 +2942,46 @@
21872942
21882943 ClearSelection(false);
21892944 } else
2190
- if (event.getSource() == clearAllItem)
2945
+ if (source == clearAllItem)
21912946 {
21922947 ClearSelection(true);
21932948 } else
2194
- if (event.getSource() == grabItem)
2949
+ if (source == grabItem || source == groupButton)
21952950 {
2196
- group(new cGroup(), true);
2951
+ group(new cGroup(), false); // true);
21972952 } else
2198
- if (event.getSource() == hideItem)
2953
+ if (source == hideItem)
21992954 {
22002955 group(new HiddenObject());
22012956 } else
2202
- if (event.getSource() == frontItem)
2957
+ if (source == frontItem)
22032958 {
22042959 front();
22052960 } else
2206
- if (event.getSource() == backItem)
2961
+ if (source == backItem)
22072962 {
22082963 back();
22092964 } else
2210
- if (event.getSource() == cameraItem)
2965
+ if (source == cameraItem)
22112966 {
22122967 makeSomething(new Camera());
22132968 } else
2214
- if (event.getSource() == compositeItem)
2969
+ if (source == compositeItem || source == compositeButton)
22152970 {
22162971 group(new Composite());
22172972 } else
2218
- if (event.getSource() == randomItem)
2973
+ if (source == switchItem || source == switchButton)
22192974 {
22202975 RandomNode random = new RandomNode();
22212976 group(random);
22222977 if (random.size() > 0)
2223
- random.name = random.get(0).name + "Rnd";
2978
+ random.name = random.get(0).name + "Switch";
22242979 } else
2225
- if (event.getSource() == physicsItem)
2980
+ if (source == physicsItem)
22262981 {
22272982 group(new PhysicsNode());
22282983 } else
2229
- if (event.getSource() == frameselectorItem)
2984
+ if (source == frameselectorItem)
22302985 {
22312986 for (int i=0; i<group.selection.size(); i++)
22322987 {
....@@ -2238,7 +2993,7 @@
22382993 ResetModel();
22392994 refreshContents();
22402995 } else
2241
- if (event.getSource() == switchGeoItem)
2996
+ if (source == switchGeoItem)
22422997 {
22432998 for (int i=0; i<group.selection.size(); i++)
22442999 {
....@@ -2250,7 +3005,7 @@
22503005 ResetModel();
22513006 refreshContents();
22523007 } else
2253
- if (event.getSource() == switchTransfoItem)
3008
+ if (source == switchTransfoItem)
22543009 {
22553010 for (int i=0; i<group.selection.size(); i++)
22563011 {
....@@ -2262,7 +3017,7 @@
22623017 ResetModel();
22633018 refreshContents();
22643019 } else
2265
- if (event.getSource() == morphItem)
3020
+ if (source == morphItem)
22663021 {
22673022 for (int i=0; i<group.selection.size(); i++)
22683023 {
....@@ -2274,7 +3029,7 @@
22743029 ResetModel();
22753030 refreshContents();
22763031 } else
2277
- if (event.getSource() == scriptNodeItem)
3032
+ if (source == scriptNodeItem)
22783033 {
22793034 boolean atleastone = false;
22803035
....@@ -2313,215 +3068,252 @@
23133068 }
23143069 }
23153070 } else
2316
- if (event.getSource() == linkerItem)
3071
+ if (source == linkerItem)
23173072 {
23183073 group(new cLinker());
23193074 } else
2320
- if (event.getSource() == textureItem)
3075
+ if (source == textureItem || source == textureButton)
23213076 {
23223077 group(new TextureNode());
23233078 } else
2324
- if (event.getSource() == billboardItem)
3079
+ if (source == billboardItem)
23253080 {
23263081 group(new BillboardNode());
23273082 } else
2328
- if (event.getSource() == shadowXItem)
3083
+ if (source == shadowXItem)
23293084 {
23303085 CastShadow(0);
23313086 } else
2332
- if (event.getSource() == shadowYItem)
3087
+ if (source == shadowYItem)
23333088 {
23343089 CastShadow(1);
23353090 } else
2336
- if (event.getSource() == shadowZItem)
3091
+ if (source == shadowZItem)
23373092 {
23383093 CastShadow(2);
23393094 } else
2340
- if (event.getSource() == ungroupItem)
3095
+ if (source == ungroupItem || source == ungroupButton)
23413096 {
2342
- //ungroup();
3097
+ boolean hasRoot = false;
3098
+
23433099 for (int i=0; i<group.selection.size(); i++)
23443100 {
2345
- Ungroup(group.selection.get(i));
3101
+ if (group.selection.get(i) == group)
3102
+ {
3103
+ hasRoot = true;
3104
+ break;
3105
+ }
23463106 }
23473107
2348
- ClearSelection(false);
2349
-
2350
- refreshContents();
3108
+ if (!hasRoot)
3109
+ {
3110
+ for (int i=0; i<group.selection.size(); i++)
3111
+ {
3112
+ Ungroup(group.selection.get(i));
3113
+ }
3114
+
3115
+ ClearSelection(false);
3116
+
3117
+ refreshContents();
3118
+ }
23513119 } else
2352
- if (event.getSource() == genUVItem)
3120
+ if (source == genUVItem)
23533121 {
23543122 GenUV();
23553123 } else
2356
- if (event.getSource() == genNormalsCADItem)
3124
+ if (source == genNormalsCADItem)
23573125 {
23583126 GenNormals(true);
23593127 } else
2360
- if (event.getSource() == genNormalsMESHItem)
3128
+ if (source == genNormalsMESHItem)
23613129 {
2362
- GenNormals(true); // TODO
3130
+ GenNormalsMESH();
23633131 } else
2364
- if (event.getSource() == genNormalsORGANItem)
3132
+ if (source == genNormalsORGANItem)
23653133 {
23663134 GenNormals(false);
23673135 } else
2368
- if (event.getSource() == genNormalsMINEItem)
3136
+ if (source == genNormalsMINEItem)
23693137 {
23703138 GenNormalsMINE();
23713139 } else
2372
- if (event.getSource() == stripifyItem)
3140
+ if (source == stripifyItem)
23733141 {
23743142 Stripify();
23753143 } else
2376
- if (event.getSource() == unstripifyItem)
3144
+ if (source == unstripifyItem)
23773145 {
23783146 Unstripify();
23793147 } else
2380
- if (event.getSource() == trimItem)
3148
+ if (source == trimItem)
23813149 {
23823150 Trim();
23833151 } else
2384
- if (event.getSource() == untrimItem)
3152
+ if (source == untrimItem)
23853153 {
23863154 Untrim();
23873155 } else
2388
- if (event.getSource() == clearColorsItem)
3156
+ if (source == clearColorsItem)
23893157 {
23903158 ClearColors();
23913159 } else
2392
- if (event.getSource() == clearMaterialsItem)
3160
+ if (source == clearMaterialsItem)
23933161 {
23943162 ClearMaterials();
23953163 } else
2396
- if (event.getSource() == liveleavesItem)
3164
+ if (source == liveleavesItem)
23973165 {
23983166 LiveLeaves(true);
23993167 } else
2400
- if (event.getSource() == unliveleavesItem)
3168
+ if (source == unliveleavesItem)
24013169 {
24023170 LiveLeaves(false);
24033171 } else
2404
- if (event.getSource() == supportleavesItem)
3172
+ if (source == supportleavesItem)
24053173 {
24063174 SupportLeaves(true);
24073175 } else
2408
- if (event.getSource() == unsupportleavesItem)
3176
+ if (source == unsupportleavesItem)
24093177 {
24103178 SupportLeaves(false);
24113179 } else
2412
- if (event.getSource() == hideleavesItem)
3180
+ if (source == hideleavesItem)
24133181 {
24143182 HideLeaves(true);
24153183 } else
2416
- if (event.getSource() == showleavesItem)
3184
+ if (source == showleavesItem)
24173185 {
24183186 HideLeaves(false);
24193187 } else
2420
- if (event.getSource() == markleavesItem)
3188
+ if (source == markleavesItem)
24213189 {
24223190 MarkLeaves(true);
24233191 } else
2424
- if (event.getSource() == unmarkleavesItem)
3192
+ if (source == unmarkleavesItem)
24253193 {
24263194 MarkLeaves(false);
24273195 } else
2428
- if (event.getSource() == flipVItem)
3196
+ if (source == rewindleavesItem)
3197
+ {
3198
+ RewindLeaves(true);
3199
+ } else
3200
+ if (source == unrewindleavesItem)
3201
+ {
3202
+ RewindLeaves(false);
3203
+ } else
3204
+ if (source == randomleavesItem)
3205
+ {
3206
+ RandomLeaves(true);
3207
+ } else
3208
+ if (source == unrandomleavesItem)
3209
+ {
3210
+ RandomLeaves(false);
3211
+ } else
3212
+ if (source == flipVItem)
24293213 {
24303214 FlipV(true);
24313215 } else
2432
- if (event.getSource() == unflipVItem)
3216
+ if (source == unflipVItem)
24333217 {
24343218 FlipV(false);
24353219 } else
2436
- if (event.getSource() == lowTexturesItem)
3220
+ if (source == lowTexturesItem)
24373221 {
24383222 SetTexRes(0);
24393223 } else
2440
- if (event.getSource() == normalTexturesItem)
3224
+ if (source == normalTexturesItem)
24413225 {
24423226 SetTexRes(1);
24433227 } else
2444
- if (event.getSource() == highTexturesItem)
3228
+ if (source == highTexturesItem)
24453229 {
24463230 SetTexRes(2);
24473231 } else
2448
- if (event.getSource() == veryhighTexturesItem)
3232
+ if (source == veryhighTexturesItem)
24493233 {
24503234 SetTexRes(3);
24513235 } else
2452
- if (event.getSource() == maxTexturesItem)
3236
+ if (source == maxTexturesItem)
24533237 {
24543238 SetTexRes(4);
24553239 } else
2456
- if (event.getSource() == panoTexturesItem)
3240
+ if (source == panoTexturesItem)
24573241 {
24583242 SetTexRes(5);
24593243 } else
2460
- if (event.getSource() == reverseNormalsItem)
3244
+ if (source == reverseNormalsItem)
24613245 {
24623246 ReverseNormals();
24633247 } else
2464
- if (event.getSource() == parseverticesItem)
3248
+ if (source == parseverticesItem)
24653249 {
24663250 ParseVertices();
24673251 } else
2468
- if (event.getSource() == textureFieldItem)
3252
+ if (source == textureFieldItem)
24693253 {
24703254 TextureVertices();
24713255 } else
2472
- if (event.getSource() == alignItem)
3256
+ if (source == alignItem)
24733257 {
24743258 Align();
24753259 } else
2476
- if (event.getSource() == mirrorItem)
3260
+ if (source == mirrorItem)
24773261 {
24783262 MirrorPoses();
24793263 } else
2480
- if (event.getSource() == reduceMorphItem)
3264
+ if (source == reduceMorphItem)
24813265 {
24823266 MeshReduction(false);
24833267 } else
2484
- if (event.getSource() == reduce34MorphItem)
3268
+ if (source == reduce34MorphItem)
24853269 {
24863270 MeshReduction(true);
24873271 } else
2488
- if (event.getSource() == reverseTrianglesItem)
3272
+ if (source == reverseTrianglesItem)
24893273 {
24903274 ReverseTriangles();
24913275 } else
2492
- if (event.getSource() == reduceMeshItem)
3276
+ if (source == reduceMeshItem)
24933277 {
24943278 ReduceMesh(false);
24953279 } else
2496
- if (event.getSource() == reduce34MeshItem)
3280
+ if (source == reduce34MeshItem)
24973281 {
24983282 ReduceMesh(true);
24993283 } else
2500
- if (event.getSource() == increaseMeshItem)
3284
+ if (source == increaseMeshItem)
25013285 {
25023286 IncreaseMesh();
25033287 } else
2504
- if (event.getSource() == clipMeshItem)
3288
+ if (source == clipMeshItem)
25053289 {
25063290 ClipMesh();
25073291 } else
2508
- if (event.getSource() == smoothMeshItem)
3292
+ if (source == smoothMeshItem)
25093293 {
25103294 SmoothMesh();
25113295 } else
2512
- if (event.getSource() == transformgeometryItem)
3296
+ if (source == transformGeometryItem)
25133297 {
25143298 TransformGeometry();
25153299 } else
2516
- if (event.getSource() == resetTransformItem)
3300
+ if (source == transformChildrenItem)
3301
+ {
3302
+ TransformChildren();
3303
+ } else
3304
+ if (source == resetTransformItem)
25173305 {
25183306 ResetTransform();
25193307 } else
2520
- if (event.getSource() == resetCentroidItem)
3308
+ if (source == resetCentroidItem)
25213309 {
2522
- ResetCentroid();
3310
+ ResetCentroid(true);
25233311 } else
2524
- if (event.getSource() == resetParentItem)
3312
+ if (source == resetCentroidXZItem)
3313
+ {
3314
+ ResetCentroid(false);
3315
+ } else
3316
+ if (source == resetParentItem)
25253317 {
25263318 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25273319 {
....@@ -2531,7 +3323,7 @@
25313323
25323324 refreshContents();
25333325 } else
2534
- if (event.getSource() == repairParentItem)
3326
+ if (source == repairParentItem)
25353327 {
25363328 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25373329 {
....@@ -2545,7 +3337,21 @@
25453337
25463338 refreshContents();
25473339 } else
2548
- if (event.getSource() == sortbysizeItem)
3340
+ if (source == repairShadowItem)
3341
+ {
3342
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3343
+ {
3344
+ Object3D obj = (Object3D)e.nextElement();
3345
+ obj.RepairShadow();
3346
+// for (int i=0; i<obj.size(); i++)
3347
+// {
3348
+// obj.get(i).parent = obj;
3349
+// }
3350
+ }
3351
+
3352
+ refreshContents();
3353
+ } else
3354
+ if (source == sortbysizeItem)
25493355 {
25503356 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25513357 {
....@@ -2557,7 +3363,7 @@
25573363 ResetModel();
25583364 refreshContents();
25593365 } else
2560
- if (event.getSource() == sortbynameItem)
3366
+ if (source == sortbynameItem)
25613367 {
25623368 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25633369 {
....@@ -2569,7 +3375,7 @@
25693375 ResetModel();
25703376 refreshContents();
25713377 } else
2572
- if (event.getSource() == attachPigmentItem)
3378
+ if (source == attachPigmentItem)
25733379 {
25743380 String texture = GetFile("Attach pigment");
25753381 Object3D obj;
....@@ -2581,7 +3387,7 @@
25813387
25823388 refreshContents();
25833389 } else
2584
- if (event.getSource() == detachPigmentItem)
3390
+ if (source == detachPigmentItem)
25853391 {
25863392 Object3D obj;
25873393 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2592,7 +3398,7 @@
25923398
25933399 refreshContents();
25943400 } else
2595
- if (event.getSource() == attachBumpItem)
3401
+ if (source == attachBumpItem)
25963402 {
25973403 String texture = GetFile("Attach bump");
25983404 Object3D obj;
....@@ -2604,18 +3410,18 @@
26043410
26053411 refreshContents();
26063412 } else
2607
- if (event.getSource() == detachBumpItem)
3413
+ if (source == detachBumpItem)
26083414 {
26093415 Object3D obj;
26103416 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26113417 {
26123418 obj = (Object3D)e.nextElement();
2613
- obj.SetBumpTexture(null);
3419
+ obj.ResetBumpTexture();
26143420 }
26153421
26163422 refreshContents();
26173423 } else
2618
- if (event.getSource() == pigmentBumpItem)
3424
+ if (source == pigmentBumpItem)
26193425 {
26203426 Object3D obj;
26213427 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2626,158 +3432,262 @@
26263432
26273433 refreshContents();
26283434 } else
2629
- if (event.getSource() == flashSelectionButton)
3435
+ if (source == embedTexturesItem)
3436
+ {
3437
+ Object3D obj;
3438
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3439
+ {
3440
+ obj = (Object3D)e.nextElement();
3441
+ obj.EmbedTextures(true);
3442
+ }
3443
+
3444
+ refreshContents();
3445
+ } else
3446
+ if (source == deEmbedTexturesItem)
3447
+ {
3448
+ Object3D obj;
3449
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3450
+ {
3451
+ obj = (Object3D)e.nextElement();
3452
+ obj.EmbedTextures(false);
3453
+ }
3454
+
3455
+ CameraPane.texturepigment.clear();
3456
+ CameraPane.texturebump.clear();
3457
+
3458
+ refreshContents();
3459
+ } else
3460
+ if (source == flashSelectionButton)
26303461 {
26313462 CameraPane.flash = true;
26323463 refreshContents();
26333464 } else
2634
- if (event.getSource() == oneButton)
3465
+ if (source == oneButton)
26353466 {
26363467 } else
2637
- if (event.getSource() == twoButton)
3468
+ if (source == twoButton)
26383469 {
26393470 radio.layout = twoButton;
3471
+
3472
+ if (CameraPane.FULLSCREEN)
3473
+ fullscreenLayout = radio.layout;
3474
+
26403475 // bug
26413476 //gridPanel.setDividerLocation(1.0);
26423477 //bigPanel.setDividerLocation(0.0);
2643
- bigThree.remove(scenePanel);
2644
- bigThree.remove(centralPanel);
2645
- bigThree.remove(XYZPanel);
2646
- aWindowConstraints.gridx = 0;
2647
- aWindowConstraints.gridy = 0;
2648
- aWindowConstraints.gridwidth = 1;
2649
- // aConstraints.gridheight = 3;
2650
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2651
- aWindowConstraints.weightx = 0;
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(centralPanel, aWindowConstraints);
2660
- aWindowConstraints.weightx = 0;
2661
- aWindowConstraints.gridx = 4;
2662
- aWindowConstraints.gridwidth = 1;
2663
- // aConstraints.gridheight = 3;
2664
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2665
- //bigThree.add(XYZPanel, aWindowConstraints);
2666
- bigThree.revalidate();
3478
+// bigThree.remove(scenePanel);
3479
+// bigThree.remove(centralPanel);
3480
+// bigThree.remove(XYZPanel);
3481
+// aWindowConstraints.gridx = 0;
3482
+// aWindowConstraints.gridy = 0;
3483
+// aWindowConstraints.gridwidth = 1;
3484
+// // aConstraints.gridheight = 3;
3485
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3486
+// aWindowConstraints.weightx = 0;
3487
+// aWindowConstraints.weighty = 1;
3488
+// //bigThree.add(jtp, aWindowConstraints);
3489
+// aWindowConstraints.weightx = 1;
3490
+// aWindowConstraints.gridwidth = 3;
3491
+// // aConstraints.gridheight = 3;
3492
+// aWindowConstraints.gridx = 1;
3493
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3494
+// bigThree.add(centralPanel, aWindowConstraints);
3495
+// aWindowConstraints.weightx = 0;
3496
+// aWindowConstraints.gridx = 4;
3497
+// aWindowConstraints.gridwidth = 1;
3498
+// // aConstraints.gridheight = 3;
3499
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3500
+// //bigThree.add(XYZPanel, aWindowConstraints);
3501
+// scenePanel.setVisible(false);
3502
+// centralPanel.setVisible(true);
3503
+// XYZPanel.setVisible(false);
3504
+ bigThree.ClearUI();
3505
+ bigThree.add(centralPanel);
3506
+ bigThree.FlushUI();
3507
+
3508
+ cameraView.requestFocusInWindow();
3509
+
3510
+// refreshContents(true);
3511
+//
3512
+// try
3513
+// {
3514
+// java.awt.Robot bot = new java.awt.Robot();
3515
+// int mask = InputEvent.BUTTON1_MASK;
3516
+// bot.mouseMove(100, 100);
3517
+// bot.mousePress(mask);
3518
+// bot.mouseRelease(mask);
3519
+// }
3520
+// catch (Exception e)
3521
+// {
3522
+//
3523
+// }
3524
+
26673525 } else
2668
- if (event.getSource() == threeButton)
3526
+ if (source == threeButton)
26693527 {
26703528 radio.layout = threeButton;
2671
- bigThree.remove(scenePanel);
2672
- bigThree.remove(centralPanel);
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
- // aConstraints.gridheight = 3;
2685
- aWindowConstraints.gridx = 1;
2686
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2687
- bigThree.add(centralPanel, aWindowConstraints);
2688
- aWindowConstraints.weightx = 0;
2689
- aWindowConstraints.gridx = 4;
2690
- aWindowConstraints.gridwidth = 1;
2691
- // aConstraints.gridheight = 3;
2692
- aConstraints.fill = GridBagConstraints.VERTICAL;
2693
- bigThree.add(XYZPanel, aWindowConstraints);
2694
- bigThree.revalidate();
3529
+
3530
+ if (CameraPane.FULLSCREEN)
3531
+ fullscreenLayout = radio.layout;
3532
+
3533
+// bigThree.remove(scenePanel);
3534
+// bigThree.remove(centralPanel);
3535
+// bigThree.remove(XYZPanel);
3536
+// aWindowConstraints.gridx = 0;
3537
+// aWindowConstraints.gridy = 0;
3538
+// aWindowConstraints.gridwidth = 1;
3539
+// // aConstraints.gridheight = 3;
3540
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3541
+// aWindowConstraints.weightx = 0;
3542
+// aWindowConstraints.weighty = 1;
3543
+// //bigThree.add(jtp, aWindowConstraints);
3544
+// aWindowConstraints.weightx = 1;
3545
+// aWindowConstraints.gridwidth = 3;
3546
+// // aConstraints.gridheight = 3;
3547
+// aWindowConstraints.gridx = 1;
3548
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3549
+// bigThree.add(centralPanel, aWindowConstraints);
3550
+// aWindowConstraints.weightx = 0;
3551
+// aWindowConstraints.gridx = 4;
3552
+// aWindowConstraints.gridwidth = 1;
3553
+// // aConstraints.gridheight = 3;
3554
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3555
+// bigThree.add(XYZPanel, aWindowConstraints);
3556
+// bigThree.validate();
3557
+// scenePanel.setVisible(false);
3558
+// centralPanel.setVisible(true);
3559
+// XYZPanel.setVisible(true);
3560
+ bigThree.ClearUI();
3561
+ bigThree.add(scenePanel);
3562
+ bigThree.add(centralPanel);
3563
+ bigThree.FlushUI();
3564
+
3565
+ cameraView.requestFocusInWindow();
26953566 } else
2696
- if (event.getSource() == fourButton)
3567
+ if (source == fourButton)
26973568 {
26983569 radio.layout = fourButton;
2699
- bigThree.remove(scenePanel);
2700
- bigThree.remove(centralPanel);
2701
- bigThree.remove(XYZPanel);
2702
- aWindowConstraints.gridx = 0;
2703
- aWindowConstraints.gridy = 0;
2704
- aWindowConstraints.gridwidth = 1;
2705
- // aWindowConstraints.gridheight = 3;
2706
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2707
- aWindowConstraints.weightx = 1;
2708
- aWindowConstraints.weighty = 1;
2709
- bigThree.add(scenePanel, aWindowConstraints);
2710
- aWindowConstraints.weightx = 1;
2711
- aWindowConstraints.gridwidth = 3;
2712
- // aConstraints.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
- // aWindowConstraints.gridheight = 3;
2720
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2721
- //bigThree.add(XYZPanel, aWindowConstraints);
2722
- bigThree.revalidate();
3570
+
3571
+ if (CameraPane.FULLSCREEN)
3572
+ fullscreenLayout = radio.layout;
3573
+
3574
+// bigThree.remove(scenePanel);
3575
+// bigThree.remove(centralPanel);
3576
+// bigThree.remove(XYZPanel);
3577
+// aWindowConstraints.gridx = 0;
3578
+// aWindowConstraints.gridy = 0;
3579
+// aWindowConstraints.gridwidth = 1;
3580
+// // aWindowConstraints.gridheight = 3;
3581
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3582
+// aWindowConstraints.weightx = 1;
3583
+// aWindowConstraints.weighty = 1;
3584
+// bigThree.add(scenePanel, aWindowConstraints);
3585
+// aWindowConstraints.weightx = 1;
3586
+// aWindowConstraints.gridwidth = 3;
3587
+// // aConstraints.gridheight = 3;
3588
+// aWindowConstraints.gridx = 1;
3589
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3590
+// //bigThree.add(cameraPanel, aWindowConstraints);
3591
+// aWindowConstraints.weightx = 0;
3592
+// aWindowConstraints.gridx = 4;
3593
+// aWindowConstraints.gridwidth = 1;
3594
+// // aWindowConstraints.gridheight = 3;
3595
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3596
+// //bigThree.add(XYZPanel, aWindowConstraints);
3597
+// bigThree.validate();
3598
+// scenePanel.setVisible(true);
3599
+// centralPanel.setVisible(false);
3600
+// XYZPanel.setVisible(false);
3601
+ bigThree.ClearUI();
3602
+ bigThree.add(scenePanel);
3603
+ bigThree.FlushUI();
3604
+
3605
+ cameraView.requestFocusInWindow();
27233606 } else
2724
- if (event.getSource() == sixButton)
3607
+ if (source == sixButton)
27253608 {
27263609 radio.layout = sixButton;
2727
- bigThree.remove(scenePanel);
2728
- bigThree.remove(centralPanel);
2729
- bigThree.remove(XYZPanel);
2730
- aWindowConstraints.gridx = 0;
2731
- aWindowConstraints.gridy = 0;
2732
- aWindowConstraints.gridwidth = 1;
2733
- // aConstraints.gridheight = 3;
2734
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2735
- aWindowConstraints.weightx = 0;
2736
- aWindowConstraints.weighty = 1;
2737
- bigThree.add(scenePanel, aWindowConstraints);
2738
- aWindowConstraints.weightx = 1;
2739
- aWindowConstraints.gridwidth = 3;
2740
- // aWindowConstraints.gridheight = 3;
2741
- aWindowConstraints.gridx = 1;
2742
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2743
- bigThree.add(centralPanel, aWindowConstraints);
2744
- aWindowConstraints.weightx = 0;
2745
- aWindowConstraints.gridx = 4;
2746
- aWindowConstraints.gridwidth = 1;
2747
- // aWindowConstraints.gridheight = 3;
2748
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2749
- //bigThree.add(XYZPanel, aConstraints);
2750
- bigThree.revalidate();
3610
+
3611
+ if (CameraPane.FULLSCREEN)
3612
+ fullscreenLayout = radio.layout;
3613
+
3614
+// bigThree.remove(scenePanel);
3615
+// bigThree.remove(centralPanel);
3616
+// bigThree.remove(XYZPanel);
3617
+// aWindowConstraints.gridx = 0;
3618
+// aWindowConstraints.gridy = 0;
3619
+// aWindowConstraints.gridwidth = 1;
3620
+// // aConstraints.gridheight = 3;
3621
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3622
+// aWindowConstraints.weightx = 0;
3623
+// aWindowConstraints.weighty = 1;
3624
+// bigThree.add(scenePanel, aWindowConstraints);
3625
+// aWindowConstraints.weightx = 1;
3626
+// aWindowConstraints.gridwidth = 3;
3627
+// // aWindowConstraints.gridheight = 3;
3628
+// aWindowConstraints.gridx = 1;
3629
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3630
+// bigThree.add(centralPanel, aWindowConstraints);
3631
+// aWindowConstraints.weightx = 0;
3632
+// aWindowConstraints.gridx = 4;
3633
+// aWindowConstraints.gridwidth = 1;
3634
+// // aWindowConstraints.gridheight = 3;
3635
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3636
+// //bigThree.add(XYZPanel, aConstraints);
3637
+// bigThree.validate();
3638
+// scenePanel.setVisible(true);
3639
+// centralPanel.setVisible(true);
3640
+// XYZPanel.setVisible(false);
3641
+ bigThree.ClearUI();
3642
+ bigThree.add(centralPanel);
3643
+ bigThree.add(scenePanel);
3644
+ bigThree.FlushUI();
3645
+
3646
+ cameraView.requestFocusInWindow();
27513647 } else
2752
- if (event.getSource() == sevenButton)
3648
+ if (source == sevenButton)
27533649 {
27543650 radio.layout = sevenButton;
2755
- bigThree.remove(scenePanel);
2756
- bigThree.remove(centralPanel);
2757
- bigThree.remove(XYZPanel);
2758
- aWindowConstraints.gridx = 0;
2759
- aWindowConstraints.gridy = 0;
2760
- aWindowConstraints.gridwidth = 1;
2761
- // aWindowConstraints.gridheight = 3;
2762
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2763
- aWindowConstraints.weightx = 0;
2764
- aWindowConstraints.weighty = 1;
2765
- bigThree.add(scenePanel, aWindowConstraints);
2766
- aWindowConstraints.weightx = 1;
2767
- aWindowConstraints.gridwidth = 3;
2768
- // aWindowConstraints.gridheight = 3;
2769
- aWindowConstraints.gridx = 1;
2770
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2771
- bigThree.add(centralPanel, aWindowConstraints);
2772
- aWindowConstraints.weightx = 0;
2773
- aWindowConstraints.gridx = 4;
2774
- aWindowConstraints.gridwidth = 1;
2775
- // aConstraints.gridheight = 3;
2776
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2777
- bigThree.add(XYZPanel, aWindowConstraints);
2778
- bigThree.revalidate();
3651
+
3652
+ if (CameraPane.FULLSCREEN)
3653
+ fullscreenLayout = radio.layout;
3654
+
3655
+// bigThree.remove(scenePanel);
3656
+// bigThree.remove(centralPanel);
3657
+// bigThree.remove(XYZPanel);
3658
+// aWindowConstraints.gridx = 0;
3659
+// aWindowConstraints.gridy = 0;
3660
+// aWindowConstraints.gridwidth = 1;
3661
+// // aWindowConstraints.gridheight = 3;
3662
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3663
+// aWindowConstraints.weightx = 0;
3664
+// aWindowConstraints.weighty = 1;
3665
+// bigThree.add(scenePanel, aWindowConstraints);
3666
+// aWindowConstraints.weightx = 1;
3667
+// aWindowConstraints.gridwidth = 3;
3668
+// // aWindowConstraints.gridheight = 3;
3669
+// aWindowConstraints.gridx = 1;
3670
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3671
+// bigThree.add(centralPanel, aWindowConstraints);
3672
+// aWindowConstraints.weightx = 0;
3673
+// aWindowConstraints.gridx = 4;
3674
+// aWindowConstraints.gridwidth = 1;
3675
+// // aConstraints.gridheight = 3;
3676
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3677
+// bigThree.add(XYZPanel, aWindowConstraints);
3678
+// bigThree.validate();
3679
+// scenePanel.setVisible(true);
3680
+// centralPanel.setVisible(true);
3681
+// XYZPanel.setVisible(true);
3682
+ bigThree.ClearUI();
3683
+ bigThree.add(scenePanel);
3684
+ bigThree.add(centralPanel);
3685
+ bigThree.add(XYZPanel);
3686
+ bigThree.FlushUI();
3687
+
3688
+ cameraView.requestFocusInWindow();
27793689 } else
2780
- if (event.getSource() == rootButton)
3690
+ if (source == rootButton)
27813691 {
27823692 Object3D obj;
27833693 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2787,66 +3697,84 @@
27873697 EditObject(obj);
27883698 }
27893699
3700
+ cameraView.requestFocusInWindow();
27903701 refreshContents(true);
27913702 } else
2792
- if (event.getSource() == closeButton)
3703
+ if (source == closeButton)
27933704 {
27943705 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27953706 cRadio ab;
27963707 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27973708 {
27983709 ab = (cRadio)e.nextElement();
2799
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3710
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28003711 {
3712
+ // Patch to avoid bug with transparency.
3713
+ if (!ab.hadMaterial)
3714
+ {
3715
+ ab.object.material = null;
3716
+ }
3717
+
28013718 buttonGroup.remove(ab);
28023719 radioPanel.remove(ab);
28033720
2804
- ab.GetObject().editWindow = null;
3721
+ //ab.GetObject().editWindow = null;
3722
+ ab.GetObject().manipWindow = null;
28053723 // ab.GetObject().objectUI = null; // ?????????
28063724
28073725 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28083726 break;
28093727 }
28103728 }
3729
+
3730
+ cameraView.requestFocusInWindow();
28113731 refreshContents(true);
28123732 } else
2813
- if (event.getSource() == editItem || event.getSource() == editButton)
3733
+ if (source == editItem || source == editButton)
28143734 {
3735
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3736
+ {
3737
+ Object3D child = (Object3D)e.nextElement();
3738
+ child.pinned = true;
3739
+ }
3740
+
28153741 EditSelection(false);
28163742 } else
2817
- if (event.getSource() == uneditButton)
3743
+ if (source == uneditButton)
28183744 {
28193745 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28203746 {
28213747 Object3D child = (Object3D)e.nextElement();
28223748 if(child.editWindow != null)
28233749 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3750
+ child.pinned = false;
28243751 child.CloseUI();
28253752 listUI.remove(child);
28263753
2827
- child.editWindow = null; // ???????????
3754
+ //child.editWindow = null; // ???????????
28283755 }
2829
- objEditor.ctrlPanel.revalidate();
3756
+ objEditor.ctrlPanel.FlushUI();
28303757 //objEditor.jTree.clearSelection();
28313758 //objEditor.ResetSliders();
28323759 refreshContents(true);
28333760 } else
2834
- if (event.getSource() == clearPanelButton)
3761
+ if (source == clearPanelButton)
28353762 {
28363763 assert(copy == group);
28373764 //copy.ClearUI();
28383765 for (Object3D obj : listUI)
28393766 {
3767
+ obj.pinned = false;
28403768 obj.CloseUI();
28413769 }
28423770 listUI.clear();
28433771 refreshContents(true);
28443772 } else
2845
- if (event.getSource() == allParamsButton)
3773
+ if (source == allParamsButton)
28463774 {
28473775 assert(copy == group);
28483776
2849
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3777
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28503778
28513779 for (Object3D obj : listUI)
28523780 {
....@@ -2863,19 +3791,19 @@
28633791
28643792 refreshContents(true);
28653793 } else
2866
- if (event.getSource() == unselectButton)
3794
+ if (source == unselectButton)
28673795 {
28683796 objEditor.jTree.clearSelection();
28693797 // ?? oct 2012 GrafreeD.clipboard.clear();
28703798 objEditor.ResetSliders();
28713799 refreshContents(true);
28723800 } else
2873
- if(event.getSource() instanceof cRadio)
3801
+ if(source instanceof cRadio)
28743802 {
28753803 group.parent = keepparent;
28763804 group.attributes = 0;
28773805 //group.editWindow = null;
2878
- /*cRadio*/ radio = (cRadio)event.getSource();
3806
+ /*cRadio*/ radio = (cRadio)source;
28793807 Object3D obj = radio.GetObject();
28803808 System.out.println("Edit " + obj);
28813809 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2895,7 +3823,10 @@
28953823 }
28963824
28973825 copy = group;
2898
- //CameraPane.theRenderer.object = group;
3826
+
3827
+ SetUndoStates();
3828
+
3829
+ //Globals.theRenderer.object = group;
28993830 if(!useclient)
29003831 {
29013832 cameraView.renderCamera = radio.camera;
....@@ -2904,25 +3835,52 @@
29043835 cameraView.cameras[cameraView.cameracount] = radio.camera;
29053836 cameraView.targetLookAt.set(radio.camera.lookAt);
29063837 cameraView.object = group;
2907
- cameraView.lighttouched = true;
3838
+ //cameraView.lighttouched = true;
3839
+ Globals.lighttouched = true;
29083840 topView.object = group;
29093841 frontView.object = group;
29103842 sideView.object = group;
29113843 }
2912
- group.editWindow = this;
3844
+
3845
+// fix "+" issue
3846
+ //group.editWindow = this;
3847
+ group.manipWindow = this;
3848
+
29133849 /*
29143850 currentLayout = radio.layout;
29153851 if (currentLayout == null)
29163852 currentLayout = sevenButton;
29173853 */
29183854 radio.layout.doClick();
3855
+
3856
+ ClearUnpinned();
3857
+ //Grafreed.Assert(group != null);
3858
+ //Grafreed.Assert(group.selection != null);
3859
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3860
+ if (group.selection == null || group.selection.size() == 1)
3861
+ EditSelection(false);
29193862 keepparent = group.parent;
29203863 // PARENT = NULL or not???
29213864 //group.parent = null; // ROOT
29223865 //group.attributes = -1;
29233866 ResetModel();
3867
+
3868
+ cameraView.requestFocusInWindow();
29243869 refreshContents(true);
2925
- }
3870
+ } else if (event.getSource() == editCameraItem)
3871
+ {
3872
+ cameraView.ProtectCamera();
3873
+ cameraView.repaint();
3874
+ return;
3875
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3876
+ {
3877
+ cameraView.RevertCamera();
3878
+ cameraView.repaint();
3879
+ return;
3880
+ // } else if (event.getSource() == textureButton)
3881
+ // {
3882
+ // return; // true;
3883
+ }
29263884 else
29273885 {
29283886 //return super.action(event, arg);
....@@ -2931,7 +3889,6 @@
29313889 }
29323890
29333891 boolean useclient = false;
2934
- cRadio radio;
29353892
29363893 void ToggleRoot()
29373894 {
....@@ -2940,7 +3897,7 @@
29403897 if (useclient)
29413898 {
29423899 cameraView.object = client;
2943
- cameraView.lighttouched = true;
3900
+ Globals.lighttouched = true;
29443901 //topView.object = client;
29453902 //frontView.object = client;
29463903 //sideView.object = client;
....@@ -2948,7 +3905,7 @@
29483905 else
29493906 {
29503907 cameraView.object = group;
2951
- cameraView.lighttouched = true;
3908
+ Globals.lighttouched = true;
29523909 //topView.object = group;
29533910 //frontView.object = group;
29543911 //sideView.object = group;
....@@ -2983,6 +3940,28 @@
29833940 refreshContents();
29843941 }
29853942
3943
+ void TransformChildren()
3944
+ {
3945
+ Object3D obj;
3946
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3947
+ {
3948
+ obj = (Object3D)e.nextElement();
3949
+ obj.KeepTextureMatrices();
3950
+ obj.TransformChildren();
3951
+ obj.RestoreTextureMatrices();
3952
+
3953
+// if (obj.parent == null)
3954
+// {
3955
+// System.out.println("NULL PARENT!");
3956
+// new Exception().printStackTrace();
3957
+// }
3958
+// else
3959
+// TouchTransform(obj);
3960
+// //obj.parent.Touch();
3961
+ }
3962
+
3963
+ refreshContents();
3964
+ }
29863965
29873966 void ResetTransform()
29883967 {
....@@ -3095,7 +4074,7 @@
30954074 refreshContents();
30964075 }
30974076
3098
- void ResetCentroid()
4077
+ void ResetCentroid(boolean full)
30994078 {
31004079 Object3D obj;
31014080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3110,12 +4089,16 @@
31104089 LA.matIdentity(Object3D.mat);
31114090 obj.getBounds(minima, maxima, false);
31124091 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3113
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4092
+ if (full)
4093
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31144094 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31154095 obj.TransformMesh(Object3D.mat);
4096
+
31164097 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3117
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4098
+ if (full)
4099
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31184100 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4101
+
31194102 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31204103 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31214104 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3144,7 +4127,8 @@
31444127
31454128 int size = obj.MemorySize();
31464129
3147
- System.err.println((size/1024) + " KB is the size of " + obj);
4130
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4131
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
31484132 }
31494133 }
31504134 catch (Exception e)
....@@ -3181,9 +4165,9 @@
31814165 obj = (Object3D)e.nextElement();
31824166
31834167 System.out.println("Object is: " + obj);
3184
- GrafreeD.AnalyzeObject(obj);
4168
+ Grafreed.AnalyzeObject(obj);
31854169 System.out.println("Boundary rep: " + obj.bRep);
3186
- GrafreeD.AnalyzeObject(obj.bRep);
4170
+ Grafreed.AnalyzeObject(obj.bRep);
31874171
31884172 // System.err.println((size/1024) + " KB is the size of " + obj);
31894173 }
....@@ -3225,6 +4209,13 @@
32254209 void GenNormals(boolean crease)
32264210 {
32274211 group.GenNormalsS(crease);
4212
+
4213
+ refreshContents();
4214
+ }
4215
+
4216
+ void GenNormalsMESH()
4217
+ {
4218
+ group.GenNormalsMeshS();
32284219
32294220 refreshContents();
32304221 }
....@@ -3397,8 +4388,8 @@
33974388
33984389 void ParseVertices()
33994390 {
3400
- boolean epsequal = GrafreeD.epsequal;
3401
- GrafreeD.epsequal = true;
4391
+ boolean epsequal = Grafreed.epsequal;
4392
+ Grafreed.epsequal = true;
34024393
34034394 for (int i=0; i<group.selection.size(); i++)
34044395 {
....@@ -3423,7 +4414,7 @@
34234414 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34244415 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34254416
3426
- g.add(GrafreeD.clipboard);
4417
+ g.add(Grafreed.clipboard);
34274418
34284419 buffer.add(g);
34294420 }
....@@ -3438,7 +4429,7 @@
34384429 makeSomething(buffer, i==group.selection.size()-1);
34394430 }
34404431
3441
- GrafreeD.epsequal = epsequal;
4432
+ Grafreed.epsequal = epsequal;
34424433
34434434 refreshContents();
34444435 }
....@@ -3456,7 +4447,16 @@
34564447 String pigment = Object3D.GetPigment(tex);
34574448 //String bump = Object3D.GetBump(tex);
34584449
3459
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4450
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4451
+
4452
+ try
4453
+ {
4454
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4455
+ }
4456
+ catch (Exception e)
4457
+ {
4458
+ System.err.println("FAIL: " + node);
4459
+ }
34604460
34614461 double s = v.s;
34624462
....@@ -3544,11 +4544,11 @@
35444544
35454545 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35464546
3547
- boolean random = CameraPane.RANDOM;
3548
- CameraPane.RANDOM = false; // parse all random nodes
4547
+ boolean random = CameraPane.SWITCH;
4548
+ CameraPane.SWITCH = false; // parse all random nodes
35494549 lowres.linkVerticesThis(null);
35504550 lowres.linkVerticesThis(sn);
3551
- CameraPane.RANDOM = random;
4551
+ CameraPane.SWITCH = random;
35524552
35534553 System.err.flush();
35544554
....@@ -3588,7 +4588,7 @@
35884588 return;
35894589
35904590 Object3D poses = group.selection.get(0);
3591
- Object3D ref = GrafreeD.clipboard.get(0);
4591
+ Object3D ref = Grafreed.clipboard.get(0);
35924592
35934593 Object3D newgroup = new Object3D("Po:" + poses.name);
35944594
....@@ -3757,7 +4757,7 @@
37574757 group.selection.RelinkToSupport(); // july 2014
37584758 System.out.println("DONE.");
37594759 refreshContents();
3760
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4760
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
37614761 }
37624762
37634763 void ReduceMesh(boolean reduction34)
....@@ -3782,9 +4782,9 @@
37824782
37834783 void ClipMesh()
37844784 {
3785
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4785
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37864786 {
3787
- Object3D content = GrafreeD.clipboard.get(0);
4787
+ Object3D content = Grafreed.clipboard.get(0);
37884788
37894789 if (content instanceof cGroup && ((cGroup)content).transientlink )
37904790 content = ((cGroup)content).get(0);
....@@ -3793,7 +4793,7 @@
37934793 // {
37944794 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37954795 // }
3796
- group.selection.ClipMesh(GrafreeD.clipboard);
4796
+ group.selection.ClipMesh(Grafreed.clipboard);
37974797 }
37984798 // group.selection.ClipMesh(GrafreeD.clipboard);
37994799 System.out.println("DONE.");
....@@ -3840,6 +4840,18 @@
38404840 void MarkLeaves(boolean hide)
38414841 {
38424842 group.selection.MarkLeaves(hide);
4843
+ refreshContents();
4844
+ }
4845
+
4846
+ void RewindLeaves(boolean hide)
4847
+ {
4848
+ group.selection.RewindLeaves(hide);
4849
+ refreshContents();
4850
+ }
4851
+
4852
+ void RandomLeaves(boolean hide)
4853
+ {
4854
+ group.selection.RandomLeaves(hide);
38434855 refreshContents();
38444856 }
38454857
....@@ -3914,28 +4926,25 @@
39144926 // }
39154927 // }
39164928
3917
- static boolean allparams = true;
3918
-
3919
- static Vector<Object3D> listUI = new Vector<Object3D>();
3920
-
39214929 void EditSelection(boolean newWindow)
39224930 {
4931
+ if (group.selection == null)
4932
+ {
4933
+ EditElement(group, newWindow); // ? new
4934
+ return;
4935
+ }
4936
+
39234937 // aConstraints.gridy = 0;
39244938 for (int i=0; i<group.selection.size(); i++)
39254939 {
39264940 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39274941 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3928
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4942
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39294943
39304944 Object3D elem = (Object3D)group.selection.elementAt(i);
3931
- if(elem != group)
4945
+ if(elem != group || !newWindow)
39324946 {
3933
- // if (!(elem instanceof Composite))
3934
- // newWindow = false;
3935
- listUI.add(elem);
3936
- elem.openEditWindow(this, newWindow); //, false);
3937
- System.out.println("edit : " + elem);
3938
- elem.editWindow.refreshContents(true); // ? new
4947
+ EditElement(elem, newWindow); // ? new
39394948 }
39404949 }
39414950 }
....@@ -4010,7 +5019,8 @@
40105019 //new Exception().printStackTrace();
40115020
40125021 freezemodel = true;
4013
-
5022
+ ClearUnpinned();
5023
+
40145024 /**/
40155025 //switch (event.id)
40165026 {
....@@ -4018,7 +5028,6 @@
40185028 //case 702: // Event.LIST_DESELECT
40195029 group.deselectAll();
40205030 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4021
- objEditor.ClearInfo(); // .GetMaterial());
40225031 if (tps != null)
40235032 {
40245033 for (int i=0; i < tps.length; i++)
....@@ -4027,33 +5036,39 @@
40275036
40285037 //if (child.parent != null)
40295038 //child.parent.addSelectee(child);
5039
+ objEditor.SetMaterial(child);
40305040 group.addSelectee(child);
4031
- objEditor.SetMaterial(child); // .GetMaterial());
4032
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4033
- System.err.println("info : " + child.GetPath());
40345041 }
40355042 }
4036
- else
4037
- {
4038
- objEditor.SetMaterial(group); // .GetMaterial());
4039
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4040
- System.err.println("info : " + group.GetPath());
4041
- }
5043
+// else
5044
+// {
5045
+// objEditor.SetMaterial(group); // .GetMaterial());
5046
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5047
+// System.err.println("info : " + group.GetPath());
5048
+// }
40425049
4043
- objEditor.SetText(); // jan 2014
4044
-
4045
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5050
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
40465051 CameraPane.flash = true;
40475052
4048
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5053
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40495054 // a camera
40505055 {
4051
- CameraPane.camerachangeframe = 0; // don't refuse it
4052
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4053
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4054
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
5056
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5057
+ {
5058
+ CameraPane.camerachangeframe = 0; // don't refuse it
5059
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5060
+ }
5061
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5062
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
40555063 }
40565064
5065
+ if (tps != null && tps.length == 1)
5066
+ {
5067
+ EditSelection(false);
5068
+ }
5069
+
5070
+ SetPinStates(tps != null && tps.length > 0);
5071
+
40575072 refreshContents();
40585073 //return true;
40595074 }
....@@ -4062,6 +5077,35 @@
40625077
40635078 freezemodel = false;
40645079 }
5080
+
5081
+ void SetPinStates(boolean enabled)
5082
+ {
5083
+ editButton.setEnabled(enabled);
5084
+ uneditButton.setEnabled(enabled);
5085
+ unselectButton.setEnabled(enabled);
5086
+ flashSelectionButton.setEnabled(enabled);
5087
+ }
5088
+
5089
+ void refreshContents(boolean cp)
5090
+ {
5091
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5092
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5093
+ {
5094
+ objEditor.ClearInfo(); // .GetMaterial());
5095
+
5096
+ for (int i=0; i < group.selection.Size(); i++)
5097
+ {
5098
+ Object3D child = (Object3D) group.selection.get(i);
5099
+
5100
+ objEditor.AddInfo(child, this, true);
5101
+ System.err.println("info : " + child.GetPath());
5102
+ }
5103
+
5104
+ objEditor.SetText(); // jan 2014
5105
+ }
5106
+
5107
+ super.refreshContents(cp);
5108
+ }
40655109
40665110 void linkSomething(Object3D thing)
40675111 {
....@@ -4133,16 +5177,19 @@
41335177 {
41345178 if (group.selection.isEmpty())
41355179 return;
4136
- GrafreeD.clipboardIsTempGroup = false;
5180
+
5181
+ Grafreed.clipboardIsTempGroup = false;
41375182 Composite tGroup = null;
41385183 if (group.selection.size() > 0) // 1)
41395184 {
41405185 tGroup = new cGroup();
4141
- GrafreeD.clipboardIsTempGroup = true;
5186
+ Grafreed.clipboardIsTempGroup = true;
41425187 }
41435188
41445189 if (cut)
41455190 {
5191
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5192
+// Save();
41465193 //int indices[] = jList.getSelectedIndices();
41475194 //for (int i = indices.length - 1; i >= 0; i--)
41485195 //jList.remove(indices[i]);
....@@ -4178,16 +5225,16 @@
41785225 //System.out.println("cut " + child);
41795226 //System.out.println("parent = " + child.parent);
41805227 // tmp.addChild(child);
4181
- if (GrafreeD.clipboardIsTempGroup)
5228
+ if (Grafreed.clipboardIsTempGroup)
41825229 tGroup.add/*Child*/(tmp);
41835230 else
4184
- GrafreeD.clipboard = tmp;
5231
+ Grafreed.clipboard = tmp;
41855232 }
41865233 else
4187
- if (GrafreeD.clipboardIsTempGroup)
5234
+ if (Grafreed.clipboardIsTempGroup)
41885235 tGroup.add/*Child*/(child);
41895236 else
4190
- GrafreeD.clipboard = child;
5237
+ Grafreed.clipboard = child;
41915238 }
41925239
41935240 //ResetModel();
....@@ -4219,21 +5266,23 @@
42195266 //System.out.println("cut " + elem);
42205267 //System.out.println("parent = " + elem.parent);
42215268 // tmp.addChild(elem);
4222
- if (GrafreeD.clipboardIsTempGroup)
5269
+ if (Grafreed.clipboardIsTempGroup)
42235270 tGroup.add/*Child*/(tmp);
42245271 else
4225
- GrafreeD.clipboard = tmp;
5272
+ Grafreed.clipboard = tmp;
42265273 }
42275274 else
4228
- if (GrafreeD.clipboardIsTempGroup)
5275
+ if (Grafreed.clipboardIsTempGroup)
42295276 tGroup.add/*Child*/(child);
42305277 else
4231
- GrafreeD.clipboard = child;
5278
+ Grafreed.clipboard = child;
42325279 }
42335280
42345281 }
4235
- if (GrafreeD.clipboardIsTempGroup)
4236
- GrafreeD.clipboard = tGroup;
5282
+
5283
+ if (Grafreed.clipboardIsTempGroup)
5284
+ Grafreed.clipboard = tGroup;
5285
+
42375286 if (cut)
42385287 {
42395288 ResetModel();
....@@ -4243,11 +5292,15 @@
42435292
42445293 void paste(boolean expand)
42455294 {
5295
+ if (Globals.REPLACEONMAKE)
5296
+ Save();
5297
+ boolean keep = Globals.REPLACEONMAKE;
5298
+ Globals.REPLACEONMAKE = false;
42465299 // if (GrafreeD.clipboard == null)
42475300 // return;
42485301 boolean first = true;
42495302
4250
- if (GrafreeD.clipboardIsTempGroup)
5303
+ if (Grafreed.clipboardIsTempGroup)
42515304 {
42525305 Composite temp;
42535306
....@@ -4258,7 +5311,7 @@
42585311 temp = (Composite)Applet3D.clipboard.deepCopy();
42595312 */
42605313 Object3D elem;
4261
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5314
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
42625315 {
42635316 Object3D child = (Object3D)e.nextElement();
42645317
....@@ -4292,21 +5345,22 @@
42925345 //Object3D cb = Applet3D.clipboard;
42935346 //temp.addChild(cb);
42945347 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4295
- assert(GrafreeD.clipboard.parent == null);
4296
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4297
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4298
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4299
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5348
+ assert(Grafreed.clipboard.parent == null);
5349
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5350
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5351
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5352
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43005353 else
4301
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4302
- GrafreeD.clipboard.get(0).parent = keepparent;
5354
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5355
+ Grafreed.clipboard.get(0).parent = keepparent;
43035356 }
43045357
5358
+ Globals.REPLACEONMAKE = keep;
43055359 ResetModel();
43065360 refreshContents();
43075361 }
43085362
4309
- void pasteInto(boolean copyit)
5363
+ void pasteInto(boolean copyit, boolean clone)
43105364 {
43115365 // if (GrafreeD.clipboard == null)
43125366 // return;
....@@ -4335,15 +5389,22 @@
43355389 if (copyit)
43365390 {
43375391 // paste(false);
4338
- CloneClipboard(false); // sept 2014
5392
+ if (clone)
5393
+ {
5394
+ CloneClipboard(false); // sept 2014
5395
+ }
5396
+ else
5397
+ {
5398
+ paste(false);
5399
+ }
43395400 }
43405401 else
43415402 {
43425403 boolean first = true;
43435404
4344
- if (GrafreeD.clipboardIsTempGroup)
5405
+ if (Grafreed.clipboardIsTempGroup)
43455406 {
4346
- Composite temp = (Composite)GrafreeD.clipboard;
5407
+ Composite temp = (Composite)Grafreed.clipboard;
43475408 Object3D copy;
43485409 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43495410 {
....@@ -4353,7 +5414,7 @@
43535414 }
43545415 } else
43555416 {
4356
- linkSomething(GrafreeD.clipboard); //.get(0));
5417
+ linkSomething(Grafreed.clipboard); //.get(0));
43575418 }
43585419 }
43595420 }
....@@ -4430,6 +5491,10 @@
44305491
44315492 void group(Object3D csg, boolean grab)
44325493 {
5494
+ if (Globals.REPLACEONMAKE)
5495
+ Save();
5496
+ boolean keep = Globals.REPLACEONMAKE;
5497
+ Globals.REPLACEONMAKE = false;
44335498 if (//false) // why??
44345499 !group.selection.isEmpty())
44355500 {
....@@ -4543,10 +5608,15 @@
45435608 //node.add(csg);
45445609 //makeSomething(node);
45455610 makeSomething(csg);
5611
+ Globals.REPLACEONMAKE = keep;
45465612 }
45475613
45485614 void Ungroup(Object3D g)
45495615 {
5616
+ if (Globals.REPLACEONMAKE)
5617
+ Save();
5618
+ boolean keep = Globals.REPLACEONMAKE;
5619
+ Globals.REPLACEONMAKE = false;
45505620 if (g instanceof HiddenObject)
45515621 {
45525622 HiddenObject h = (HiddenObject) g;
....@@ -4563,6 +5633,7 @@
45635633 objEditor.makeSomething(g.get(i), false);
45645634 }
45655635 }
5636
+ Globals.REPLACEONMAKE = keep;
45665637 }
45675638
45685639 void ungroup()
....@@ -4758,21 +5829,6 @@
47585829 }
47595830 */
47605831
4761
- void ImportGFD()
4762
- {
4763
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4764
- browser.show();
4765
- String filename = browser.getFile();
4766
- if (filename != null && filename.length() > 0)
4767
- {
4768
- String fullname = browser.getDirectory() + filename;
4769
-
4770
- //Object3D readobj =
4771
- objEditor.ReadGFD(fullname, objEditor);
4772
- //makeSomething(readobj);
4773
- }
4774
- }
4775
-
47765832 /*
47775833 public void Callback(Object obj)
47785834 {
....@@ -4796,26 +5852,9 @@
47965852 }
47975853 */
47985854
4799
- void ImportVRMLX3D()
4800
- {
4801
- if (GrafreeD.standAlone)
4802
- {
4803
- /**/
4804
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4805
- browser.show();
4806
- String filename = browser.getFile();
4807
- if (filename != null && filename.length() > 0)
4808
- {
4809
- String fullname = browser.getDirectory() + filename;
4810
- LoadVRMLX3D(fullname);
4811
- }
4812
- /**/
4813
- }
4814
- }
4815
-
48165855 String GetFile(String dialogName)
48175856 {
4818
- if (GrafreeD.standAlone)
5857
+ if (Grafreed.standAlone)
48195858 {
48205859 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48215860 browser.show();
....@@ -4879,10 +5918,49 @@
48795918 cButton flashSelectionButton;
48805919 cButton editButton;
48815920 cButton uneditButton;
5921
+ JCheckBox allParamsButton;
48825922 cButton clearpanelButton;
4883
- cButton allParamsButton;
48845923 cButton unselectButton;
48855924
5925
+ cButton restoreCameraButton;
5926
+
5927
+ cButton saveButton;
5928
+ cButton oneStepButton;
5929
+
5930
+ cButton groupButton;
5931
+ cButton ungroupButton;
5932
+ cButton compositeButton;
5933
+ cButton switchButton;
5934
+ cButton loopButton;
5935
+ cButton textureButton;
5936
+
5937
+ cButton skybox1Button;
5938
+ cButton skybox2Button;
5939
+ cButton skybox3Button;
5940
+ cButton skybox4Button;
5941
+ cButton skybox5Button;
5942
+ cButton skybox6Button;
5943
+ cButton skybox7Button;
5944
+
5945
+ cButton skybox11Button;
5946
+ cButton skybox12Button;
5947
+ cButton skybox13Button;
5948
+ cButton skybox14Button;
5949
+ cButton skybox15Button;
5950
+ cButton skybox16Button;
5951
+ cButton skybox17Button;
5952
+
5953
+ cButton gridButton;
5954
+ cButton boxButton;
5955
+ cButton sphereButton;
5956
+ cButton coneButton;
5957
+ cButton torusButton;
5958
+ cButton superButton;
5959
+ cButton kleinButton;
5960
+ cButton particlesButton;
5961
+ cButton overlayButton;
5962
+ cButton lightButton;
5963
+
48865964 cButton screenfitButton;
48875965 cButton screenfitpointButton;
48885966 cButton snapobjectButton;
....@@ -4894,14 +5972,6 @@
48945972
48955973 cButton setsupportButton;
48965974
4897
- cButton twoButton;
4898
- cButton sixButton;
4899
- cButton threeButton;
4900
- cButton sevenButton;
4901
- cButton fourButton; // full panel
4902
- cButton oneButton; // full XYZ
4903
- //cButton currentLayout;
4904
-
49055975 //
49065976 //Composite
49075977 Object3D // to do !!
....@@ -4911,9 +5981,11 @@
49115981 //JTree jTree;
49125982 private MenuItem lookAtItem;
49135983 private MenuItem lookFromItem;
4914
- private MenuItem switchItem;
5984
+ private MenuItem switchViewItem;
49155985 private MenuItem cutItem;
4916
- private MenuItem duplicateItem;
5986
+ private MenuItem undoItem;
5987
+ private MenuItem redoItem;
5988
+ private JMenuItem duplicateItem;
49175989 private MenuItem cloneItem;
49185990 private MenuItem cloneSupportItem;
49195991 private MenuItem overwriteGeoItem;
....@@ -4926,7 +5998,7 @@
49265998 private MenuItem linkverticesItem;
49275999 private MenuItem relinkverticesItem;
49286000 private MenuItem setMasterItem;
4929
- private MenuItem resetMeshItem;
6001
+ private MenuItem resetAllItem;
49306002 private MenuItem stepAllItem;
49316003 private MenuItem revertMeshItem;
49326004 private MenuItem poseMeshItem;
....@@ -4937,10 +6009,11 @@
49376009 private MenuItem mergeGeometriesItem;
49386010 private MenuItem copyItem;
49396011 private MenuItem pasteItem;
6012
+ private MenuItem pasteIntoItem;
49406013 private MenuItem pasteLinkItem;
49416014 private MenuItem pasteCloneItem;
49426015 private MenuItem pasteExpandItem;
4943
- private MenuItem clearItem;
6016
+ private MenuItem deleteItem;
49446017 private MenuItem clearAllItem;
49456018 private MenuItem genUVItem;
49466019 private MenuItem genNormalsMESHItem;
....@@ -4975,6 +6048,10 @@
49756048 private MenuItem showleavesItem;
49766049 private MenuItem markleavesItem;
49776050 private MenuItem unmarkleavesItem;
6051
+ private MenuItem rewindleavesItem;
6052
+ private MenuItem unrewindleavesItem;
6053
+ private MenuItem randomleavesItem;
6054
+ private MenuItem unrandomleavesItem;
49786055
49796056 private MenuItem flipVItem;
49806057 private MenuItem unflipVItem;
....@@ -4986,15 +6063,17 @@
49866063 private MenuItem panoTexturesItem;
49876064
49886065 private MenuItem resetCentroidItem;
4989
- private MenuItem transformgeometryItem;
6066
+ private MenuItem resetCentroidXZItem;
49906067 private MenuItem resetTransformItem;
6068
+ private MenuItem transformGeometryItem;
6069
+ private MenuItem transformChildrenItem;
49916070 private MenuItem hideItem;
49926071 private MenuItem grabItem;
49936072 private MenuItem backItem;
49946073 private MenuItem frontItem;
49956074 private MenuItem cameraItem;
49966075 private MenuItem compositeItem;
4997
- private MenuItem randomItem;
6076
+ private MenuItem switchItem;
49986077 private MenuItem physicsItem;
49996078 private MenuItem frameselectorItem;
50006079 private MenuItem scriptNodeItem;
....@@ -5009,6 +6088,7 @@
50096088
50106089 private MenuItem resetParentItem;
50116090 private MenuItem repairParentItem;
6091
+ private MenuItem repairShadowItem;
50126092 private MenuItem sortbysizeItem;
50136093 private MenuItem sortbynameItem;
50146094
....@@ -5017,6 +6097,8 @@
50176097 private MenuItem attachBumpItem;
50186098 private MenuItem detachBumpItem;
50196099 private MenuItem pigmentBumpItem;
6100
+ private MenuItem embedTexturesItem;
6101
+ private MenuItem deEmbedTexturesItem;
50206102
50216103 private MenuItem particleItem;
50226104 private MenuItem ragdollItem;
....@@ -5033,7 +6115,7 @@
50336115 private MenuItem blobItem;
50346116 private MenuItem latheItem;
50356117 private MenuItem bezierItem;
5036
- private MenuItem checkerItem;
6118
+ private MenuItem overlayItem;
50376119 private MenuItem meshItem;
50386120 // private MenuItem meshGroupItem;
50396121 private MenuItem springItem;
....@@ -5055,11 +6137,6 @@
50556137 private MenuItem doubleItem;
50566138 private MenuItem tripleItem;
50576139
5058
- private MenuItem importGFDItem;
5059
- private MenuItem importVRMLX3DItem;
5060
- private MenuItem import3DSItem;
5061
- private MenuItem importOBJItem;
5062
-
50636140 private MenuItem computeAOItem;
50646141 private MenuItem recompileItem;
50656142 private MenuItem editScriptItem;
....@@ -5069,4 +6146,8 @@
50696146 private MenuItem analyzeItem;
50706147 private MenuItem dumpItem;
50716148 //boolean freezemodel = false;
6149
+
6150
+ Menu cameraMenu;
6151
+ MenuItem editCameraItem;
6152
+ MenuItem restoreCameraItem;
50726153 }