Normand Briere
2019-07-30 475f8cbdbd96fdbf8f5b216ffebb31a51f25c2f9
GroupEditor.java
....@@ -23,6 +23,240 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
32
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
+ skyboxButton.setToolTipText(s);
34
+ skyboxButton.addActionListener(new ActionListener()
35
+ {
36
+ @Override
37
+ public void actionPerformed(ActionEvent e)
38
+ {
39
+ ChangeSkybox(path);
40
+ }
41
+ });
42
+ }
43
+
44
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
45
+ {
46
+ cGridBag tab0 = new cGridBag().setVertical(true);
47
+
48
+ tab0.setName("Urban");
49
+ skyboxpanel.add(tab0);
50
+
51
+ cGridBag row0 = new cGridBag();
52
+ cGridBag row1 = new cGridBag();
53
+ cGridBag row2 = new cGridBag();
54
+ cGridBag row3 = new cGridBag();
55
+ cGridBag row4 = new cGridBag();
56
+ cGridBag row5 = new cGridBag();
57
+ cGridBag row6 = new cGridBag();
58
+
59
+ AddSkyboxButton("default", "rgb", row0);
60
+ //AddSkyboxButton("default", "cornell", row0);
61
+ AddSkyboxButton("penguins", "dust", row0);
62
+ AddSkyboxButton("penguins", "tropic", row0);
63
+ AddSkyboxButton("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
+
26260 //ObjEditor objEditor;
27261 public void closeUI2()
28262 {
....@@ -60,6 +294,12 @@
60294 this.copy = this.group = group;
61295 //selectees = this.group.selectees;
62296
297
+ if (copy.versions == null)
298
+ {
299
+ copy.versions = new byte[100][];
300
+ copy.versionindex = -1;
301
+ }
302
+
63303 if(ui)
64304 SetupUI(objEditor);
65305 }
....@@ -74,16 +314,28 @@
74314 this.copy = this.group = copy;
75315 //selectees = this.group.selectees;
76316
77
- SetupMenu2(objEditor);
317
+ SetupMenu2(this); //objEditor);
78318 SetupUI2(objEditor);
79319 objEditor.SetupUI(true);
80320 SetupViews(objEditor);
81321
82322 ((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
+ }
83331 }
84332
85333 void CloneSelection(boolean supports)
86334 {
335
+ if (Globals.REPLACEONMAKE)
336
+ Save();
337
+ boolean keep = Globals.REPLACEONMAKE;
338
+ Globals.REPLACEONMAKE = false;
87339 // Object3D keep = GrafreeD.clipboard;
88340 //Object3D obj;
89341 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +346,19 @@
94346
95347 makeSomething(clone, i==group.selection.size()-1);
96348 }
349
+ Globals.REPLACEONMAKE = keep;
97350 }
98351
99352 void CloneClipboard(boolean supports)
100353 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
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));
106359 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
360
+ makeSomething(CloneObject(Grafreed.clipboard, false));
361
+ Grafreed.clipboard.get(0).parent = keepparent;
109362 }
110363
111364 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +372,7 @@
119372 // obj.support = null;
120373 if (!supports)
121374 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
375
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123376 obj.parent = parent;
124377 // obj.support = support;
125378 // clone.support = support; // aout 2013
....@@ -148,30 +401,29 @@
148401
149402 //JTextField nameField;
150403
151
- void SetupMenu2(ObjEditor oe)
404
+ void SetupMenu2(GroupEditor oe)
152405 {
153
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
154
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
155
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
156
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
157
- oe.cameraMenu.add("-");
158
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
159
- openWindowItem.addActionListener(this);
160
- editLeafItem.addActionListener(this);
161
- lookAtItem.addActionListener(this);
162
- //lookFromItem.addActinoListener(this);
163
- //switchItem.addActionListener(this);
406
+ oe.jTree = new cTree();
407
+
164408 Menu menu;
165409 oe.menuBar.add(menu = new Menu("Edit"));
166410 //editItem = menu.add(new MenuItem("Edit"));
167411 //editItem.addActionListener(this);
168
- 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"));
169419 duplicateItem.addActionListener(this);
170
- menu.add("-");
171420 cloneItem = menu.add(new MenuItem("Clone"));
172421 cloneItem.addActionListener(this);
422
+ if (Globals.ADVANCED)
423
+ {
173424 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174425 cloneSupportItem.addActionListener(this);
426
+ }
175427 menu.add("-");
176428 cutItem = menu.add(new MenuItem("Cut"));
177429 cutItem.addActionListener(this);
....@@ -179,27 +431,123 @@
179431 copyItem.addActionListener(this);
180432 pasteItem = menu.add(new MenuItem("Paste"));
181433 pasteItem.addActionListener(this);
434
+
435
+ menu.add("-");
436
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
437
+ pasteIntoItem.addActionListener(this);
182438 pasteLinkItem = menu.add(new MenuItem("Paste link"));
183439 pasteLinkItem.addActionListener(this);
184440 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185441 pasteCloneItem.addActionListener(this);
186442 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187443 // pasteExpandItem.addActionListener(this);
188
- clearItem = menu.add(new MenuItem("Clear"));
189
- 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...
190451 clearAllItem = menu.add(new MenuItem("Clear All"));
191452 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());
192490
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
+
193542 oe.menuBar.add(menu = new Menu("Setting"));
194
- resetMeshItem = menu.add(new MenuItem("Reset All"));
195
- resetMeshItem.addActionListener(this);
196
- stepAllItem = menu.add(new MenuItem("Step All"));
197
- stepAllItem.addActionListener(this);
543
+ if (Globals.ADVANCED)
544
+ {
198545 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199546 revertMeshItem.addActionListener(this);
200547 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201548 resetreferencesItem.addActionListener(this);
202549 menu.add("-");
550
+ }
203551 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204552 overwriteGeoItem.addActionListener(this);
205553 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,79 +559,104 @@
211559 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212560 overwriteUVItem.addActionListener(this);
213561 menu.add("-");
562
+ if (Globals.ADVANCED)
563
+ {
214564 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215565 generateMeshItem.addActionListener(this);
216566 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217567 poseMeshItem.addActionListener(this);
218568 menu.add("-");
569
+ }
219570 resetsupportItem = menu.add(new MenuItem("Reset support"));
220571 resetsupportItem.addActionListener(this);
221572 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222573 linkverticesItem.addActionListener(this);
223574 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224575 relinkverticesItem.addActionListener(this);
576
+
577
+ if (Globals.ADVANCED)
578
+ {
225579 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226580 setMasterItem.addActionListener(this);
581
+ }
227582
228583 oe.menuBar.add(menu = new Menu("Group"));
229
- grabItem = menu.add(new MenuItem("Grab"));
230
- grabItem.addActionListener(this);
584
+// grabItem = menu.add(new MenuItem("Grab"));
585
+// grabItem.addActionListener(this);
231586 backItem = menu.add(new MenuItem("Back"));
232587 backItem.addActionListener(this);
233588 frontItem = menu.add(new MenuItem("Front"));
234589 frontItem.addActionListener(this);
235
- compositeItem = menu.add(new MenuItem("Composite"));
236
- compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
590
+// compositeItem = menu.add(new MenuItem("Composite"));
591
+// compositeItem.addActionListener(this);
592
+
593
+ if (Globals.ADVANCED)
594
+ {
595
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238596 hideItem.addActionListener(this);
597
+ }
239598 ungroupItem = menu.add(new MenuItem("Ungroup"));
240599 ungroupItem.addActionListener(this);
241
- menu.add("-");
242
- randomItem = menu.add(new MenuItem("Random"));
243
- randomItem.addActionListener(this);
244
- physicsItem = menu.add(new MenuItem("Physics"));
245
- physicsItem.addActionListener(this);
246
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
247
- frameselectorItem.addActionListener(this);
600
+
601
+// menu.add("-");
602
+//
603
+// switchItem = menu.add(new MenuItem("Switch node"));
604
+// switchItem.addActionListener(this);
605
+ if (Globals.ADVANCED)
606
+ {
248607 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249608 switchGeoItem.addActionListener(this);
250609 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251610 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
611
+ morphItem = menu.add(new MenuItem("Morph Group"));
253612 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);
254619 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255620 scriptNodeItem.addActionListener(this);
256
- cameraItem = menu.add(new MenuItem("Camera"));
257
- cameraItem.addActionListener(this);
621
+ }
258622
259623 oe.menuBar.add(menu = new Menu("Object"));
260
- textureItem = menu.add(new MenuItem("Texture"));
261
- textureItem.addActionListener(this);
624
+// textureItem = menu.add(new MenuItem("Texture"));
625
+// textureItem.addActionListener(this);
262626 billboardItem = menu.add(new MenuItem("Billboard"));
263627 billboardItem.addActionListener(this);
264628 csgItem = menu.add(new MenuItem("CSG"));
265629 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
630
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267631 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
632
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269633 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
634
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271635 shadowZItem.addActionListener(this);
636
+ attributeItem = menu.add(new MenuItem("Attribute"));
637
+ attributeItem.addActionListener(this);
638
+
639
+ if (Globals.ADVANCED)
640
+ {
641
+ menu.add("-");
272642 linkerItem = menu.add(new MenuItem("Linker"));
273643 linkerItem.addActionListener(this);
274644 templateItem = menu.add(new MenuItem("Template"));
275645 templateItem.addActionListener(this);
276
- attributeItem = menu.add(new MenuItem("Attribute"));
277
- attributeItem.addActionListener(this);
278646 pointflowItem = menu.add(new MenuItem("Point Flow"));
279647 pointflowItem.addActionListener(this);
648
+ }
280649 menu.add("-");
281650 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282651 resetTransformItem.addActionListener(this);
283652 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284653 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
654
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
655
+ resetCentroidXZItem.addActionListener(this);
656
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
657
+ transformGeometryItem.addActionListener(this);
658
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
659
+ transformChildrenItem.addActionListener(this);
287660
288661 oe.menuBar.add(menu = new Menu("Geometry"));
289662 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +667,11 @@
294667 genNormalsCADItem.addActionListener(this);
295668 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296669 genNormalsMESHItem.addActionListener(this);
297
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
670
+ if (Globals.ADVANCED)
671
+ {
672
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
298673 genNormalsMINEItem.addActionListener(this);
674
+ }
299675 stripifyItem = menu.add(new MenuItem("Stripify"));
300676 stripifyItem.addActionListener(this);
301677 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +693,34 @@
317693 reduce34MeshItem.addActionListener(this);
318694 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319695 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322696 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323697 clipMeshItem.addActionListener(this);
698
+
699
+ if (Globals.ADVANCED)
700
+ {
701
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
702
+ smoothMeshItem.addActionListener(this);
703
+ }
324704
325705 oe.menuBar.add(menu = new Menu("Attributes"));
326706 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327707 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);
328712 menu.add("-");
329713 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330714 liveleavesItem.addActionListener(this);
331715 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332716 unliveleavesItem.addActionListener(this);
717
+ if (Globals.ADVANCED)
718
+ {
333719 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334720 supportleavesItem.addActionListener(this);
335721 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336722 unsupportleavesItem.addActionListener(this);
723
+ }
337724 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338725 hideleavesItem.addActionListener(this);
339726 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +729,14 @@
342729 markleavesItem.addActionListener(this);
343730 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344731 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);
345740 menu.add("-");
346741 flipVItem = menu.add(new MenuItem("Flip V"));
347742 flipVItem.addActionListener(this);
....@@ -367,45 +762,56 @@
367762 attachBumpItem.addActionListener(this);
368763 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
369764 pigmentBumpItem.addActionListener(this);
765
+ //embedTexturesItem
370766 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
371767 detachPigmentItem.addActionListener(this);
372768 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
373769 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);
374774 menu.add("-");
375775 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
376776 sortbysizeItem.addActionListener(this);
377777 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378778 sortbynameItem.addActionListener(this);
379779 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.
380787 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381788 extractGeometriesItem.addActionListener(this);
382789 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383790 cloneGeometriesItem.addActionListener(this);
384
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
385
- shareGeometriesItem.addActionListener(this);
386
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
387
- mergeGeometriesItem.addActionListener(this);
791
+ }
388792
389793 oe.menuBar.add(menu = new Menu("Insert"));
390794 buildCreateMenu(menu);
391795
392
-
393
- oe.menuBar.add(menu = new Menu("Include"));
394
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
395
- importGFDItem.addActionListener(this);
396
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
397
- importVRMLX3DItem.addActionListener(this);
398
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
399
- importOBJItem.addActionListener(this);
400
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
401
- import3DSItem.addActionListener(this);
402
-
403796 oe.menuBar.add(menu = new Menu("Tools"));
404797 buildToolsMenu(menu);
405798 }
406799
800
+
407801 void SetupUI2(ObjEditor oe)
408802 {
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
+
409815 //new Exception().printStackTrace();
410816
411817 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,110 +840,238 @@
434840 oe.radioPanel.add(dummyButton);
435841 oe.buttonGroup.add(dummyButton);
436842 */
437
- aConstraints.gridy += 1;
843
+ cGridBag copyOptionsPanel = new cGridBag();
844
+
845
+ copyOptionsPanel.preferredHeight = 2;
438846
439847 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
440848
441
- oe.aConstraints.gridwidth = 1;
442
- oe.aConstraints.gridx = 0;
849
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
850
+ //minButton.setToolTipText("Minimize window");
851
+ //minButton.addActionListener(this);
443852
444
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
445
- liveCB.setToolTipText("Enabled animation");
446
- liveCB.addItemListener(this);
447
-
448
- oe.aConstraints.gridx += 1;
449
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
450
- trackCB.setToolTipText("Enable tracking");
451
- trackCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
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);
455865 screenfitButton.setToolTipText("Screen fit");
456866 screenfitButton.addActionListener(this);
457
- oe.aConstraints.gridx += 1;
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");
901
+ liveCB.addItemListener(this);
902
+
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");
909
+ fastCB.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);
916
+
458917 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
459918 // screenfitpointButton.addActionListener(this);
460
-// oe.aConstraints.gridx += 1;
461
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
462
- snapobjectButton.addActionListener(this);
463
- snapobjectButton.setToolTipText("Snap Object");
464
- oe.aConstraints.gridx += 1;
465919
466
- //aConstraints.gridx = 0;
467
- //aConstraints.gridy += 1;
468
- oe.aConstraints.weighty = 0;
469
- oe.aConstraints.gridwidth = 1;
470
-
471
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
472
- flashSelectionButton.setToolTipText("Show selection");
473
- flashSelectionButton.addActionListener(this);
474
-
475
- oe.toolbarPanel.add(new cButton(" ", false));
476
-
477
- oe.aConstraints.gridx += 1;
478
- oe.aConstraints.weighty = 0;
479
- oe.aConstraints.gridwidth = 1;
480
-
481
- //
482
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
483
- twoButton.setToolTipText("Show center view only");
484
- twoButton.addActionListener(this);
485
- 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);
486927 fourButton.addActionListener(this);
487
- fourButton.setToolTipText("Show left panel only");
488
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
489
- sixButton.setToolTipText("2-column layout left");
490
- sixButton.addActionListener(this);
491
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
492
- threeButton.setToolTipText("2-column layout right");
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");
493940 threeButton.addActionListener(this);
494
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
495
- sevenButton.setToolTipText("3-column layout");
496
- 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);
497947 //
498948
499
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
500
- rootButton.setToolTipText("Edit object in new tab");
949
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ rootButton.setToolTipText("Open selection in new tab");
501951 rootButton.addActionListener(this);
502
- oe.aConstraints.gridx += 1;
503
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
952
+
953
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504954 closeButton.setToolTipText("Close tab");
505955 closeButton.addActionListener(this);
506956 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
507957 //clearButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509
-
510
- oe.aConstraints.gridx = 1; //
511
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
512
- editButton.addActionListener(this);
513
- oe.aConstraints.gridx += 1;
514
- oe.aConstraints.weighty = 0;
515
- oe.aConstraints.gridwidth = 1;
516958
517
- 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");
5181051 uneditButton.addActionListener(this);
5191052
520
- oe.aConstraints.gridx += 1;
521
- oe.aConstraints.weighty = 0;
522
- oe.aConstraints.gridwidth = 1;
523
-
524
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
525
- clearPanelButton.addActionListener(this);
526
-
527
- oe.aConstraints.gridx += 1;
528
- oe.aConstraints.weighty = 0;
529
- oe.aConstraints.gridwidth = 1;
530
-
531
- 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");
5321055 allParamsButton.addActionListener(this);
5331056
534
- oe.aConstraints.gridx += 1;
535
- oe.aConstraints.weighty = 0;
536
- oe.aConstraints.gridwidth = 1;
537
-
538
- 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");
5391063 unselectButton.addActionListener(this);
5401064
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
+
5411075 // oe.aConstraints.gridx += 1;
5421076 // oe.aConstraints.weighty = 0;
5431077 // oe.aConstraints.gridwidth = 1;
....@@ -549,47 +1083,32 @@
5491083 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5501084 // gcButton.addActionListener(this);
5511085
552
- oe.aConstraints.gridx = 0;
553
- oe.aConstraints.gridy += 1;
554
-
555
- //ctrlPanel.add(objList = new List(5, true));
556
- oe.aConstraints.gridwidth = 100;
557
- // oe.aConstraints.gridheight = 100;
558
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
559
- oe.aConstraints.gridheight = 1;
560
- oe.aConstraints.weighty = 0.5;
561
- oe.aConstraints.gridx = 0;
562
- JScrollPane jSP;
1086
+ cGridBag jSPPanel = new cGridBag();
1087
+
1088
+ JScrollPane jSP;
5631089 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
564
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1090
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5651091 ResetModel();
566
- oe.aConstraints.weighty = 0.5;
567
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
568
- oe.aConstraints.gridy += 1;
569
- oe.aConstraints.gridwidth = 1;
570
-
571
- oe.aConstraints.weighty = 0;
572
- oe.aConstraints.gridwidth = 2;
573
-
574
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
575
- colorCB.addItemListener(this);
576
- oe.aConstraints.gridx += 2;
577
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
578
- materialCB.addItemListener(this);
579
- oe.aConstraints.gridx += 2;
580
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
581
- textureCB.addItemListener(this);
582
-
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
5851092
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
+
5861105 //jList.addListSelectionListener(this);
5871106 oe.jTree.addTreeSelectionListener(this);
5881107 //jTree.setRootVisible(false);
5891108 //jTree.setEditable(true);
5901109 oe.jTree.setDragEnabled(true);
5911110 //jTree.setPreferredSize(new Dimension(10,10));
592
- jSP.setPreferredSize(new Dimension(100,200));
1111
+ //jSP.setPreferredSize(new Dimension(100,200));
5931112
5941113 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
5951114
....@@ -601,53 +1120,67 @@
6011120 dgr.addDragGestureListener(this);
6021121 }catch(Exception e) {}
6031122 */
604
- radio.layout = sevenButton;
1123
+ radio.layout = sixButton; // sevenButton;
6051124 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6061125 }
6071126
6081127 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6091128 {
610
- //constraints.gridx = 0;
611
- //constraints.gridy = 0;
612
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
613
- fastCB.setToolTipText("Fast mode");
614
- fastCB.addItemListener(this);
615
- //constraints.gridy += 1;
616
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
617
- supportCB.setToolTipText("Enabled rigging");
618
- supportCB.addItemListener(this);
1129
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1130
+ colorCB.setToolTipText("Copy color when dropped");
1131
+ colorCB.addItemListener(this);
6191132
620
- // constraints.gridy += 1;
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
+
6211161 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6221162 // localCB.addItemListener(this);
6231163
624
- //constraints.gridy += 1;
1164
+ panel.Return();
1165
+
6251166 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6261167 crowdCB.setToolTipText("Used for crowds");
6271168 crowdCB.addItemListener(this);
6281169
629
- //constraints.gridy += 1;
6301170 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
6311171 smoothCB.setToolTipText("Snapping delay");
6321172 smoothCB.addItemListener(this);
6331173
634
- //constraints.gridy += 1;
6351174 panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
6361175 slowCB.setToolTipText("Smooth interpolation");
6371176 slowCB.addItemListener(this);
638
- //constraints.gridy += 1;
639
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
640
- boxCB.setToolTipText("Display bounding boxes");
641
- boxCB.addItemListener(this);
642
- //constraints.gridy += 1;
643
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
644
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
645
- zoomBoxCB.addItemListener(this);
646
-
1177
+
6471178 // constraints.gridy += 1;
6481179 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6491180 // speakerMocapCB.addItemListener(this);
6501181
1182
+ panel.Return();
1183
+
6511184 if (false)
6521185 {
6531186 // handled in scripts
....@@ -662,36 +1195,85 @@
6621195 //constraints.gridy += 1;
6631196 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6641197 smoothfocusCB.addItemListener(this);
1198
+ panel.Return();
6651199 }
6661200
6671201 //constraints.gridx += 1;
6681202 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6691203 // debugCB.addItemListener(this);
6701204
671
- //constraints.gridy += 1;
1205
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1206
+ trackCB.setToolTipText("Enable tracking target");
1207
+ trackCB.addItemListener(this);
1208
+
6721209 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1210
+ oeilCB.setToolTipText("Move camera when tracking");
6731211 oeilCB.addItemListener(this);
6741212
675
- //constraints.gridy += 1;
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
+ {
6761233 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
6771234 lookAtCB.setToolTipText("Look-at target");
6781235 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);
6791250
6801251 }
6811252
6821253 void EditObject(Object3D obj)
6831254 {
6841255 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
+
6851264 radioButton.SetObject(obj);
686
- radioButton.layout = sevenButton;
1265
+ radioButton.layout = sixButton; // sevenButton;
6871266 radioButton.SetCamera(cameraView.renderCamera, false);
6881267 radioButton.addActionListener(this);
6891268 radioPanel.add(radioButton);
6901269 buttonGroup.add(radioButton);
6911270 radioButton.doClick();
6921271 }
1272
+
6931273 void SetupViews(ObjEditor oe)
6941274 {
1275
+ theFrame = this;
1276
+
6951277 oe.SetupViews();
6961278
6971279 System.out.println("SetupViews");
....@@ -700,23 +1282,28 @@
7001282 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7011283 }
7021284
703
- JCheckBox liveCB;
704
- JCheckBox supportCB;
705
- JCheckBox localCB;
706
- JCheckBox crowdCB;
707
- JCheckBox smoothCB;
708
- JCheckBox fastCB;
709
- JCheckBox slowCB;
710
- JCheckBox boxCB;
711
- JCheckBox zoomBoxCB;
712
- JCheckBox trackCB;
713
- 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;
7141298 // JCheckBox speakerMocapCB;
715
- JCheckBox speakerCameraCB;
716
- JCheckBox speakerFocusCB;
717
- JCheckBox debugCB;
718
- JCheckBox oeilCB;
719
- JCheckBox lookAtCB;
1299
+ cCheckBox speakerCameraCB;
1300
+ cCheckBox speakerFocusCB;
1301
+ cCheckBox debugCB;
1302
+
1303
+ cCheckBox oeilCB;
1304
+ cCheckBox shadowCB;
1305
+ cCheckBox autokeepCB;
1306
+ cCheckBox lookAtCB;
7201307
7211308 // static int COLOR = 1;
7221309 // static int MATERIAL = 2;
....@@ -724,9 +1311,9 @@
7241311
7251312 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7261313
727
- JCheckBox colorCB;
728
- JCheckBox materialCB;
729
- JCheckBox textureCB;
1314
+ cCheckBox colorCB;
1315
+ cCheckBox materialCB;
1316
+ cCheckBox textureCB;
7301317
7311318 public void itemStateChanged(ItemEvent e)
7321319 {
....@@ -754,6 +1341,7 @@
7541341 } else if(e.getSource() == liveCB)
7551342 {
7561343 cameraView.ToggleLive();
1344
+ refreshContents(false);
7571345 }
7581346 else if(e.getSource() == supportCB)
7591347 {
....@@ -818,6 +1406,18 @@
8181406 {
8191407 cameraView.ToggleOeil();
8201408 }
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
+ }
8211421 else if(e.getSource() == lookAtCB)
8221422 {
8231423 cameraView.ToggleLookAt();
....@@ -834,7 +1434,8 @@
8341434
8351435 /**/
8361436 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
837
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1437
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1438
+ TreePath path = objEditor.jTree.getSelectionPath();
8381439 if ((path == null) || (path.getPathCount() <= 1)) {
8391440 // We can't move the root node or an empty selection
8401441 return;
....@@ -897,8 +1498,6 @@
8971498 }
8981499 }
8991500
900
- String string = (String) object;
901
-
9021501 System.out.println("Transfer = " + object + "; drop : " + target);
9031502 // if( object instanceof java.io.File[])
9041503 // {
....@@ -906,7 +1505,11 @@
9061505 // objEditor.DropFile((java.io.File[]) object, true);
9071506 // return;
9081507 // }
909
- 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) == ':')
9101513 {
9111514 // file(s)
9121515 String[] names = string.split("\n");
....@@ -933,7 +1536,7 @@
9331536
9341537 flashIt = false;
9351538 CameraPane pane = (CameraPane) target;
936
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1539
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9371540 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9381541
9391542 if (group.selection.size() == 1)
....@@ -949,23 +1552,33 @@
9491552
9501553 assert target == objEditor.jTree;
9511554 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1555
+ Object3D destinationLeaf;
9521556 try {
953
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1557
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9541558 } catch (Exception e) {
9551559 System.out.println("destinationPath : " + destinationPath);
9561560 return;
9571561 }
9581562
959
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1563
+ for (int i=group.selection.size(); --i>=0;)
9601564 {
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
+// {
9611574 loadClipboard(true);
9621575 objEditor.jTree.setSelectionPath(destinationPath);
963
- pasteInto(false);
964
- } else {
965
- loadClipboard(false);
966
- objEditor.jTree.setSelectionPath(destinationPath);
967
- pasteInto(false); // true); // ???
968
- }
1576
+ pasteInto(false, false);
1577
+// } else {
1578
+// loadClipboard(false);
1579
+// objEditor.jTree.setSelectionPath(destinationPath);
1580
+// pasteInto(false, false); // true); // ???
1581
+// }
9691582 }
9701583 public void dropActionChanged(DropTargetDragEvent dtde)
9711584 // Called if the user has modified the current drop gesture
....@@ -1070,85 +1683,107 @@
10701683 {
10711684 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10721685 //heightFieldItem.addActionListener(this);
1073
- gridItem = menu.add(new MenuItem("Grid"));
1074
- gridItem.addActionListener(this);
1075
- rectoidItem = menu.add(new MenuItem("Box"));
1076
- rectoidItem.addActionListener(this);
1077
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1078
- ellipsoidItem.addActionListener(this);
1079
- coneItem = menu.add(new MenuItem("Cone"));
1080
- coneItem.addActionListener(this);
1081
- torusItem = menu.add(new MenuItem("Torus"));
1082
- torusItem.addActionListener(this);
1083
- superItem = menu.add(new MenuItem("Superellipsoid"));
1084
- superItem.addActionListener(this);
1686
+// gridItem = menu.add(new MenuItem("Grid"));
1687
+// gridItem.addActionListener(this);
1688
+// rectoidItem = menu.add(new MenuItem("Box"));
1689
+// rectoidItem.addActionListener(this);
1690
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1691
+// ellipsoidItem.addActionListener(this);
1692
+// coneItem = menu.add(new MenuItem("Cone"));
1693
+// coneItem.addActionListener(this);
1694
+// torusItem = menu.add(new MenuItem("Torus"));
1695
+// torusItem.addActionListener(this);
1696
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1697
+// superItem.addActionListener(this);
1698
+
1699
+ cameraItem = menu.add(new MenuItem("Camera"));
1700
+ cameraItem.addActionListener(this);
1701
+
1702
+ if (!Globals.ADVANCED)
1703
+ {
10851704 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10861705 kleinItem.addActionListener(this);
1087
- particleItem = menu.add(new MenuItem("Particle system"));
1088
- particleItem.addActionListener(this);
1706
+ }
1707
+
1708
+// particleItem = menu.add(new MenuItem("Particle system"));
1709
+// particleItem.addActionListener(this);
1710
+ if (Globals.ADVANCED)
1711
+ {
10891712 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10901713 ragdollItem.addActionListener(this);
10911714 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10921715 ragdoll2Item.addActionListener(this);
1716
+ }
10931717 menu.add("-");
1094
- meshItem = menu.add(new MenuItem("Mesh"));
1718
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10951719 meshItem.addActionListener(this);
10961720 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10971721 // meshGroupItem.addActionListener(this);
1722
+ if (Globals.ADVANCED)
1723
+ {
10981724 springItem = menu.add(new MenuItem("Spring"));
10991725 springItem.addActionListener(this);
11001726 flagItem = menu.add(new MenuItem("Flag"));
11011727 flagItem.addActionListener(this);
1102
- bezierItem = menu.add(new MenuItem("Patch"));
1103
- bezierItem.addActionListener(this);
1104
- checkerItem = menu.add(new MenuItem("Checker"));
1105
- checkerItem.addActionListener(this);
11061728 blobItem = menu.add(new MenuItem("Blob"));
11071729 blobItem.addActionListener(this);
11081730 latheItem = menu.add(new MenuItem("Lathe"));
11091731 latheItem.addActionListener(this);
1110
- lightItem = menu.add(new MenuItem("Light"));
1111
- 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);
11121739 menu.add("-");
11131740 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11141741 //superLoopItem.addActionListener(this);
1115
- loopItem = menu.add(new MenuItem("Loop"));
1116
- loopItem.addActionListener(this);
1742
+// loopItem = menu.add(new MenuItem("Loop"));
1743
+// loopItem.addActionListener(this);
11171744 doubleItem = menu.add(new MenuItem("Fork"));
11181745 doubleItem.addActionListener(this);
1746
+ if (Globals.ADVANCED)
1747
+ {
11191748 tripleItem = menu.add(new MenuItem("Trident"));
11201749 tripleItem.addActionListener(this);
1750
+ }
11211751 }
11221752
11231753 void buildToolsMenu(Menu menu)
11241754 {
11251755 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11261756 animationItem.addItemListener(this);
1127
- animationItem.setState(CameraPane.ANIMATION);
1757
+ animationItem.setState(Globals.ANIMATION);
1758
+
1759
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1760
+ archiveItem.addActionListener(this);
11281761
11291762 menu.add("-");
11301763 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11311764 parseverticesItem.addActionListener(this);
11321765 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11331766 textureFieldItem.addActionListener(this);
1134
- alignItem = menu.add(new MenuItem("Align"));
1767
+ alignItem = menu.add(new MenuItem("Align Objects"));
11351768 alignItem.addActionListener(this);
1136
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1137
- mirrorItem.addActionListener(this);
11381769 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11391770 reduceMorphItem.addActionListener(this);
11401771 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11411772 reduce34MorphItem.addActionListener(this);
1142
-
1143
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1144
- computeAOItem.addActionListener(this);
11451773 menu.add("-");
1146
-
11471774 menu.add(memoryItem = new MenuItem("Memory Usage"));
11481775 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("-");
11491784 menu.add(analyzeItem = new MenuItem("Analyze"));
11501785 analyzeItem.addActionListener(this);
1151
- menu.add(dumpItem = new MenuItem("Dump"));
1786
+ menu.add(dumpItem = new MenuItem("Print"));
11521787 dumpItem.addActionListener(this);
11531788 // menu.add(pathItem = new MenuItem("From-to path"));
11541789 // pathItem.addActionListener(this);
....@@ -1166,6 +1801,7 @@
11661801 menu.add("-");
11671802 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11681803 editScriptItem.addActionListener(this);
1804
+ }
11691805 }
11701806
11711807 void ScreenFit()
....@@ -1288,9 +1924,34 @@
12881924 shadow.material = new cMaterial(obj.material);
12891925 shadow.material.diffuse = 0.0001f;
12901926 shadow.material.specular = 0.0001f;
1927
+ //shadow.projectedVertices[1].x = 300;
12911928
12921929 makeSomething(shadow);
12931930 }
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
+ }
12941955
12951956 /**
12961957 * applyExample
....@@ -1494,9 +2155,9 @@
14942155
14952156 void Overwrite(int mask)
14962157 {
1497
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2158
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14982159 {
1499
- Object3D content = GrafreeD.clipboard.get(0);
2160
+ Object3D content = Grafreed.clipboard.get(0);
15002161
15012162 if (content instanceof cGroup && ((cGroup)content).transientlink )
15022163 content = ((cGroup)content).get(0);
....@@ -1535,7 +2196,7 @@
15352196 {
15362197 ScreenFit();
15372198 } else
1538
- if (source == switchItem)
2199
+ if (source == switchViewItem)
15392200 {
15402201 cVector v1 = new cVector();
15412202 cVector v2 = new cVector();
....@@ -1544,11 +2205,11 @@
15442205 objEditor.cameraView.renderCamera.setAim(v2, v1);
15452206 objEditor.cameraView.repaint();
15462207 } else
1547
- if (source == rectoidItem)
2208
+ if (source == rectoidItem || source == boxButton)
15482209 {
15492210 makeSomething(new Box());
15502211 } else
1551
- if (source == particleItem)
2212
+ if (source == particleItem || source == particlesButton)
15522213 {
15532214 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15542215 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1627,27 +2288,27 @@
16272288
16282289 makeSomething(obj);
16292290 } else
1630
- if (source == gridItem)
2291
+ if (source == gridItem || source == gridButton)
16312292 {
16322293 makeSomething(new Grid());
16332294 } else
1634
- if (source == ellipsoidItem)
2295
+ if (source == ellipsoidItem || source == sphereButton)
16352296 {
16362297 makeSomething(new Sphere());
16372298 } else
1638
- if (source == coneItem)
2299
+ if (source == coneItem || source == coneButton)
16392300 {
16402301 makeSomething(new Cone());
16412302 } else
1642
- if (source == torusItem)
2303
+ if (source == torusItem || source == torusButton)
16432304 {
16442305 makeSomething(new Torus());
16452306 } else
1646
- if (source == superItem)
2307
+ if (source == superItem || source == superButton)
16472308 {
16482309 makeSomething(new Superellipsoid());
16492310 } else
1650
- if (source == kleinItem)
2311
+ if (source == kleinItem || source == kleinButton)
16512312 {
16522313 makeSomething(new Klein());
16532314 } else
....@@ -1667,7 +2328,7 @@
16672328 {
16682329 makeSomething(new BezierSurface());
16692330 } else
1670
- if (source == checkerItem)
2331
+ if (source == overlayItem || source == overlayButton)
16712332 {
16722333 /*
16732334 Object3D obj = new BezierSurface(5,8);
....@@ -1715,10 +2376,27 @@
17152376 s.setup();
17162377 makeSomething(s);
17172378 } else
1718
- if (source == lightItem)
2379
+ if (source == lightItem || source == lightButton)
17192380 {
17202381 makeSomething(new Light());
17212382 } else
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
17222400 if (source == csgItem)
17232401 {
17242402 group(new CSG());
....@@ -1765,30 +2443,30 @@
17652443
17662444 group(g);
17672445 } else
1768
- if (source == loopItem)
2446
+ if (source == loopItem || source == loopButton)
17692447 {
17702448 Composite csg = new GroupLeaf();
17712449 csg.count = 5;
17722450 group(csg);
1773
- Composite child = new cGroup();
2451
+ Composite child = new cGroup("Branch");
17742452 csg.addChild(child);
17752453 child.addChild(csg);
17762454 } else
17772455 if (source == doubleItem)
17782456 {
1779
- Composite csg = new GroupLeaf();
2457
+ Composite csg = new GroupLeaf("Fork");
17802458 csg.count = 5;
17812459 group(csg);
1782
- Composite child = new cGroup();
2460
+ Composite child = new cGroup("Branch A");
17832461 csg.addChild(child);
17842462 child.addChild(csg);
1785
- child = new cGroup();
2463
+ child = new cGroup("Branch B");
17862464 csg.addChild(child);
17872465 child.addChild(csg);
17882466 } else
17892467 if (source == tripleItem)
17902468 {
1791
- Composite csg = new GroupLeaf();
2469
+ Composite csg = new GroupLeaf("Trident");
17922470 csg.count = 4;
17932471 group(csg);
17942472 Composite child = new cGroup();
....@@ -1801,27 +2479,10 @@
18012479 csg.addChild(child);
18022480 child.addChild(csg);
18032481 } else
1804
-
1805
- if (source == importGFDItem)
1806
- {
1807
- ImportGFD();
1808
- } else
1809
- if (source == importVRMLX3DItem)
1810
- {
1811
- ImportVRMLX3D();
1812
- } else
1813
- if (source == import3DSItem)
1814
- {
1815
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1816
- } else
1817
- if (source == importOBJItem)
1818
- {
1819
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1820
- } else
18212482 if (source == computeAOItem)
18222483 {
18232484 Globals.drawMode = CameraPane.OCCLUSION;
1824
- Globals.theRenderer.repaint();
2485
+ cameraView.repaint();
18252486 } else
18262487 if (source == recompileItem)
18272488 {
....@@ -1836,7 +2497,7 @@
18362497 if (source == invariantsItem)
18372498 {
18382499 System.out.println("Invariants:");
1839
- GrafreeD.grafreeD.universe.invariants();
2500
+ Grafreed.grafreeD.universe.invariants();
18402501 } else
18412502 if (source == memoryItem)
18422503 {
....@@ -1855,19 +2516,61 @@
18552516 {
18562517 DumpObject();
18572518 } else
2519
+ if (source == minButton)
2520
+ {
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
18582564 if (source == screenfitButton)
18592565 {
1860
- //Reload(lastConverter, lastFilename, true);
18612566 ScreenFit();
18622567 } else
18632568 if (source == screenfitpointButton)
18642569 {
1865
- //Reload(lastConverter, lastFilename, true);
18662570 ScreenFitPoint();
18672571 } else
18682572 if (source == snapobjectButton)
18692573 {
1870
- //Reload(lastConverter, lastFilename, true);
18712574 SnapObject();
18722575 } else
18732576 // if (event.getSource() == recompileButton)
....@@ -1904,12 +2607,20 @@
19042607 {
19052608 loadClipboard(true);
19062609 } else
2610
+ if (source == undoItem)
2611
+ {
2612
+ Undo();
2613
+ } else
2614
+ if (source == redoItem)
2615
+ {
2616
+ Redo();
2617
+ } else
19072618 if (source == duplicateItem)
19082619 {
1909
- Object3D keep = GrafreeD.clipboard;
2620
+ Object3D keep = Grafreed.clipboard;
19102621 loadClipboard(false);
19112622 paste(false);
1912
- GrafreeD.clipboard = keep;
2623
+ Grafreed.clipboard = keep;
19132624 } else
19142625 if (source == cloneItem)
19152626 {
....@@ -1927,13 +2638,17 @@
19272638 {
19282639 paste(false);
19292640 } else
2641
+ if (source == pasteIntoItem)
2642
+ {
2643
+ pasteInto(true, false);
2644
+ } else
19302645 if (source == pasteLinkItem)
19312646 {
1932
- pasteInto(false);
2647
+ pasteInto(false, false);
19332648 } else
19342649 if (source == pasteCloneItem)
19352650 {
1936
- pasteInto(true);
2651
+ pasteInto(true, true);
19372652 } else
19382653 if (source == pasteExpandItem)
19392654 {
....@@ -2125,9 +2840,9 @@
21252840 // group.selection.get(0).setMasterThis(content); // should be identity
21262841 // refreshContents();
21272842 // }
2128
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2843
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21292844 {
2130
- Object3D content = GrafreeD.clipboard.get(0);
2845
+ Object3D content = Grafreed.clipboard.get(0);
21312846
21322847 if (content instanceof cGroup && ((cGroup)content).transientlink )
21332848 content = ((cGroup)content).get(0);
....@@ -2135,11 +2850,11 @@
21352850 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21362851 for (int i=0; i<group.selection.size(); i++)
21372852 {
2138
- boolean random = CameraPane.RANDOM;
2139
- CameraPane.RANDOM = false; // parse all random nodes
2853
+ boolean random = CameraPane.SWITCH;
2854
+ CameraPane.SWITCH = false; // parse all random nodes
21402855 group.selection.get(i).linkVerticesThis(content);
21412856 // group.selection.get(i).setMasterThis(content); // should be identity
2142
- CameraPane.RANDOM = random;
2857
+ CameraPane.SWITCH = random;
21432858 }
21442859 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21452860 refreshContents();
....@@ -2149,20 +2864,20 @@
21492864 {
21502865 for (int i=0; i<group.selection.size(); i++)
21512866 {
2152
- boolean random = CameraPane.RANDOM;
2153
- CameraPane.RANDOM = false; // parse all random nodes
2867
+ boolean random = CameraPane.SWITCH;
2868
+ CameraPane.SWITCH = false; // parse all random nodes
21542869 group.selection.get(i).linkVerticesThis(null);
2155
- CameraPane.RANDOM = random;
2870
+ CameraPane.SWITCH = random;
21562871 }
21572872
21582873 refreshContents();
21592874 } else
21602875 if (source == relinkverticesItem)
21612876 {
2162
- boolean random = CameraPane.RANDOM;
2163
- CameraPane.RANDOM = false; // parse all random nodes
2877
+ boolean random = CameraPane.SWITCH;
2878
+ CameraPane.SWITCH = false; // parse all random nodes
21642879 group.selection.RelinkToSupport();
2165
- CameraPane.RANDOM = random;
2880
+ CameraPane.SWITCH = random;
21662881
21672882 refreshContents();
21682883 } else
....@@ -2177,9 +2892,9 @@
21772892 } else
21782893 if (source == setMasterItem)
21792894 {
2180
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2895
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21812896 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2897
+ Object3D content = Grafreed.clipboard.get(0);
21832898
21842899 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852900 content = ((cGroup)content).get(0);
....@@ -2192,9 +2907,9 @@
21922907 {
21932908 if (group.selection.size() == 1)
21942909 {
2195
- if (GrafreeD.clipboard.size() == 1)
2910
+ if (Grafreed.clipboard.size() == 1)
21962911 {
2197
- Object3D content = GrafreeD.clipboard.get(0);
2912
+ Object3D content = Grafreed.clipboard.get(0);
21982913
21992914 if (content instanceof cGroup && ((cGroup)content).transientlink )
22002915 content = ((cGroup)content).get(0);
....@@ -2211,7 +2926,7 @@
22112926 {
22122927 RevertMeshes();
22132928 } else
2214
- if (source == resetMeshItem)
2929
+ if (source == resetAllItem)
22152930 {
22162931 ResetAll();
22172932 } else
....@@ -2219,7 +2934,7 @@
22192934 {
22202935 StepAll();
22212936 } else
2222
- if (source == clearItem) // || event.getSource() == clearButton)
2937
+ if (source == deleteItem) // || event.getSource() == clearButton)
22232938 {
22242939 //int indices[] = jList.getSelectedIndices();
22252940 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2231,9 +2946,9 @@
22312946 {
22322947 ClearSelection(true);
22332948 } else
2234
- if (source == grabItem)
2949
+ if (source == grabItem || source == groupButton)
22352950 {
2236
- group(new cGroup(), true);
2951
+ group(new cGroup(), false); // true);
22372952 } else
22382953 if (source == hideItem)
22392954 {
....@@ -2251,16 +2966,16 @@
22512966 {
22522967 makeSomething(new Camera());
22532968 } else
2254
- if (source == compositeItem)
2969
+ if (source == compositeItem || source == compositeButton)
22552970 {
22562971 group(new Composite());
22572972 } else
2258
- if (source == randomItem)
2973
+ if (source == switchItem || source == switchButton)
22592974 {
22602975 RandomNode random = new RandomNode();
22612976 group(random);
22622977 if (random.size() > 0)
2263
- random.name = random.get(0).name + "Rnd";
2978
+ random.name = random.get(0).name + "Switch";
22642979 } else
22652980 if (source == physicsItem)
22662981 {
....@@ -2357,7 +3072,7 @@
23573072 {
23583073 group(new cLinker());
23593074 } else
2360
- if (source == textureItem)
3075
+ if (source == textureItem || source == textureButton)
23613076 {
23623077 group(new TextureNode());
23633078 } else
....@@ -2377,17 +3092,30 @@
23773092 {
23783093 CastShadow(2);
23793094 } else
2380
- if (source == ungroupItem)
3095
+ if (source == ungroupItem || source == ungroupButton)
23813096 {
2382
- //ungroup();
3097
+ boolean hasRoot = false;
3098
+
23833099 for (int i=0; i<group.selection.size(); i++)
23843100 {
2385
- Ungroup(group.selection.get(i));
3101
+ if (group.selection.get(i) == group)
3102
+ {
3103
+ hasRoot = true;
3104
+ break;
3105
+ }
23863106 }
23873107
2388
- ClearSelection(false);
2389
-
2390
- refreshContents();
3108
+ if (!hasRoot)
3109
+ {
3110
+ for (int i=0; i<group.selection.size(); i++)
3111
+ {
3112
+ Ungroup(group.selection.get(i));
3113
+ }
3114
+
3115
+ ClearSelection(false);
3116
+
3117
+ refreshContents();
3118
+ }
23913119 } else
23923120 if (source == genUVItem)
23933121 {
....@@ -2399,7 +3127,7 @@
23993127 } else
24003128 if (source == genNormalsMESHItem)
24013129 {
2402
- GenNormals(true); // TODO
3130
+ GenNormalsMESH();
24033131 } else
24043132 if (source == genNormalsORGANItem)
24053133 {
....@@ -2464,6 +3192,22 @@
24643192 if (source == unmarkleavesItem)
24653193 {
24663194 MarkLeaves(false);
3195
+ } else
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);
24673211 } else
24683212 if (source == flipVItem)
24693213 {
....@@ -2549,9 +3293,13 @@
25493293 {
25503294 SmoothMesh();
25513295 } else
2552
- if (source == transformgeometryItem)
3296
+ if (source == transformGeometryItem)
25533297 {
25543298 TransformGeometry();
3299
+ } else
3300
+ if (source == transformChildrenItem)
3301
+ {
3302
+ TransformChildren();
25553303 } else
25563304 if (source == resetTransformItem)
25573305 {
....@@ -2559,7 +3307,11 @@
25593307 } else
25603308 if (source == resetCentroidItem)
25613309 {
2562
- ResetCentroid();
3310
+ ResetCentroid(true);
3311
+ } else
3312
+ if (source == resetCentroidXZItem)
3313
+ {
3314
+ ResetCentroid(false);
25633315 } else
25643316 if (source == resetParentItem)
25653317 {
....@@ -2664,7 +3416,7 @@
26643416 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26653417 {
26663418 obj = (Object3D)e.nextElement();
2667
- obj.SetBumpTexture(null);
3419
+ obj.ResetBumpTexture();
26683420 }
26693421
26703422 refreshContents();
....@@ -2680,6 +3432,31 @@
26803432
26813433 refreshContents();
26823434 } else
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
26833460 if (source == flashSelectionButton)
26843461 {
26853462 CameraPane.flash = true;
....@@ -2691,6 +3468,10 @@
26913468 if (source == twoButton)
26923469 {
26933470 radio.layout = twoButton;
3471
+
3472
+ if (CameraPane.FULLSCREEN)
3473
+ fullscreenLayout = radio.layout;
3474
+
26943475 // bug
26953476 //gridPanel.setDividerLocation(1.0);
26963477 //bigPanel.setDividerLocation(0.0);
....@@ -2723,10 +3504,31 @@
27233504 bigThree.ClearUI();
27243505 bigThree.add(centralPanel);
27253506 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
+
27263525 } else
27273526 if (source == threeButton)
27283527 {
27293528 radio.layout = threeButton;
3529
+
3530
+ if (CameraPane.FULLSCREEN)
3531
+ fullscreenLayout = radio.layout;
27303532
27313533 // bigThree.remove(scenePanel);
27323534 // bigThree.remove(centralPanel);
....@@ -2756,13 +3558,18 @@
27563558 // centralPanel.setVisible(true);
27573559 // XYZPanel.setVisible(true);
27583560 bigThree.ClearUI();
3561
+ bigThree.add(scenePanel);
27593562 bigThree.add(centralPanel);
2760
- bigThree.add(XYZPanel);
27613563 bigThree.FlushUI();
3564
+
3565
+ cameraView.requestFocusInWindow();
27623566 } else
27633567 if (source == fourButton)
27643568 {
27653569 radio.layout = fourButton;
3570
+
3571
+ if (CameraPane.FULLSCREEN)
3572
+ fullscreenLayout = radio.layout;
27663573
27673574 // bigThree.remove(scenePanel);
27683575 // bigThree.remove(centralPanel);
....@@ -2794,10 +3601,15 @@
27943601 bigThree.ClearUI();
27953602 bigThree.add(scenePanel);
27963603 bigThree.FlushUI();
3604
+
3605
+ cameraView.requestFocusInWindow();
27973606 } else
27983607 if (source == sixButton)
27993608 {
28003609 radio.layout = sixButton;
3610
+
3611
+ if (CameraPane.FULLSCREEN)
3612
+ fullscreenLayout = radio.layout;
28013613
28023614 // bigThree.remove(scenePanel);
28033615 // bigThree.remove(centralPanel);
....@@ -2827,13 +3639,18 @@
28273639 // centralPanel.setVisible(true);
28283640 // XYZPanel.setVisible(false);
28293641 bigThree.ClearUI();
2830
- bigThree.add(scenePanel);
28313642 bigThree.add(centralPanel);
3643
+ bigThree.add(scenePanel);
28323644 bigThree.FlushUI();
3645
+
3646
+ cameraView.requestFocusInWindow();
28333647 } else
28343648 if (source == sevenButton)
28353649 {
28363650 radio.layout = sevenButton;
3651
+
3652
+ if (CameraPane.FULLSCREEN)
3653
+ fullscreenLayout = radio.layout;
28373654
28383655 // bigThree.remove(scenePanel);
28393656 // bigThree.remove(centralPanel);
....@@ -2867,6 +3684,8 @@
28673684 bigThree.add(centralPanel);
28683685 bigThree.add(XYZPanel);
28693686 bigThree.FlushUI();
3687
+
3688
+ cameraView.requestFocusInWindow();
28703689 } else
28713690 if (source == rootButton)
28723691 {
....@@ -2878,6 +3697,7 @@
28783697 EditObject(obj);
28793698 }
28803699
3700
+ cameraView.requestFocusInWindow();
28813701 refreshContents(true);
28823702 } else
28833703 if (source == closeButton)
....@@ -2887,22 +3707,37 @@
28873707 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28883708 {
28893709 ab = (cRadio)e.nextElement();
2890
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3710
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28913711 {
3712
+ // Patch to avoid bug with transparency.
3713
+ if (!ab.hadMaterial)
3714
+ {
3715
+ ab.object.material = null;
3716
+ }
3717
+
28923718 buttonGroup.remove(ab);
28933719 radioPanel.remove(ab);
28943720
2895
- ab.GetObject().editWindow = null;
3721
+ //ab.GetObject().editWindow = null;
3722
+ ab.GetObject().manipWindow = null;
28963723 // ab.GetObject().objectUI = null; // ?????????
28973724
28983725 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28993726 break;
29003727 }
29013728 }
3729
+
3730
+ cameraView.requestFocusInWindow();
29023731 refreshContents(true);
29033732 } else
29043733 if (source == editItem || source == editButton)
29053734 {
3735
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3736
+ {
3737
+ Object3D child = (Object3D)e.nextElement();
3738
+ child.pinned = true;
3739
+ }
3740
+
29063741 EditSelection(false);
29073742 } else
29083743 if (source == uneditButton)
....@@ -2912,12 +3747,13 @@
29123747 Object3D child = (Object3D)e.nextElement();
29133748 if(child.editWindow != null)
29143749 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3750
+ child.pinned = false;
29153751 child.CloseUI();
29163752 listUI.remove(child);
29173753
2918
- child.editWindow = null; // ???????????
3754
+ //child.editWindow = null; // ???????????
29193755 }
2920
- objEditor.ctrlPanel.validate();
3756
+ objEditor.ctrlPanel.FlushUI();
29213757 //objEditor.jTree.clearSelection();
29223758 //objEditor.ResetSliders();
29233759 refreshContents(true);
....@@ -2928,6 +3764,7 @@
29283764 //copy.ClearUI();
29293765 for (Object3D obj : listUI)
29303766 {
3767
+ obj.pinned = false;
29313768 obj.CloseUI();
29323769 }
29333770 listUI.clear();
....@@ -2937,7 +3774,7 @@
29373774 {
29383775 assert(copy == group);
29393776
2940
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3777
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29413778
29423779 for (Object3D obj : listUI)
29433780 {
....@@ -2986,6 +3823,9 @@
29863823 }
29873824
29883825 copy = group;
3826
+
3827
+ SetUndoStates();
3828
+
29893829 //Globals.theRenderer.object = group;
29903830 if(!useclient)
29913831 {
....@@ -3001,20 +3841,46 @@
30013841 frontView.object = group;
30023842 sideView.object = group;
30033843 }
3004
- group.editWindow = this;
3844
+
3845
+// fix "+" issue
3846
+ //group.editWindow = this;
3847
+ group.manipWindow = this;
3848
+
30053849 /*
30063850 currentLayout = radio.layout;
30073851 if (currentLayout == null)
30083852 currentLayout = sevenButton;
30093853 */
30103854 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);
30113862 keepparent = group.parent;
30123863 // PARENT = NULL or not???
30133864 //group.parent = null; // ROOT
30143865 //group.attributes = -1;
30153866 ResetModel();
3867
+
3868
+ cameraView.requestFocusInWindow();
30163869 refreshContents(true);
3017
- }
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
+ }
30183884 else
30193885 {
30203886 //return super.action(event, arg);
....@@ -3023,7 +3889,6 @@
30233889 }
30243890
30253891 boolean useclient = false;
3026
- cRadio radio;
30273892
30283893 void ToggleRoot()
30293894 {
....@@ -3075,6 +3940,28 @@
30753940 refreshContents();
30763941 }
30773942
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
+ }
30783965
30793966 void ResetTransform()
30803967 {
....@@ -3187,7 +4074,7 @@
31874074 refreshContents();
31884075 }
31894076
3190
- void ResetCentroid()
4077
+ void ResetCentroid(boolean full)
31914078 {
31924079 Object3D obj;
31934080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3202,12 +4089,16 @@
32024089 LA.matIdentity(Object3D.mat);
32034090 obj.getBounds(minima, maxima, false);
32044091 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3205
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4092
+ if (full)
4093
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32064094 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32074095 obj.TransformMesh(Object3D.mat);
4096
+
32084097 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3209
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4098
+ if (full)
4099
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32104100 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4101
+
32114102 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32124103 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32134104 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3236,7 +4127,8 @@
32364127
32374128 int size = obj.MemorySize();
32384129
3239
- 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)");
32404132 }
32414133 }
32424134 catch (Exception e)
....@@ -3273,9 +4165,9 @@
32734165 obj = (Object3D)e.nextElement();
32744166
32754167 System.out.println("Object is: " + obj);
3276
- GrafreeD.AnalyzeObject(obj);
4168
+ Grafreed.AnalyzeObject(obj);
32774169 System.out.println("Boundary rep: " + obj.bRep);
3278
- GrafreeD.AnalyzeObject(obj.bRep);
4170
+ Grafreed.AnalyzeObject(obj.bRep);
32794171
32804172 // System.err.println((size/1024) + " KB is the size of " + obj);
32814173 }
....@@ -3317,6 +4209,13 @@
33174209 void GenNormals(boolean crease)
33184210 {
33194211 group.GenNormalsS(crease);
4212
+
4213
+ refreshContents();
4214
+ }
4215
+
4216
+ void GenNormalsMESH()
4217
+ {
4218
+ group.GenNormalsMeshS();
33204219
33214220 refreshContents();
33224221 }
....@@ -3489,8 +4388,8 @@
34894388
34904389 void ParseVertices()
34914390 {
3492
- boolean epsequal = GrafreeD.epsequal;
3493
- GrafreeD.epsequal = true;
4391
+ boolean epsequal = Grafreed.epsequal;
4392
+ Grafreed.epsequal = true;
34944393
34954394 for (int i=0; i<group.selection.size(); i++)
34964395 {
....@@ -3515,7 +4414,7 @@
35154414 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35164415 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35174416
3518
- g.add(GrafreeD.clipboard);
4417
+ g.add(Grafreed.clipboard);
35194418
35204419 buffer.add(g);
35214420 }
....@@ -3530,7 +4429,7 @@
35304429 makeSomething(buffer, i==group.selection.size()-1);
35314430 }
35324431
3533
- GrafreeD.epsequal = epsequal;
4432
+ Grafreed.epsequal = epsequal;
35344433
35354434 refreshContents();
35364435 }
....@@ -3548,7 +4447,16 @@
35484447 String pigment = Object3D.GetPigment(tex);
35494448 //String bump = Object3D.GetBump(tex);
35504449
3551
- com.sun.opengl.util.texture.TextureData texturedata = Globals.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
+ }
35524460
35534461 double s = v.s;
35544462
....@@ -3636,11 +4544,11 @@
36364544
36374545 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36384546
3639
- boolean random = CameraPane.RANDOM;
3640
- CameraPane.RANDOM = false; // parse all random nodes
4547
+ boolean random = CameraPane.SWITCH;
4548
+ CameraPane.SWITCH = false; // parse all random nodes
36414549 lowres.linkVerticesThis(null);
36424550 lowres.linkVerticesThis(sn);
3643
- CameraPane.RANDOM = random;
4551
+ CameraPane.SWITCH = random;
36444552
36454553 System.err.flush();
36464554
....@@ -3680,7 +4588,7 @@
36804588 return;
36814589
36824590 Object3D poses = group.selection.get(0);
3683
- Object3D ref = GrafreeD.clipboard.get(0);
4591
+ Object3D ref = Grafreed.clipboard.get(0);
36844592
36854593 Object3D newgroup = new Object3D("Po:" + poses.name);
36864594
....@@ -3874,9 +4782,9 @@
38744782
38754783 void ClipMesh()
38764784 {
3877
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4785
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38784786 {
3879
- Object3D content = GrafreeD.clipboard.get(0);
4787
+ Object3D content = Grafreed.clipboard.get(0);
38804788
38814789 if (content instanceof cGroup && ((cGroup)content).transientlink )
38824790 content = ((cGroup)content).get(0);
....@@ -3885,7 +4793,7 @@
38854793 // {
38864794 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38874795 // }
3888
- group.selection.ClipMesh(GrafreeD.clipboard);
4796
+ group.selection.ClipMesh(Grafreed.clipboard);
38894797 }
38904798 // group.selection.ClipMesh(GrafreeD.clipboard);
38914799 System.out.println("DONE.");
....@@ -3932,6 +4840,18 @@
39324840 void MarkLeaves(boolean hide)
39334841 {
39344842 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);
39354855 refreshContents();
39364856 }
39374857
....@@ -4006,28 +4926,25 @@
40064926 // }
40074927 // }
40084928
4009
- static boolean allparams = true;
4010
-
4011
- static Vector<Object3D> listUI = new Vector<Object3D>();
4012
-
40134929 void EditSelection(boolean newWindow)
40144930 {
4931
+ if (group.selection == null)
4932
+ {
4933
+ EditElement(group, newWindow); // ? new
4934
+ return;
4935
+ }
4936
+
40154937 // aConstraints.gridy = 0;
40164938 for (int i=0; i<group.selection.size(); i++)
40174939 {
40184940 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40194941 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4020
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4942
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40214943
40224944 Object3D elem = (Object3D)group.selection.elementAt(i);
4023
- if(elem != group)
4945
+ if(elem != group || !newWindow)
40244946 {
4025
- // if (!(elem instanceof Composite))
4026
- // newWindow = false;
4027
- listUI.add(elem);
4028
- elem.openEditWindow(this, newWindow); //, false);
4029
- System.out.println("edit : " + elem);
4030
- elem.editWindow.refreshContents(true); // ? new
4947
+ EditElement(elem, newWindow); // ? new
40314948 }
40324949 }
40334950 }
....@@ -4102,7 +5019,8 @@
41025019 //new Exception().printStackTrace();
41035020
41045021 freezemodel = true;
4105
-
5022
+ ClearUnpinned();
5023
+
41065024 /**/
41075025 //switch (event.id)
41085026 {
....@@ -4110,7 +5028,6 @@
41105028 //case 702: // Event.LIST_DESELECT
41115029 group.deselectAll();
41125030 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4113
- objEditor.ClearInfo(); // .GetMaterial());
41145031 if (tps != null)
41155032 {
41165033 for (int i=0; i < tps.length; i++)
....@@ -4119,33 +5036,39 @@
41195036
41205037 //if (child.parent != null)
41215038 //child.parent.addSelectee(child);
5039
+ objEditor.SetMaterial(child);
41225040 group.addSelectee(child);
4123
- objEditor.SetMaterial(child); // .GetMaterial());
4124
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4125
- System.err.println("info : " + child.GetPath());
41265041 }
41275042 }
4128
- else
4129
- {
4130
- objEditor.SetMaterial(group); // .GetMaterial());
4131
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4132
- System.err.println("info : " + group.GetPath());
4133
- }
5043
+// else
5044
+// {
5045
+// objEditor.SetMaterial(group); // .GetMaterial());
5046
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5047
+// System.err.println("info : " + group.GetPath());
5048
+// }
41345049
4135
- objEditor.SetText(); // jan 2014
4136
-
4137
- if (flashIt && !Globals.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))
41385051 CameraPane.flash = true;
41395052
4140
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5053
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41415054 // a camera
41425055 {
4143
- CameraPane.camerachangeframe = 0; // don't refuse it
4144
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
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
+ }
41455061 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41465062 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41475063 }
41485064
5065
+ if (tps != null && tps.length == 1)
5066
+ {
5067
+ EditSelection(false);
5068
+ }
5069
+
5070
+ SetPinStates(tps != null && tps.length > 0);
5071
+
41495072 refreshContents();
41505073 //return true;
41515074 }
....@@ -4154,6 +5077,35 @@
41545077
41555078 freezemodel = false;
41565079 }
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
+ }
41575109
41585110 void linkSomething(Object3D thing)
41595111 {
....@@ -4225,16 +5177,19 @@
42255177 {
42265178 if (group.selection.isEmpty())
42275179 return;
4228
- GrafreeD.clipboardIsTempGroup = false;
5180
+
5181
+ Grafreed.clipboardIsTempGroup = false;
42295182 Composite tGroup = null;
42305183 if (group.selection.size() > 0) // 1)
42315184 {
42325185 tGroup = new cGroup();
4233
- GrafreeD.clipboardIsTempGroup = true;
5186
+ Grafreed.clipboardIsTempGroup = true;
42345187 }
42355188
42365189 if (cut)
42375190 {
5191
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5192
+// Save();
42385193 //int indices[] = jList.getSelectedIndices();
42395194 //for (int i = indices.length - 1; i >= 0; i--)
42405195 //jList.remove(indices[i]);
....@@ -4270,16 +5225,16 @@
42705225 //System.out.println("cut " + child);
42715226 //System.out.println("parent = " + child.parent);
42725227 // tmp.addChild(child);
4273
- if (GrafreeD.clipboardIsTempGroup)
5228
+ if (Grafreed.clipboardIsTempGroup)
42745229 tGroup.add/*Child*/(tmp);
42755230 else
4276
- GrafreeD.clipboard = tmp;
5231
+ Grafreed.clipboard = tmp;
42775232 }
42785233 else
4279
- if (GrafreeD.clipboardIsTempGroup)
5234
+ if (Grafreed.clipboardIsTempGroup)
42805235 tGroup.add/*Child*/(child);
42815236 else
4282
- GrafreeD.clipboard = child;
5237
+ Grafreed.clipboard = child;
42835238 }
42845239
42855240 //ResetModel();
....@@ -4311,21 +5266,23 @@
43115266 //System.out.println("cut " + elem);
43125267 //System.out.println("parent = " + elem.parent);
43135268 // tmp.addChild(elem);
4314
- if (GrafreeD.clipboardIsTempGroup)
5269
+ if (Grafreed.clipboardIsTempGroup)
43155270 tGroup.add/*Child*/(tmp);
43165271 else
4317
- GrafreeD.clipboard = tmp;
5272
+ Grafreed.clipboard = tmp;
43185273 }
43195274 else
4320
- if (GrafreeD.clipboardIsTempGroup)
5275
+ if (Grafreed.clipboardIsTempGroup)
43215276 tGroup.add/*Child*/(child);
43225277 else
4323
- GrafreeD.clipboard = child;
5278
+ Grafreed.clipboard = child;
43245279 }
43255280
43265281 }
4327
- if (GrafreeD.clipboardIsTempGroup)
4328
- GrafreeD.clipboard = tGroup;
5282
+
5283
+ if (Grafreed.clipboardIsTempGroup)
5284
+ Grafreed.clipboard = tGroup;
5285
+
43295286 if (cut)
43305287 {
43315288 ResetModel();
....@@ -4335,11 +5292,15 @@
43355292
43365293 void paste(boolean expand)
43375294 {
5295
+ if (Globals.REPLACEONMAKE)
5296
+ Save();
5297
+ boolean keep = Globals.REPLACEONMAKE;
5298
+ Globals.REPLACEONMAKE = false;
43385299 // if (GrafreeD.clipboard == null)
43395300 // return;
43405301 boolean first = true;
43415302
4342
- if (GrafreeD.clipboardIsTempGroup)
5303
+ if (Grafreed.clipboardIsTempGroup)
43435304 {
43445305 Composite temp;
43455306
....@@ -4350,7 +5311,7 @@
43505311 temp = (Composite)Applet3D.clipboard.deepCopy();
43515312 */
43525313 Object3D elem;
4353
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5314
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43545315 {
43555316 Object3D child = (Object3D)e.nextElement();
43565317
....@@ -4384,21 +5345,22 @@
43845345 //Object3D cb = Applet3D.clipboard;
43855346 //temp.addChild(cb);
43865347 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4387
- assert(GrafreeD.clipboard.parent == null);
4388
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4389
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4390
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4391
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5348
+ assert(Grafreed.clipboard.parent == null);
5349
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5350
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5351
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5352
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43925353 else
4393
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4394
- GrafreeD.clipboard.get(0).parent = keepparent;
5354
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5355
+ Grafreed.clipboard.get(0).parent = keepparent;
43955356 }
43965357
5358
+ Globals.REPLACEONMAKE = keep;
43975359 ResetModel();
43985360 refreshContents();
43995361 }
44005362
4401
- void pasteInto(boolean copyit)
5363
+ void pasteInto(boolean copyit, boolean clone)
44025364 {
44035365 // if (GrafreeD.clipboard == null)
44045366 // return;
....@@ -4427,15 +5389,22 @@
44275389 if (copyit)
44285390 {
44295391 // paste(false);
4430
- CloneClipboard(false); // sept 2014
5392
+ if (clone)
5393
+ {
5394
+ CloneClipboard(false); // sept 2014
5395
+ }
5396
+ else
5397
+ {
5398
+ paste(false);
5399
+ }
44315400 }
44325401 else
44335402 {
44345403 boolean first = true;
44355404
4436
- if (GrafreeD.clipboardIsTempGroup)
5405
+ if (Grafreed.clipboardIsTempGroup)
44375406 {
4438
- Composite temp = (Composite)GrafreeD.clipboard;
5407
+ Composite temp = (Composite)Grafreed.clipboard;
44395408 Object3D copy;
44405409 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44415410 {
....@@ -4445,7 +5414,7 @@
44455414 }
44465415 } else
44475416 {
4448
- linkSomething(GrafreeD.clipboard); //.get(0));
5417
+ linkSomething(Grafreed.clipboard); //.get(0));
44495418 }
44505419 }
44515420 }
....@@ -4522,6 +5491,10 @@
45225491
45235492 void group(Object3D csg, boolean grab)
45245493 {
5494
+ if (Globals.REPLACEONMAKE)
5495
+ Save();
5496
+ boolean keep = Globals.REPLACEONMAKE;
5497
+ Globals.REPLACEONMAKE = false;
45255498 if (//false) // why??
45265499 !group.selection.isEmpty())
45275500 {
....@@ -4635,10 +5608,15 @@
46355608 //node.add(csg);
46365609 //makeSomething(node);
46375610 makeSomething(csg);
5611
+ Globals.REPLACEONMAKE = keep;
46385612 }
46395613
46405614 void Ungroup(Object3D g)
46415615 {
5616
+ if (Globals.REPLACEONMAKE)
5617
+ Save();
5618
+ boolean keep = Globals.REPLACEONMAKE;
5619
+ Globals.REPLACEONMAKE = false;
46425620 if (g instanceof HiddenObject)
46435621 {
46445622 HiddenObject h = (HiddenObject) g;
....@@ -4655,6 +5633,7 @@
46555633 objEditor.makeSomething(g.get(i), false);
46565634 }
46575635 }
5636
+ Globals.REPLACEONMAKE = keep;
46585637 }
46595638
46605639 void ungroup()
....@@ -4850,21 +5829,6 @@
48505829 }
48515830 */
48525831
4853
- void ImportGFD()
4854
- {
4855
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4856
- browser.show();
4857
- String filename = browser.getFile();
4858
- if (filename != null && filename.length() > 0)
4859
- {
4860
- String fullname = browser.getDirectory() + filename;
4861
-
4862
- //Object3D readobj =
4863
- objEditor.ReadGFD(fullname, objEditor);
4864
- //makeSomething(readobj);
4865
- }
4866
- }
4867
-
48685832 /*
48695833 public void Callback(Object obj)
48705834 {
....@@ -4888,26 +5852,9 @@
48885852 }
48895853 */
48905854
4891
- void ImportVRMLX3D()
4892
- {
4893
- if (GrafreeD.standAlone)
4894
- {
4895
- /**/
4896
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4897
- browser.show();
4898
- String filename = browser.getFile();
4899
- if (filename != null && filename.length() > 0)
4900
- {
4901
- String fullname = browser.getDirectory() + filename;
4902
- LoadVRMLX3D(fullname);
4903
- }
4904
- /**/
4905
- }
4906
- }
4907
-
49085855 String GetFile(String dialogName)
49095856 {
4910
- if (GrafreeD.standAlone)
5857
+ if (Grafreed.standAlone)
49115858 {
49125859 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49135860 browser.show();
....@@ -4971,10 +5918,49 @@
49715918 cButton flashSelectionButton;
49725919 cButton editButton;
49735920 cButton uneditButton;
5921
+ JCheckBox allParamsButton;
49745922 cButton clearpanelButton;
4975
- cButton allParamsButton;
49765923 cButton unselectButton;
49775924
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
+
49785964 cButton screenfitButton;
49795965 cButton screenfitpointButton;
49805966 cButton snapobjectButton;
....@@ -4986,14 +5972,6 @@
49865972
49875973 cButton setsupportButton;
49885974
4989
- cButton twoButton;
4990
- cButton sixButton;
4991
- cButton threeButton;
4992
- cButton sevenButton;
4993
- cButton fourButton; // full panel
4994
- cButton oneButton; // full XYZ
4995
- //cButton currentLayout;
4996
-
49975975 //
49985976 //Composite
49995977 Object3D // to do !!
....@@ -5003,9 +5981,11 @@
50035981 //JTree jTree;
50045982 private MenuItem lookAtItem;
50055983 private MenuItem lookFromItem;
5006
- private MenuItem switchItem;
5984
+ private MenuItem switchViewItem;
50075985 private MenuItem cutItem;
5008
- private MenuItem duplicateItem;
5986
+ private MenuItem undoItem;
5987
+ private MenuItem redoItem;
5988
+ private JMenuItem duplicateItem;
50095989 private MenuItem cloneItem;
50105990 private MenuItem cloneSupportItem;
50115991 private MenuItem overwriteGeoItem;
....@@ -5018,7 +5998,7 @@
50185998 private MenuItem linkverticesItem;
50195999 private MenuItem relinkverticesItem;
50206000 private MenuItem setMasterItem;
5021
- private MenuItem resetMeshItem;
6001
+ private MenuItem resetAllItem;
50226002 private MenuItem stepAllItem;
50236003 private MenuItem revertMeshItem;
50246004 private MenuItem poseMeshItem;
....@@ -5029,10 +6009,11 @@
50296009 private MenuItem mergeGeometriesItem;
50306010 private MenuItem copyItem;
50316011 private MenuItem pasteItem;
6012
+ private MenuItem pasteIntoItem;
50326013 private MenuItem pasteLinkItem;
50336014 private MenuItem pasteCloneItem;
50346015 private MenuItem pasteExpandItem;
5035
- private MenuItem clearItem;
6016
+ private MenuItem deleteItem;
50366017 private MenuItem clearAllItem;
50376018 private MenuItem genUVItem;
50386019 private MenuItem genNormalsMESHItem;
....@@ -5067,6 +6048,10 @@
50676048 private MenuItem showleavesItem;
50686049 private MenuItem markleavesItem;
50696050 private MenuItem unmarkleavesItem;
6051
+ private MenuItem rewindleavesItem;
6052
+ private MenuItem unrewindleavesItem;
6053
+ private MenuItem randomleavesItem;
6054
+ private MenuItem unrandomleavesItem;
50706055
50716056 private MenuItem flipVItem;
50726057 private MenuItem unflipVItem;
....@@ -5078,15 +6063,17 @@
50786063 private MenuItem panoTexturesItem;
50796064
50806065 private MenuItem resetCentroidItem;
5081
- private MenuItem transformgeometryItem;
6066
+ private MenuItem resetCentroidXZItem;
50826067 private MenuItem resetTransformItem;
6068
+ private MenuItem transformGeometryItem;
6069
+ private MenuItem transformChildrenItem;
50836070 private MenuItem hideItem;
50846071 private MenuItem grabItem;
50856072 private MenuItem backItem;
50866073 private MenuItem frontItem;
50876074 private MenuItem cameraItem;
50886075 private MenuItem compositeItem;
5089
- private MenuItem randomItem;
6076
+ private MenuItem switchItem;
50906077 private MenuItem physicsItem;
50916078 private MenuItem frameselectorItem;
50926079 private MenuItem scriptNodeItem;
....@@ -5110,6 +6097,8 @@
51106097 private MenuItem attachBumpItem;
51116098 private MenuItem detachBumpItem;
51126099 private MenuItem pigmentBumpItem;
6100
+ private MenuItem embedTexturesItem;
6101
+ private MenuItem deEmbedTexturesItem;
51136102
51146103 private MenuItem particleItem;
51156104 private MenuItem ragdollItem;
....@@ -5126,7 +6115,7 @@
51266115 private MenuItem blobItem;
51276116 private MenuItem latheItem;
51286117 private MenuItem bezierItem;
5129
- private MenuItem checkerItem;
6118
+ private MenuItem overlayItem;
51306119 private MenuItem meshItem;
51316120 // private MenuItem meshGroupItem;
51326121 private MenuItem springItem;
....@@ -5148,11 +6137,6 @@
51486137 private MenuItem doubleItem;
51496138 private MenuItem tripleItem;
51506139
5151
- private MenuItem importGFDItem;
5152
- private MenuItem importVRMLX3DItem;
5153
- private MenuItem import3DSItem;
5154
- private MenuItem importOBJItem;
5155
-
51566140 private MenuItem computeAOItem;
51576141 private MenuItem recompileItem;
51586142 private MenuItem editScriptItem;
....@@ -5162,4 +6146,8 @@
51626146 private MenuItem analyzeItem;
51636147 private MenuItem dumpItem;
51646148 //boolean freezemodel = false;
6149
+
6150
+ Menu cameraMenu;
6151
+ MenuItem editCameraItem;
6152
+ MenuItem restoreCameraItem;
51656153 }