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,17 +314,29 @@
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 {
86
- // Object3D keep = GraphreeD.clipboard;
335
+ if (Globals.REPLACEONMAKE)
336
+ Save();
337
+ boolean keep = Globals.REPLACEONMAKE;
338
+ Globals.REPLACEONMAKE = false;
339
+ // Object3D keep = GrafreeD.clipboard;
87340 //Object3D obj;
88341 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
89342 {
....@@ -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(GraphreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
102
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GraphreeD.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(GraphreeD.clipboard, false));
107
- GraphreeD.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)GraphreeD.clone(obj);
375
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122376 obj.parent = parent;
123377 // obj.support = support;
124378 // clone.support = support; // aout 2013
....@@ -147,30 +401,29 @@
147401
148402 //JTextField nameField;
149403
150
- void SetupMenu2(ObjEditor oe)
404
+ void SetupMenu2(GroupEditor oe)
151405 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
406
+ oe.jTree = new cTree();
407
+
163408 Menu menu;
164409 oe.menuBar.add(menu = new Menu("Edit"));
165410 //editItem = menu.add(new MenuItem("Edit"));
166411 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
412
+
413
+// undoItem = menu.add(new MenuItem("Undo"));
414
+// undoItem.addActionListener(this);
415
+// redoItem = menu.add(new MenuItem("Redo"));
416
+// redoItem.addActionListener(this);
417
+// menu.add("-");
418
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168419 duplicateItem.addActionListener(this);
169
- menu.add("-");
170420 cloneItem = menu.add(new MenuItem("Clone"));
171421 cloneItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
172424 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173425 cloneSupportItem.addActionListener(this);
426
+ }
174427 menu.add("-");
175428 cutItem = menu.add(new MenuItem("Cut"));
176429 cutItem.addActionListener(this);
....@@ -178,27 +431,123 @@
178431 copyItem.addActionListener(this);
179432 pasteItem = menu.add(new MenuItem("Paste"));
180433 pasteItem.addActionListener(this);
434
+
435
+ menu.add("-");
436
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
437
+ pasteIntoItem.addActionListener(this);
181438 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182439 pasteLinkItem.addActionListener(this);
183440 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184441 pasteCloneItem.addActionListener(this);
185442 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186443 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
444
+ menu.add("-");
445
+ deleteItem = menu.add(new MenuItem("Delete"));
446
+ deleteItem.addActionListener(this);
447
+
448
+ if (Globals.ADVANCED)
449
+ {
450
+ // Deletes the cameras...
189451 clearAllItem = menu.add(new MenuItem("Clear All"));
190452 clearAllItem.addActionListener(this);
453
+ }
454
+
455
+ menuBar.add(cameraMenu = new Menu("View"));
456
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
457
+ //zBufferItem.addActionListener(this);
458
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
459
+ //normalLensItem.addActionListener(this);
460
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
461
+ restoreCameraItem.addActionListener(this);
462
+
463
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
464
+// toggleFullScreenItem.addItemListener(this);
465
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
466
+// cameraMenu.add("-");
467
+//
468
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
469
+// toggleTextureItem.addItemListener(this);
470
+// toggleTextureItem.setState(CameraPane.textureon);
471
+//
472
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
473
+// toggleSwitchItem.addItemListener(this);
474
+// toggleSwitchItem.setState(CameraPane.SWITCH);
475
+
476
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
477
+ toggleHandleItem.addItemListener(this);
478
+ toggleHandleItem.setState(CameraPane.HANDLES);
479
+
480
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
481
+ togglePaintItem.addItemListener(this);
482
+ togglePaintItem.setState(CameraPane.PAINTMODE);
483
+
484
+ if (Globals.ADVANCED)
485
+ {
486
+ cameraMenu.add("-");
487
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
488
+ toggleLiveItem.addItemListener(this);
489
+ toggleLiveItem.setState(Globals.isLIVE());
191490
491
+ cameraMenu.add(stepItem = new MenuItem("Step"));
492
+ stepItem.addActionListener(this);
493
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
494
+ // toggleDLItem.addItemListener(this);
495
+ // toggleDLItem.setState(false);
496
+
497
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
498
+ toggleRenderItem.addItemListener(this);
499
+ toggleRenderItem.setState(!CameraPane.frozen);
500
+
501
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
502
+ toggleDebugItem.addItemListener(this);
503
+ toggleDebugItem.setState(Globals.DEBUG);
504
+
505
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
506
+ toggleFrustumItem.addItemListener(this);
507
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
508
+
509
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
510
+ toggleFootContactItem.addItemListener(this);
511
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
512
+
513
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
514
+ toggleTimelineItem.addItemListener(this);
515
+ }
516
+
517
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
518
+// toggleRootItem.addItemListener(this);
519
+// toggleRootItem.setState(false);
520
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
521
+// animationItem.addItemListener(this);
522
+// animationItem.setState(CameraPane.ANIMATION);
523
+ cameraMenu.add("-");
524
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
525
+ editCameraItem.addActionListener(this);
526
+
527
+ if (Globals.ADVANCED)
528
+ {
529
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
530
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
531
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
532
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
533
+ oe.cameraMenu.add("-");
534
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
535
+ openWindowItem.addActionListener(this);
536
+ editLeafItem.addActionListener(this);
537
+ lookAtItem.addActionListener(this);
538
+ //lookFromItem.addActinoListener(this);
539
+ //switchViewItem.addActionListener(this);
540
+ }
541
+
192542 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
543
+ if (Globals.ADVANCED)
544
+ {
197545 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198546 revertMeshItem.addActionListener(this);
199547 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200548 resetreferencesItem.addActionListener(this);
201549 menu.add("-");
550
+ }
202551 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203552 overwriteGeoItem.addActionListener(this);
204553 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,73 +559,104 @@
210559 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211560 overwriteUVItem.addActionListener(this);
212561 menu.add("-");
562
+ if (Globals.ADVANCED)
563
+ {
213564 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214565 generateMeshItem.addActionListener(this);
215566 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216567 poseMeshItem.addActionListener(this);
217568 menu.add("-");
569
+ }
218570 resetsupportItem = menu.add(new MenuItem("Reset support"));
219571 resetsupportItem.addActionListener(this);
220572 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221573 linkverticesItem.addActionListener(this);
574
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
575
+ relinkverticesItem.addActionListener(this);
576
+
577
+ if (Globals.ADVANCED)
578
+ {
222579 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223580 setMasterItem.addActionListener(this);
581
+ }
224582
225583 oe.menuBar.add(menu = new Menu("Group"));
226
- grabItem = menu.add(new MenuItem("Grab"));
227
- grabItem.addActionListener(this);
228
- frontItem = menu.add(new MenuItem("Front"));
229
- frontItem.addActionListener(this);
584
+// grabItem = menu.add(new MenuItem("Grab"));
585
+// grabItem.addActionListener(this);
230586 backItem = menu.add(new MenuItem("Back"));
231587 backItem.addActionListener(this);
232
- compositeItem = menu.add(new MenuItem("Composite"));
233
- compositeItem.addActionListener(this);
234
- menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
236
- randomItem.addActionListener(this);
237
- physicsItem = menu.add(new MenuItem("Physics"));
238
- physicsItem.addActionListener(this);
239
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
240
- frameselectorItem.addActionListener(this);
588
+ frontItem = menu.add(new MenuItem("Front"));
589
+ frontItem.addActionListener(this);
590
+// compositeItem = menu.add(new MenuItem("Composite"));
591
+// compositeItem.addActionListener(this);
592
+
593
+ if (Globals.ADVANCED)
594
+ {
595
+ hideItem = menu.add(new MenuItem("Hidden Group"));
596
+ hideItem.addActionListener(this);
597
+ }
598
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
599
+ ungroupItem.addActionListener(this);
600
+
601
+// menu.add("-");
602
+//
603
+// switchItem = menu.add(new MenuItem("Switch node"));
604
+// switchItem.addActionListener(this);
605
+ if (Globals.ADVANCED)
606
+ {
241607 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242608 switchGeoItem.addActionListener(this);
243609 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244610 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
611
+ morphItem = menu.add(new MenuItem("Morph Group"));
246612 morphItem.addActionListener(this);
613
+
614
+ menu.add("-");
615
+ physicsItem = menu.add(new MenuItem("Physics"));
616
+ physicsItem.addActionListener(this);
617
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
618
+ frameselectorItem.addActionListener(this);
247619 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248620 scriptNodeItem.addActionListener(this);
249
- cameraItem = menu.add(new MenuItem("Camera"));
250
- cameraItem.addActionListener(this);
621
+ }
251622
252623 oe.menuBar.add(menu = new Menu("Object"));
253
- textureItem = menu.add(new MenuItem("Texture"));
254
- textureItem.addActionListener(this);
624
+// textureItem = menu.add(new MenuItem("Texture"));
625
+// textureItem.addActionListener(this);
626
+ billboardItem = menu.add(new MenuItem("Billboard"));
627
+ billboardItem.addActionListener(this);
255628 csgItem = menu.add(new MenuItem("CSG"));
256629 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
630
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258631 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
632
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260633 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
634
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262635 shadowZItem.addActionListener(this);
636
+ attributeItem = menu.add(new MenuItem("Attribute"));
637
+ attributeItem.addActionListener(this);
638
+
639
+ if (Globals.ADVANCED)
640
+ {
641
+ menu.add("-");
263642 linkerItem = menu.add(new MenuItem("Linker"));
264643 linkerItem.addActionListener(this);
265644 templateItem = menu.add(new MenuItem("Template"));
266645 templateItem.addActionListener(this);
267
- attributeItem = menu.add(new MenuItem("Attribute"));
268
- attributeItem.addActionListener(this);
269646 pointflowItem = menu.add(new MenuItem("Point Flow"));
270647 pointflowItem.addActionListener(this);
648
+ }
271649 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274650 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275651 resetTransformItem.addActionListener(this);
276652 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277653 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
654
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
655
+ resetCentroidXZItem.addActionListener(this);
656
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
657
+ transformGeometryItem.addActionListener(this);
658
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
659
+ transformChildrenItem.addActionListener(this);
280660
281661 oe.menuBar.add(menu = new Menu("Geometry"));
282662 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -285,6 +665,13 @@
285665 genNormalsORGANItem.addActionListener(this);
286666 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
287667 genNormalsCADItem.addActionListener(this);
668
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
669
+ genNormalsMESHItem.addActionListener(this);
670
+ if (Globals.ADVANCED)
671
+ {
672
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
673
+ genNormalsMINEItem.addActionListener(this);
674
+ }
288675 stripifyItem = menu.add(new MenuItem("Stripify"));
289676 stripifyItem.addActionListener(this);
290677 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -306,23 +693,34 @@
306693 reduce34MeshItem.addActionListener(this);
307694 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308695 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311696 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312697 clipMeshItem.addActionListener(this);
698
+
699
+ if (Globals.ADVANCED)
700
+ {
701
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
702
+ smoothMeshItem.addActionListener(this);
703
+ }
313704
314705 oe.menuBar.add(menu = new Menu("Attributes"));
315706 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
316707 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);
317712 menu.add("-");
318713 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
319714 liveleavesItem.addActionListener(this);
320715 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
321716 unliveleavesItem.addActionListener(this);
717
+ if (Globals.ADVANCED)
718
+ {
322719 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
323720 supportleavesItem.addActionListener(this);
324721 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
325722 unsupportleavesItem.addActionListener(this);
723
+ }
326724 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
327725 hideleavesItem.addActionListener(this);
328726 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -331,6 +729,14 @@
331729 markleavesItem.addActionListener(this);
332730 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
333731 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);
334740 menu.add("-");
335741 flipVItem = menu.add(new MenuItem("Flip V"));
336742 flipVItem.addActionListener(this);
....@@ -356,45 +762,56 @@
356762 attachBumpItem.addActionListener(this);
357763 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
358764 pigmentBumpItem.addActionListener(this);
765
+ //embedTexturesItem
359766 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
360767 detachPigmentItem.addActionListener(this);
361768 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
362769 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);
363774 menu.add("-");
364775 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
365776 sortbysizeItem.addActionListener(this);
366777 sortbynameItem = menu.add(new MenuItem("Sort by name"));
367778 sortbynameItem.addActionListener(this);
368779 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.
369787 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
370788 extractGeometriesItem.addActionListener(this);
371789 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
372790 cloneGeometriesItem.addActionListener(this);
373
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
374
- shareGeometriesItem.addActionListener(this);
375
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
376
- mergeGeometriesItem.addActionListener(this);
791
+ }
377792
378793 oe.menuBar.add(menu = new Menu("Insert"));
379794 buildCreateMenu(menu);
380795
381
-
382
- oe.menuBar.add(menu = new Menu("Include"));
383
- importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
384
- importGFDItem.addActionListener(this);
385
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
386
- importVRMLX3DItem.addActionListener(this);
387
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
388
- importOBJItem.addActionListener(this);
389
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
390
- import3DSItem.addActionListener(this);
391
-
392796 oe.menuBar.add(menu = new Menu("Tools"));
393797 buildToolsMenu(menu);
394798 }
395799
800
+
396801 void SetupUI2(ObjEditor oe)
397802 {
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
+
398815 //new Exception().printStackTrace();
399816
400817 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -423,150 +840,238 @@
423840 oe.radioPanel.add(dummyButton);
424841 oe.buttonGroup.add(dummyButton);
425842 */
426
- aConstraints.gridy += 1;
427
- oe.aConstraints.gridwidth = 1;
428
- oe.aConstraints.gridx = 0;
843
+ cGridBag copyOptionsPanel = new cGridBag();
844
+
845
+ copyOptionsPanel.preferredHeight = 2;
429846
430
- 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");
431901 liveCB.addItemListener(this);
432902
433
- oe.aConstraints.gridx += 1;
434
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
435
- supportCB.addItemListener(this);
436
-
437
- // oe.aConstraints.gridx += 1;
438
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
439
- // localCB.addItemListener(this);
440
-
441
- oe.aConstraints.gridx += 1;
442
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
443
- crowdCB.addItemListener(this);
444
-
445
- oe.aConstraints.gridx += 1;
446
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
447
- smoothCB.addItemListener(this);
448
-
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
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");
451909 fastCB.addItemListener(this);
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
454
- slowCB.addItemListener(this);
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
457
- boxCB.addItemListener(this);
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);
458916
459
-// oe.aConstraints.gridx += 1;
460
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
461
-// speakerMocapCB.addItemListener(this);
462
-
463
- if (false)
464
- {
465
- // handled in scripts
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
468
- speakerCameraCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
472
- speakerFocusCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
476
- smoothfocusCB.addItemListener(this);
477
- }
478
-
479
-//oe.aConstraints.gridx += 1;
480
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
481
-// debugCB.addItemListener(this);
482
-
483
- oe.aConstraints.gridx += 1;
484
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
485
- oeilCB.addItemListener(this);
486
-
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
489
- lookAtCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
493
- trackCB.addItemListener(this);
494
-
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
497
- screenfitButton.addActionListener(this);
498
- oe.aConstraints.gridx += 1;
499917 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
500918 // screenfitpointButton.addActionListener(this);
501
-// oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
503
- snapobjectButton.addActionListener(this);
504
- oe.aConstraints.gridx += 1;
505919
506
- //aConstraints.gridx = 0;
507
- //aConstraints.gridy += 1;
508
- oe.aConstraints.weighty = 0;
509
- oe.aConstraints.gridwidth = 1;
510
-
511
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
512
- flashSelectionButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
516
-
517
- //
518
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
519
- twoButton.addActionListener(this);
520
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
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);
521927 fourButton.addActionListener(this);
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
523
- sixButton.addActionListener(this);
524
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
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");
525940 threeButton.addActionListener(this);
526
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
527
- 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);
528947 //
529948
530
- 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");
531951 rootButton.addActionListener(this);
532
- oe.aConstraints.gridx += 1;
533
- 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");
534955 closeButton.addActionListener(this);
535956 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
536957 //clearButton.addActionListener(this);
537
- oe.aConstraints.gridx += 1;
538
-
539
- oe.aConstraints.gridx = 1; //
540
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
541
- editButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
545958
546
- 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");
5471051 uneditButton.addActionListener(this);
5481052
549
- oe.aConstraints.gridx += 1;
550
- oe.aConstraints.weighty = 0;
551
- oe.aConstraints.gridwidth = 1;
552
-
553
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
554
- clearPanelButton.addActionListener(this);
555
-
556
- oe.aConstraints.gridx += 1;
557
- oe.aConstraints.weighty = 0;
558
- oe.aConstraints.gridwidth = 1;
559
-
560
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1053
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1054
+ allParamsButton.setToolTipText("Show all controle");
5611055 allParamsButton.addActionListener(this);
5621056
563
- oe.aConstraints.gridx += 1;
564
- oe.aConstraints.weighty = 0;
565
- oe.aConstraints.gridwidth = 1;
566
-
567
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
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");
5681063 unselectButton.addActionListener(this);
5691064
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
+
5701075 // oe.aConstraints.gridx += 1;
5711076 // oe.aConstraints.weighty = 0;
5721077 // oe.aConstraints.gridwidth = 1;
....@@ -578,47 +1083,32 @@
5781083 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5791084 // gcButton.addActionListener(this);
5801085
581
- oe.aConstraints.gridx = 0;
582
- oe.aConstraints.gridy += 1;
583
-
584
- //ctrlPanel.add(objList = new List(5, true));
585
- oe.aConstraints.gridwidth = 100;
586
- // oe.aConstraints.gridheight = 100;
587
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
588
- oe.aConstraints.gridheight = 1;
589
- oe.aConstraints.weighty = 0.5;
590
- oe.aConstraints.gridx = 0;
591
- JScrollPane jSP;
1086
+ cGridBag jSPPanel = new cGridBag();
1087
+
1088
+ JScrollPane jSP;
5921089 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
593
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1090
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5941091 ResetModel();
595
- oe.aConstraints.weighty = 0.5;
596
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
597
- oe.aConstraints.gridy += 1;
598
- oe.aConstraints.gridwidth = 1;
599
-
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 2;
602
-
603
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
604
- colorCB.addItemListener(this);
605
- oe.aConstraints.gridx += 2;
606
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
607
- materialCB.addItemListener(this);
608
- oe.aConstraints.gridx += 2;
609
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
610
- textureCB.addItemListener(this);
611
-
612
- oe.aConstraints.gridx = 0;
613
- oe.aConstraints.gridy += 1;
6141092
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
+
6151105 //jList.addListSelectionListener(this);
6161106 oe.jTree.addTreeSelectionListener(this);
6171107 //jTree.setRootVisible(false);
6181108 //jTree.setEditable(true);
6191109 oe.jTree.setDragEnabled(true);
6201110 //jTree.setPreferredSize(new Dimension(10,10));
621
- jSP.setPreferredSize(new Dimension(100,200));
1111
+ //jSP.setPreferredSize(new Dimension(100,200));
6221112
6231113 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6241114
....@@ -630,23 +1120,160 @@
6301120 dgr.addDragGestureListener(this);
6311121 }catch(Exception e) {}
6321122 */
633
- radio.layout = sevenButton;
1123
+ radio.layout = sixButton; // sevenButton;
6341124 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6351125 }
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
+ }
6361252
6371253 void EditObject(Object3D obj)
6381254 {
639
- cRadio dummyButton = new cRadio(obj.name);
640
- dummyButton.SetObject(obj);
641
- dummyButton.layout = sevenButton;
642
- dummyButton.SetCamera(cameraView.renderCamera, false);
643
- dummyButton.addActionListener(this);
644
- radioPanel.add(dummyButton);
645
- buttonGroup.add(dummyButton);
646
- dummyButton.doClick();
1255
+ cRadio radioButton = new cRadio(obj.name);
1256
+
1257
+ // June 2019. Patch to avoid bug with transparency.
1258
+ radioButton.hadMaterial = obj.material != null;
1259
+ if (!radioButton.hadMaterial)
1260
+ {
1261
+ obj.material = new cMaterial();
1262
+ }
1263
+
1264
+ radioButton.SetObject(obj);
1265
+ radioButton.layout = sixButton; // sevenButton;
1266
+ radioButton.SetCamera(cameraView.renderCamera, false);
1267
+ radioButton.addActionListener(this);
1268
+ radioPanel.add(radioButton);
1269
+ buttonGroup.add(radioButton);
1270
+ radioButton.doClick();
6471271 }
1272
+
6481273 void SetupViews(ObjEditor oe)
6491274 {
1275
+ theFrame = this;
1276
+
6501277 oe.SetupViews();
6511278
6521279 System.out.println("SetupViews");
....@@ -655,22 +1282,28 @@
6551282 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6561283 }
6571284
658
- JCheckBox liveCB;
659
- JCheckBox supportCB;
660
- JCheckBox localCB;
661
- JCheckBox crowdCB;
662
- JCheckBox smoothCB;
663
- JCheckBox fastCB;
664
- JCheckBox slowCB;
665
- JCheckBox boxCB;
666
- JCheckBox trackCB;
667
- JCheckBox smoothfocusCB;
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;
6681298 // JCheckBox speakerMocapCB;
669
- JCheckBox speakerCameraCB;
670
- JCheckBox speakerFocusCB;
671
- JCheckBox debugCB;
672
- JCheckBox oeilCB;
673
- JCheckBox lookAtCB;
1299
+ cCheckBox speakerCameraCB;
1300
+ cCheckBox speakerFocusCB;
1301
+ cCheckBox debugCB;
1302
+
1303
+ cCheckBox oeilCB;
1304
+ cCheckBox shadowCB;
1305
+ cCheckBox autokeepCB;
1306
+ cCheckBox lookAtCB;
6741307
6751308 // static int COLOR = 1;
6761309 // static int MATERIAL = 2;
....@@ -678,9 +1311,9 @@
6781311
6791312 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6801313
681
- JCheckBox colorCB;
682
- JCheckBox materialCB;
683
- JCheckBox textureCB;
1314
+ cCheckBox colorCB;
1315
+ cCheckBox materialCB;
1316
+ cCheckBox textureCB;
6841317
6851318 public void itemStateChanged(ItemEvent e)
6861319 {
....@@ -705,10 +1338,10 @@
7051338 dropAttributes |= Object3D.TEXTURE;
7061339 else
7071340 dropAttributes &= ~Object3D.TEXTURE;
708
- }
709
- else if(e.getSource() == liveCB)
1341
+ } else if(e.getSource() == liveCB)
7101342 {
7111343 cameraView.ToggleLive();
1344
+ refreshContents(false);
7121345 }
7131346 else if(e.getSource() == supportCB)
7141347 {
....@@ -744,6 +1377,10 @@
7441377 cameraView.repaint();
7451378 // refreshContents();
7461379 }
1380
+ else if(e.getSource() == zoomBoxCB)
1381
+ {
1382
+ cameraView.ToggleZoomBoxMode();
1383
+ }
7471384 else if(e.getSource() == smoothfocusCB)
7481385 {
7491386 cameraView.ToggleSmoothFocus();
....@@ -769,6 +1406,18 @@
7691406 {
7701407 cameraView.ToggleOeil();
7711408 }
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
+ }
7721421 else if(e.getSource() == lookAtCB)
7731422 {
7741423 cameraView.ToggleLookAt();
....@@ -785,7 +1434,8 @@
7851434
7861435 /**/
7871436 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
788
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1437
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1438
+ TreePath path = objEditor.jTree.getSelectionPath();
7891439 if ((path == null) || (path.getPathCount() <= 1)) {
7901440 // We can't move the root node or an empty selection
7911441 return;
....@@ -848,8 +1498,6 @@
8481498 }
8491499 }
8501500
851
- String string = (String) object;
852
-
8531501 System.out.println("Transfer = " + object + "; drop : " + target);
8541502 // if( object instanceof java.io.File[])
8551503 // {
....@@ -857,7 +1505,11 @@
8571505 // objEditor.DropFile((java.io.File[]) object, true);
8581506 // return;
8591507 // }
860
- 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) == ':')
8611513 {
8621514 // file(s)
8631515 String[] names = string.split("\n");
....@@ -884,7 +1536,7 @@
8841536
8851537 flashIt = false;
8861538 CameraPane pane = (CameraPane) target;
887
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1539
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8881540 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8891541
8901542 if (group.selection.size() == 1)
....@@ -900,23 +1552,33 @@
9001552
9011553 assert target == objEditor.jTree;
9021554 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1555
+ Object3D destinationLeaf;
9031556 try {
904
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1557
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9051558 } catch (Exception e) {
9061559 System.out.println("destinationPath : " + destinationPath);
9071560 return;
9081561 }
9091562
910
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1563
+ for (int i=group.selection.size(); --i>=0;)
9111564 {
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
+// {
9121574 loadClipboard(true);
9131575 objEditor.jTree.setSelectionPath(destinationPath);
914
- pasteInto(false);
915
- } else {
916
- loadClipboard(false);
917
- objEditor.jTree.setSelectionPath(destinationPath);
918
- pasteInto(false); // true); // ???
919
- }
1576
+ pasteInto(false, false);
1577
+// } else {
1578
+// loadClipboard(false);
1579
+// objEditor.jTree.setSelectionPath(destinationPath);
1580
+// pasteInto(false, false); // true); // ???
1581
+// }
9201582 }
9211583 public void dropActionChanged(DropTargetDragEvent dtde)
9221584 // Called if the user has modified the current drop gesture
....@@ -1021,83 +1683,107 @@
10211683 {
10221684 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10231685 //heightFieldItem.addActionListener(this);
1024
- gridItem = menu.add(new MenuItem("Grid"));
1025
- gridItem.addActionListener(this);
1026
- rectoidItem = menu.add(new MenuItem("Box"));
1027
- rectoidItem.addActionListener(this);
1028
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1029
- ellipsoidItem.addActionListener(this);
1030
- coneItem = menu.add(new MenuItem("Cone"));
1031
- coneItem.addActionListener(this);
1032
- torusItem = menu.add(new MenuItem("Torus"));
1033
- torusItem.addActionListener(this);
1034
- superItem = menu.add(new MenuItem("Superellipsoid"));
1035
- superItem.addActionListener(this);
1036
- particleItem = menu.add(new MenuItem("Particle system"));
1037
- particleItem.addActionListener(this);
1686
+// gridItem = menu.add(new MenuItem("Grid"));
1687
+// gridItem.addActionListener(this);
1688
+// rectoidItem = menu.add(new MenuItem("Box"));
1689
+// rectoidItem.addActionListener(this);
1690
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1691
+// ellipsoidItem.addActionListener(this);
1692
+// coneItem = menu.add(new MenuItem("Cone"));
1693
+// coneItem.addActionListener(this);
1694
+// torusItem = menu.add(new MenuItem("Torus"));
1695
+// torusItem.addActionListener(this);
1696
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1697
+// superItem.addActionListener(this);
1698
+
1699
+ cameraItem = menu.add(new MenuItem("Camera"));
1700
+ cameraItem.addActionListener(this);
1701
+
1702
+ if (!Globals.ADVANCED)
1703
+ {
1704
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1705
+ kleinItem.addActionListener(this);
1706
+ }
1707
+
1708
+// particleItem = menu.add(new MenuItem("Particle system"));
1709
+// particleItem.addActionListener(this);
1710
+ if (Globals.ADVANCED)
1711
+ {
10381712 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10391713 ragdollItem.addActionListener(this);
10401714 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10411715 ragdoll2Item.addActionListener(this);
1716
+ }
10421717 menu.add("-");
1043
- meshItem = menu.add(new MenuItem("Mesh"));
1718
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10441719 meshItem.addActionListener(this);
10451720 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10461721 // meshGroupItem.addActionListener(this);
1722
+ if (Globals.ADVANCED)
1723
+ {
10471724 springItem = menu.add(new MenuItem("Spring"));
10481725 springItem.addActionListener(this);
10491726 flagItem = menu.add(new MenuItem("Flag"));
10501727 flagItem.addActionListener(this);
1051
- bezierItem = menu.add(new MenuItem("Patch"));
1052
- bezierItem.addActionListener(this);
1053
- checkerItem = menu.add(new MenuItem("Checker"));
1054
- checkerItem.addActionListener(this);
10551728 blobItem = menu.add(new MenuItem("Blob"));
10561729 blobItem.addActionListener(this);
10571730 latheItem = menu.add(new MenuItem("Lathe"));
10581731 latheItem.addActionListener(this);
1059
- lightItem = menu.add(new MenuItem("Light"));
1060
- 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);
10611739 menu.add("-");
10621740 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10631741 //superLoopItem.addActionListener(this);
1064
- loopItem = menu.add(new MenuItem("Loop"));
1065
- loopItem.addActionListener(this);
1742
+// loopItem = menu.add(new MenuItem("Loop"));
1743
+// loopItem.addActionListener(this);
10661744 doubleItem = menu.add(new MenuItem("Fork"));
10671745 doubleItem.addActionListener(this);
1746
+ if (Globals.ADVANCED)
1747
+ {
10681748 tripleItem = menu.add(new MenuItem("Trident"));
10691749 tripleItem.addActionListener(this);
1750
+ }
10701751 }
10711752
10721753 void buildToolsMenu(Menu menu)
10731754 {
10741755 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10751756 animationItem.addItemListener(this);
1076
- animationItem.setState(CameraPane.ANIMATION);
1757
+ animationItem.setState(Globals.ANIMATION);
1758
+
1759
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1760
+ archiveItem.addActionListener(this);
10771761
10781762 menu.add("-");
10791763 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10801764 parseverticesItem.addActionListener(this);
10811765 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10821766 textureFieldItem.addActionListener(this);
1083
- alignItem = menu.add(new MenuItem("Align"));
1767
+ alignItem = menu.add(new MenuItem("Align Objects"));
10841768 alignItem.addActionListener(this);
1085
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1086
- mirrorItem.addActionListener(this);
10871769 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10881770 reduceMorphItem.addActionListener(this);
10891771 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10901772 reduce34MorphItem.addActionListener(this);
1091
-
1092
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1093
- computeAOItem.addActionListener(this);
10941773 menu.add("-");
1095
-
10961774 menu.add(memoryItem = new MenuItem("Memory Usage"));
10971775 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("-");
10981784 menu.add(analyzeItem = new MenuItem("Analyze"));
10991785 analyzeItem.addActionListener(this);
1100
- menu.add(dumpItem = new MenuItem("Dump"));
1786
+ menu.add(dumpItem = new MenuItem("Print"));
11011787 dumpItem.addActionListener(this);
11021788 // menu.add(pathItem = new MenuItem("From-to path"));
11031789 // pathItem.addActionListener(this);
....@@ -1106,6 +1792,8 @@
11061792 resetParentItem.addActionListener(this);
11071793 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11081794 repairParentItem.addActionListener(this);
1795
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1796
+ repairShadowItem.addActionListener(this);
11091797 menu.add(invariantsItem = new MenuItem("Invariants"));
11101798 invariantsItem.addActionListener(this);
11111799 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1113,6 +1801,7 @@
11131801 menu.add("-");
11141802 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11151803 editScriptItem.addActionListener(this);
1804
+ }
11161805 }
11171806
11181807 void ScreenFit()
....@@ -1235,9 +1924,34 @@
12351924 shadow.material = new cMaterial(obj.material);
12361925 shadow.material.diffuse = 0.0001f;
12371926 shadow.material.specular = 0.0001f;
1927
+ //shadow.projectedVertices[1].x = 300;
12381928
12391929 makeSomething(shadow);
12401930 }
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
+ }
12411955
12421956 /**
12431957 * applyExample
....@@ -1441,9 +2155,9 @@
14412155
14422156 void Overwrite(int mask)
14432157 {
1444
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2158
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14452159 {
1446
- Object3D content = GraphreeD.clipboard.get(0);
2160
+ Object3D content = Grafreed.clipboard.get(0);
14472161
14482162 if (content instanceof cGroup && ((cGroup)content).transientlink )
14492163 content = ((cGroup)content).get(0);
....@@ -1466,6 +2180,7 @@
14662180 //
14672181 public void actionPerformed(ActionEvent event) // , Object arg)
14682182 {
2183
+ Object source = event.getSource();
14692184 /*
14702185 if (event.getSource() == nameField)
14712186 {
....@@ -1477,11 +2192,11 @@
14772192 }
14782193 else
14792194 */
1480
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2195
+ if (source == lookAtItem || source == lookFromItem)
14812196 {
14822197 ScreenFit();
14832198 } else
1484
- if (event.getSource() == switchItem)
2199
+ if (source == switchViewItem)
14852200 {
14862201 cVector v1 = new cVector();
14872202 cVector v2 = new cVector();
....@@ -1490,11 +2205,11 @@
14902205 objEditor.cameraView.renderCamera.setAim(v2, v1);
14912206 objEditor.cameraView.repaint();
14922207 } else
1493
- if (event.getSource() == rectoidItem)
2208
+ if (source == rectoidItem || source == boxButton)
14942209 {
14952210 makeSomething(new Box());
14962211 } else
1497
- if (event.getSource() == particleItem)
2212
+ if (source == particleItem || source == particlesButton)
14982213 {
14992214 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15002215 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1515,9 +2230,9 @@
15152230 applyExample(particleGeom, "SMOKE");
15162231 makeSomething(particleGeom);
15172232 } else
1518
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2233
+ if (source == ragdollItem || source == ragdoll2Item)
15192234 {
1520
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2235
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15212236
15222237 ragdoll.toParent = LA.newMatrix();
15232238 ragdoll.fromParent = LA.newMatrix();
....@@ -1535,7 +2250,7 @@
15352250 } else
15362251 /*
15372252 */
1538
- if (event.getSource() == heightFieldItem)
2253
+ if (source == heightFieldItem)
15392254 {
15402255 Object3D obj = new Object3D();
15412256
....@@ -1573,27 +2288,31 @@
15732288
15742289 makeSomething(obj);
15752290 } else
1576
- if (event.getSource() == gridItem)
2291
+ if (source == gridItem || source == gridButton)
15772292 {
15782293 makeSomething(new Grid());
15792294 } else
1580
- if (event.getSource() == ellipsoidItem)
2295
+ if (source == ellipsoidItem || source == sphereButton)
15812296 {
15822297 makeSomething(new Sphere());
15832298 } else
1584
- if (event.getSource() == coneItem)
2299
+ if (source == coneItem || source == coneButton)
15852300 {
15862301 makeSomething(new Cone());
15872302 } else
1588
- if (event.getSource() == torusItem)
2303
+ if (source == torusItem || source == torusButton)
15892304 {
15902305 makeSomething(new Torus());
15912306 } else
1592
- if (event.getSource() == superItem)
2307
+ if (source == superItem || source == superButton)
15932308 {
15942309 makeSomething(new Superellipsoid());
15952310 } else
1596
- if (event.getSource() == blobItem)
2311
+ if (source == kleinItem || source == kleinButton)
2312
+ {
2313
+ makeSomething(new Klein());
2314
+ } else
2315
+ if (source == blobItem)
15972316 {
15982317 Blob blob = new Blob();
15992318 BlobComponent comp = new BlobComponent();
....@@ -1601,15 +2320,15 @@
16012320 //blob.retile();
16022321 makeSomething(blob);
16032322 } else
1604
- if (event.getSource() == latheItem)
2323
+ if (source == latheItem)
16052324 {
16062325 makeSomething(new Lathe());
16072326 } else
1608
- if (event.getSource() == bezierItem)
2327
+ if (source == bezierItem)
16092328 {
16102329 makeSomething(new BezierSurface());
16112330 } else
1612
- if (event.getSource() == checkerItem)
2331
+ if (source == overlayItem || source == overlayButton)
16132332 {
16142333 /*
16152334 Object3D obj = new BezierSurface(5,8);
....@@ -1624,7 +2343,7 @@
16242343 */
16252344 makeSomething(new Checker());
16262345 } else
1627
- if (event.getSource() == meshItem)
2346
+ if (source == meshItem)
16282347 {
16292348 Object3D itemtomake = new Object3D();
16302349 Object3D child;
....@@ -1645,35 +2364,52 @@
16452364 makeSomething(child);
16462365 }
16472366 } else
1648
- if (event.getSource() == springItem)
2367
+ if (source == springItem)
16492368 {
16502369 cSpring s = new cSpring();
16512370 s.setup();
16522371 makeSomething(s);
16532372 } else
1654
- if (event.getSource() == flagItem)
2373
+ if (source == flagItem)
16552374 {
16562375 cSpring s = new cFlag();
16572376 s.setup();
16582377 makeSomething(s);
16592378 } else
1660
- if (event.getSource() == lightItem)
2379
+ if (source == lightItem || source == lightButton)
16612380 {
16622381 makeSomething(new Light());
16632382 } else
1664
- 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)
16652401 {
16662402 group(new CSG());
16672403 } else
1668
- if (event.getSource() == templateItem)
2404
+ if (source == templateItem)
16692405 {
16702406 group(new cTemplate());
16712407 } else
1672
- if (event.getSource() == attributeItem)
2408
+ if (source == attributeItem)
16732409 {
16742410 makeSomething(new Attribute());
16752411 } else
1676
- if (event.getSource() == pointflowItem)
2412
+ if (source == pointflowItem)
16772413 {
16782414 makeSomething(new PointFlow());
16792415 } else
....@@ -1685,7 +2421,7 @@
16852421 } else
16862422 */
16872423
1688
- if (event.getSource() == superLoopItem)
2424
+ if (source == superLoopItem)
16892425 {
16902426 Composite g = new cGroup();
16912427 for (int i=0; i<15; i++)
....@@ -1707,30 +2443,30 @@
17072443
17082444 group(g);
17092445 } else
1710
- if (event.getSource() == loopItem)
2446
+ if (source == loopItem || source == loopButton)
17112447 {
17122448 Composite csg = new GroupLeaf();
17132449 csg.count = 5;
17142450 group(csg);
1715
- Composite child = new cGroup();
2451
+ Composite child = new cGroup("Branch");
17162452 csg.addChild(child);
17172453 child.addChild(csg);
17182454 } else
1719
- if (event.getSource() == doubleItem)
2455
+ if (source == doubleItem)
17202456 {
1721
- Composite csg = new GroupLeaf();
2457
+ Composite csg = new GroupLeaf("Fork");
17222458 csg.count = 5;
17232459 group(csg);
1724
- Composite child = new cGroup();
2460
+ Composite child = new cGroup("Branch A");
17252461 csg.addChild(child);
17262462 child.addChild(csg);
1727
- child = new cGroup();
2463
+ child = new cGroup("Branch B");
17282464 csg.addChild(child);
17292465 child.addChild(csg);
17302466 } else
1731
- if (event.getSource() == tripleItem)
2467
+ if (source == tripleItem)
17322468 {
1733
- Composite csg = new GroupLeaf();
2469
+ Composite csg = new GroupLeaf("Trident");
17342470 csg.count = 4;
17352471 group(csg);
17362472 Composite child = new cGroup();
....@@ -1743,73 +2479,98 @@
17432479 csg.addChild(child);
17442480 child.addChild(csg);
17452481 } else
1746
-
1747
- if (event.getSource() == importGFDItem)
2482
+ if (source == computeAOItem)
17482483 {
1749
- ImportGFD();
2484
+ Globals.drawMode = CameraPane.OCCLUSION;
2485
+ cameraView.repaint();
17502486 } else
1751
- if (event.getSource() == importVRMLX3DItem)
1752
- {
1753
- ImportVRMLX3D();
1754
- } else
1755
- if (event.getSource() == import3DSItem)
1756
- {
1757
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1758
- } else
1759
- if (event.getSource() == importOBJItem)
1760
- {
1761
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1762
- } else
1763
- if (event.getSource() == computeAOItem)
1764
- {
1765
- CameraPane.drawMode = CameraPane.OCCLUSION;
1766
- CameraPane.theRenderer.repaint();
1767
- } else
1768
- if (event.getSource() == recompileItem)
2487
+ if (source == recompileItem)
17692488 {
17702489 Recompile();
17712490 refreshContents();
17722491 } else
1773
- if (event.getSource() == editScriptItem)
2492
+ if (source == editScriptItem)
17742493 {
17752494 OpenDialog();
17762495 refreshContents();
17772496 } else
1778
- if (event.getSource() == invariantsItem)
2497
+ if (source == invariantsItem)
17792498 {
17802499 System.out.println("Invariants:");
1781
- GraphreeD.theApplet3D.universe.invariants();
2500
+ Grafreed.grafreeD.universe.invariants();
17822501 } else
1783
- if (event.getSource() == memoryItem)
2502
+ if (source == memoryItem)
17842503 {
17852504 //System.out.println("Invariants:");
17862505 PrintMemory();
17872506 } else
1788
- if (event.getSource() == pathItem)
2507
+ if (source == pathItem)
17892508 {
17902509 PrintPath();
17912510 } else
1792
- if (event.getSource() == analyzeItem)
2511
+ if (source == analyzeItem)
17932512 {
17942513 AnalyzeObject();
17952514 } else
1796
- if (event.getSource() == dumpItem)
2515
+ if (source == dumpItem)
17972516 {
17982517 DumpObject();
17992518 } else
1800
- if (event.getSource() == screenfitButton)
2519
+ if (source == minButton)
18012520 {
1802
- //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
+ {
18032566 ScreenFit();
18042567 } else
1805
- if (event.getSource() == screenfitpointButton)
2568
+ if (source == screenfitpointButton)
18062569 {
1807
- //Reload(lastConverter, lastFilename, true);
18082570 ScreenFitPoint();
18092571 } else
1810
- if (event.getSource() == snapobjectButton)
2572
+ if (source == snapobjectButton)
18112573 {
1812
- //Reload(lastConverter, lastFilename, true);
18132574 SnapObject();
18142575 } else
18152576 // if (event.getSource() == recompileButton)
....@@ -1818,13 +2579,13 @@
18182579 // Recompile();
18192580 // refreshContents();
18202581 // } else
1821
- if (event.getSource() == gcButton)
2582
+ if (source == gcButton)
18222583 {
18232584 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18242585 System.gc();
18252586 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262587 } else
1827
- if (event.getSource() == editLeafItem)
2588
+ if (source == editLeafItem)
18282589 {
18292590 Object3D obj;
18302591 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1838,65 +2599,78 @@
18382599 }
18392600 refreshContents(true);
18402601 } else
1841
- if (event.getSource() == openWindowItem)
2602
+ if (source == openWindowItem)
18422603 {
18432604 EditSelection(true);
18442605 } else
1845
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2606
+ if (source == cutItem || source == clearButton)
18462607 {
18472608 loadClipboard(true);
18482609 } else
1849
- if (event.getSource() == duplicateItem)
2610
+ if (source == undoItem)
18502611 {
1851
- Object3D keep = GraphreeD.clipboard;
2612
+ Undo();
2613
+ } else
2614
+ if (source == redoItem)
2615
+ {
2616
+ Redo();
2617
+ } else
2618
+ if (source == duplicateItem)
2619
+ {
2620
+ Object3D keep = Grafreed.clipboard;
18522621 loadClipboard(false);
18532622 paste(false);
1854
- GraphreeD.clipboard = keep;
2623
+ Grafreed.clipboard = keep;
18552624 } else
1856
- if (event.getSource() == cloneItem)
2625
+ if (source == cloneItem)
18572626 {
18582627 CloneSelection(false);
18592628 } else
1860
- if (event.getSource() == cloneSupportItem)
2629
+ if (source == cloneSupportItem)
18612630 {
18622631 CloneSelection(true);
18632632 } else
1864
- if (event.getSource() == copyItem)
2633
+ if (source == copyItem)
18652634 {
18662635 loadClipboard(false);
18672636 } else
1868
- if (event.getSource() == pasteItem)
2637
+ if (source == pasteItem)
18692638 {
18702639 paste(false);
18712640 } else
1872
- if (event.getSource() == pasteLinkItem)
2641
+ if (source == pasteIntoItem)
18732642 {
1874
- pasteInto(false);
2643
+ pasteInto(true, false);
18752644 } else
1876
- if (event.getSource() == pasteCloneItem)
2645
+ if (source == pasteLinkItem)
18772646 {
1878
- pasteInto(true);
2647
+ pasteInto(false, false);
18792648 } else
1880
- if (event.getSource() == pasteExpandItem)
2649
+ if (source == pasteCloneItem)
2650
+ {
2651
+ pasteInto(true, true);
2652
+ } else
2653
+ if (source == pasteExpandItem)
18812654 {
18822655 paste(true);
18832656 } else
1884
- if (event.getSource() == synchronizeItem)
2657
+ if (source == synchronizeItem)
18852658 {
18862659 Overwrite(Object3D.TRANSFORM);
18872660 } else
1888
- if (event.getSource() == overwriteNameItem)
2661
+ if (source == overwriteNameItem)
18892662 {
18902663 Overwrite(Object3D.NAME);
18912664 } else
1892
- if (event.getSource() == overwriteUVItem)
2665
+ if (source == overwriteUVItem)
18932666 {
18942667 Overwrite(Object3D.UV);
18952668 } else
1896
- if (event.getSource() == overwriteMatItem)
2669
+ if (source == overwriteMatItem)
18972670 {
2671
+ /* july 2015
18982672 if ((dropAttributes & Object3D.TEXTURE) == 0)
1899
- Overwrite(Object3D.MATERIAL);
2673
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
19002674 else
19012675 {
19022676 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1908,13 +2682,16 @@
19082682 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
19092683 }
19102684 }
2685
+ */
2686
+
2687
+ Overwrite(dropAttributes);
19112688 }
1912
- if (event.getSource() == overwriteGeoItem)
2689
+ if (source == overwriteGeoItem)
19132690 {
19142691 Overwrite(Object3D.GEOMETRY);
1915
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2692
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
19162693 // {
1917
-// Object3D content = GraphreeD.clipboard.get(0);
2694
+// Object3D content = GrafreeD.clipboard.get(0);
19182695 //
19192696 // if (content instanceof cGroup && ((cGroup)content).transientlink )
19202697 // content = ((cGroup)content).get(0);
....@@ -1926,7 +2703,7 @@
19262703 // refreshContents();
19272704 // }
19282705 } else
1929
- if (event.getSource() == generateMeshItem)
2706
+ if (source == generateMeshItem)
19302707 {
19312708 //if (group.selection.size() == 1)
19322709 // for (int i=0; i<group.selection.size(); i++)
....@@ -1937,7 +2714,7 @@
19372714 ResetModel();
19382715 refreshContents();
19392716 } else
1940
- if (event.getSource() == extractGeometriesItem)
2717
+ if (source == extractGeometriesItem)
19412718 {
19422719 boolean one = false;
19432720
....@@ -1964,7 +2741,7 @@
19642741 ResetModel();
19652742 refreshContents();
19662743 } else
1967
- if (event.getSource() == cloneGeometriesItem)
2744
+ if (source == cloneGeometriesItem)
19682745 {
19692746 boolean one = false;
19702747
....@@ -1990,32 +2767,37 @@
19902767 ResetModel();
19912768 refreshContents();
19922769 } else
1993
- if (event.getSource() == shareGeometriesItem)
2770
+ if (source == shareGeometriesItem)
19942771 {
19952772 boolean one = false;
19962773
19972774 if (group.selection.size() == 1)
19982775 one = true;
19992776
2777
+ Object3D merge = null;
2778
+
20002779 Object3D content = new cGroup();
20012780
20022781 for (int i=0; i<group.selection.size(); i++)
20032782 {
2004
- Object3D sel = new Merge(group.selection.get(i));
2783
+ merge = new Merge(group.selection.get(i));
20052784
20062785 if (one)
2007
- makeSomething(sel, false);
2786
+ makeSomething(merge, false);
20082787 else
2009
- content.addChild(sel);
2788
+ content.addChild(merge);
20102789 }
20112790
20122791 if (!one)
2013
- makeSomething(content, false);
2014
-
2015
- ResetModel();
2016
- refreshContents();
2792
+ makeSomething(content, true);
2793
+ else
2794
+ {
2795
+ ResetModel();
2796
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2797
+ refreshContents();
2798
+ }
20172799 } else
2018
- if (event.getSource() == mergeGeometriesItem)
2800
+ if (source == mergeGeometriesItem)
20192801 {
20202802 boolean one = false;
20212803
....@@ -2045,11 +2827,11 @@
20452827 ResetModel();
20462828 refreshContents();
20472829 } else
2048
- if (event.getSource() == linkverticesItem)
2830
+ if (source == linkverticesItem)
20492831 {
2050
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2832
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20512833 // {
2052
-// Object3D content = GraphreeD.clipboard.get(0);
2834
+// Object3D content = GrafreeD.clipboard.get(0);
20532835 //
20542836 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20552837 // content = ((cGroup)content).get(0);
....@@ -2058,39 +2840,48 @@
20582840 // group.selection.get(0).setMasterThis(content); // should be identity
20592841 // refreshContents();
20602842 // }
2061
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2843
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20622844 {
2063
- Object3D content = GraphreeD.clipboard.get(0);
2845
+ Object3D content = Grafreed.clipboard.get(0);
20642846
20652847 if (content instanceof cGroup && ((cGroup)content).transientlink )
20662848 content = ((cGroup)content).get(0);
20672849
2068
- 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));
20692851 for (int i=0; i<group.selection.size(); i++)
20702852 {
2071
- boolean random = CameraPane.RANDOM;
2072
- CameraPane.RANDOM = false; // parse all random nodes
2853
+ boolean random = CameraPane.SWITCH;
2854
+ CameraPane.SWITCH = false; // parse all random nodes
20732855 group.selection.get(i).linkVerticesThis(content);
20742856 // group.selection.get(i).setMasterThis(content); // should be identity
2075
- CameraPane.RANDOM = random;
2857
+ CameraPane.SWITCH = random;
20762858 }
2077
- 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));
20782860 refreshContents();
20792861 }
20802862 } else
2081
- if (event.getSource() == resetsupportItem)
2863
+ if (source == resetsupportItem)
20822864 {
20832865 for (int i=0; i<group.selection.size(); i++)
20842866 {
2085
- boolean random = CameraPane.RANDOM;
2086
- CameraPane.RANDOM = false; // parse all random nodes
2867
+ boolean random = CameraPane.SWITCH;
2868
+ CameraPane.SWITCH = false; // parse all random nodes
20872869 group.selection.get(i).linkVerticesThis(null);
2088
- CameraPane.RANDOM = random;
2870
+ CameraPane.SWITCH = random;
20892871 }
20902872
20912873 refreshContents();
20922874 } else
2093
- if (event.getSource() == resetreferencesItem)
2875
+ if (source == relinkverticesItem)
2876
+ {
2877
+ boolean random = CameraPane.SWITCH;
2878
+ CameraPane.SWITCH = false; // parse all random nodes
2879
+ group.selection.RelinkToSupport();
2880
+ CameraPane.SWITCH = random;
2881
+
2882
+ refreshContents();
2883
+ } else
2884
+ if (source == resetreferencesItem)
20942885 {
20952886 for (int i=0; i<group.selection.size(); i++)
20962887 {
....@@ -2099,11 +2890,11 @@
20992890
21002891 refreshContents();
21012892 } else
2102
- if (event.getSource() == setMasterItem)
2893
+ if (source == setMasterItem)
21032894 {
2104
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
2895
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21052896 {
2106
- Object3D content = GraphreeD.clipboard.get(0);
2897
+ Object3D content = Grafreed.clipboard.get(0);
21072898
21082899 if (content instanceof cGroup && ((cGroup)content).transientlink )
21092900 content = ((cGroup)content).get(0);
....@@ -2112,13 +2903,13 @@
21122903 refreshContents();
21132904 }
21142905 } else
2115
- if (event.getSource() == poseMeshItem)
2906
+ if (source == poseMeshItem)
21162907 {
21172908 if (group.selection.size() == 1)
21182909 {
2119
- if (GraphreeD.clipboard.size() == 1)
2910
+ if (Grafreed.clipboard.size() == 1)
21202911 {
2121
- Object3D content = GraphreeD.clipboard.get(0);
2912
+ Object3D content = Grafreed.clipboard.get(0);
21222913
21232914 if (content instanceof cGroup && ((cGroup)content).transientlink )
21242915 content = ((cGroup)content).get(0);
....@@ -2131,19 +2922,19 @@
21312922 }
21322923
21332924 } else
2134
- if (event.getSource() == revertMeshItem)
2925
+ if (source == revertMeshItem)
21352926 {
21362927 RevertMeshes();
21372928 } else
2138
- if (event.getSource() == resetMeshItem)
2929
+ if (source == resetAllItem)
21392930 {
21402931 ResetAll();
21412932 } else
2142
- if (event.getSource() == stepAllItem)
2933
+ if (source == stepAllItem)
21432934 {
21442935 StepAll();
21452936 } else
2146
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2937
+ if (source == deleteItem) // || event.getSource() == clearButton)
21472938 {
21482939 //int indices[] = jList.getSelectedIndices();
21492940 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2151,42 +2942,46 @@
21512942
21522943 ClearSelection(false);
21532944 } else
2154
- if (event.getSource() == clearAllItem)
2945
+ if (source == clearAllItem)
21552946 {
21562947 ClearSelection(true);
21572948 } else
2158
- if (event.getSource() == grabItem)
2949
+ if (source == grabItem || source == groupButton)
21592950 {
2160
- group(new cGroup(), true);
2951
+ group(new cGroup(), false); // true);
21612952 } else
2162
- if (event.getSource() == frontItem)
2953
+ if (source == hideItem)
2954
+ {
2955
+ group(new HiddenObject());
2956
+ } else
2957
+ if (source == frontItem)
21632958 {
21642959 front();
21652960 } else
2166
- if (event.getSource() == backItem)
2961
+ if (source == backItem)
21672962 {
21682963 back();
21692964 } else
2170
- if (event.getSource() == cameraItem)
2965
+ if (source == cameraItem)
21712966 {
21722967 makeSomething(new Camera());
21732968 } else
2174
- if (event.getSource() == compositeItem)
2969
+ if (source == compositeItem || source == compositeButton)
21752970 {
21762971 group(new Composite());
21772972 } else
2178
- if (event.getSource() == randomItem)
2973
+ if (source == switchItem || source == switchButton)
21792974 {
21802975 RandomNode random = new RandomNode();
21812976 group(random);
21822977 if (random.size() > 0)
2183
- random.name = random.get(0).name + "Rnd";
2978
+ random.name = random.get(0).name + "Switch";
21842979 } else
2185
- if (event.getSource() == physicsItem)
2980
+ if (source == physicsItem)
21862981 {
21872982 group(new PhysicsNode());
21882983 } else
2189
- if (event.getSource() == frameselectorItem)
2984
+ if (source == frameselectorItem)
21902985 {
21912986 for (int i=0; i<group.selection.size(); i++)
21922987 {
....@@ -2198,7 +2993,7 @@
21982993 ResetModel();
21992994 refreshContents();
22002995 } else
2201
- if (event.getSource() == switchGeoItem)
2996
+ if (source == switchGeoItem)
22022997 {
22032998 for (int i=0; i<group.selection.size(); i++)
22042999 {
....@@ -2210,7 +3005,7 @@
22103005 ResetModel();
22113006 refreshContents();
22123007 } else
2213
- if (event.getSource() == switchTransfoItem)
3008
+ if (source == switchTransfoItem)
22143009 {
22153010 for (int i=0; i<group.selection.size(); i++)
22163011 {
....@@ -2222,7 +3017,7 @@
22223017 ResetModel();
22233018 refreshContents();
22243019 } else
2225
- if (event.getSource() == morphItem)
3020
+ if (source == morphItem)
22263021 {
22273022 for (int i=0; i<group.selection.size(); i++)
22283023 {
....@@ -2234,7 +3029,7 @@
22343029 ResetModel();
22353030 refreshContents();
22363031 } else
2237
- if (event.getSource() == scriptNodeItem)
3032
+ if (source == scriptNodeItem)
22383033 {
22393034 boolean atleastone = false;
22403035
....@@ -2273,195 +3068,252 @@
22733068 }
22743069 }
22753070 } else
2276
- if (event.getSource() == linkerItem)
3071
+ if (source == linkerItem)
22773072 {
22783073 group(new cLinker());
22793074 } else
2280
- if (event.getSource() == textureItem)
3075
+ if (source == textureItem || source == textureButton)
22813076 {
22823077 group(new TextureNode());
22833078 } else
2284
- if (event.getSource() == shadowXItem)
3079
+ if (source == billboardItem)
3080
+ {
3081
+ group(new BillboardNode());
3082
+ } else
3083
+ if (source == shadowXItem)
22853084 {
22863085 CastShadow(0);
22873086 } else
2288
- if (event.getSource() == shadowYItem)
3087
+ if (source == shadowYItem)
22893088 {
22903089 CastShadow(1);
22913090 } else
2292
- if (event.getSource() == shadowZItem)
3091
+ if (source == shadowZItem)
22933092 {
22943093 CastShadow(2);
22953094 } else
2296
- if (event.getSource() == ungroupItem)
3095
+ if (source == ungroupItem || source == ungroupButton)
22973096 {
2298
- ungroup();
3097
+ boolean hasRoot = false;
3098
+
3099
+ for (int i=0; i<group.selection.size(); i++)
3100
+ {
3101
+ if (group.selection.get(i) == group)
3102
+ {
3103
+ hasRoot = true;
3104
+ break;
3105
+ }
3106
+ }
3107
+
3108
+ if (!hasRoot)
3109
+ {
3110
+ for (int i=0; i<group.selection.size(); i++)
3111
+ {
3112
+ Ungroup(group.selection.get(i));
3113
+ }
3114
+
3115
+ ClearSelection(false);
3116
+
3117
+ refreshContents();
3118
+ }
22993119 } else
2300
- if (event.getSource() == genUVItem)
3120
+ if (source == genUVItem)
23013121 {
23023122 GenUV();
23033123 } else
2304
- if (event.getSource() == genNormalsCADItem)
3124
+ if (source == genNormalsCADItem)
23053125 {
23063126 GenNormals(true);
23073127 } else
2308
- if (event.getSource() == genNormalsORGANItem)
3128
+ if (source == genNormalsMESHItem)
3129
+ {
3130
+ GenNormalsMESH();
3131
+ } else
3132
+ if (source == genNormalsORGANItem)
23093133 {
23103134 GenNormals(false);
23113135 } else
2312
- if (event.getSource() == stripifyItem)
3136
+ if (source == genNormalsMINEItem)
3137
+ {
3138
+ GenNormalsMINE();
3139
+ } else
3140
+ if (source == stripifyItem)
23133141 {
23143142 Stripify();
23153143 } else
2316
- if (event.getSource() == unstripifyItem)
3144
+ if (source == unstripifyItem)
23173145 {
23183146 Unstripify();
23193147 } else
2320
- if (event.getSource() == trimItem)
3148
+ if (source == trimItem)
23213149 {
23223150 Trim();
23233151 } else
2324
- if (event.getSource() == untrimItem)
3152
+ if (source == untrimItem)
23253153 {
23263154 Untrim();
23273155 } else
2328
- if (event.getSource() == clearColorsItem)
3156
+ if (source == clearColorsItem)
23293157 {
23303158 ClearColors();
23313159 } else
2332
- if (event.getSource() == clearMaterialsItem)
3160
+ if (source == clearMaterialsItem)
23333161 {
23343162 ClearMaterials();
23353163 } else
2336
- if (event.getSource() == liveleavesItem)
3164
+ if (source == liveleavesItem)
23373165 {
23383166 LiveLeaves(true);
23393167 } else
2340
- if (event.getSource() == unliveleavesItem)
3168
+ if (source == unliveleavesItem)
23413169 {
23423170 LiveLeaves(false);
23433171 } else
2344
- if (event.getSource() == supportleavesItem)
3172
+ if (source == supportleavesItem)
23453173 {
23463174 SupportLeaves(true);
23473175 } else
2348
- if (event.getSource() == unsupportleavesItem)
3176
+ if (source == unsupportleavesItem)
23493177 {
23503178 SupportLeaves(false);
23513179 } else
2352
- if (event.getSource() == hideleavesItem)
3180
+ if (source == hideleavesItem)
23533181 {
23543182 HideLeaves(true);
23553183 } else
2356
- if (event.getSource() == showleavesItem)
3184
+ if (source == showleavesItem)
23573185 {
23583186 HideLeaves(false);
23593187 } else
2360
- if (event.getSource() == markleavesItem)
3188
+ if (source == markleavesItem)
23613189 {
23623190 MarkLeaves(true);
23633191 } else
2364
- if (event.getSource() == unmarkleavesItem)
3192
+ if (source == unmarkleavesItem)
23653193 {
23663194 MarkLeaves(false);
23673195 } else
2368
- 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)
23693213 {
23703214 FlipV(true);
23713215 } else
2372
- if (event.getSource() == unflipVItem)
3216
+ if (source == unflipVItem)
23733217 {
23743218 FlipV(false);
23753219 } else
2376
- if (event.getSource() == lowTexturesItem)
3220
+ if (source == lowTexturesItem)
23773221 {
23783222 SetTexRes(0);
23793223 } else
2380
- if (event.getSource() == normalTexturesItem)
3224
+ if (source == normalTexturesItem)
23813225 {
23823226 SetTexRes(1);
23833227 } else
2384
- if (event.getSource() == highTexturesItem)
3228
+ if (source == highTexturesItem)
23853229 {
23863230 SetTexRes(2);
23873231 } else
2388
- if (event.getSource() == veryhighTexturesItem)
3232
+ if (source == veryhighTexturesItem)
23893233 {
23903234 SetTexRes(3);
23913235 } else
2392
- if (event.getSource() == maxTexturesItem)
3236
+ if (source == maxTexturesItem)
23933237 {
23943238 SetTexRes(4);
23953239 } else
2396
- if (event.getSource() == panoTexturesItem)
3240
+ if (source == panoTexturesItem)
23973241 {
23983242 SetTexRes(5);
23993243 } else
2400
- if (event.getSource() == reverseNormalsItem)
3244
+ if (source == reverseNormalsItem)
24013245 {
24023246 ReverseNormals();
24033247 } else
2404
- if (event.getSource() == parseverticesItem)
3248
+ if (source == parseverticesItem)
24053249 {
24063250 ParseVertices();
24073251 } else
2408
- if (event.getSource() == textureFieldItem)
3252
+ if (source == textureFieldItem)
24093253 {
24103254 TextureVertices();
24113255 } else
2412
- if (event.getSource() == alignItem)
3256
+ if (source == alignItem)
24133257 {
24143258 Align();
24153259 } else
2416
- if (event.getSource() == mirrorItem)
3260
+ if (source == mirrorItem)
24173261 {
24183262 MirrorPoses();
24193263 } else
2420
- if (event.getSource() == reduceMorphItem)
3264
+ if (source == reduceMorphItem)
24213265 {
24223266 MeshReduction(false);
24233267 } else
2424
- if (event.getSource() == reduce34MorphItem)
3268
+ if (source == reduce34MorphItem)
24253269 {
24263270 MeshReduction(true);
24273271 } else
2428
- if (event.getSource() == reverseTrianglesItem)
3272
+ if (source == reverseTrianglesItem)
24293273 {
24303274 ReverseTriangles();
24313275 } else
2432
- if (event.getSource() == reduceMeshItem)
3276
+ if (source == reduceMeshItem)
24333277 {
24343278 ReduceMesh(false);
24353279 } else
2436
- if (event.getSource() == reduce34MeshItem)
3280
+ if (source == reduce34MeshItem)
24373281 {
24383282 ReduceMesh(true);
24393283 } else
2440
- if (event.getSource() == increaseMeshItem)
3284
+ if (source == increaseMeshItem)
24413285 {
24423286 IncreaseMesh();
24433287 } else
2444
- if (event.getSource() == clipMeshItem)
3288
+ if (source == clipMeshItem)
24453289 {
24463290 ClipMesh();
24473291 } else
2448
- if (event.getSource() == smoothMeshItem)
3292
+ if (source == smoothMeshItem)
24493293 {
24503294 SmoothMesh();
24513295 } else
2452
- if (event.getSource() == transformgeometryItem)
3296
+ if (source == transformGeometryItem)
24533297 {
24543298 TransformGeometry();
24553299 } else
2456
- if (event.getSource() == resetTransformItem)
3300
+ if (source == transformChildrenItem)
3301
+ {
3302
+ TransformChildren();
3303
+ } else
3304
+ if (source == resetTransformItem)
24573305 {
24583306 ResetTransform();
24593307 } else
2460
- if (event.getSource() == resetCentroidItem)
3308
+ if (source == resetCentroidItem)
24613309 {
2462
- ResetCentroid();
3310
+ ResetCentroid(true);
24633311 } else
2464
- if (event.getSource() == resetParentItem)
3312
+ if (source == resetCentroidXZItem)
3313
+ {
3314
+ ResetCentroid(false);
3315
+ } else
3316
+ if (source == resetParentItem)
24653317 {
24663318 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24673319 {
....@@ -2471,7 +3323,7 @@
24713323
24723324 refreshContents();
24733325 } else
2474
- if (event.getSource() == repairParentItem)
3326
+ if (source == repairParentItem)
24753327 {
24763328 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24773329 {
....@@ -2485,7 +3337,21 @@
24853337
24863338 refreshContents();
24873339 } else
2488
- 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)
24893355 {
24903356 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24913357 {
....@@ -2497,7 +3363,7 @@
24973363 ResetModel();
24983364 refreshContents();
24993365 } else
2500
- if (event.getSource() == sortbynameItem)
3366
+ if (source == sortbynameItem)
25013367 {
25023368 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25033369 {
....@@ -2509,7 +3375,7 @@
25093375 ResetModel();
25103376 refreshContents();
25113377 } else
2512
- if (event.getSource() == attachPigmentItem)
3378
+ if (source == attachPigmentItem)
25133379 {
25143380 String texture = GetFile("Attach pigment");
25153381 Object3D obj;
....@@ -2521,7 +3387,7 @@
25213387
25223388 refreshContents();
25233389 } else
2524
- if (event.getSource() == detachPigmentItem)
3390
+ if (source == detachPigmentItem)
25253391 {
25263392 Object3D obj;
25273393 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2532,7 +3398,7 @@
25323398
25333399 refreshContents();
25343400 } else
2535
- if (event.getSource() == attachBumpItem)
3401
+ if (source == attachBumpItem)
25363402 {
25373403 String texture = GetFile("Attach bump");
25383404 Object3D obj;
....@@ -2544,18 +3410,18 @@
25443410
25453411 refreshContents();
25463412 } else
2547
- if (event.getSource() == detachBumpItem)
3413
+ if (source == detachBumpItem)
25483414 {
25493415 Object3D obj;
25503416 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25513417 {
25523418 obj = (Object3D)e.nextElement();
2553
- obj.SetBumpTexture(null);
3419
+ obj.ResetBumpTexture();
25543420 }
25553421
25563422 refreshContents();
25573423 } else
2558
- if (event.getSource() == pigmentBumpItem)
3424
+ if (source == pigmentBumpItem)
25593425 {
25603426 Object3D obj;
25613427 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2566,158 +3432,262 @@
25663432
25673433 refreshContents();
25683434 } else
2569
- 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)
25703461 {
25713462 CameraPane.flash = true;
25723463 refreshContents();
25733464 } else
2574
- if (event.getSource() == oneButton)
3465
+ if (source == oneButton)
25753466 {
25763467 } else
2577
- if (event.getSource() == twoButton)
3468
+ if (source == twoButton)
25783469 {
25793470 radio.layout = twoButton;
3471
+
3472
+ if (CameraPane.FULLSCREEN)
3473
+ fullscreenLayout = radio.layout;
3474
+
25803475 // bug
25813476 //gridPanel.setDividerLocation(1.0);
25823477 //bigPanel.setDividerLocation(0.0);
2583
- bigThree.remove(jtp);
2584
- bigThree.remove(cameraPanel);
2585
- bigThree.remove(XYZPanel);
2586
- aWindowConstraints.gridx = 0;
2587
- aWindowConstraints.gridy = 0;
2588
- aWindowConstraints.gridwidth = 1;
2589
- // aConstraints.gridheight = 3;
2590
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2591
- aWindowConstraints.weightx = 0;
2592
- aWindowConstraints.weighty = 1;
2593
- //bigThree.add(jtp, aWindowConstraints);
2594
- aWindowConstraints.weightx = 1;
2595
- aWindowConstraints.gridwidth = 3;
2596
- // aConstraints.gridheight = 3;
2597
- aWindowConstraints.gridx = 1;
2598
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2599
- bigThree.add(cameraPanel, aWindowConstraints);
2600
- aWindowConstraints.weightx = 0;
2601
- aWindowConstraints.gridx = 4;
2602
- aWindowConstraints.gridwidth = 1;
2603
- // aConstraints.gridheight = 3;
2604
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2605
- //bigThree.add(XYZPanel, aWindowConstraints);
2606
- 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
+
26073525 } else
2608
- if (event.getSource() == threeButton)
3526
+ if (source == threeButton)
26093527 {
26103528 radio.layout = threeButton;
2611
- bigThree.remove(jtp);
2612
- bigThree.remove(cameraPanel);
2613
- bigThree.remove(XYZPanel);
2614
- aWindowConstraints.gridx = 0;
2615
- aWindowConstraints.gridy = 0;
2616
- aWindowConstraints.gridwidth = 1;
2617
- // aConstraints.gridheight = 3;
2618
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2619
- aWindowConstraints.weightx = 0;
2620
- aWindowConstraints.weighty = 1;
2621
- //bigThree.add(jtp, aWindowConstraints);
2622
- aWindowConstraints.weightx = 1;
2623
- aWindowConstraints.gridwidth = 3;
2624
- // aConstraints.gridheight = 3;
2625
- aWindowConstraints.gridx = 1;
2626
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2627
- bigThree.add(cameraPanel, aWindowConstraints);
2628
- aWindowConstraints.weightx = 0;
2629
- aWindowConstraints.gridx = 4;
2630
- aWindowConstraints.gridwidth = 1;
2631
- // aConstraints.gridheight = 3;
2632
- aConstraints.fill = GridBagConstraints.VERTICAL;
2633
- bigThree.add(XYZPanel, aWindowConstraints);
2634
- 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();
26353566 } else
2636
- if (event.getSource() == fourButton)
3567
+ if (source == fourButton)
26373568 {
26383569 radio.layout = fourButton;
2639
- bigThree.remove(jtp);
2640
- bigThree.remove(cameraPanel);
2641
- bigThree.remove(XYZPanel);
2642
- aWindowConstraints.gridx = 0;
2643
- aWindowConstraints.gridy = 0;
2644
- aWindowConstraints.gridwidth = 1;
2645
- // aWindowConstraints.gridheight = 3;
2646
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2647
- aWindowConstraints.weightx = 1;
2648
- aWindowConstraints.weighty = 1;
2649
- bigThree.add(jtp, aWindowConstraints);
2650
- aWindowConstraints.weightx = 1;
2651
- aWindowConstraints.gridwidth = 3;
2652
- // aConstraints.gridheight = 3;
2653
- aWindowConstraints.gridx = 1;
2654
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2655
- //bigThree.add(cameraPanel, aWindowConstraints);
2656
- aWindowConstraints.weightx = 0;
2657
- aWindowConstraints.gridx = 4;
2658
- aWindowConstraints.gridwidth = 1;
2659
- // aWindowConstraints.gridheight = 3;
2660
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2661
- //bigThree.add(XYZPanel, aWindowConstraints);
2662
- 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();
26633606 } else
2664
- if (event.getSource() == sixButton)
3607
+ if (source == sixButton)
26653608 {
26663609 radio.layout = sixButton;
2667
- bigThree.remove(jtp);
2668
- bigThree.remove(cameraPanel);
2669
- bigThree.remove(XYZPanel);
2670
- aWindowConstraints.gridx = 0;
2671
- aWindowConstraints.gridy = 0;
2672
- aWindowConstraints.gridwidth = 1;
2673
- // aConstraints.gridheight = 3;
2674
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2675
- aWindowConstraints.weightx = 0;
2676
- aWindowConstraints.weighty = 1;
2677
- bigThree.add(jtp, aWindowConstraints);
2678
- aWindowConstraints.weightx = 1;
2679
- aWindowConstraints.gridwidth = 3;
2680
- // aWindowConstraints.gridheight = 3;
2681
- aWindowConstraints.gridx = 1;
2682
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2683
- bigThree.add(cameraPanel, aWindowConstraints);
2684
- aWindowConstraints.weightx = 0;
2685
- aWindowConstraints.gridx = 4;
2686
- aWindowConstraints.gridwidth = 1;
2687
- // aWindowConstraints.gridheight = 3;
2688
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2689
- //bigThree.add(XYZPanel, aConstraints);
2690
- 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();
26913647 } else
2692
- if (event.getSource() == sevenButton)
3648
+ if (source == sevenButton)
26933649 {
26943650 radio.layout = sevenButton;
2695
- bigThree.remove(jtp);
2696
- bigThree.remove(cameraPanel);
2697
- bigThree.remove(XYZPanel);
2698
- aWindowConstraints.gridx = 0;
2699
- aWindowConstraints.gridy = 0;
2700
- aWindowConstraints.gridwidth = 1;
2701
- // aWindowConstraints.gridheight = 3;
2702
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2703
- aWindowConstraints.weightx = 0;
2704
- aWindowConstraints.weighty = 1;
2705
- bigThree.add(jtp, aWindowConstraints);
2706
- aWindowConstraints.weightx = 1;
2707
- aWindowConstraints.gridwidth = 3;
2708
- // aWindowConstraints.gridheight = 3;
2709
- aWindowConstraints.gridx = 1;
2710
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2711
- bigThree.add(cameraPanel, aWindowConstraints);
2712
- aWindowConstraints.weightx = 0;
2713
- aWindowConstraints.gridx = 4;
2714
- aWindowConstraints.gridwidth = 1;
2715
- // aConstraints.gridheight = 3;
2716
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2717
- bigThree.add(XYZPanel, aWindowConstraints);
2718
- 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();
27193689 } else
2720
- if (event.getSource() == rootButton)
3690
+ if (source == rootButton)
27213691 {
27223692 Object3D obj;
27233693 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2727,66 +3697,84 @@
27273697 EditObject(obj);
27283698 }
27293699
3700
+ cameraView.requestFocusInWindow();
27303701 refreshContents(true);
27313702 } else
2732
- if (event.getSource() == closeButton)
3703
+ if (source == closeButton)
27333704 {
27343705 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27353706 cRadio ab;
27363707 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27373708 {
27383709 ab = (cRadio)e.nextElement();
2739
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3710
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27403711 {
3712
+ // Patch to avoid bug with transparency.
3713
+ if (!ab.hadMaterial)
3714
+ {
3715
+ ab.object.material = null;
3716
+ }
3717
+
27413718 buttonGroup.remove(ab);
27423719 radioPanel.remove(ab);
27433720
2744
- ab.GetObject().editWindow = null;
3721
+ //ab.GetObject().editWindow = null;
3722
+ ab.GetObject().manipWindow = null;
27453723 // ab.GetObject().objectUI = null; // ?????????
27463724
27473725 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27483726 break;
27493727 }
27503728 }
3729
+
3730
+ cameraView.requestFocusInWindow();
27513731 refreshContents(true);
27523732 } else
2753
- if (event.getSource() == editItem || event.getSource() == editButton)
3733
+ if (source == editItem || source == editButton)
27543734 {
3735
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3736
+ {
3737
+ Object3D child = (Object3D)e.nextElement();
3738
+ child.pinned = true;
3739
+ }
3740
+
27553741 EditSelection(false);
27563742 } else
2757
- if (event.getSource() == uneditButton)
3743
+ if (source == uneditButton)
27583744 {
27593745 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27603746 {
27613747 Object3D child = (Object3D)e.nextElement();
27623748 if(child.editWindow != null)
27633749 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3750
+ child.pinned = false;
27643751 child.CloseUI();
27653752 listUI.remove(child);
27663753
2767
- child.editWindow = null; // ???????????
3754
+ //child.editWindow = null; // ???????????
27683755 }
2769
- objEditor.ctrlPanel.revalidate();
3756
+ objEditor.ctrlPanel.FlushUI();
27703757 //objEditor.jTree.clearSelection();
27713758 //objEditor.ResetSliders();
27723759 refreshContents(true);
27733760 } else
2774
- if (event.getSource() == clearPanelButton)
3761
+ if (source == clearPanelButton)
27753762 {
27763763 assert(copy == group);
27773764 //copy.ClearUI();
27783765 for (Object3D obj : listUI)
27793766 {
3767
+ obj.pinned = false;
27803768 obj.CloseUI();
27813769 }
27823770 listUI.clear();
27833771 refreshContents(true);
27843772 } else
2785
- if (event.getSource() == allParamsButton)
3773
+ if (source == allParamsButton)
27863774 {
27873775 assert(copy == group);
27883776
2789
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3777
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27903778
27913779 for (Object3D obj : listUI)
27923780 {
....@@ -2803,19 +3791,19 @@
28033791
28043792 refreshContents(true);
28053793 } else
2806
- if (event.getSource() == unselectButton)
3794
+ if (source == unselectButton)
28073795 {
28083796 objEditor.jTree.clearSelection();
2809
- // ?? oct 2012 GraphreeD.clipboard.clear();
3797
+ // ?? oct 2012 GrafreeD.clipboard.clear();
28103798 objEditor.ResetSliders();
28113799 refreshContents(true);
28123800 } else
2813
- if(event.getSource() instanceof cRadio)
3801
+ if(source instanceof cRadio)
28143802 {
28153803 group.parent = keepparent;
28163804 group.attributes = 0;
28173805 //group.editWindow = null;
2818
- /*cRadio*/ radio = (cRadio)event.getSource();
3806
+ /*cRadio*/ radio = (cRadio)source;
28193807 Object3D obj = radio.GetObject();
28203808 System.out.println("Edit " + obj);
28213809 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2835,7 +3823,10 @@
28353823 }
28363824
28373825 copy = group;
2838
- //CameraPane.theRenderer.object = group;
3826
+
3827
+ SetUndoStates();
3828
+
3829
+ //Globals.theRenderer.object = group;
28393830 if(!useclient)
28403831 {
28413832 cameraView.renderCamera = radio.camera;
....@@ -2844,25 +3835,52 @@
28443835 cameraView.cameras[cameraView.cameracount] = radio.camera;
28453836 cameraView.targetLookAt.set(radio.camera.lookAt);
28463837 cameraView.object = group;
2847
- cameraView.lighttouched = true;
3838
+ //cameraView.lighttouched = true;
3839
+ Globals.lighttouched = true;
28483840 topView.object = group;
28493841 frontView.object = group;
28503842 sideView.object = group;
28513843 }
2852
- group.editWindow = this;
3844
+
3845
+// fix "+" issue
3846
+ //group.editWindow = this;
3847
+ group.manipWindow = this;
3848
+
28533849 /*
28543850 currentLayout = radio.layout;
28553851 if (currentLayout == null)
28563852 currentLayout = sevenButton;
28573853 */
28583854 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);
28593862 keepparent = group.parent;
28603863 // PARENT = NULL or not???
28613864 //group.parent = null; // ROOT
28623865 //group.attributes = -1;
28633866 ResetModel();
3867
+
3868
+ cameraView.requestFocusInWindow();
28643869 refreshContents(true);
2865
- }
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
+ }
28663884 else
28673885 {
28683886 //return super.action(event, arg);
....@@ -2871,7 +3889,6 @@
28713889 }
28723890
28733891 boolean useclient = false;
2874
- cRadio radio;
28753892
28763893 void ToggleRoot()
28773894 {
....@@ -2880,7 +3897,7 @@
28803897 if (useclient)
28813898 {
28823899 cameraView.object = client;
2883
- cameraView.lighttouched = true;
3900
+ Globals.lighttouched = true;
28843901 //topView.object = client;
28853902 //frontView.object = client;
28863903 //sideView.object = client;
....@@ -2888,7 +3905,7 @@
28883905 else
28893906 {
28903907 cameraView.object = group;
2891
- cameraView.lighttouched = true;
3908
+ Globals.lighttouched = true;
28923909 //topView.object = group;
28933910 //frontView.object = group;
28943911 //sideView.object = group;
....@@ -2923,6 +3940,28 @@
29233940 refreshContents();
29243941 }
29253942
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
+ }
29263965
29273966 void ResetTransform()
29283967 {
....@@ -3035,7 +4074,7 @@
30354074 refreshContents();
30364075 }
30374076
3038
- void ResetCentroid()
4077
+ void ResetCentroid(boolean full)
30394078 {
30404079 Object3D obj;
30414080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3050,12 +4089,16 @@
30504089 LA.matIdentity(Object3D.mat);
30514090 obj.getBounds(minima, maxima, false);
30524091 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3053
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4092
+ if (full)
4093
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30544094 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30554095 obj.TransformMesh(Object3D.mat);
4096
+
30564097 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3057
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4098
+ if (full)
4099
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30584100 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4101
+
30594102 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30604103 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30614104 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3084,7 +4127,8 @@
30844127
30854128 int size = obj.MemorySize();
30864129
3087
- 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)");
30884132 }
30894133 }
30904134 catch (Exception e)
....@@ -3121,9 +4165,9 @@
31214165 obj = (Object3D)e.nextElement();
31224166
31234167 System.out.println("Object is: " + obj);
3124
- GraphreeD.AnalyzeObject(obj);
4168
+ Grafreed.AnalyzeObject(obj);
31254169 System.out.println("Boundary rep: " + obj.bRep);
3126
- GraphreeD.AnalyzeObject(obj.bRep);
4170
+ Grafreed.AnalyzeObject(obj.bRep);
31274171
31284172 // System.err.println((size/1024) + " KB is the size of " + obj);
31294173 }
....@@ -3165,6 +4209,20 @@
31654209 void GenNormals(boolean crease)
31664210 {
31674211 group.GenNormalsS(crease);
4212
+
4213
+ refreshContents();
4214
+ }
4215
+
4216
+ void GenNormalsMESH()
4217
+ {
4218
+ group.GenNormalsMeshS();
4219
+
4220
+ refreshContents();
4221
+ }
4222
+
4223
+ void GenNormalsMINE()
4224
+ {
4225
+ group.selection.GenNormalsMINE();
31684226
31694227 refreshContents();
31704228 }
....@@ -3250,7 +4308,7 @@
32504308 // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
32514309 // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32524310 //
3253
-// g.add(GraphreeD.clipboard);
4311
+// g.add(GrafreeD.clipboard);
32544312 //
32554313 // buffer.add(g);
32564314 // }
....@@ -3269,8 +4327,8 @@
32694327 // nodes = new Object3D();
32704328 // vertices = new Vector<Vertex>();
32714329 //
3272
-// boolean epsequal = GraphreeD.epsequal;
3273
-// GraphreeD.epsequal = true;
4330
+// boolean epsequal = GrafreeD.epsequal;
4331
+// GrafreeD.epsequal = true;
32744332 //
32754333 // for (int i=0; i<group.selection.size(); i++)
32764334 // {
....@@ -3311,7 +4369,7 @@
33114369 // LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33124370 // LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33134371 //
3314
-// g.add(GraphreeD.clipboard);
4372
+// g.add(GrafreeD.clipboard);
33154373 //
33164374 // buffer.add(g);
33174375 // }
....@@ -3319,7 +4377,7 @@
33194377 // makeSomething(buffer, i==group.selection.size()-1);
33204378 // }
33214379 //
3322
-// GraphreeD.epsequal = epsequal;
4380
+// GrafreeD.epsequal = epsequal;
33234381 //
33244382 // //buffer = null;
33254383 // temprep = null;
....@@ -3330,8 +4388,8 @@
33304388
33314389 void ParseVertices()
33324390 {
3333
- boolean epsequal = GraphreeD.epsequal;
3334
- GraphreeD.epsequal = true;
4391
+ boolean epsequal = Grafreed.epsequal;
4392
+ Grafreed.epsequal = true;
33354393
33364394 for (int i=0; i<group.selection.size(); i++)
33374395 {
....@@ -3356,7 +4414,7 @@
33564414 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33574415 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33584416
3359
- g.add(GraphreeD.clipboard);
4417
+ g.add(Grafreed.clipboard);
33604418
33614419 buffer.add(g);
33624420 }
....@@ -3371,7 +4429,7 @@
33714429 makeSomething(buffer, i==group.selection.size()-1);
33724430 }
33734431
3374
- GraphreeD.epsequal = epsequal;
4432
+ Grafreed.epsequal = epsequal;
33754433
33764434 refreshContents();
33774435 }
....@@ -3389,7 +4447,16 @@
33894447 String pigment = Object3D.GetPigment(tex);
33904448 //String bump = Object3D.GetBump(tex);
33914449
3392
- 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
+ }
33934460
33944461 double s = v.s;
33954462
....@@ -3416,7 +4483,7 @@
34164483 scale /= 3;
34174484
34184485 scale /= 0xFF;
3419
- scale /= 4;
4486
+ // c'est quoi ca? scale /= 4;
34204487
34214488 //v.AO = scale;
34224489
....@@ -3437,12 +4504,26 @@
34374504
34384505 void Align()
34394506 {
4507
+ if (group.selection.size() == 0)
4508
+ return;
4509
+
4510
+ cVector bbmin = new cVector();
4511
+ cVector bbmax = new cVector();
4512
+
4513
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4514
+
4515
+ double dx = bbmax.x - bbmin.x;
4516
+ double dy = bbmax.y - bbmin.y;
4517
+ double dz = bbmax.z - bbmin.z;
4518
+
4519
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4520
+
34404521 for (int i=0; i<group.selection.size(); i++)
34414522 {
34424523 Object3D obj = group.selection.get(i);
34434524
3444
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3445
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4525
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4526
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34464527 }
34474528
34484529 refreshContents();
....@@ -3455,7 +4536,7 @@
34554536 // ref.SaveSupports();
34564537 // Object3D par = ref.parent;
34574538 // ref.parent = null;
3458
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4539
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
34594540 // ref.parent = par;
34604541 // ref.RestoreSupports();
34614542
....@@ -3463,11 +4544,11 @@
34634544
34644545 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34654546
3466
- boolean random = CameraPane.RANDOM;
3467
- CameraPane.RANDOM = false; // parse all random nodes
4547
+ boolean random = CameraPane.SWITCH;
4548
+ CameraPane.SWITCH = false; // parse all random nodes
34684549 lowres.linkVerticesThis(null);
34694550 lowres.linkVerticesThis(sn);
3470
- CameraPane.RANDOM = random;
4551
+ CameraPane.SWITCH = random;
34714552
34724553 System.err.flush();
34734554
....@@ -3485,7 +4566,7 @@
34854566 // lowres.SaveSupports();
34864567 // par = lowres.parent;
34874568 // lowres.parent = null;
3488
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4569
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
34894570 Object3D newlow = CloneObject(lowres, false);
34904571 newlow.name = sn.switchobject.get(i).name;
34914572 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3507,7 +4588,7 @@
35074588 return;
35084589
35094590 Object3D poses = group.selection.get(0);
3510
- Object3D ref = GraphreeD.clipboard.get(0);
4591
+ Object3D ref = Grafreed.clipboard.get(0);
35114592
35124593 Object3D newgroup = new Object3D("Po:" + poses.name);
35134594
....@@ -3676,7 +4757,7 @@
36764757 group.selection.RelinkToSupport(); // july 2014
36774758 System.out.println("DONE.");
36784759 refreshContents();
3679
- 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));
36804761 }
36814762
36824763 void ReduceMesh(boolean reduction34)
....@@ -3701,20 +4782,20 @@
37014782
37024783 void ClipMesh()
37034784 {
3704
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4785
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37054786 {
3706
- Object3D content = GraphreeD.clipboard.get(0);
4787
+ Object3D content = Grafreed.clipboard.get(0);
37074788
37084789 if (content instanceof cGroup && ((cGroup)content).transientlink )
37094790 content = ((cGroup)content).get(0);
37104791
37114792 // for (int i=0; i<group.selection.size(); i++)
37124793 // {
3713
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4794
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37144795 // }
3715
- group.selection.ClipMesh(GraphreeD.clipboard);
4796
+ group.selection.ClipMesh(Grafreed.clipboard);
37164797 }
3717
-// group.selection.ClipMesh(GraphreeD.clipboard);
4798
+// group.selection.ClipMesh(GrafreeD.clipboard);
37184799 System.out.println("DONE.");
37194800 refreshContents();
37204801 }
....@@ -3759,6 +4840,18 @@
37594840 void MarkLeaves(boolean hide)
37604841 {
37614842 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);
37624855 refreshContents();
37634856 }
37644857
....@@ -3833,28 +4926,25 @@
38334926 // }
38344927 // }
38354928
3836
- static boolean allparams = true;
3837
-
3838
- static Vector<Object3D> listUI = new Vector<Object3D>();
3839
-
38404929 void EditSelection(boolean newWindow)
38414930 {
4931
+ if (group.selection == null)
4932
+ {
4933
+ EditElement(group, newWindow); // ? new
4934
+ return;
4935
+ }
4936
+
38424937 // aConstraints.gridy = 0;
38434938 for (int i=0; i<group.selection.size(); i++)
38444939 {
38454940 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38464941 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3847
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4942
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38484943
38494944 Object3D elem = (Object3D)group.selection.elementAt(i);
3850
- if(elem != group)
4945
+ if(elem != group || !newWindow)
38514946 {
3852
- // if (!(elem instanceof Composite))
3853
- // newWindow = false;
3854
- listUI.add(elem);
3855
- elem.openEditWindow(this, newWindow); //, false);
3856
- System.out.println("edit : " + elem);
3857
- elem.editWindow.refreshContents(true); // ? new
4947
+ EditElement(elem, newWindow); // ? new
38584948 }
38594949 }
38604950 }
....@@ -3929,7 +5019,8 @@
39295019 //new Exception().printStackTrace();
39305020
39315021 freezemodel = true;
3932
-
5022
+ ClearUnpinned();
5023
+
39335024 /**/
39345025 //switch (event.id)
39355026 {
....@@ -3937,7 +5028,6 @@
39375028 //case 702: // Event.LIST_DESELECT
39385029 group.deselectAll();
39395030 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3940
- objEditor.ClearInfo(); // .GetMaterial());
39415031 if (tps != null)
39425032 {
39435033 for (int i=0; i < tps.length; i++)
....@@ -3946,33 +5036,39 @@
39465036
39475037 //if (child.parent != null)
39485038 //child.parent.addSelectee(child);
5039
+ objEditor.SetMaterial(child);
39495040 group.addSelectee(child);
3950
- objEditor.SetMaterial(child); // .GetMaterial());
3951
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3952
- System.err.println("info : " + child.GetPath());
39535041 }
39545042 }
3955
- else
3956
- {
3957
- objEditor.SetMaterial(group); // .GetMaterial());
3958
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3959
- System.err.println("info : " + group.GetPath());
3960
- }
5043
+// else
5044
+// {
5045
+// objEditor.SetMaterial(group); // .GetMaterial());
5046
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5047
+// System.err.println("info : " + group.GetPath());
5048
+// }
39615049
3962
- objEditor.SetText(); // jan 2014
3963
-
3964
- 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))
39655051 CameraPane.flash = true;
39665052
3967
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5053
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39685054 // a camera
39695055 {
3970
- CameraPane.camerachangeframe = 0; // don't refuse it
3971
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3972
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3973
- // 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;
39745063 }
39755064
5065
+ if (tps != null && tps.length == 1)
5066
+ {
5067
+ EditSelection(false);
5068
+ }
5069
+
5070
+ SetPinStates(tps != null && tps.length > 0);
5071
+
39765072 refreshContents();
39775073 //return true;
39785074 }
....@@ -3981,6 +5077,35 @@
39815077
39825078 freezemodel = false;
39835079 }
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
+ }
39845109
39855110 void linkSomething(Object3D thing)
39865111 {
....@@ -4052,16 +5177,19 @@
40525177 {
40535178 if (group.selection.isEmpty())
40545179 return;
4055
- GraphreeD.clipboardIsTempGroup = false;
5180
+
5181
+ Grafreed.clipboardIsTempGroup = false;
40565182 Composite tGroup = null;
40575183 if (group.selection.size() > 0) // 1)
40585184 {
40595185 tGroup = new cGroup();
4060
- GraphreeD.clipboardIsTempGroup = true;
5186
+ Grafreed.clipboardIsTempGroup = true;
40615187 }
40625188
40635189 if (cut)
40645190 {
5191
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5192
+// Save();
40655193 //int indices[] = jList.getSelectedIndices();
40665194 //for (int i = indices.length - 1; i >= 0; i--)
40675195 //jList.remove(indices[i]);
....@@ -4097,16 +5225,16 @@
40975225 //System.out.println("cut " + child);
40985226 //System.out.println("parent = " + child.parent);
40995227 // tmp.addChild(child);
4100
- if (GraphreeD.clipboardIsTempGroup)
5228
+ if (Grafreed.clipboardIsTempGroup)
41015229 tGroup.add/*Child*/(tmp);
41025230 else
4103
- GraphreeD.clipboard = tmp;
5231
+ Grafreed.clipboard = tmp;
41045232 }
41055233 else
4106
- if (GraphreeD.clipboardIsTempGroup)
5234
+ if (Grafreed.clipboardIsTempGroup)
41075235 tGroup.add/*Child*/(child);
41085236 else
4109
- GraphreeD.clipboard = child;
5237
+ Grafreed.clipboard = child;
41105238 }
41115239
41125240 //ResetModel();
....@@ -4138,21 +5266,23 @@
41385266 //System.out.println("cut " + elem);
41395267 //System.out.println("parent = " + elem.parent);
41405268 // tmp.addChild(elem);
4141
- if (GraphreeD.clipboardIsTempGroup)
5269
+ if (Grafreed.clipboardIsTempGroup)
41425270 tGroup.add/*Child*/(tmp);
41435271 else
4144
- GraphreeD.clipboard = tmp;
5272
+ Grafreed.clipboard = tmp;
41455273 }
41465274 else
4147
- if (GraphreeD.clipboardIsTempGroup)
5275
+ if (Grafreed.clipboardIsTempGroup)
41485276 tGroup.add/*Child*/(child);
41495277 else
4150
- GraphreeD.clipboard = child;
5278
+ Grafreed.clipboard = child;
41515279 }
41525280
41535281 }
4154
- if (GraphreeD.clipboardIsTempGroup)
4155
- GraphreeD.clipboard = tGroup;
5282
+
5283
+ if (Grafreed.clipboardIsTempGroup)
5284
+ Grafreed.clipboard = tGroup;
5285
+
41565286 if (cut)
41575287 {
41585288 ResetModel();
....@@ -4162,11 +5292,15 @@
41625292
41635293 void paste(boolean expand)
41645294 {
4165
- // if (GraphreeD.clipboard == null)
5295
+ if (Globals.REPLACEONMAKE)
5296
+ Save();
5297
+ boolean keep = Globals.REPLACEONMAKE;
5298
+ Globals.REPLACEONMAKE = false;
5299
+ // if (GrafreeD.clipboard == null)
41665300 // return;
41675301 boolean first = true;
41685302
4169
- if (GraphreeD.clipboardIsTempGroup)
5303
+ if (Grafreed.clipboardIsTempGroup)
41705304 {
41715305 Composite temp;
41725306
....@@ -4177,7 +5311,7 @@
41775311 temp = (Composite)Applet3D.clipboard.deepCopy();
41785312 */
41795313 Object3D elem;
4180
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5314
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41815315 {
41825316 Object3D child = (Object3D)e.nextElement();
41835317
....@@ -4191,7 +5325,7 @@
41915325 else
41925326 elem = child.deepCopy(); // ?
41935327 child.parent = keepparent;
4194
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5328
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
41955329 // elem = elem.get(0);
41965330 makeSomething(elem, true); // ?? first);
41975331 //group.addChild(elem);
....@@ -4211,23 +5345,24 @@
42115345 //Object3D cb = Applet3D.clipboard;
42125346 //temp.addChild(cb);
42135347 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4214
- assert(GraphreeD.clipboard.parent == null);
4215
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
4216
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
4217
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
4218
- makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.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());
42195353 else
4220
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4221
- GraphreeD.clipboard.get(0).parent = keepparent;
5354
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5355
+ Grafreed.clipboard.get(0).parent = keepparent;
42225356 }
42235357
5358
+ Globals.REPLACEONMAKE = keep;
42245359 ResetModel();
42255360 refreshContents();
42265361 }
42275362
4228
- void pasteInto(boolean copyit)
5363
+ void pasteInto(boolean copyit, boolean clone)
42295364 {
4230
-// if (GraphreeD.clipboard == null)
5365
+// if (GrafreeD.clipboard == null)
42315366 // return;
42325367
42335368 if (group.selection.size() != 1)
....@@ -4254,15 +5389,22 @@
42545389 if (copyit)
42555390 {
42565391 // paste(false);
4257
- CloneClipboard(false); // sept 2014
5392
+ if (clone)
5393
+ {
5394
+ CloneClipboard(false); // sept 2014
5395
+ }
5396
+ else
5397
+ {
5398
+ paste(false);
5399
+ }
42585400 }
42595401 else
42605402 {
42615403 boolean first = true;
42625404
4263
- if (GraphreeD.clipboardIsTempGroup)
5405
+ if (Grafreed.clipboardIsTempGroup)
42645406 {
4265
- Composite temp = (Composite)GraphreeD.clipboard;
5407
+ Composite temp = (Composite)Grafreed.clipboard;
42665408 Object3D copy;
42675409 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42685410 {
....@@ -4272,7 +5414,7 @@
42725414 }
42735415 } else
42745416 {
4275
- linkSomething(GraphreeD.clipboard); //.get(0));
5417
+ linkSomething(Grafreed.clipboard); //.get(0));
42765418 }
42775419 }
42785420 }
....@@ -4349,6 +5491,10 @@
43495491
43505492 void group(Object3D csg, boolean grab)
43515493 {
5494
+ if (Globals.REPLACEONMAKE)
5495
+ Save();
5496
+ boolean keep = Globals.REPLACEONMAKE;
5497
+ Globals.REPLACEONMAKE = false;
43525498 if (//false) // why??
43535499 !group.selection.isEmpty())
43545500 {
....@@ -4462,8 +5608,34 @@
44625608 //node.add(csg);
44635609 //makeSomething(node);
44645610 makeSomething(csg);
5611
+ Globals.REPLACEONMAKE = keep;
44655612 }
44665613
5614
+ void Ungroup(Object3D g)
5615
+ {
5616
+ if (Globals.REPLACEONMAKE)
5617
+ Save();
5618
+ boolean keep = Globals.REPLACEONMAKE;
5619
+ Globals.REPLACEONMAKE = false;
5620
+ if (g instanceof HiddenObject)
5621
+ {
5622
+ HiddenObject h = (HiddenObject) g;
5623
+
5624
+ for (int i=0; i<h.ActualSize(); i++)
5625
+ {
5626
+ objEditor.makeSomething(h.get(i), false);
5627
+ }
5628
+ }
5629
+ else
5630
+ {
5631
+ for (int i=0; i<g.Size(); i++)
5632
+ {
5633
+ objEditor.makeSomething(g.get(i), false);
5634
+ }
5635
+ }
5636
+ Globals.REPLACEONMAKE = keep;
5637
+ }
5638
+
44675639 void ungroup()
44685640 {
44695641 /*
....@@ -4657,21 +5829,6 @@
46575829 }
46585830 */
46595831
4660
- void ImportGFD()
4661
- {
4662
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4663
- browser.show();
4664
- String filename = browser.getFile();
4665
- if (filename != null && filename.length() > 0)
4666
- {
4667
- String fullname = browser.getDirectory() + filename;
4668
-
4669
- //Object3D readobj =
4670
- objEditor.ReadGFD(fullname, objEditor);
4671
- //makeSomething(readobj);
4672
- }
4673
- }
4674
-
46755832 /*
46765833 public void Callback(Object obj)
46775834 {
....@@ -4695,26 +5852,9 @@
46955852 }
46965853 */
46975854
4698
- void ImportVRMLX3D()
4699
- {
4700
- if (GraphreeD.standAlone)
4701
- {
4702
- /**/
4703
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4704
- browser.show();
4705
- String filename = browser.getFile();
4706
- if (filename != null && filename.length() > 0)
4707
- {
4708
- String fullname = browser.getDirectory() + filename;
4709
- LoadVRMLX3D(fullname);
4710
- }
4711
- /**/
4712
- }
4713
- }
4714
-
47155855 String GetFile(String dialogName)
47165856 {
4717
- if (GraphreeD.standAlone)
5857
+ if (Grafreed.standAlone)
47185858 {
47195859 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47205860 browser.show();
....@@ -4778,10 +5918,49 @@
47785918 cButton flashSelectionButton;
47795919 cButton editButton;
47805920 cButton uneditButton;
5921
+ JCheckBox allParamsButton;
47815922 cButton clearpanelButton;
4782
- cButton allParamsButton;
47835923 cButton unselectButton;
47845924
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
+
47855964 cButton screenfitButton;
47865965 cButton screenfitpointButton;
47875966 cButton snapobjectButton;
....@@ -4793,14 +5972,6 @@
47935972
47945973 cButton setsupportButton;
47955974
4796
- cButton twoButton;
4797
- cButton sixButton;
4798
- cButton threeButton;
4799
- cButton sevenButton;
4800
- cButton fourButton; // full panel
4801
- cButton oneButton; // full XYZ
4802
- //cButton currentLayout;
4803
-
48045975 //
48055976 //Composite
48065977 Object3D // to do !!
....@@ -4810,9 +5981,11 @@
48105981 //JTree jTree;
48115982 private MenuItem lookAtItem;
48125983 private MenuItem lookFromItem;
4813
- private MenuItem switchItem;
5984
+ private MenuItem switchViewItem;
48145985 private MenuItem cutItem;
4815
- private MenuItem duplicateItem;
5986
+ private MenuItem undoItem;
5987
+ private MenuItem redoItem;
5988
+ private JMenuItem duplicateItem;
48165989 private MenuItem cloneItem;
48175990 private MenuItem cloneSupportItem;
48185991 private MenuItem overwriteGeoItem;
....@@ -4823,8 +5996,9 @@
48235996 private MenuItem resetsupportItem;
48245997 private MenuItem resetreferencesItem;
48255998 private MenuItem linkverticesItem;
5999
+ private MenuItem relinkverticesItem;
48266000 private MenuItem setMasterItem;
4827
- private MenuItem resetMeshItem;
6001
+ private MenuItem resetAllItem;
48286002 private MenuItem stepAllItem;
48296003 private MenuItem revertMeshItem;
48306004 private MenuItem poseMeshItem;
....@@ -4835,14 +6009,17 @@
48356009 private MenuItem mergeGeometriesItem;
48366010 private MenuItem copyItem;
48376011 private MenuItem pasteItem;
6012
+ private MenuItem pasteIntoItem;
48386013 private MenuItem pasteLinkItem;
48396014 private MenuItem pasteCloneItem;
48406015 private MenuItem pasteExpandItem;
4841
- private MenuItem clearItem;
6016
+ private MenuItem deleteItem;
48426017 private MenuItem clearAllItem;
48436018 private MenuItem genUVItem;
6019
+ private MenuItem genNormalsMESHItem;
48446020 private MenuItem genNormalsCADItem;
48456021 private MenuItem genNormalsORGANItem;
6022
+ private MenuItem genNormalsMINEItem;
48466023 private MenuItem stripifyItem;
48476024 private MenuItem unstripifyItem;
48486025 private MenuItem trimItem;
....@@ -4871,6 +6048,10 @@
48716048 private MenuItem showleavesItem;
48726049 private MenuItem markleavesItem;
48736050 private MenuItem unmarkleavesItem;
6051
+ private MenuItem rewindleavesItem;
6052
+ private MenuItem unrewindleavesItem;
6053
+ private MenuItem randomleavesItem;
6054
+ private MenuItem unrandomleavesItem;
48746055
48756056 private MenuItem flipVItem;
48766057 private MenuItem unflipVItem;
....@@ -4882,14 +6063,17 @@
48826063 private MenuItem panoTexturesItem;
48836064
48846065 private MenuItem resetCentroidItem;
4885
- private MenuItem transformgeometryItem;
6066
+ private MenuItem resetCentroidXZItem;
48866067 private MenuItem resetTransformItem;
6068
+ private MenuItem transformGeometryItem;
6069
+ private MenuItem transformChildrenItem;
6070
+ private MenuItem hideItem;
48876071 private MenuItem grabItem;
48886072 private MenuItem backItem;
48896073 private MenuItem frontItem;
48906074 private MenuItem cameraItem;
48916075 private MenuItem compositeItem;
4892
- private MenuItem randomItem;
6076
+ private MenuItem switchItem;
48936077 private MenuItem physicsItem;
48946078 private MenuItem frameselectorItem;
48956079 private MenuItem scriptNodeItem;
....@@ -4904,6 +6088,7 @@
49046088
49056089 private MenuItem resetParentItem;
49066090 private MenuItem repairParentItem;
6091
+ private MenuItem repairShadowItem;
49076092 private MenuItem sortbysizeItem;
49086093 private MenuItem sortbynameItem;
49096094
....@@ -4912,6 +6097,8 @@
49126097 private MenuItem attachBumpItem;
49136098 private MenuItem detachBumpItem;
49146099 private MenuItem pigmentBumpItem;
6100
+ private MenuItem embedTexturesItem;
6101
+ private MenuItem deEmbedTexturesItem;
49156102
49166103 private MenuItem particleItem;
49176104 private MenuItem ragdollItem;
....@@ -4924,10 +6111,11 @@
49246111 private MenuItem coneItem;
49256112 private MenuItem torusItem;
49266113 private MenuItem superItem;
6114
+ private MenuItem kleinItem;
49276115 private MenuItem blobItem;
49286116 private MenuItem latheItem;
49296117 private MenuItem bezierItem;
4930
- private MenuItem checkerItem;
6118
+ private MenuItem overlayItem;
49316119 private MenuItem meshItem;
49326120 // private MenuItem meshGroupItem;
49336121 private MenuItem springItem;
....@@ -4936,6 +6124,7 @@
49366124 private MenuItem csgItem;
49376125 private MenuItem templateItem;
49386126 private MenuItem textureItem;
6127
+ private MenuItem billboardItem;
49396128 private MenuItem shadowXItem;
49406129 private MenuItem shadowYItem;
49416130 private MenuItem shadowZItem;
....@@ -4948,11 +6137,6 @@
49486137 private MenuItem doubleItem;
49496138 private MenuItem tripleItem;
49506139
4951
- private MenuItem importGFDItem;
4952
- private MenuItem importVRMLX3DItem;
4953
- private MenuItem import3DSItem;
4954
- private MenuItem importOBJItem;
4955
-
49566140 private MenuItem computeAOItem;
49576141 private MenuItem recompileItem;
49586142 private MenuItem editScriptItem;
....@@ -4962,4 +6146,8 @@
49626146 private MenuItem analyzeItem;
49636147 private MenuItem dumpItem;
49646148 //boolean freezemodel = false;
6149
+
6150
+ Menu cameraMenu;
6151
+ MenuItem editCameraItem;
6152
+ MenuItem restoreCameraItem;
49656153 }