Normand Briere
2019-07-28 d7fd07756f4095cb87dc25d89fcffcbda092e2cf
GroupEditor.java
....@@ -23,6 +23,237 @@
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 + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
+ skyboxButton.setToolTipText(s);
34
+ skyboxButton.addActionListener(new ActionListener()
35
+ {
36
+ @Override
37
+ public void actionPerformed(ActionEvent e)
38
+ {
39
+ ChangeSkybox(path);
40
+ }
41
+ });
42
+ }
43
+
44
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
45
+ {
46
+ cGridBag tab0 = new cGridBag().setVertical(true);
47
+
48
+ tab0.setName("Urban");
49
+ skyboxpanel.add(tab0);
50
+
51
+ cGridBag row0 = new cGridBag();
52
+ cGridBag row1 = new cGridBag();
53
+ cGridBag row2 = new cGridBag();
54
+ cGridBag row3 = new cGridBag();
55
+ cGridBag row4 = new cGridBag();
56
+ cGridBag row5 = new cGridBag();
57
+ cGridBag row6 = new cGridBag();
58
+
59
+ AddSkyboxButton("default", "rgb", row0);
60
+ AddSkyboxButton("default", "cornell", row0);
61
+ AddSkyboxButton("default", "uffizi", row0);
62
+ AddSkyboxButton("default", "CloudyHills", row0);
63
+
64
+ AddSkyboxButton("default", "skycube", row1);
65
+ AddSkyboxButton("bridge", "Bridge", row1);
66
+ AddSkyboxButton("bridge", "Bridge2", row1);
67
+ AddSkyboxButton("urban", "GamlaStan2", row1);
68
+
69
+ AddSkyboxButton("urban", "Parliament", row2);
70
+ AddSkyboxButton("urban", "Roundabout", row2);
71
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
73
+
74
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
75
+ AddSkyboxButton("urban", "UnionSquare", row3);
76
+ AddSkyboxButton("park", "BerzeliiPark", row3);
77
+ AddSkyboxButton("park", "Buddha", row3);
78
+
79
+ AddSkyboxButton("park", "CNTower2", row4);
80
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
81
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
82
+ AddSkyboxButton("park", "Park", row4);
83
+
84
+ AddSkyboxButton("park", "Pond", row5);
85
+ AddSkyboxButton("park", "Skansen", row5);
86
+ AddSkyboxButton("park", "Skansen2", row5);
87
+ AddSkyboxButton("park", "Skansen3", row5);
88
+
89
+ AddSkyboxButton("park", "Skansen4", row6);
90
+ AddSkyboxButton("park", "Skansen5", row6);
91
+ AddSkyboxButton("park", "Stairs", row6);
92
+ AddSkyboxButton("park", "Tantolunden4", row6);
93
+
94
+ tab0.add(row0);
95
+ tab0.add(row1);
96
+ tab0.add(row2);
97
+ tab0.add(row3);
98
+ tab0.add(row4);
99
+ tab0.add(row5);
100
+ tab0.add(row6);
101
+
102
+ for (int i=5; --i>=0;)
103
+ {
104
+ //oe.toolboxPanel.Return();
105
+ //tab0.add(new cGridBag());
106
+ }
107
+ }
108
+
109
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
110
+ {
111
+ cGridBag tab0 = new cGridBag().setVertical(true);
112
+
113
+ tab0.setName("Nature");
114
+ skyboxpanel.add(tab0);
115
+
116
+ cGridBag row0 = new cGridBag();
117
+ cGridBag row1 = new cGridBag();
118
+ cGridBag row2 = new cGridBag();
119
+ cGridBag row3 = new cGridBag();
120
+ cGridBag row4 = new cGridBag();
121
+ cGridBag row5 = new cGridBag();
122
+ cGridBag row6 = new cGridBag();
123
+
124
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
125
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
126
+ AddSkyboxButton("beach", "PalmTrees", row0);
127
+ AddSkyboxButton("beach", "Tenerife", row0);
128
+
129
+ AddSkyboxButton("beach", "Tenerife2", row1);
130
+ AddSkyboxButton("beach", "Tenerife3", row1);
131
+ AddSkyboxButton("field", "FishPond", row1);
132
+ AddSkyboxButton("field", "Footballfield", row1);
133
+
134
+ AddSkyboxButton("field", "Meadow", row2);
135
+ AddSkyboxButton("field", "Sorsele", row2);
136
+ AddSkyboxButton("field", "Sorsele2", row2);
137
+ AddSkyboxButton("field", "Sorsele3", row2);
138
+
139
+ AddSkyboxButton("forest", "Brudslojan", row3);
140
+ AddSkyboxButton("forest", "Langholmen2", row3);
141
+ AddSkyboxButton("forest", "Plants", row3);
142
+ AddSkyboxButton("mountain", "Maskonaive", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
146
+ AddSkyboxButton("mountain", "Ryfjallet", row4);
147
+ AddSkyboxButton("mountain", "Teide", row4);
148
+
149
+ AddSkyboxButton("rocky", "Langholmen", row5);
150
+ AddSkyboxButton("rocky", "Riddarfjarden", row5);
151
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
152
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
153
+ /*
154
+Kastellholmen
155
+Langholmen
156
+Riddarfjarden
157
+Skinnarviksberget
158
+Tanto
159
+Tantolunden2
160
+Tantolunden6
161
+ */
162
+
163
+ tab0.add(row0);
164
+ tab0.add(row1);
165
+ tab0.add(row2);
166
+ tab0.add(row3);
167
+ tab0.add(row4);
168
+ tab0.add(row5);
169
+ tab0.add(row6);
170
+
171
+ for (int i=5; --i>=0;)
172
+ {
173
+ //oe.toolboxPanel.Return();
174
+ //tab0.add(new cGridBag());
175
+ }
176
+ }
177
+
178
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
179
+ {
180
+ cGridBag tab0 = new cGridBag().setVertical(true);
181
+
182
+ tab0.setName("Night");
183
+ skyboxpanel.add(tab0);
184
+
185
+ cGridBag row0 = new cGridBag();
186
+ cGridBag row1 = new cGridBag();
187
+ cGridBag row2 = new cGridBag();
188
+ cGridBag row3 = new cGridBag();
189
+ cGridBag row4 = new cGridBag();
190
+ cGridBag row5 = new cGridBag();
191
+ cGridBag row6 = new cGridBag();
192
+
193
+ AddSkyboxButton("night", "NightPath", row0);
194
+ AddSkyboxButton("night", "PondNight", row0);
195
+ AddSkyboxButton("night", "Powerlines", row0);
196
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
197
+
198
+ AddSkyboxButton("urban", "CNTower", row1);
199
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
200
+ AddSkyboxButton("indoors", "DallasW", row1);
201
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row1);
202
+
203
+ AddSkyboxButton("indoors", "Vasa", row2);
204
+ AddSkyboxButton("winter", "Backyard", row2);
205
+ AddSkyboxButton("winter", "Creek", row2);
206
+ AddSkyboxButton("winter", "FootballField3", row2);
207
+
208
+ AddSkyboxButton("winter", "Forest", row3);
209
+ AddSkyboxButton("winter", "HornstullsStrand2", row3);
210
+ AddSkyboxButton("winter", "House", row3);
211
+ AddSkyboxButton("winter", "IceLake", row3);
212
+
213
+ AddSkyboxButton("winter", "IceRiver", row4);
214
+ AddSkyboxButton("winter", "Park3", row4);
215
+ AddSkyboxButton("winter", "PondWinter", row4);
216
+
217
+ AddSkyboxButton("winter", "Tantolunden5", row5);
218
+ AddSkyboxButton("winter", "Vindelalven", row5);
219
+ /*
220
+Backyard
221
+Creek
222
+FootballField3
223
+Forest
224
+HornstullsStrand2
225
+House
226
+IceLake
227
+IceRiver
228
+Park3
229
+PondWinter
230
+Tantolunden5
231
+Vindelalven *
232
+ */
233
+
234
+ tab0.add(row0);
235
+ tab0.add(row1);
236
+ tab0.add(row2);
237
+ tab0.add(row3);
238
+ tab0.add(row4);
239
+ tab0.add(row5);
240
+ tab0.add(row6);
241
+
242
+ for (int i=5; --i>=0;)
243
+ {
244
+ //oe.toolboxPanel.Return();
245
+ //tab0.add(new cGridBag());
246
+ }
247
+ }
248
+
249
+ public void ChangeSkybox(String name)
250
+ {
251
+ cameraView.envyoff = false;
252
+ cameraView.skyboxname = name;
253
+ cameraView.skyboxext = "jpg";
254
+ cameraView.repaint();
255
+ }
256
+
26257 //ObjEditor objEditor;
27258 public void closeUI2()
28259 {
....@@ -60,6 +291,12 @@
60291 this.copy = this.group = group;
61292 //selectees = this.group.selectees;
62293
294
+ if (copy.versions == null)
295
+ {
296
+ copy.versions = new byte[100][];
297
+ copy.versionindex = -1;
298
+ }
299
+
63300 if(ui)
64301 SetupUI(objEditor);
65302 }
....@@ -74,16 +311,28 @@
74311 this.copy = this.group = copy;
75312 //selectees = this.group.selectees;
76313
77
- SetupMenu2(objEditor);
314
+ SetupMenu2(this); //objEditor);
78315 SetupUI2(objEditor);
79316 objEditor.SetupUI(true);
80317 SetupViews(objEditor);
81318
82319 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
320
+
321
+ if (copy.versions == null)
322
+ {
323
+ copy.versions = new byte[100][];
324
+ copy.versionindex = -1;
325
+
326
+ Save(true);
327
+ }
83328 }
84329
85330 void CloneSelection(boolean supports)
86331 {
332
+ if (Globals.REPLACEONMAKE)
333
+ Save();
334
+ boolean keep = Globals.REPLACEONMAKE;
335
+ Globals.REPLACEONMAKE = false;
87336 // Object3D keep = GrafreeD.clipboard;
88337 //Object3D obj;
89338 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +343,19 @@
94343
95344 makeSomething(clone, i==group.selection.size()-1);
96345 }
346
+ Globals.REPLACEONMAKE = keep;
97347 }
98348
99349 void CloneClipboard(boolean supports)
100350 {
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));
351
+ assert(Grafreed.clipboard.parent == null);
352
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
353
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
354
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
355
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106356 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
357
+ makeSomething(CloneObject(Grafreed.clipboard, false));
358
+ Grafreed.clipboard.get(0).parent = keepparent;
109359 }
110360
111361 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +369,7 @@
119369 // obj.support = null;
120370 if (!supports)
121371 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
372
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123373 obj.parent = parent;
124374 // obj.support = support;
125375 // clone.support = support; // aout 2013
....@@ -148,30 +398,29 @@
148398
149399 //JTextField nameField;
150400
151
- void SetupMenu2(ObjEditor oe)
401
+ void SetupMenu2(GroupEditor oe)
152402 {
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);
403
+ oe.jTree = new cTree();
404
+
164405 Menu menu;
165406 oe.menuBar.add(menu = new Menu("Edit"));
166407 //editItem = menu.add(new MenuItem("Edit"));
167408 //editItem.addActionListener(this);
168
- duplicateItem = menu.add(new MenuItem("Duplicate"));
409
+
410
+// undoItem = menu.add(new MenuItem("Undo"));
411
+// undoItem.addActionListener(this);
412
+// redoItem = menu.add(new MenuItem("Redo"));
413
+// redoItem.addActionListener(this);
414
+// menu.add("-");
415
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
169416 duplicateItem.addActionListener(this);
170
- menu.add("-");
171417 cloneItem = menu.add(new MenuItem("Clone"));
172418 cloneItem.addActionListener(this);
419
+ if (Globals.ADVANCED)
420
+ {
173421 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174422 cloneSupportItem.addActionListener(this);
423
+ }
175424 menu.add("-");
176425 cutItem = menu.add(new MenuItem("Cut"));
177426 cutItem.addActionListener(this);
....@@ -179,27 +428,123 @@
179428 copyItem.addActionListener(this);
180429 pasteItem = menu.add(new MenuItem("Paste"));
181430 pasteItem.addActionListener(this);
431
+
432
+ menu.add("-");
433
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
434
+ pasteIntoItem.addActionListener(this);
182435 pasteLinkItem = menu.add(new MenuItem("Paste link"));
183436 pasteLinkItem.addActionListener(this);
184437 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185438 pasteCloneItem.addActionListener(this);
186439 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187440 // pasteExpandItem.addActionListener(this);
188
- clearItem = menu.add(new MenuItem("Clear"));
189
- clearItem.addActionListener(this);
441
+ menu.add("-");
442
+ deleteItem = menu.add(new MenuItem("Delete"));
443
+ deleteItem.addActionListener(this);
444
+
445
+ if (Globals.ADVANCED)
446
+ {
447
+ // Deletes the cameras...
190448 clearAllItem = menu.add(new MenuItem("Clear All"));
191449 clearAllItem.addActionListener(this);
450
+ }
451
+
452
+ menuBar.add(cameraMenu = new Menu("View"));
453
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
454
+ //zBufferItem.addActionListener(this);
455
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
456
+ //normalLensItem.addActionListener(this);
457
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
458
+ restoreCameraItem.addActionListener(this);
459
+
460
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
461
+// toggleFullScreenItem.addItemListener(this);
462
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
463
+// cameraMenu.add("-");
464
+//
465
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
466
+// toggleTextureItem.addItemListener(this);
467
+// toggleTextureItem.setState(CameraPane.textureon);
468
+//
469
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
470
+// toggleSwitchItem.addItemListener(this);
471
+// toggleSwitchItem.setState(CameraPane.SWITCH);
472
+
473
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
474
+ toggleHandleItem.addItemListener(this);
475
+ toggleHandleItem.setState(CameraPane.HANDLES);
476
+
477
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
478
+ togglePaintItem.addItemListener(this);
479
+ togglePaintItem.setState(CameraPane.PAINTMODE);
480
+
481
+ if (Globals.ADVANCED)
482
+ {
483
+ cameraMenu.add("-");
484
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
485
+ toggleLiveItem.addItemListener(this);
486
+ toggleLiveItem.setState(Globals.isLIVE());
192487
488
+ cameraMenu.add(stepItem = new MenuItem("Step"));
489
+ stepItem.addActionListener(this);
490
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
491
+ // toggleDLItem.addItemListener(this);
492
+ // toggleDLItem.setState(false);
493
+
494
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
495
+ toggleRenderItem.addItemListener(this);
496
+ toggleRenderItem.setState(!CameraPane.frozen);
497
+
498
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
499
+ toggleDebugItem.addItemListener(this);
500
+ toggleDebugItem.setState(Globals.DEBUG);
501
+
502
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
503
+ toggleFrustumItem.addItemListener(this);
504
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
505
+
506
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
507
+ toggleFootContactItem.addItemListener(this);
508
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
509
+
510
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
511
+ toggleTimelineItem.addItemListener(this);
512
+ }
513
+
514
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
515
+// toggleRootItem.addItemListener(this);
516
+// toggleRootItem.setState(false);
517
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
518
+// animationItem.addItemListener(this);
519
+// animationItem.setState(CameraPane.ANIMATION);
520
+ cameraMenu.add("-");
521
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
522
+ editCameraItem.addActionListener(this);
523
+
524
+ if (Globals.ADVANCED)
525
+ {
526
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
527
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
528
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
529
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
530
+ oe.cameraMenu.add("-");
531
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
532
+ openWindowItem.addActionListener(this);
533
+ editLeafItem.addActionListener(this);
534
+ lookAtItem.addActionListener(this);
535
+ //lookFromItem.addActinoListener(this);
536
+ //switchViewItem.addActionListener(this);
537
+ }
538
+
193539 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);
540
+ if (Globals.ADVANCED)
541
+ {
198542 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199543 revertMeshItem.addActionListener(this);
200544 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201545 resetreferencesItem.addActionListener(this);
202546 menu.add("-");
547
+ }
203548 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204549 overwriteGeoItem.addActionListener(this);
205550 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,79 +556,104 @@
211556 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212557 overwriteUVItem.addActionListener(this);
213558 menu.add("-");
559
+ if (Globals.ADVANCED)
560
+ {
214561 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215562 generateMeshItem.addActionListener(this);
216563 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217564 poseMeshItem.addActionListener(this);
218565 menu.add("-");
566
+ }
219567 resetsupportItem = menu.add(new MenuItem("Reset support"));
220568 resetsupportItem.addActionListener(this);
221569 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222570 linkverticesItem.addActionListener(this);
223571 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224572 relinkverticesItem.addActionListener(this);
573
+
574
+ if (Globals.ADVANCED)
575
+ {
225576 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226577 setMasterItem.addActionListener(this);
578
+ }
227579
228580 oe.menuBar.add(menu = new Menu("Group"));
229
- grabItem = menu.add(new MenuItem("Grab"));
230
- grabItem.addActionListener(this);
581
+// grabItem = menu.add(new MenuItem("Grab"));
582
+// grabItem.addActionListener(this);
231583 backItem = menu.add(new MenuItem("Back"));
232584 backItem.addActionListener(this);
233585 frontItem = menu.add(new MenuItem("Front"));
234586 frontItem.addActionListener(this);
235
- compositeItem = menu.add(new MenuItem("Composite"));
236
- compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
587
+// compositeItem = menu.add(new MenuItem("Composite"));
588
+// compositeItem.addActionListener(this);
589
+
590
+ if (Globals.ADVANCED)
591
+ {
592
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238593 hideItem.addActionListener(this);
594
+ }
239595 ungroupItem = menu.add(new MenuItem("Ungroup"));
240596 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);
597
+
598
+// menu.add("-");
599
+//
600
+// switchItem = menu.add(new MenuItem("Switch node"));
601
+// switchItem.addActionListener(this);
602
+ if (Globals.ADVANCED)
603
+ {
248604 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
249605 switchGeoItem.addActionListener(this);
250606 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
251607 switchTransfoItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
608
+ morphItem = menu.add(new MenuItem("Morph Group"));
253609 morphItem.addActionListener(this);
610
+
611
+ menu.add("-");
612
+ physicsItem = menu.add(new MenuItem("Physics"));
613
+ physicsItem.addActionListener(this);
614
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
615
+ frameselectorItem.addActionListener(this);
254616 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255617 scriptNodeItem.addActionListener(this);
256
- cameraItem = menu.add(new MenuItem("Camera"));
257
- cameraItem.addActionListener(this);
618
+ }
258619
259620 oe.menuBar.add(menu = new Menu("Object"));
260
- textureItem = menu.add(new MenuItem("Texture"));
261
- textureItem.addActionListener(this);
621
+// textureItem = menu.add(new MenuItem("Texture"));
622
+// textureItem.addActionListener(this);
262623 billboardItem = menu.add(new MenuItem("Billboard"));
263624 billboardItem.addActionListener(this);
264625 csgItem = menu.add(new MenuItem("CSG"));
265626 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
627
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267628 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
629
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269630 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
631
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271632 shadowZItem.addActionListener(this);
633
+ attributeItem = menu.add(new MenuItem("Attribute"));
634
+ attributeItem.addActionListener(this);
635
+
636
+ if (Globals.ADVANCED)
637
+ {
638
+ menu.add("-");
272639 linkerItem = menu.add(new MenuItem("Linker"));
273640 linkerItem.addActionListener(this);
274641 templateItem = menu.add(new MenuItem("Template"));
275642 templateItem.addActionListener(this);
276
- attributeItem = menu.add(new MenuItem("Attribute"));
277
- attributeItem.addActionListener(this);
278643 pointflowItem = menu.add(new MenuItem("Point Flow"));
279644 pointflowItem.addActionListener(this);
645
+ }
280646 menu.add("-");
281647 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282648 resetTransformItem.addActionListener(this);
283649 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284650 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
651
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
652
+ resetCentroidXZItem.addActionListener(this);
653
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
654
+ transformGeometryItem.addActionListener(this);
655
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
656
+ transformChildrenItem.addActionListener(this);
287657
288658 oe.menuBar.add(menu = new Menu("Geometry"));
289659 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +664,11 @@
294664 genNormalsCADItem.addActionListener(this);
295665 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296666 genNormalsMESHItem.addActionListener(this);
297
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
667
+ if (Globals.ADVANCED)
668
+ {
669
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
298670 genNormalsMINEItem.addActionListener(this);
671
+ }
299672 stripifyItem = menu.add(new MenuItem("Stripify"));
300673 stripifyItem.addActionListener(this);
301674 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +690,34 @@
317690 reduce34MeshItem.addActionListener(this);
318691 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319692 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322693 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323694 clipMeshItem.addActionListener(this);
695
+
696
+ if (Globals.ADVANCED)
697
+ {
698
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
699
+ smoothMeshItem.addActionListener(this);
700
+ }
324701
325702 oe.menuBar.add(menu = new Menu("Attributes"));
326703 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327704 clearMaterialsItem.addActionListener(this);
705
+ resetAllItem = menu.add(new MenuItem("Reset All"));
706
+ resetAllItem.addActionListener(this);
707
+ stepAllItem = menu.add(new MenuItem("Step All"));
708
+ stepAllItem.addActionListener(this);
328709 menu.add("-");
329710 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330711 liveleavesItem.addActionListener(this);
331712 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332713 unliveleavesItem.addActionListener(this);
714
+ if (Globals.ADVANCED)
715
+ {
333716 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334717 supportleavesItem.addActionListener(this);
335718 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336719 unsupportleavesItem.addActionListener(this);
720
+ }
337721 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338722 hideleavesItem.addActionListener(this);
339723 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +726,14 @@
342726 markleavesItem.addActionListener(this);
343727 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344728 unmarkleavesItem.addActionListener(this);
729
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
730
+ rewindleavesItem.addActionListener(this);
731
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
732
+ unrewindleavesItem.addActionListener(this);
733
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
734
+ randomleavesItem.addActionListener(this);
735
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
736
+ unrandomleavesItem.addActionListener(this);
345737 menu.add("-");
346738 flipVItem = menu.add(new MenuItem("Flip V"));
347739 flipVItem.addActionListener(this);
....@@ -367,45 +759,56 @@
367759 attachBumpItem.addActionListener(this);
368760 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
369761 pigmentBumpItem.addActionListener(this);
762
+ //embedTexturesItem
370763 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
371764 detachPigmentItem.addActionListener(this);
372765 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
373766 detachBumpItem.addActionListener(this);
767
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
768
+ embedTexturesItem.addActionListener(this);
769
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
770
+ deEmbedTexturesItem.addActionListener(this);
374771 menu.add("-");
375772 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
376773 sortbysizeItem.addActionListener(this);
377774 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378775 sortbynameItem.addActionListener(this);
379776 menu.add("-");
777
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
778
+ shareGeometriesItem.addActionListener(this);
779
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
780
+ mergeGeometriesItem.addActionListener(this);
781
+ if (Globals.ADVANCED)
782
+ {
783
+ // Pretty much the same as duplicate and clone.
380784 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381785 extractGeometriesItem.addActionListener(this);
382786 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383787 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);
788
+ }
388789
389790 oe.menuBar.add(menu = new Menu("Insert"));
390791 buildCreateMenu(menu);
391792
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
-
403793 oe.menuBar.add(menu = new Menu("Tools"));
404794 buildToolsMenu(menu);
405795 }
406796
797
+
407798 void SetupUI2(ObjEditor oe)
408799 {
800
+ // June 2019
801
+ if (oe == null)
802
+ {
803
+ //super.SetupUI2(this);
804
+ //return;
805
+ }
806
+
807
+ if (copy != group)
808
+ {
809
+ //super.SetupUI2(this);
810
+ }
811
+
409812 //new Exception().printStackTrace();
410813
411814 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,110 +837,238 @@
434837 oe.radioPanel.add(dummyButton);
435838 oe.buttonGroup.add(dummyButton);
436839 */
437
- aConstraints.gridy += 1;
840
+ cGridBag copyOptionsPanel = new cGridBag();
841
+
842
+ copyOptionsPanel.preferredHeight = 2;
438843
439844 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
440845
441
- oe.aConstraints.gridwidth = 1;
442
- oe.aConstraints.gridx = 0;
846
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
847
+ //minButton.setToolTipText("Minimize window");
848
+ //minButton.addActionListener(this);
443849
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);
850
+ if (Globals.ADVANCED)
851
+ {
852
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
853
+ maxButton.setToolTipText("Maximize window");
854
+ maxButton.addActionListener(this);
855
+ }
856
+
857
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
858
+ fullButton.setToolTipText("Full-screen window");
859
+ fullButton.addActionListener(this);
860
+
861
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
455862 screenfitButton.setToolTipText("Screen fit");
456863 screenfitButton.addActionListener(this);
457
- oe.aConstraints.gridx += 1;
864
+
865
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
866
+ restoreCameraButton.setToolTipText("Restore viewpoint");
867
+ restoreCameraButton.addActionListener(this);
868
+
869
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
870
+ saveButton.setToolTipText("New version");
871
+ saveButton.addActionListener(this);
872
+
873
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
874
+ undoButton.setToolTipText("Previous version");
875
+ undoButton.addActionListener(this);
876
+ undoButton.setEnabled(false);
877
+
878
+ cGridBag updown = new cGridBag().setVertical(true);
879
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
880
+ restoreButton.setToolTipText("Restore current");
881
+ restoreButton.addActionListener(this);
882
+ restoreButton.setEnabled(false);
883
+
884
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
885
+ replaceButton.setToolTipText("Replace current");
886
+ replaceButton.addActionListener(this);
887
+ replaceButton.setEnabled(false);
888
+
889
+ copyOptionsPanel.add(updown);
890
+
891
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
892
+ redoButton.setToolTipText("Next version");
893
+ redoButton.addActionListener(this);
894
+ redoButton.setEnabled(false);
895
+
896
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
897
+ liveCB.setToolTipText("Enable animation");
898
+ liveCB.addItemListener(this);
899
+
900
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
901
+ oneStepButton.setToolTipText("Animate one step forward");
902
+ oneStepButton.addActionListener(this);
903
+
904
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
905
+ fastCB.setToolTipText("Fast mode");
906
+ fastCB.addItemListener(this);
907
+
908
+ //oe.toolboxPanel.Return();
909
+
910
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
911
+// trackCB.setToolTipText("Enable tracking");
912
+// trackCB.addItemListener(this);
913
+
458914 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
459915 // 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;
465916
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);
917
+ if (Globals.ADVANCED)
918
+ {
919
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
920
+ snapobjectButton.addActionListener(this);
921
+ snapobjectButton.setToolTipText("Snap Object");
922
+
923
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
486924 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");
925
+ fourButton.setToolTipText("Show control panel only");
926
+ }
927
+
928
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
929
+
930
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ twoButton.setToolTipText("Show 3D view only");
932
+ twoButton.addActionListener(this);
933
+ this.fullscreenLayout = twoButton;
934
+
935
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
936
+ threeButton.setToolTipText("Show controls and 3D view");
493937 threeButton.addActionListener(this);
494
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
495
- sevenButton.setToolTipText("3-column layout");
496
- sevenButton.addActionListener(this);
938
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ sixButton.setToolTipText("Show 3D view and controls");
940
+ sixButton.addActionListener(this);
941
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
+// sevenButton.setToolTipText("3-column layout");
943
+// sevenButton.addActionListener(this);
497944 //
498945
499
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
500
- rootButton.setToolTipText("Edit object in new tab");
946
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
947
+ rootButton.setToolTipText("Open selection in new tab");
501948 rootButton.addActionListener(this);
502
- oe.aConstraints.gridx += 1;
503
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
949
+
950
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
504951 closeButton.setToolTipText("Close tab");
505952 closeButton.addActionListener(this);
506953 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
507954 //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;
516955
517
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
956
+ cGridBag row1 = new cGridBag();
957
+
958
+ // INSERT
959
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
960
+ gridButton.setToolTipText("Create grid");
961
+ gridButton.addActionListener(this);
962
+
963
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
964
+ boxButton.setToolTipText("Create box");
965
+ boxButton.addActionListener(this);
966
+
967
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
968
+ sphereButton.setToolTipText("Create sphere");
969
+ sphereButton.addActionListener(this);
970
+
971
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
972
+ coneButton.setToolTipText("Create cone");
973
+ coneButton.addActionListener(this);
974
+
975
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
976
+ torusButton.setToolTipText("Create torus");
977
+ torusButton.addActionListener(this);
978
+
979
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
980
+ superButton.setToolTipText("Create superellipsoid");
981
+ superButton.addActionListener(this);
982
+
983
+ if (Globals.ADVANCED)
984
+ {
985
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
986
+ kleinButton.setToolTipText("Create Klein bottle");
987
+ kleinButton.addActionListener(this);
988
+ }
989
+
990
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
991
+ particlesButton.setToolTipText("Create particle system");
992
+ particlesButton.addActionListener(this);
993
+
994
+ oe.toolboxPanel.add(row1);
995
+
996
+ cGridBag row2 = new cGridBag();
997
+
998
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
999
+ groupButton.setToolTipText("Create group");
1000
+ groupButton.addActionListener(this);
1001
+
1002
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1003
+ compositeButton.setToolTipText("Create composite");
1004
+ compositeButton.addActionListener(this);
1005
+
1006
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
+ switchButton.setToolTipText("Create item switcher");
1008
+ switchButton.addActionListener(this);
1009
+
1010
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1011
+ loopButton.setToolTipText("Create loop");
1012
+ loopButton.addActionListener(this);
1013
+
1014
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1015
+ textureButton.setToolTipText("Create texture");
1016
+ textureButton.addActionListener(this);
1017
+
1018
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1019
+ overlayButton.setToolTipText("Create overlay");
1020
+ overlayButton.addActionListener(this);
1021
+
1022
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1023
+ lightButton.setToolTipText("Create light");
1024
+ lightButton.addActionListener(this);
1025
+
1026
+ oe.toolboxPanel.add(row2);
1027
+
1028
+ // ENVYMAPS
1029
+ cGridBag skyboxpane = new cGridBag();
1030
+ skyboxpane.preferredHeight = 100;
1031
+
1032
+ oe.toolboxPanel.add(skyboxpane);
1033
+
1034
+ JTabbedPane skyboxpanel = new JTabbedPane();
1035
+ skyboxpane.add(skyboxpanel);
1036
+
1037
+ AddSkyboxTab0(skyboxpanel);
1038
+ AddSkyboxTab1(skyboxpanel);
1039
+ AddSkyboxTab2(skyboxpanel);
1040
+
1041
+ // EDIT panel
1042
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1043
+ editButton.setToolTipText("Pin selection controls");
1044
+ editButton.addActionListener(this);
1045
+
1046
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1047
+ uneditButton.setToolTipText("Remove selection controls");
5181048 uneditButton.addActionListener(this);
5191049
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);
1050
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1051
+ allParamsButton.setToolTipText("Show all controle");
5321052 allParamsButton.addActionListener(this);
5331053
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);
1054
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
+ clearPanelButton.setToolTipText("Clear edit panel");
1056
+ clearPanelButton.addActionListener(this);
1057
+
1058
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1059
+ unselectButton.setToolTipText("Unselect");
5391060 unselectButton.addActionListener(this);
5401061
1062
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1063
+ flashSelectionButton.setToolTipText("Highlight selection");
1064
+ flashSelectionButton.addActionListener(this);
1065
+
1066
+ editCommandsPanel.preferredHeight = 1;
1067
+
1068
+ SetPinStates(false);
1069
+// oe.treePanel.add(commandsPanel);
1070
+// oe.treePanel.Return();
1071
+
5411072 // oe.aConstraints.gridx += 1;
5421073 // oe.aConstraints.weighty = 0;
5431074 // oe.aConstraints.gridwidth = 1;
....@@ -549,47 +1080,32 @@
5491080 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5501081 // gcButton.addActionListener(this);
5511082
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;
1083
+ cGridBag jSPPanel = new cGridBag();
1084
+
1085
+ JScrollPane jSP;
5631086 //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);
1087
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5651088 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;
5851089
1090
+ oe.treePanel.add(jSPPanel);
1091
+ oe.treePanel.Return();
1092
+
1093
+ oe.treePanel.add(copyOptionsPanel);
1094
+ oe.treePanel.Return();
1095
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1096
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1097
+ sliderPane.preferredHeight = 1;
1098
+
1099
+// mainPanel.setDividerLocation(0.1); //1.0);
1100
+ mainPanel.setResizeWeight(0.4);
1101
+
5861102 //jList.addListSelectionListener(this);
5871103 oe.jTree.addTreeSelectionListener(this);
5881104 //jTree.setRootVisible(false);
5891105 //jTree.setEditable(true);
5901106 oe.jTree.setDragEnabled(true);
5911107 //jTree.setPreferredSize(new Dimension(10,10));
592
- jSP.setPreferredSize(new Dimension(100,200));
1108
+ //jSP.setPreferredSize(new Dimension(100,200));
5931109
5941110 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
5951111
....@@ -601,53 +1117,67 @@
6011117 dgr.addDragGestureListener(this);
6021118 }catch(Exception e) {}
6031119 */
604
- radio.layout = sevenButton;
1120
+ radio.layout = sixButton; // sevenButton;
6051121 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6061122 }
6071123
6081124 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6091125 {
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);
1126
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1127
+ colorCB.setToolTipText("Copy color when dropped");
1128
+ colorCB.addItemListener(this);
6191129
620
- // constraints.gridy += 1;
1130
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1131
+ materialCB.setToolTipText("Copy material when dropped");
1132
+ materialCB.addItemListener(this);
1133
+
1134
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1135
+ textureCB.setToolTipText("Copy texture when dropped");
1136
+ textureCB.addItemListener(this);
1137
+
1138
+ panel.Return();
1139
+
1140
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1141
+ boxCB.setToolTipText("Display bounding boxes");
1142
+ boxCB.addItemListener(this);
1143
+
1144
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1145
+ zoomBoxCB.setToolTipText("Display only for wheel");
1146
+ zoomBoxCB.addItemListener(this);
1147
+
1148
+ if (true) // Globals.ADVANCED)
1149
+ {
1150
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1151
+// supportCB.setToolTipText("Enable rigging");
1152
+// supportCB.addItemListener(this);
1153
+
1154
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1155
+ freezeCB.setToolTipText("Fast moving camera");
1156
+ freezeCB.addItemListener(this);
1157
+
6211158 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6221159 // localCB.addItemListener(this);
6231160
624
- //constraints.gridy += 1;
1161
+ panel.Return();
1162
+
6251163 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6261164 crowdCB.setToolTipText("Used for crowds");
6271165 crowdCB.addItemListener(this);
6281166
629
- //constraints.gridy += 1;
6301167 panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
6311168 smoothCB.setToolTipText("Snapping delay");
6321169 smoothCB.addItemListener(this);
6331170
634
- //constraints.gridy += 1;
6351171 panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
6361172 slowCB.setToolTipText("Smooth interpolation");
6371173 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
-
1174
+
6471175 // constraints.gridy += 1;
6481176 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6491177 // speakerMocapCB.addItemListener(this);
6501178
1179
+ panel.Return();
1180
+
6511181 if (false)
6521182 {
6531183 // handled in scripts
....@@ -662,36 +1192,85 @@
6621192 //constraints.gridy += 1;
6631193 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6641194 smoothfocusCB.addItemListener(this);
1195
+ panel.Return();
6651196 }
6661197
6671198 //constraints.gridx += 1;
6681199 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6691200 // debugCB.addItemListener(this);
6701201
671
- //constraints.gridy += 1;
1202
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1203
+ trackCB.setToolTipText("Enable tracking target");
1204
+ trackCB.addItemListener(this);
1205
+
6721206 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1207
+ oeilCB.setToolTipText("Move camera when tracking");
6731208 oeilCB.addItemListener(this);
6741209
675
- //constraints.gridy += 1;
1210
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1211
+ shadowCB.setToolTipText("When live compute shadows");
1212
+ shadowCB.addItemListener(this);
1213
+
1214
+ panel.Return();
1215
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1216
+ toggleTextureCB.setToolTipText("Load textures");
1217
+ toggleTextureCB.addItemListener(this);
1218
+
1219
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1220
+ toggleSwitchCB.setToolTipText("Choose a single item");
1221
+ toggleSwitchCB.addItemListener(this);
1222
+
1223
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1224
+ autokeepCB.setToolTipText("On structure change");
1225
+ autokeepCB.addItemListener(this);
1226
+
1227
+ panel.Return();
1228
+ if (Globals.ADVANCED)
1229
+ {
6761230 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
6771231 lookAtCB.setToolTipText("Look-at target");
6781232 lookAtCB.addItemListener(this);
1233
+ }
1234
+
1235
+ }
1236
+
1237
+ cGridBag fill = new cGridBag();
1238
+ fill.preferredHeight = 200;
1239
+ cGridBag fill2 = new cGridBag();
1240
+ fill2.preferredHeight = 200;
1241
+ cGridBag fill3 = new cGridBag();
1242
+ fill3.preferredHeight = 200;
1243
+
1244
+ panel.add(fill);
1245
+ panel.add(fill2);
1246
+ panel.add(fill3);
6791247
6801248 }
6811249
6821250 void EditObject(Object3D obj)
6831251 {
6841252 cRadio radioButton = new cRadio(obj.name);
1253
+
1254
+ // June 2019. Patch to avoid bug with transparency.
1255
+ radioButton.hadMaterial = obj.material != null;
1256
+ if (!radioButton.hadMaterial)
1257
+ {
1258
+ obj.material = new cMaterial();
1259
+ }
1260
+
6851261 radioButton.SetObject(obj);
686
- radioButton.layout = sevenButton;
1262
+ radioButton.layout = sixButton; // sevenButton;
6871263 radioButton.SetCamera(cameraView.renderCamera, false);
6881264 radioButton.addActionListener(this);
6891265 radioPanel.add(radioButton);
6901266 buttonGroup.add(radioButton);
6911267 radioButton.doClick();
6921268 }
1269
+
6931270 void SetupViews(ObjEditor oe)
6941271 {
1272
+ theFrame = this;
1273
+
6951274 oe.SetupViews();
6961275
6971276 System.out.println("SetupViews");
....@@ -700,23 +1279,28 @@
7001279 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7011280 }
7021281
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;
1282
+ cToggleButton liveCB;
1283
+ cCheckBox supportCB;
1284
+ cCheckBox localCB;
1285
+ cCheckBox crowdCB;
1286
+ cCheckBox smoothCB;
1287
+ cToggleButton fastCB;
1288
+ cCheckBox slowCB;
1289
+ cCheckBox boxCB;
1290
+ cCheckBox zoomBoxCB;
1291
+ cCheckBox freezeCB;
1292
+ //cToggleButton trackCB;
1293
+ cCheckBox trackCB;
1294
+ cCheckBox smoothfocusCB;
7141295 // JCheckBox speakerMocapCB;
715
- JCheckBox speakerCameraCB;
716
- JCheckBox speakerFocusCB;
717
- JCheckBox debugCB;
718
- JCheckBox oeilCB;
719
- JCheckBox lookAtCB;
1296
+ cCheckBox speakerCameraCB;
1297
+ cCheckBox speakerFocusCB;
1298
+ cCheckBox debugCB;
1299
+
1300
+ cCheckBox oeilCB;
1301
+ cCheckBox shadowCB;
1302
+ cCheckBox autokeepCB;
1303
+ cCheckBox lookAtCB;
7201304
7211305 // static int COLOR = 1;
7221306 // static int MATERIAL = 2;
....@@ -724,9 +1308,9 @@
7241308
7251309 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7261310
727
- JCheckBox colorCB;
728
- JCheckBox materialCB;
729
- JCheckBox textureCB;
1311
+ cCheckBox colorCB;
1312
+ cCheckBox materialCB;
1313
+ cCheckBox textureCB;
7301314
7311315 public void itemStateChanged(ItemEvent e)
7321316 {
....@@ -754,6 +1338,7 @@
7541338 } else if(e.getSource() == liveCB)
7551339 {
7561340 cameraView.ToggleLive();
1341
+ refreshContents(false);
7571342 }
7581343 else if(e.getSource() == supportCB)
7591344 {
....@@ -818,6 +1403,18 @@
8181403 {
8191404 cameraView.ToggleOeil();
8201405 }
1406
+ else if(e.getSource() == shadowCB)
1407
+ {
1408
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1409
+ }
1410
+ else if(e.getSource() == freezeCB)
1411
+ {
1412
+ Globals.FREEZEONMOVE ^= true;
1413
+ }
1414
+ else if(e.getSource() == autokeepCB)
1415
+ {
1416
+ Globals.REPLACEONMAKE ^= true;
1417
+ }
8211418 else if(e.getSource() == lookAtCB)
8221419 {
8231420 cameraView.ToggleLookAt();
....@@ -834,7 +1431,8 @@
8341431
8351432 /**/
8361433 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
837
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1434
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1435
+ TreePath path = objEditor.jTree.getSelectionPath();
8381436 if ((path == null) || (path.getPathCount() <= 1)) {
8391437 // We can't move the root node or an empty selection
8401438 return;
....@@ -897,8 +1495,6 @@
8971495 }
8981496 }
8991497
900
- String string = (String) object;
901
-
9021498 System.out.println("Transfer = " + object + "; drop : " + target);
9031499 // if( object instanceof java.io.File[])
9041500 // {
....@@ -906,7 +1502,11 @@
9061502 // objEditor.DropFile((java.io.File[]) object, true);
9071503 // return;
9081504 // }
909
- if (string.charAt(0) == '/')
1505
+
1506
+ String string = object.toString();
1507
+
1508
+ // File path for Mac and Windows
1509
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9101510 {
9111511 // file(s)
9121512 String[] names = string.split("\n");
....@@ -933,7 +1533,7 @@
9331533
9341534 flashIt = false;
9351535 CameraPane pane = (CameraPane) target;
936
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1536
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9371537 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9381538
9391539 if (group.selection.size() == 1)
....@@ -949,23 +1549,33 @@
9491549
9501550 assert target == objEditor.jTree;
9511551 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1552
+ Object3D destinationLeaf;
9521553 try {
953
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1554
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9541555 } catch (Exception e) {
9551556 System.out.println("destinationPath : " + destinationPath);
9561557 return;
9571558 }
9581559
959
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1560
+ for (int i=group.selection.size(); --i>=0;)
9601561 {
1562
+ Object3D child = (Object3D)group.selection.elementAt(i);
1563
+
1564
+ // Cannot move into itself
1565
+ if (child == destinationLeaf)
1566
+ return;
1567
+ }
1568
+
1569
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1570
+// {
9611571 loadClipboard(true);
9621572 objEditor.jTree.setSelectionPath(destinationPath);
963
- pasteInto(false);
964
- } else {
965
- loadClipboard(false);
966
- objEditor.jTree.setSelectionPath(destinationPath);
967
- pasteInto(false); // true); // ???
968
- }
1573
+ pasteInto(false, false);
1574
+// } else {
1575
+// loadClipboard(false);
1576
+// objEditor.jTree.setSelectionPath(destinationPath);
1577
+// pasteInto(false, false); // true); // ???
1578
+// }
9691579 }
9701580 public void dropActionChanged(DropTargetDragEvent dtde)
9711581 // Called if the user has modified the current drop gesture
....@@ -1070,85 +1680,107 @@
10701680 {
10711681 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10721682 //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);
1683
+// gridItem = menu.add(new MenuItem("Grid"));
1684
+// gridItem.addActionListener(this);
1685
+// rectoidItem = menu.add(new MenuItem("Box"));
1686
+// rectoidItem.addActionListener(this);
1687
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1688
+// ellipsoidItem.addActionListener(this);
1689
+// coneItem = menu.add(new MenuItem("Cone"));
1690
+// coneItem.addActionListener(this);
1691
+// torusItem = menu.add(new MenuItem("Torus"));
1692
+// torusItem.addActionListener(this);
1693
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1694
+// superItem.addActionListener(this);
1695
+
1696
+ cameraItem = menu.add(new MenuItem("Camera"));
1697
+ cameraItem.addActionListener(this);
1698
+
1699
+ if (!Globals.ADVANCED)
1700
+ {
10851701 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10861702 kleinItem.addActionListener(this);
1087
- particleItem = menu.add(new MenuItem("Particle system"));
1088
- particleItem.addActionListener(this);
1703
+ }
1704
+
1705
+// particleItem = menu.add(new MenuItem("Particle system"));
1706
+// particleItem.addActionListener(this);
1707
+ if (Globals.ADVANCED)
1708
+ {
10891709 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10901710 ragdollItem.addActionListener(this);
10911711 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10921712 ragdoll2Item.addActionListener(this);
1713
+ }
10931714 menu.add("-");
1094
- meshItem = menu.add(new MenuItem("Mesh"));
1715
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10951716 meshItem.addActionListener(this);
10961717 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10971718 // meshGroupItem.addActionListener(this);
1719
+ if (Globals.ADVANCED)
1720
+ {
10981721 springItem = menu.add(new MenuItem("Spring"));
10991722 springItem.addActionListener(this);
11001723 flagItem = menu.add(new MenuItem("Flag"));
11011724 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);
11061725 blobItem = menu.add(new MenuItem("Blob"));
11071726 blobItem.addActionListener(this);
11081727 latheItem = menu.add(new MenuItem("Lathe"));
11091728 latheItem.addActionListener(this);
1110
- lightItem = menu.add(new MenuItem("Light"));
1111
- lightItem.addActionListener(this);
1729
+ }
1730
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1731
+ bezierItem.addActionListener(this);
1732
+// overlayItem = menu.add(new MenuItem("Overlay"));
1733
+// overlayItem.addActionListener(this);
1734
+// lightItem = menu.add(new MenuItem("Light"));
1735
+// lightItem.addActionListener(this);
11121736 menu.add("-");
11131737 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11141738 //superLoopItem.addActionListener(this);
1115
- loopItem = menu.add(new MenuItem("Loop"));
1116
- loopItem.addActionListener(this);
1739
+// loopItem = menu.add(new MenuItem("Loop"));
1740
+// loopItem.addActionListener(this);
11171741 doubleItem = menu.add(new MenuItem("Fork"));
11181742 doubleItem.addActionListener(this);
1743
+ if (Globals.ADVANCED)
1744
+ {
11191745 tripleItem = menu.add(new MenuItem("Trident"));
11201746 tripleItem.addActionListener(this);
1747
+ }
11211748 }
11221749
11231750 void buildToolsMenu(Menu menu)
11241751 {
11251752 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11261753 animationItem.addItemListener(this);
1127
- animationItem.setState(CameraPane.ANIMATION);
1754
+ animationItem.setState(Globals.ANIMATION);
1755
+
1756
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1757
+ archiveItem.addActionListener(this);
11281758
11291759 menu.add("-");
11301760 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11311761 parseverticesItem.addActionListener(this);
11321762 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11331763 textureFieldItem.addActionListener(this);
1134
- alignItem = menu.add(new MenuItem("Align"));
1764
+ alignItem = menu.add(new MenuItem("Align Objects"));
11351765 alignItem.addActionListener(this);
1136
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1137
- mirrorItem.addActionListener(this);
11381766 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11391767 reduceMorphItem.addActionListener(this);
11401768 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11411769 reduce34MorphItem.addActionListener(this);
1142
-
1143
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1144
- computeAOItem.addActionListener(this);
11451770 menu.add("-");
1146
-
11471771 menu.add(memoryItem = new MenuItem("Memory Usage"));
11481772 memoryItem.addActionListener(this);
1773
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1774
+ computeAOItem.addActionListener(this);
1775
+
1776
+ if (Globals.ADVANCED)
1777
+ {
1778
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1779
+ mirrorItem.addActionListener(this);
1780
+ menu.add("-");
11491781 menu.add(analyzeItem = new MenuItem("Analyze"));
11501782 analyzeItem.addActionListener(this);
1151
- menu.add(dumpItem = new MenuItem("Dump"));
1783
+ menu.add(dumpItem = new MenuItem("Print"));
11521784 dumpItem.addActionListener(this);
11531785 // menu.add(pathItem = new MenuItem("From-to path"));
11541786 // pathItem.addActionListener(this);
....@@ -1166,6 +1798,7 @@
11661798 menu.add("-");
11671799 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11681800 editScriptItem.addActionListener(this);
1801
+ }
11691802 }
11701803
11711804 void ScreenFit()
....@@ -1288,9 +1921,34 @@
12881921 shadow.material = new cMaterial(obj.material);
12891922 shadow.material.diffuse = 0.0001f;
12901923 shadow.material.specular = 0.0001f;
1924
+ //shadow.projectedVertices[1].x = 300;
12911925
12921926 makeSomething(shadow);
12931927 }
1928
+
1929
+ private void ClearUnpinned()
1930
+ {
1931
+ //for (Object3D obj : listUI)
1932
+ for (int i=listUI.size(); --i>=0;)
1933
+ {
1934
+ Object3D obj = listUI.elementAt(i);
1935
+ if (!obj.pinned)
1936
+ {
1937
+ obj.CloseUI();
1938
+ listUI.remove(i);
1939
+ }
1940
+ }
1941
+ }
1942
+
1943
+ private void EditElement(Object3D elem, boolean newWindow)
1944
+ {
1945
+ // if (!(elem instanceof Composite))
1946
+ // newWindow = false;
1947
+ listUI.add(elem);
1948
+ elem.openEditWindow(this, newWindow); //, false);
1949
+ System.out.println("edit : " + elem);
1950
+ elem.editWindow.refreshContents(true); // ? new
1951
+ }
12941952
12951953 /**
12961954 * applyExample
....@@ -1494,9 +2152,9 @@
14942152
14952153 void Overwrite(int mask)
14962154 {
1497
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2155
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14982156 {
1499
- Object3D content = GrafreeD.clipboard.get(0);
2157
+ Object3D content = Grafreed.clipboard.get(0);
15002158
15012159 if (content instanceof cGroup && ((cGroup)content).transientlink )
15022160 content = ((cGroup)content).get(0);
....@@ -1535,7 +2193,7 @@
15352193 {
15362194 ScreenFit();
15372195 } else
1538
- if (source == switchItem)
2196
+ if (source == switchViewItem)
15392197 {
15402198 cVector v1 = new cVector();
15412199 cVector v2 = new cVector();
....@@ -1544,11 +2202,11 @@
15442202 objEditor.cameraView.renderCamera.setAim(v2, v1);
15452203 objEditor.cameraView.repaint();
15462204 } else
1547
- if (source == rectoidItem)
2205
+ if (source == rectoidItem || source == boxButton)
15482206 {
15492207 makeSomething(new Box());
15502208 } else
1551
- if (source == particleItem)
2209
+ if (source == particleItem || source == particlesButton)
15522210 {
15532211 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15542212 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1627,27 +2285,27 @@
16272285
16282286 makeSomething(obj);
16292287 } else
1630
- if (source == gridItem)
2288
+ if (source == gridItem || source == gridButton)
16312289 {
16322290 makeSomething(new Grid());
16332291 } else
1634
- if (source == ellipsoidItem)
2292
+ if (source == ellipsoidItem || source == sphereButton)
16352293 {
16362294 makeSomething(new Sphere());
16372295 } else
1638
- if (source == coneItem)
2296
+ if (source == coneItem || source == coneButton)
16392297 {
16402298 makeSomething(new Cone());
16412299 } else
1642
- if (source == torusItem)
2300
+ if (source == torusItem || source == torusButton)
16432301 {
16442302 makeSomething(new Torus());
16452303 } else
1646
- if (source == superItem)
2304
+ if (source == superItem || source == superButton)
16472305 {
16482306 makeSomething(new Superellipsoid());
16492307 } else
1650
- if (source == kleinItem)
2308
+ if (source == kleinItem || source == kleinButton)
16512309 {
16522310 makeSomething(new Klein());
16532311 } else
....@@ -1667,7 +2325,7 @@
16672325 {
16682326 makeSomething(new BezierSurface());
16692327 } else
1670
- if (source == checkerItem)
2328
+ if (source == overlayItem || source == overlayButton)
16712329 {
16722330 /*
16732331 Object3D obj = new BezierSurface(5,8);
....@@ -1715,10 +2373,27 @@
17152373 s.setup();
17162374 makeSomething(s);
17172375 } else
1718
- if (source == lightItem)
2376
+ if (source == lightItem || source == lightButton)
17192377 {
17202378 makeSomething(new Light());
17212379 } else
2380
+// if (source == skybox1Button ||
2381
+// source == skybox2Button ||
2382
+// source == skybox3Button ||
2383
+// source == skybox4Button ||
2384
+// source == skybox5Button ||
2385
+// source == skybox6Button ||
2386
+// source == skybox7Button ||
2387
+// source == skybox11Button ||
2388
+// source == skybox12Button ||
2389
+// source == skybox13Button ||
2390
+// source == skybox14Button ||
2391
+// source == skybox15Button ||
2392
+// source == skybox16Button ||
2393
+// source == skybox17Button)
2394
+// {
2395
+// ChangeSkybox(source);
2396
+// } else
17222397 if (source == csgItem)
17232398 {
17242399 group(new CSG());
....@@ -1765,30 +2440,30 @@
17652440
17662441 group(g);
17672442 } else
1768
- if (source == loopItem)
2443
+ if (source == loopItem || source == loopButton)
17692444 {
17702445 Composite csg = new GroupLeaf();
17712446 csg.count = 5;
17722447 group(csg);
1773
- Composite child = new cGroup();
2448
+ Composite child = new cGroup("Branch");
17742449 csg.addChild(child);
17752450 child.addChild(csg);
17762451 } else
17772452 if (source == doubleItem)
17782453 {
1779
- Composite csg = new GroupLeaf();
2454
+ Composite csg = new GroupLeaf("Fork");
17802455 csg.count = 5;
17812456 group(csg);
1782
- Composite child = new cGroup();
2457
+ Composite child = new cGroup("Branch A");
17832458 csg.addChild(child);
17842459 child.addChild(csg);
1785
- child = new cGroup();
2460
+ child = new cGroup("Branch B");
17862461 csg.addChild(child);
17872462 child.addChild(csg);
17882463 } else
17892464 if (source == tripleItem)
17902465 {
1791
- Composite csg = new GroupLeaf();
2466
+ Composite csg = new GroupLeaf("Trident");
17922467 csg.count = 4;
17932468 group(csg);
17942469 Composite child = new cGroup();
....@@ -1801,27 +2476,10 @@
18012476 csg.addChild(child);
18022477 child.addChild(csg);
18032478 } 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
18212479 if (source == computeAOItem)
18222480 {
18232481 Globals.drawMode = CameraPane.OCCLUSION;
1824
- Globals.theRenderer.repaint();
2482
+ cameraView.repaint();
18252483 } else
18262484 if (source == recompileItem)
18272485 {
....@@ -1836,7 +2494,7 @@
18362494 if (source == invariantsItem)
18372495 {
18382496 System.out.println("Invariants:");
1839
- GrafreeD.grafreeD.universe.invariants();
2497
+ Grafreed.grafreeD.universe.invariants();
18402498 } else
18412499 if (source == memoryItem)
18422500 {
....@@ -1855,19 +2513,61 @@
18552513 {
18562514 DumpObject();
18572515 } else
2516
+ if (source == minButton)
2517
+ {
2518
+ Minimize();
2519
+ } else
2520
+ if (source == maxButton)
2521
+ {
2522
+ Maximize();
2523
+ } else
2524
+ if (source == fullButton)
2525
+ {
2526
+ ToggleFullScreen();
2527
+ } else
2528
+ if (source == undoButton)
2529
+ {
2530
+ // Go to previous version
2531
+ //if (!Undo())
2532
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2533
+ Undo();
2534
+ } else
2535
+ if (source == restoreButton)
2536
+ {
2537
+ // Restore current version
2538
+ Restore();
2539
+ } else
2540
+ if (source == replaceButton)
2541
+ {
2542
+ // Overwrite current version
2543
+ Replace();
2544
+ } else
2545
+ if (source == redoButton)
2546
+ {
2547
+ // Go to next version
2548
+ Redo();
2549
+ } else
2550
+ if (source == saveButton)
2551
+ {
2552
+ // Save a new version
2553
+ if (!Save(true))
2554
+ java.awt.Toolkit.getDefaultToolkit().beep();
2555
+ } else
2556
+ if (source == oneStepButton)
2557
+ {
2558
+ Globals.ONESTEP = true;
2559
+ cameraView.repaint();
2560
+ } else
18582561 if (source == screenfitButton)
18592562 {
1860
- //Reload(lastConverter, lastFilename, true);
18612563 ScreenFit();
18622564 } else
18632565 if (source == screenfitpointButton)
18642566 {
1865
- //Reload(lastConverter, lastFilename, true);
18662567 ScreenFitPoint();
18672568 } else
18682569 if (source == snapobjectButton)
18692570 {
1870
- //Reload(lastConverter, lastFilename, true);
18712571 SnapObject();
18722572 } else
18732573 // if (event.getSource() == recompileButton)
....@@ -1904,12 +2604,20 @@
19042604 {
19052605 loadClipboard(true);
19062606 } else
2607
+ if (source == undoItem)
2608
+ {
2609
+ Undo();
2610
+ } else
2611
+ if (source == redoItem)
2612
+ {
2613
+ Redo();
2614
+ } else
19072615 if (source == duplicateItem)
19082616 {
1909
- Object3D keep = GrafreeD.clipboard;
2617
+ Object3D keep = Grafreed.clipboard;
19102618 loadClipboard(false);
19112619 paste(false);
1912
- GrafreeD.clipboard = keep;
2620
+ Grafreed.clipboard = keep;
19132621 } else
19142622 if (source == cloneItem)
19152623 {
....@@ -1927,13 +2635,17 @@
19272635 {
19282636 paste(false);
19292637 } else
2638
+ if (source == pasteIntoItem)
2639
+ {
2640
+ pasteInto(true, false);
2641
+ } else
19302642 if (source == pasteLinkItem)
19312643 {
1932
- pasteInto(false);
2644
+ pasteInto(false, false);
19332645 } else
19342646 if (source == pasteCloneItem)
19352647 {
1936
- pasteInto(true);
2648
+ pasteInto(true, true);
19372649 } else
19382650 if (source == pasteExpandItem)
19392651 {
....@@ -2125,9 +2837,9 @@
21252837 // group.selection.get(0).setMasterThis(content); // should be identity
21262838 // refreshContents();
21272839 // }
2128
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2840
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21292841 {
2130
- Object3D content = GrafreeD.clipboard.get(0);
2842
+ Object3D content = Grafreed.clipboard.get(0);
21312843
21322844 if (content instanceof cGroup && ((cGroup)content).transientlink )
21332845 content = ((cGroup)content).get(0);
....@@ -2135,11 +2847,11 @@
21352847 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21362848 for (int i=0; i<group.selection.size(); i++)
21372849 {
2138
- boolean random = CameraPane.RANDOM;
2139
- CameraPane.RANDOM = false; // parse all random nodes
2850
+ boolean random = CameraPane.SWITCH;
2851
+ CameraPane.SWITCH = false; // parse all random nodes
21402852 group.selection.get(i).linkVerticesThis(content);
21412853 // group.selection.get(i).setMasterThis(content); // should be identity
2142
- CameraPane.RANDOM = random;
2854
+ CameraPane.SWITCH = random;
21432855 }
21442856 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21452857 refreshContents();
....@@ -2149,20 +2861,20 @@
21492861 {
21502862 for (int i=0; i<group.selection.size(); i++)
21512863 {
2152
- boolean random = CameraPane.RANDOM;
2153
- CameraPane.RANDOM = false; // parse all random nodes
2864
+ boolean random = CameraPane.SWITCH;
2865
+ CameraPane.SWITCH = false; // parse all random nodes
21542866 group.selection.get(i).linkVerticesThis(null);
2155
- CameraPane.RANDOM = random;
2867
+ CameraPane.SWITCH = random;
21562868 }
21572869
21582870 refreshContents();
21592871 } else
21602872 if (source == relinkverticesItem)
21612873 {
2162
- boolean random = CameraPane.RANDOM;
2163
- CameraPane.RANDOM = false; // parse all random nodes
2874
+ boolean random = CameraPane.SWITCH;
2875
+ CameraPane.SWITCH = false; // parse all random nodes
21642876 group.selection.RelinkToSupport();
2165
- CameraPane.RANDOM = random;
2877
+ CameraPane.SWITCH = random;
21662878
21672879 refreshContents();
21682880 } else
....@@ -2177,9 +2889,9 @@
21772889 } else
21782890 if (source == setMasterItem)
21792891 {
2180
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2892
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21812893 {
2182
- Object3D content = GrafreeD.clipboard.get(0);
2894
+ Object3D content = Grafreed.clipboard.get(0);
21832895
21842896 if (content instanceof cGroup && ((cGroup)content).transientlink )
21852897 content = ((cGroup)content).get(0);
....@@ -2192,9 +2904,9 @@
21922904 {
21932905 if (group.selection.size() == 1)
21942906 {
2195
- if (GrafreeD.clipboard.size() == 1)
2907
+ if (Grafreed.clipboard.size() == 1)
21962908 {
2197
- Object3D content = GrafreeD.clipboard.get(0);
2909
+ Object3D content = Grafreed.clipboard.get(0);
21982910
21992911 if (content instanceof cGroup && ((cGroup)content).transientlink )
22002912 content = ((cGroup)content).get(0);
....@@ -2211,7 +2923,7 @@
22112923 {
22122924 RevertMeshes();
22132925 } else
2214
- if (source == resetMeshItem)
2926
+ if (source == resetAllItem)
22152927 {
22162928 ResetAll();
22172929 } else
....@@ -2219,7 +2931,7 @@
22192931 {
22202932 StepAll();
22212933 } else
2222
- if (source == clearItem) // || event.getSource() == clearButton)
2934
+ if (source == deleteItem) // || event.getSource() == clearButton)
22232935 {
22242936 //int indices[] = jList.getSelectedIndices();
22252937 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2231,9 +2943,9 @@
22312943 {
22322944 ClearSelection(true);
22332945 } else
2234
- if (source == grabItem)
2946
+ if (source == grabItem || source == groupButton)
22352947 {
2236
- group(new cGroup(), true);
2948
+ group(new cGroup(), false); // true);
22372949 } else
22382950 if (source == hideItem)
22392951 {
....@@ -2251,16 +2963,16 @@
22512963 {
22522964 makeSomething(new Camera());
22532965 } else
2254
- if (source == compositeItem)
2966
+ if (source == compositeItem || source == compositeButton)
22552967 {
22562968 group(new Composite());
22572969 } else
2258
- if (source == randomItem)
2970
+ if (source == switchItem || source == switchButton)
22592971 {
22602972 RandomNode random = new RandomNode();
22612973 group(random);
22622974 if (random.size() > 0)
2263
- random.name = random.get(0).name + "Rnd";
2975
+ random.name = random.get(0).name + "Switch";
22642976 } else
22652977 if (source == physicsItem)
22662978 {
....@@ -2357,7 +3069,7 @@
23573069 {
23583070 group(new cLinker());
23593071 } else
2360
- if (source == textureItem)
3072
+ if (source == textureItem || source == textureButton)
23613073 {
23623074 group(new TextureNode());
23633075 } else
....@@ -2377,17 +3089,30 @@
23773089 {
23783090 CastShadow(2);
23793091 } else
2380
- if (source == ungroupItem)
3092
+ if (source == ungroupItem || source == ungroupButton)
23813093 {
2382
- //ungroup();
3094
+ boolean hasRoot = false;
3095
+
23833096 for (int i=0; i<group.selection.size(); i++)
23843097 {
2385
- Ungroup(group.selection.get(i));
3098
+ if (group.selection.get(i) == group)
3099
+ {
3100
+ hasRoot = true;
3101
+ break;
3102
+ }
23863103 }
23873104
2388
- ClearSelection(false);
2389
-
2390
- refreshContents();
3105
+ if (!hasRoot)
3106
+ {
3107
+ for (int i=0; i<group.selection.size(); i++)
3108
+ {
3109
+ Ungroup(group.selection.get(i));
3110
+ }
3111
+
3112
+ ClearSelection(false);
3113
+
3114
+ refreshContents();
3115
+ }
23913116 } else
23923117 if (source == genUVItem)
23933118 {
....@@ -2399,7 +3124,7 @@
23993124 } else
24003125 if (source == genNormalsMESHItem)
24013126 {
2402
- GenNormals(true); // TODO
3127
+ GenNormalsMESH();
24033128 } else
24043129 if (source == genNormalsORGANItem)
24053130 {
....@@ -2464,6 +3189,22 @@
24643189 if (source == unmarkleavesItem)
24653190 {
24663191 MarkLeaves(false);
3192
+ } else
3193
+ if (source == rewindleavesItem)
3194
+ {
3195
+ RewindLeaves(true);
3196
+ } else
3197
+ if (source == unrewindleavesItem)
3198
+ {
3199
+ RewindLeaves(false);
3200
+ } else
3201
+ if (source == randomleavesItem)
3202
+ {
3203
+ RandomLeaves(true);
3204
+ } else
3205
+ if (source == unrandomleavesItem)
3206
+ {
3207
+ RandomLeaves(false);
24673208 } else
24683209 if (source == flipVItem)
24693210 {
....@@ -2549,9 +3290,13 @@
25493290 {
25503291 SmoothMesh();
25513292 } else
2552
- if (source == transformgeometryItem)
3293
+ if (source == transformGeometryItem)
25533294 {
25543295 TransformGeometry();
3296
+ } else
3297
+ if (source == transformChildrenItem)
3298
+ {
3299
+ TransformChildren();
25553300 } else
25563301 if (source == resetTransformItem)
25573302 {
....@@ -2559,7 +3304,11 @@
25593304 } else
25603305 if (source == resetCentroidItem)
25613306 {
2562
- ResetCentroid();
3307
+ ResetCentroid(true);
3308
+ } else
3309
+ if (source == resetCentroidXZItem)
3310
+ {
3311
+ ResetCentroid(false);
25633312 } else
25643313 if (source == resetParentItem)
25653314 {
....@@ -2664,7 +3413,7 @@
26643413 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26653414 {
26663415 obj = (Object3D)e.nextElement();
2667
- obj.SetBumpTexture(null);
3416
+ obj.ResetBumpTexture();
26683417 }
26693418
26703419 refreshContents();
....@@ -2680,6 +3429,31 @@
26803429
26813430 refreshContents();
26823431 } else
3432
+ if (source == embedTexturesItem)
3433
+ {
3434
+ Object3D obj;
3435
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3436
+ {
3437
+ obj = (Object3D)e.nextElement();
3438
+ obj.EmbedTextures(true);
3439
+ }
3440
+
3441
+ refreshContents();
3442
+ } else
3443
+ if (source == deEmbedTexturesItem)
3444
+ {
3445
+ Object3D obj;
3446
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3447
+ {
3448
+ obj = (Object3D)e.nextElement();
3449
+ obj.EmbedTextures(false);
3450
+ }
3451
+
3452
+ CameraPane.texturepigment.clear();
3453
+ CameraPane.texturebump.clear();
3454
+
3455
+ refreshContents();
3456
+ } else
26833457 if (source == flashSelectionButton)
26843458 {
26853459 CameraPane.flash = true;
....@@ -2691,6 +3465,10 @@
26913465 if (source == twoButton)
26923466 {
26933467 radio.layout = twoButton;
3468
+
3469
+ if (CameraPane.FULLSCREEN)
3470
+ fullscreenLayout = radio.layout;
3471
+
26943472 // bug
26953473 //gridPanel.setDividerLocation(1.0);
26963474 //bigPanel.setDividerLocation(0.0);
....@@ -2723,10 +3501,31 @@
27233501 bigThree.ClearUI();
27243502 bigThree.add(centralPanel);
27253503 bigThree.FlushUI();
3504
+
3505
+ cameraView.requestFocusInWindow();
3506
+
3507
+// refreshContents(true);
3508
+//
3509
+// try
3510
+// {
3511
+// java.awt.Robot bot = new java.awt.Robot();
3512
+// int mask = InputEvent.BUTTON1_MASK;
3513
+// bot.mouseMove(100, 100);
3514
+// bot.mousePress(mask);
3515
+// bot.mouseRelease(mask);
3516
+// }
3517
+// catch (Exception e)
3518
+// {
3519
+//
3520
+// }
3521
+
27263522 } else
27273523 if (source == threeButton)
27283524 {
27293525 radio.layout = threeButton;
3526
+
3527
+ if (CameraPane.FULLSCREEN)
3528
+ fullscreenLayout = radio.layout;
27303529
27313530 // bigThree.remove(scenePanel);
27323531 // bigThree.remove(centralPanel);
....@@ -2756,13 +3555,18 @@
27563555 // centralPanel.setVisible(true);
27573556 // XYZPanel.setVisible(true);
27583557 bigThree.ClearUI();
3558
+ bigThree.add(scenePanel);
27593559 bigThree.add(centralPanel);
2760
- bigThree.add(XYZPanel);
27613560 bigThree.FlushUI();
3561
+
3562
+ cameraView.requestFocusInWindow();
27623563 } else
27633564 if (source == fourButton)
27643565 {
27653566 radio.layout = fourButton;
3567
+
3568
+ if (CameraPane.FULLSCREEN)
3569
+ fullscreenLayout = radio.layout;
27663570
27673571 // bigThree.remove(scenePanel);
27683572 // bigThree.remove(centralPanel);
....@@ -2794,10 +3598,15 @@
27943598 bigThree.ClearUI();
27953599 bigThree.add(scenePanel);
27963600 bigThree.FlushUI();
3601
+
3602
+ cameraView.requestFocusInWindow();
27973603 } else
27983604 if (source == sixButton)
27993605 {
28003606 radio.layout = sixButton;
3607
+
3608
+ if (CameraPane.FULLSCREEN)
3609
+ fullscreenLayout = radio.layout;
28013610
28023611 // bigThree.remove(scenePanel);
28033612 // bigThree.remove(centralPanel);
....@@ -2827,13 +3636,18 @@
28273636 // centralPanel.setVisible(true);
28283637 // XYZPanel.setVisible(false);
28293638 bigThree.ClearUI();
2830
- bigThree.add(scenePanel);
28313639 bigThree.add(centralPanel);
3640
+ bigThree.add(scenePanel);
28323641 bigThree.FlushUI();
3642
+
3643
+ cameraView.requestFocusInWindow();
28333644 } else
28343645 if (source == sevenButton)
28353646 {
28363647 radio.layout = sevenButton;
3648
+
3649
+ if (CameraPane.FULLSCREEN)
3650
+ fullscreenLayout = radio.layout;
28373651
28383652 // bigThree.remove(scenePanel);
28393653 // bigThree.remove(centralPanel);
....@@ -2867,6 +3681,8 @@
28673681 bigThree.add(centralPanel);
28683682 bigThree.add(XYZPanel);
28693683 bigThree.FlushUI();
3684
+
3685
+ cameraView.requestFocusInWindow();
28703686 } else
28713687 if (source == rootButton)
28723688 {
....@@ -2878,6 +3694,7 @@
28783694 EditObject(obj);
28793695 }
28803696
3697
+ cameraView.requestFocusInWindow();
28813698 refreshContents(true);
28823699 } else
28833700 if (source == closeButton)
....@@ -2887,22 +3704,37 @@
28873704 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28883705 {
28893706 ab = (cRadio)e.nextElement();
2890
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3707
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28913708 {
3709
+ // Patch to avoid bug with transparency.
3710
+ if (!ab.hadMaterial)
3711
+ {
3712
+ ab.object.material = null;
3713
+ }
3714
+
28923715 buttonGroup.remove(ab);
28933716 radioPanel.remove(ab);
28943717
2895
- ab.GetObject().editWindow = null;
3718
+ //ab.GetObject().editWindow = null;
3719
+ ab.GetObject().manipWindow = null;
28963720 // ab.GetObject().objectUI = null; // ?????????
28973721
28983722 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28993723 break;
29003724 }
29013725 }
3726
+
3727
+ cameraView.requestFocusInWindow();
29023728 refreshContents(true);
29033729 } else
29043730 if (source == editItem || source == editButton)
29053731 {
3732
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3733
+ {
3734
+ Object3D child = (Object3D)e.nextElement();
3735
+ child.pinned = true;
3736
+ }
3737
+
29063738 EditSelection(false);
29073739 } else
29083740 if (source == uneditButton)
....@@ -2912,12 +3744,13 @@
29123744 Object3D child = (Object3D)e.nextElement();
29133745 if(child.editWindow != null)
29143746 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3747
+ child.pinned = false;
29153748 child.CloseUI();
29163749 listUI.remove(child);
29173750
2918
- child.editWindow = null; // ???????????
3751
+ //child.editWindow = null; // ???????????
29193752 }
2920
- objEditor.ctrlPanel.validate();
3753
+ objEditor.ctrlPanel.FlushUI();
29213754 //objEditor.jTree.clearSelection();
29223755 //objEditor.ResetSliders();
29233756 refreshContents(true);
....@@ -2928,6 +3761,7 @@
29283761 //copy.ClearUI();
29293762 for (Object3D obj : listUI)
29303763 {
3764
+ obj.pinned = false;
29313765 obj.CloseUI();
29323766 }
29333767 listUI.clear();
....@@ -2937,7 +3771,7 @@
29373771 {
29383772 assert(copy == group);
29393773
2940
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3774
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29413775
29423776 for (Object3D obj : listUI)
29433777 {
....@@ -2986,6 +3820,9 @@
29863820 }
29873821
29883822 copy = group;
3823
+
3824
+ SetUndoStates();
3825
+
29893826 //Globals.theRenderer.object = group;
29903827 if(!useclient)
29913828 {
....@@ -3001,20 +3838,46 @@
30013838 frontView.object = group;
30023839 sideView.object = group;
30033840 }
3004
- group.editWindow = this;
3841
+
3842
+// fix "+" issue
3843
+ //group.editWindow = this;
3844
+ group.manipWindow = this;
3845
+
30053846 /*
30063847 currentLayout = radio.layout;
30073848 if (currentLayout == null)
30083849 currentLayout = sevenButton;
30093850 */
30103851 radio.layout.doClick();
3852
+
3853
+ ClearUnpinned();
3854
+ //Grafreed.Assert(group != null);
3855
+ //Grafreed.Assert(group.selection != null);
3856
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3857
+ if (group.selection == null || group.selection.size() == 1)
3858
+ EditSelection(false);
30113859 keepparent = group.parent;
30123860 // PARENT = NULL or not???
30133861 //group.parent = null; // ROOT
30143862 //group.attributes = -1;
30153863 ResetModel();
3864
+
3865
+ cameraView.requestFocusInWindow();
30163866 refreshContents(true);
3017
- }
3867
+ } else if (event.getSource() == editCameraItem)
3868
+ {
3869
+ cameraView.ProtectCamera();
3870
+ cameraView.repaint();
3871
+ return;
3872
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3873
+ {
3874
+ cameraView.RevertCamera();
3875
+ cameraView.repaint();
3876
+ return;
3877
+ // } else if (event.getSource() == textureButton)
3878
+ // {
3879
+ // return; // true;
3880
+ }
30183881 else
30193882 {
30203883 //return super.action(event, arg);
....@@ -3023,7 +3886,6 @@
30233886 }
30243887
30253888 boolean useclient = false;
3026
- cRadio radio;
30273889
30283890 void ToggleRoot()
30293891 {
....@@ -3075,6 +3937,28 @@
30753937 refreshContents();
30763938 }
30773939
3940
+ void TransformChildren()
3941
+ {
3942
+ Object3D obj;
3943
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3944
+ {
3945
+ obj = (Object3D)e.nextElement();
3946
+ obj.KeepTextureMatrices();
3947
+ obj.TransformChildren();
3948
+ obj.RestoreTextureMatrices();
3949
+
3950
+// if (obj.parent == null)
3951
+// {
3952
+// System.out.println("NULL PARENT!");
3953
+// new Exception().printStackTrace();
3954
+// }
3955
+// else
3956
+// TouchTransform(obj);
3957
+// //obj.parent.Touch();
3958
+ }
3959
+
3960
+ refreshContents();
3961
+ }
30783962
30793963 void ResetTransform()
30803964 {
....@@ -3187,7 +4071,7 @@
31874071 refreshContents();
31884072 }
31894073
3190
- void ResetCentroid()
4074
+ void ResetCentroid(boolean full)
31914075 {
31924076 Object3D obj;
31934077 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3202,12 +4086,16 @@
32024086 LA.matIdentity(Object3D.mat);
32034087 obj.getBounds(minima, maxima, false);
32044088 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3205
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4089
+ if (full)
4090
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32064091 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32074092 obj.TransformMesh(Object3D.mat);
4093
+
32084094 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3209
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4095
+ if (full)
4096
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32104097 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4098
+
32114099 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32124100 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32134101 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3236,7 +4124,8 @@
32364124
32374125 int size = obj.MemorySize();
32384126
3239
- System.err.println((size/1024) + " KB is the size of " + obj);
4127
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4128
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32404129 }
32414130 }
32424131 catch (Exception e)
....@@ -3273,9 +4162,9 @@
32734162 obj = (Object3D)e.nextElement();
32744163
32754164 System.out.println("Object is: " + obj);
3276
- GrafreeD.AnalyzeObject(obj);
4165
+ Grafreed.AnalyzeObject(obj);
32774166 System.out.println("Boundary rep: " + obj.bRep);
3278
- GrafreeD.AnalyzeObject(obj.bRep);
4167
+ Grafreed.AnalyzeObject(obj.bRep);
32794168
32804169 // System.err.println((size/1024) + " KB is the size of " + obj);
32814170 }
....@@ -3317,6 +4206,13 @@
33174206 void GenNormals(boolean crease)
33184207 {
33194208 group.GenNormalsS(crease);
4209
+
4210
+ refreshContents();
4211
+ }
4212
+
4213
+ void GenNormalsMESH()
4214
+ {
4215
+ group.GenNormalsMeshS();
33204216
33214217 refreshContents();
33224218 }
....@@ -3489,8 +4385,8 @@
34894385
34904386 void ParseVertices()
34914387 {
3492
- boolean epsequal = GrafreeD.epsequal;
3493
- GrafreeD.epsequal = true;
4388
+ boolean epsequal = Grafreed.epsequal;
4389
+ Grafreed.epsequal = true;
34944390
34954391 for (int i=0; i<group.selection.size(); i++)
34964392 {
....@@ -3515,7 +4411,7 @@
35154411 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35164412 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35174413
3518
- g.add(GrafreeD.clipboard);
4414
+ g.add(Grafreed.clipboard);
35194415
35204416 buffer.add(g);
35214417 }
....@@ -3530,7 +4426,7 @@
35304426 makeSomething(buffer, i==group.selection.size()-1);
35314427 }
35324428
3533
- GrafreeD.epsequal = epsequal;
4429
+ Grafreed.epsequal = epsequal;
35344430
35354431 refreshContents();
35364432 }
....@@ -3548,7 +4444,16 @@
35484444 String pigment = Object3D.GetPigment(tex);
35494445 //String bump = Object3D.GetBump(tex);
35504446
3551
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4447
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4448
+
4449
+ try
4450
+ {
4451
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4452
+ }
4453
+ catch (Exception e)
4454
+ {
4455
+ System.err.println("FAIL: " + node);
4456
+ }
35524457
35534458 double s = v.s;
35544459
....@@ -3636,11 +4541,11 @@
36364541
36374542 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36384543
3639
- boolean random = CameraPane.RANDOM;
3640
- CameraPane.RANDOM = false; // parse all random nodes
4544
+ boolean random = CameraPane.SWITCH;
4545
+ CameraPane.SWITCH = false; // parse all random nodes
36414546 lowres.linkVerticesThis(null);
36424547 lowres.linkVerticesThis(sn);
3643
- CameraPane.RANDOM = random;
4548
+ CameraPane.SWITCH = random;
36444549
36454550 System.err.flush();
36464551
....@@ -3680,7 +4585,7 @@
36804585 return;
36814586
36824587 Object3D poses = group.selection.get(0);
3683
- Object3D ref = GrafreeD.clipboard.get(0);
4588
+ Object3D ref = Grafreed.clipboard.get(0);
36844589
36854590 Object3D newgroup = new Object3D("Po:" + poses.name);
36864591
....@@ -3874,9 +4779,9 @@
38744779
38754780 void ClipMesh()
38764781 {
3877
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4782
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38784783 {
3879
- Object3D content = GrafreeD.clipboard.get(0);
4784
+ Object3D content = Grafreed.clipboard.get(0);
38804785
38814786 if (content instanceof cGroup && ((cGroup)content).transientlink )
38824787 content = ((cGroup)content).get(0);
....@@ -3885,7 +4790,7 @@
38854790 // {
38864791 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38874792 // }
3888
- group.selection.ClipMesh(GrafreeD.clipboard);
4793
+ group.selection.ClipMesh(Grafreed.clipboard);
38894794 }
38904795 // group.selection.ClipMesh(GrafreeD.clipboard);
38914796 System.out.println("DONE.");
....@@ -3932,6 +4837,18 @@
39324837 void MarkLeaves(boolean hide)
39334838 {
39344839 group.selection.MarkLeaves(hide);
4840
+ refreshContents();
4841
+ }
4842
+
4843
+ void RewindLeaves(boolean hide)
4844
+ {
4845
+ group.selection.RewindLeaves(hide);
4846
+ refreshContents();
4847
+ }
4848
+
4849
+ void RandomLeaves(boolean hide)
4850
+ {
4851
+ group.selection.RandomLeaves(hide);
39354852 refreshContents();
39364853 }
39374854
....@@ -4006,28 +4923,25 @@
40064923 // }
40074924 // }
40084925
4009
- static boolean allparams = true;
4010
-
4011
- static Vector<Object3D> listUI = new Vector<Object3D>();
4012
-
40134926 void EditSelection(boolean newWindow)
40144927 {
4928
+ if (group.selection == null)
4929
+ {
4930
+ EditElement(group, newWindow); // ? new
4931
+ return;
4932
+ }
4933
+
40154934 // aConstraints.gridy = 0;
40164935 for (int i=0; i<group.selection.size(); i++)
40174936 {
40184937 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40194938 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4020
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4939
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40214940
40224941 Object3D elem = (Object3D)group.selection.elementAt(i);
4023
- if(elem != group)
4942
+ if(elem != group || !newWindow)
40244943 {
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
4944
+ EditElement(elem, newWindow); // ? new
40314945 }
40324946 }
40334947 }
....@@ -4102,7 +5016,8 @@
41025016 //new Exception().printStackTrace();
41035017
41045018 freezemodel = true;
4105
-
5019
+ ClearUnpinned();
5020
+
41065021 /**/
41075022 //switch (event.id)
41085023 {
....@@ -4110,7 +5025,6 @@
41105025 //case 702: // Event.LIST_DESELECT
41115026 group.deselectAll();
41125027 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4113
- objEditor.ClearInfo(); // .GetMaterial());
41145028 if (tps != null)
41155029 {
41165030 for (int i=0; i < tps.length; i++)
....@@ -4119,33 +5033,39 @@
41195033
41205034 //if (child.parent != null)
41215035 //child.parent.addSelectee(child);
5036
+ objEditor.SetMaterial(child);
41225037 group.addSelectee(child);
4123
- objEditor.SetMaterial(child); // .GetMaterial());
4124
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4125
- System.err.println("info : " + child.GetPath());
41265038 }
41275039 }
4128
- else
4129
- {
4130
- objEditor.SetMaterial(group); // .GetMaterial());
4131
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4132
- System.err.println("info : " + group.GetPath());
4133
- }
5040
+// else
5041
+// {
5042
+// objEditor.SetMaterial(group); // .GetMaterial());
5043
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5044
+// System.err.println("info : " + group.GetPath());
5045
+// }
41345046
4135
- objEditor.SetText(); // jan 2014
4136
-
4137
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5047
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41385048 CameraPane.flash = true;
41395049
4140
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5050
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41415051 // a camera
41425052 {
4143
- CameraPane.camerachangeframe = 0; // don't refuse it
4144
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5053
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5054
+ {
5055
+ CameraPane.camerachangeframe = 0; // don't refuse it
5056
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5057
+ }
41455058 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41465059 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41475060 }
41485061
5062
+ if (tps != null && tps.length == 1)
5063
+ {
5064
+ EditSelection(false);
5065
+ }
5066
+
5067
+ SetPinStates(tps != null && tps.length > 0);
5068
+
41495069 refreshContents();
41505070 //return true;
41515071 }
....@@ -4154,6 +5074,35 @@
41545074
41555075 freezemodel = false;
41565076 }
5077
+
5078
+ void SetPinStates(boolean enabled)
5079
+ {
5080
+ editButton.setEnabled(enabled);
5081
+ uneditButton.setEnabled(enabled);
5082
+ unselectButton.setEnabled(enabled);
5083
+ flashSelectionButton.setEnabled(enabled);
5084
+ }
5085
+
5086
+ void refreshContents(boolean cp)
5087
+ {
5088
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5089
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5090
+ {
5091
+ objEditor.ClearInfo(); // .GetMaterial());
5092
+
5093
+ for (int i=0; i < group.selection.Size(); i++)
5094
+ {
5095
+ Object3D child = (Object3D) group.selection.get(i);
5096
+
5097
+ objEditor.AddInfo(child, this, true);
5098
+ System.err.println("info : " + child.GetPath());
5099
+ }
5100
+
5101
+ objEditor.SetText(); // jan 2014
5102
+ }
5103
+
5104
+ super.refreshContents(cp);
5105
+ }
41575106
41585107 void linkSomething(Object3D thing)
41595108 {
....@@ -4225,16 +5174,19 @@
42255174 {
42265175 if (group.selection.isEmpty())
42275176 return;
4228
- GrafreeD.clipboardIsTempGroup = false;
5177
+
5178
+ Grafreed.clipboardIsTempGroup = false;
42295179 Composite tGroup = null;
42305180 if (group.selection.size() > 0) // 1)
42315181 {
42325182 tGroup = new cGroup();
4233
- GrafreeD.clipboardIsTempGroup = true;
5183
+ Grafreed.clipboardIsTempGroup = true;
42345184 }
42355185
42365186 if (cut)
42375187 {
5188
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5189
+// Save();
42385190 //int indices[] = jList.getSelectedIndices();
42395191 //for (int i = indices.length - 1; i >= 0; i--)
42405192 //jList.remove(indices[i]);
....@@ -4270,16 +5222,16 @@
42705222 //System.out.println("cut " + child);
42715223 //System.out.println("parent = " + child.parent);
42725224 // tmp.addChild(child);
4273
- if (GrafreeD.clipboardIsTempGroup)
5225
+ if (Grafreed.clipboardIsTempGroup)
42745226 tGroup.add/*Child*/(tmp);
42755227 else
4276
- GrafreeD.clipboard = tmp;
5228
+ Grafreed.clipboard = tmp;
42775229 }
42785230 else
4279
- if (GrafreeD.clipboardIsTempGroup)
5231
+ if (Grafreed.clipboardIsTempGroup)
42805232 tGroup.add/*Child*/(child);
42815233 else
4282
- GrafreeD.clipboard = child;
5234
+ Grafreed.clipboard = child;
42835235 }
42845236
42855237 //ResetModel();
....@@ -4311,21 +5263,23 @@
43115263 //System.out.println("cut " + elem);
43125264 //System.out.println("parent = " + elem.parent);
43135265 // tmp.addChild(elem);
4314
- if (GrafreeD.clipboardIsTempGroup)
5266
+ if (Grafreed.clipboardIsTempGroup)
43155267 tGroup.add/*Child*/(tmp);
43165268 else
4317
- GrafreeD.clipboard = tmp;
5269
+ Grafreed.clipboard = tmp;
43185270 }
43195271 else
4320
- if (GrafreeD.clipboardIsTempGroup)
5272
+ if (Grafreed.clipboardIsTempGroup)
43215273 tGroup.add/*Child*/(child);
43225274 else
4323
- GrafreeD.clipboard = child;
5275
+ Grafreed.clipboard = child;
43245276 }
43255277
43265278 }
4327
- if (GrafreeD.clipboardIsTempGroup)
4328
- GrafreeD.clipboard = tGroup;
5279
+
5280
+ if (Grafreed.clipboardIsTempGroup)
5281
+ Grafreed.clipboard = tGroup;
5282
+
43295283 if (cut)
43305284 {
43315285 ResetModel();
....@@ -4335,11 +5289,15 @@
43355289
43365290 void paste(boolean expand)
43375291 {
5292
+ if (Globals.REPLACEONMAKE)
5293
+ Save();
5294
+ boolean keep = Globals.REPLACEONMAKE;
5295
+ Globals.REPLACEONMAKE = false;
43385296 // if (GrafreeD.clipboard == null)
43395297 // return;
43405298 boolean first = true;
43415299
4342
- if (GrafreeD.clipboardIsTempGroup)
5300
+ if (Grafreed.clipboardIsTempGroup)
43435301 {
43445302 Composite temp;
43455303
....@@ -4350,7 +5308,7 @@
43505308 temp = (Composite)Applet3D.clipboard.deepCopy();
43515309 */
43525310 Object3D elem;
4353
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5311
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43545312 {
43555313 Object3D child = (Object3D)e.nextElement();
43565314
....@@ -4384,21 +5342,22 @@
43845342 //Object3D cb = Applet3D.clipboard;
43855343 //temp.addChild(cb);
43865344 //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());
5345
+ assert(Grafreed.clipboard.parent == null);
5346
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5347
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5348
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5349
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43925350 else
4393
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4394
- GrafreeD.clipboard.get(0).parent = keepparent;
5351
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5352
+ Grafreed.clipboard.get(0).parent = keepparent;
43955353 }
43965354
5355
+ Globals.REPLACEONMAKE = keep;
43975356 ResetModel();
43985357 refreshContents();
43995358 }
44005359
4401
- void pasteInto(boolean copyit)
5360
+ void pasteInto(boolean copyit, boolean clone)
44025361 {
44035362 // if (GrafreeD.clipboard == null)
44045363 // return;
....@@ -4427,15 +5386,22 @@
44275386 if (copyit)
44285387 {
44295388 // paste(false);
4430
- CloneClipboard(false); // sept 2014
5389
+ if (clone)
5390
+ {
5391
+ CloneClipboard(false); // sept 2014
5392
+ }
5393
+ else
5394
+ {
5395
+ paste(false);
5396
+ }
44315397 }
44325398 else
44335399 {
44345400 boolean first = true;
44355401
4436
- if (GrafreeD.clipboardIsTempGroup)
5402
+ if (Grafreed.clipboardIsTempGroup)
44375403 {
4438
- Composite temp = (Composite)GrafreeD.clipboard;
5404
+ Composite temp = (Composite)Grafreed.clipboard;
44395405 Object3D copy;
44405406 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44415407 {
....@@ -4445,7 +5411,7 @@
44455411 }
44465412 } else
44475413 {
4448
- linkSomething(GrafreeD.clipboard); //.get(0));
5414
+ linkSomething(Grafreed.clipboard); //.get(0));
44495415 }
44505416 }
44515417 }
....@@ -4522,6 +5488,10 @@
45225488
45235489 void group(Object3D csg, boolean grab)
45245490 {
5491
+ if (Globals.REPLACEONMAKE)
5492
+ Save();
5493
+ boolean keep = Globals.REPLACEONMAKE;
5494
+ Globals.REPLACEONMAKE = false;
45255495 if (//false) // why??
45265496 !group.selection.isEmpty())
45275497 {
....@@ -4635,10 +5605,15 @@
46355605 //node.add(csg);
46365606 //makeSomething(node);
46375607 makeSomething(csg);
5608
+ Globals.REPLACEONMAKE = keep;
46385609 }
46395610
46405611 void Ungroup(Object3D g)
46415612 {
5613
+ if (Globals.REPLACEONMAKE)
5614
+ Save();
5615
+ boolean keep = Globals.REPLACEONMAKE;
5616
+ Globals.REPLACEONMAKE = false;
46425617 if (g instanceof HiddenObject)
46435618 {
46445619 HiddenObject h = (HiddenObject) g;
....@@ -4655,6 +5630,7 @@
46555630 objEditor.makeSomething(g.get(i), false);
46565631 }
46575632 }
5633
+ Globals.REPLACEONMAKE = keep;
46585634 }
46595635
46605636 void ungroup()
....@@ -4850,21 +5826,6 @@
48505826 }
48515827 */
48525828
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
-
48685829 /*
48695830 public void Callback(Object obj)
48705831 {
....@@ -4888,26 +5849,9 @@
48885849 }
48895850 */
48905851
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
-
49085852 String GetFile(String dialogName)
49095853 {
4910
- if (GrafreeD.standAlone)
5854
+ if (Grafreed.standAlone)
49115855 {
49125856 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49135857 browser.show();
....@@ -4971,10 +5915,49 @@
49715915 cButton flashSelectionButton;
49725916 cButton editButton;
49735917 cButton uneditButton;
5918
+ JCheckBox allParamsButton;
49745919 cButton clearpanelButton;
4975
- cButton allParamsButton;
49765920 cButton unselectButton;
49775921
5922
+ cButton restoreCameraButton;
5923
+
5924
+ cButton saveButton;
5925
+ cButton oneStepButton;
5926
+
5927
+ cButton groupButton;
5928
+ cButton ungroupButton;
5929
+ cButton compositeButton;
5930
+ cButton switchButton;
5931
+ cButton loopButton;
5932
+ cButton textureButton;
5933
+
5934
+ cButton skybox1Button;
5935
+ cButton skybox2Button;
5936
+ cButton skybox3Button;
5937
+ cButton skybox4Button;
5938
+ cButton skybox5Button;
5939
+ cButton skybox6Button;
5940
+ cButton skybox7Button;
5941
+
5942
+ cButton skybox11Button;
5943
+ cButton skybox12Button;
5944
+ cButton skybox13Button;
5945
+ cButton skybox14Button;
5946
+ cButton skybox15Button;
5947
+ cButton skybox16Button;
5948
+ cButton skybox17Button;
5949
+
5950
+ cButton gridButton;
5951
+ cButton boxButton;
5952
+ cButton sphereButton;
5953
+ cButton coneButton;
5954
+ cButton torusButton;
5955
+ cButton superButton;
5956
+ cButton kleinButton;
5957
+ cButton particlesButton;
5958
+ cButton overlayButton;
5959
+ cButton lightButton;
5960
+
49785961 cButton screenfitButton;
49795962 cButton screenfitpointButton;
49805963 cButton snapobjectButton;
....@@ -4986,14 +5969,6 @@
49865969
49875970 cButton setsupportButton;
49885971
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
-
49975972 //
49985973 //Composite
49995974 Object3D // to do !!
....@@ -5003,9 +5978,11 @@
50035978 //JTree jTree;
50045979 private MenuItem lookAtItem;
50055980 private MenuItem lookFromItem;
5006
- private MenuItem switchItem;
5981
+ private MenuItem switchViewItem;
50075982 private MenuItem cutItem;
5008
- private MenuItem duplicateItem;
5983
+ private MenuItem undoItem;
5984
+ private MenuItem redoItem;
5985
+ private JMenuItem duplicateItem;
50095986 private MenuItem cloneItem;
50105987 private MenuItem cloneSupportItem;
50115988 private MenuItem overwriteGeoItem;
....@@ -5018,7 +5995,7 @@
50185995 private MenuItem linkverticesItem;
50195996 private MenuItem relinkverticesItem;
50205997 private MenuItem setMasterItem;
5021
- private MenuItem resetMeshItem;
5998
+ private MenuItem resetAllItem;
50225999 private MenuItem stepAllItem;
50236000 private MenuItem revertMeshItem;
50246001 private MenuItem poseMeshItem;
....@@ -5029,10 +6006,11 @@
50296006 private MenuItem mergeGeometriesItem;
50306007 private MenuItem copyItem;
50316008 private MenuItem pasteItem;
6009
+ private MenuItem pasteIntoItem;
50326010 private MenuItem pasteLinkItem;
50336011 private MenuItem pasteCloneItem;
50346012 private MenuItem pasteExpandItem;
5035
- private MenuItem clearItem;
6013
+ private MenuItem deleteItem;
50366014 private MenuItem clearAllItem;
50376015 private MenuItem genUVItem;
50386016 private MenuItem genNormalsMESHItem;
....@@ -5067,6 +6045,10 @@
50676045 private MenuItem showleavesItem;
50686046 private MenuItem markleavesItem;
50696047 private MenuItem unmarkleavesItem;
6048
+ private MenuItem rewindleavesItem;
6049
+ private MenuItem unrewindleavesItem;
6050
+ private MenuItem randomleavesItem;
6051
+ private MenuItem unrandomleavesItem;
50706052
50716053 private MenuItem flipVItem;
50726054 private MenuItem unflipVItem;
....@@ -5078,15 +6060,17 @@
50786060 private MenuItem panoTexturesItem;
50796061
50806062 private MenuItem resetCentroidItem;
5081
- private MenuItem transformgeometryItem;
6063
+ private MenuItem resetCentroidXZItem;
50826064 private MenuItem resetTransformItem;
6065
+ private MenuItem transformGeometryItem;
6066
+ private MenuItem transformChildrenItem;
50836067 private MenuItem hideItem;
50846068 private MenuItem grabItem;
50856069 private MenuItem backItem;
50866070 private MenuItem frontItem;
50876071 private MenuItem cameraItem;
50886072 private MenuItem compositeItem;
5089
- private MenuItem randomItem;
6073
+ private MenuItem switchItem;
50906074 private MenuItem physicsItem;
50916075 private MenuItem frameselectorItem;
50926076 private MenuItem scriptNodeItem;
....@@ -5110,6 +6094,8 @@
51106094 private MenuItem attachBumpItem;
51116095 private MenuItem detachBumpItem;
51126096 private MenuItem pigmentBumpItem;
6097
+ private MenuItem embedTexturesItem;
6098
+ private MenuItem deEmbedTexturesItem;
51136099
51146100 private MenuItem particleItem;
51156101 private MenuItem ragdollItem;
....@@ -5126,7 +6112,7 @@
51266112 private MenuItem blobItem;
51276113 private MenuItem latheItem;
51286114 private MenuItem bezierItem;
5129
- private MenuItem checkerItem;
6115
+ private MenuItem overlayItem;
51306116 private MenuItem meshItem;
51316117 // private MenuItem meshGroupItem;
51326118 private MenuItem springItem;
....@@ -5148,11 +6134,6 @@
51486134 private MenuItem doubleItem;
51496135 private MenuItem tripleItem;
51506136
5151
- private MenuItem importGFDItem;
5152
- private MenuItem importVRMLX3DItem;
5153
- private MenuItem import3DSItem;
5154
- private MenuItem importOBJItem;
5155
-
51566137 private MenuItem computeAOItem;
51576138 private MenuItem recompileItem;
51586139 private MenuItem editScriptItem;
....@@ -5162,4 +6143,8 @@
51626143 private MenuItem analyzeItem;
51636144 private MenuItem dumpItem;
51646145 //boolean freezemodel = false;
6146
+
6147
+ Menu cameraMenu;
6148
+ MenuItem editCameraItem;
6149
+ MenuItem restoreCameraItem;
51656150 }