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,6 +343,7 @@
94343
95344 makeSomething(clone, i==group.selection.size()-1);
96345 }
346
+ Globals.REPLACEONMAKE = keep;
97347 }
98348
99349 void CloneClipboard(boolean supports)
....@@ -148,28 +398,21 @@
148398
149399 //JTextField nameField;
150400
151
- void SetupMenu2(ObjEditor oe)
401
+ void SetupMenu2(GroupEditor oe)
152402 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
403
+ oe.jTree = new cTree();
404
+
168405 Menu menu;
169406 oe.menuBar.add(menu = new Menu("Edit"));
170407 //editItem = menu.add(new MenuItem("Edit"));
171408 //editItem.addActionListener(this);
172
- 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"));
173416 duplicateItem.addActionListener(this);
174417 cloneItem = menu.add(new MenuItem("Clone"));
175418 cloneItem.addActionListener(this);
....@@ -185,7 +428,6 @@
185428 copyItem.addActionListener(this);
186429 pasteItem = menu.add(new MenuItem("Paste"));
187430 pasteItem.addActionListener(this);
188
- menu.add("-");
189431
190432 menu.add("-");
191433 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,8 +439,8 @@
197439 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
198440 // pasteExpandItem.addActionListener(this);
199441 menu.add("-");
200
- clearItem = menu.add(new MenuItem("Clear"));
201
- clearItem.addActionListener(this);
442
+ deleteItem = menu.add(new MenuItem("Delete"));
443
+ deleteItem.addActionListener(this);
202444
203445 if (Globals.ADVANCED)
204446 {
....@@ -206,14 +448,97 @@
206448 clearAllItem = menu.add(new MenuItem("Clear All"));
207449 clearAllItem.addActionListener(this);
208450 }
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());
209487
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
+
210539 oe.menuBar.add(menu = new Menu("Setting"));
211540 if (Globals.ADVANCED)
212541 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217542 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218543 revertMeshItem.addActionListener(this);
219544 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +578,29 @@
253578 }
254579
255580 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
581
+// grabItem = menu.add(new MenuItem("Grab"));
582
+// grabItem.addActionListener(this);
258583 backItem = menu.add(new MenuItem("Back"));
259584 backItem.addActionListener(this);
260585 frontItem = menu.add(new MenuItem("Front"));
261586 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
587
+// compositeItem = menu.add(new MenuItem("Composite"));
588
+// compositeItem.addActionListener(this);
589
+
590
+ if (Globals.ADVANCED)
591
+ {
264592 hideItem = menu.add(new MenuItem("Hidden Group"));
265593 hideItem.addActionListener(this);
594
+ }
266595 ungroupItem = menu.add(new MenuItem("Ungroup"));
267596 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- randomItem.addActionListener(this);
597
+
598
+// menu.add("-");
599
+//
600
+// switchItem = menu.add(new MenuItem("Switch node"));
601
+// switchItem.addActionListener(this);
602
+ if (Globals.ADVANCED)
603
+ {
271604 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272605 switchGeoItem.addActionListener(this);
273606 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +608,6 @@
275608 morphItem = menu.add(new MenuItem("Morph Group"));
276609 morphItem.addActionListener(this);
277610
278
- if (Globals.ADVANCED)
279
- {
280611 menu.add("-");
281612 physicsItem = menu.add(new MenuItem("Physics"));
282613 physicsItem.addActionListener(this);
....@@ -284,30 +615,29 @@
284615 frameselectorItem.addActionListener(this);
285616 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286617 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289618 }
290619
291620 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
621
+// textureItem = menu.add(new MenuItem("Texture"));
622
+// textureItem.addActionListener(this);
294623 billboardItem = menu.add(new MenuItem("Billboard"));
295624 billboardItem.addActionListener(this);
296625 csgItem = menu.add(new MenuItem("CSG"));
297626 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
627
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299628 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
629
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301630 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
631
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303632 shadowZItem.addActionListener(this);
633
+ attributeItem = menu.add(new MenuItem("Attribute"));
634
+ attributeItem.addActionListener(this);
635
+
304636 if (Globals.ADVANCED)
305637 {
306638 menu.add("-");
307639 linkerItem = menu.add(new MenuItem("Linker"));
308640 linkerItem.addActionListener(this);
309
- attributeItem = menu.add(new MenuItem("Attribute"));
310
- attributeItem.addActionListener(this);
311641 templateItem = menu.add(new MenuItem("Template"));
312642 templateItem.addActionListener(this);
313643 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -336,7 +666,7 @@
336666 genNormalsMESHItem.addActionListener(this);
337667 if (Globals.ADVANCED)
338668 {
339
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
669
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
340670 genNormalsMINEItem.addActionListener(this);
341671 }
342672 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -372,6 +702,10 @@
372702 oe.menuBar.add(menu = new Menu("Attributes"));
373703 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
374704 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);
375709 menu.add("-");
376710 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
377711 liveleavesItem.addActionListener(this);
....@@ -392,6 +726,14 @@
392726 markleavesItem.addActionListener(this);
393727 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394728 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);
395737 menu.add("-");
396738 flipVItem = menu.add(new MenuItem("Flip V"));
397739 flipVItem.addActionListener(this);
....@@ -417,10 +759,15 @@
417759 attachBumpItem.addActionListener(this);
418760 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
419761 pigmentBumpItem.addActionListener(this);
762
+ //embedTexturesItem
420763 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
421764 detachPigmentItem.addActionListener(this);
422765 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
423766 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);
424771 menu.add("-");
425772 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
426773 sortbysizeItem.addActionListener(this);
....@@ -443,25 +790,25 @@
443790 oe.menuBar.add(menu = new Menu("Insert"));
444791 buildCreateMenu(menu);
445792
446
- oe.menuBar.add(menu = new Menu("Include"));
447
- importOBJItem = menu.add(new MenuItem("OBJ file..."));
448
- importOBJItem.addActionListener(this);
449
- menu.add("-");
450
- import3DSItem = menu.add(new MenuItem("3DS file..."));
451
- import3DSItem.addActionListener(this);
452
- menu.add("-");
453
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
454
- importVRMLX3DItem.addActionListener(this);
455
- menu.add("-");
456
- importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
457
- importGFDItem.addActionListener(this);
458
-
459793 oe.menuBar.add(menu = new Menu("Tools"));
460794 buildToolsMenu(menu);
461795 }
462796
797
+
463798 void SetupUI2(ObjEditor oe)
464799 {
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
+
465812 //new Exception().printStackTrace();
466813
467814 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +837,79 @@
490837 oe.radioPanel.add(dummyButton);
491838 oe.buttonGroup.add(dummyButton);
492839 */
840
+ cGridBag copyOptionsPanel = new cGridBag();
841
+
842
+ copyOptionsPanel.preferredHeight = 2;
843
+
493844 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494845
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
496
- liveCB.setToolTipText("Enabled animation");
846
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
847
+ //minButton.setToolTipText("Minimize window");
848
+ //minButton.addActionListener(this);
849
+
850
+ if (Globals.ADVANCED)
851
+ {
852
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
853
+ maxButton.setToolTipText("Maximize window");
854
+ maxButton.addActionListener(this);
855
+ }
856
+
857
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
858
+ fullButton.setToolTipText("Full-screen window");
859
+ fullButton.addActionListener(this);
860
+
861
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
862
+ screenfitButton.setToolTipText("Screen fit");
863
+ screenfitButton.addActionListener(this);
864
+
865
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
866
+ restoreCameraButton.setToolTipText("Restore viewpoint");
867
+ restoreCameraButton.addActionListener(this);
868
+
869
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
870
+ saveButton.setToolTipText("New version");
871
+ saveButton.addActionListener(this);
872
+
873
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
874
+ undoButton.setToolTipText("Previous version");
875
+ undoButton.addActionListener(this);
876
+ undoButton.setEnabled(false);
877
+
878
+ cGridBag updown = new cGridBag().setVertical(true);
879
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
880
+ restoreButton.setToolTipText("Restore current");
881
+ restoreButton.addActionListener(this);
882
+ restoreButton.setEnabled(false);
883
+
884
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
885
+ replaceButton.setToolTipText("Replace current");
886
+ replaceButton.addActionListener(this);
887
+ replaceButton.setEnabled(false);
888
+
889
+ copyOptionsPanel.add(updown);
890
+
891
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
892
+ redoButton.setToolTipText("Next version");
893
+ redoButton.addActionListener(this);
894
+ redoButton.setEnabled(false);
895
+
896
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
897
+ liveCB.setToolTipText("Enable animation");
497898 liveCB.addItemListener(this);
498899
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
900
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500901 oneStepButton.setToolTipText("Animate one step forward");
501902 oneStepButton.addActionListener(this);
502903
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
904
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504905 fastCB.setToolTipText("Fast mode");
505906 fastCB.addItemListener(this);
506907
507
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
508
- trackCB.setToolTipText("Enable tracking");
509
- trackCB.addItemListener(this);
510
-
511
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512
- screenfitButton.setToolTipText("Screen fit");
513
- screenfitButton.addActionListener(this);
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);
514913
515914 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516915 // screenfitpointButton.addActionListener(this);
....@@ -520,67 +919,155 @@
520919 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521920 snapobjectButton.addActionListener(this);
522921 snapobjectButton.setToolTipText("Snap Object");
922
+
923
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
924
+ fourButton.addActionListener(this);
925
+ fourButton.setToolTipText("Show control panel only");
523926 }
524927
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
928
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528929
529
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
-
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532
- twoButton.setToolTipText("Show center view only");
930
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ twoButton.setToolTipText("Show 3D view only");
533932 twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535
- fourButton.addActionListener(this);
536
- fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538
- sixButton.setToolTipText("2-column layout left");
539
- sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541
- threeButton.setToolTipText("2-column layout right");
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");
542937 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544
- sevenButton.setToolTipText("3-column layout");
545
- 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);
546944 //
547945
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549
- rootButton.setToolTipText("Edit selection in new tab");
946
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
947
+ rootButton.setToolTipText("Open selection in new tab");
550948 rootButton.addActionListener(this);
551949
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
553951 closeButton.setToolTipText("Close tab");
554952 closeButton.addActionListener(this);
555953 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
556954 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
955
+
956
+ cGridBag row1 = new cGridBag();
559957
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- editButton.setToolTipText("Edit selection");
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");
5621044 editButton.addActionListener(this);
5631045
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
1046
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1047
+ uneditButton.setToolTipText("Remove selection controls");
5661048 uneditButton.addActionListener(this);
5671049
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
1050
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1051
+ allParamsButton.setToolTipText("Show all controle");
5701052 allParamsButton.addActionListener(this);
5711053
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5731055 clearPanelButton.setToolTipText("Clear edit panel");
5741056 clearPanelButton.addActionListener(this);
5751057
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5771059 unselectButton.setToolTipText("Unselect");
5781060 unselectButton.addActionListener(this);
5791061
580
- commandsPanel.preferredHeight = 1;
1062
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1063
+ flashSelectionButton.setToolTipText("Highlight selection");
1064
+ flashSelectionButton.addActionListener(this);
5811065
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
1066
+ editCommandsPanel.preferredHeight = 1;
1067
+
1068
+ SetPinStates(false);
1069
+// oe.treePanel.add(commandsPanel);
1070
+// oe.treePanel.Return();
5841071
5851072 // oe.aConstraints.gridx += 1;
5861073 // oe.aConstraints.weighty = 0;
....@@ -597,32 +1084,20 @@
5971084
5981085 JScrollPane jSP;
5991086 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1087
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6011088 ResetModel();
6021089
6031090 oe.treePanel.add(jSPPanel);
6041091 oe.treePanel.Return();
6051092
606
- cGridBag copyOptionsPanel = new cGridBag();
607
-
608
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
609
- colorCB.setToolTipText("Copy color when dropped");
610
- colorCB.addItemListener(this);
611
-
612
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
613
- materialCB.setToolTipText("Copy material when dropped");
614
- materialCB.addItemListener(this);
615
-
616
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
617
- textureCB.setToolTipText("Copy texture when dropped");
618
- textureCB.addItemListener(this);
619
-
620
- copyOptionsPanel.preferredHeight = 1;
6211093 oe.treePanel.add(copyOptionsPanel);
6221094 oe.treePanel.Return();
1095
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1096
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1097
+ sliderPane.preferredHeight = 1;
6231098
624
-// mainPanel.setDividerLocation(0.5); //1.0);
625
-// mainPanel.setResizeWeight(0.5);
1099
+// mainPanel.setDividerLocation(0.1); //1.0);
1100
+ mainPanel.setResizeWeight(0.4);
6261101
6271102 //jList.addListSelectionListener(this);
6281103 oe.jTree.addTreeSelectionListener(this);
....@@ -630,7 +1105,7 @@
6301105 //jTree.setEditable(true);
6311106 oe.jTree.setDragEnabled(true);
6321107 //jTree.setPreferredSize(new Dimension(10,10));
633
- jSP.setPreferredSize(new Dimension(100,200));
1108
+ //jSP.setPreferredSize(new Dimension(100,200));
6341109
6351110 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6361111
....@@ -642,29 +1117,49 @@
6421117 dgr.addDragGestureListener(this);
6431118 }catch(Exception e) {}
6441119 */
645
- radio.layout = sevenButton;
1120
+ radio.layout = sixButton; // sevenButton;
6461121 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6471122 }
6481123
6491124 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6501125 {
1126
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1127
+ colorCB.setToolTipText("Copy color when dropped");
1128
+ colorCB.addItemListener(this);
1129
+
1130
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1131
+ materialCB.setToolTipText("Copy material when dropped");
1132
+ materialCB.addItemListener(this);
1133
+
1134
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1135
+ textureCB.setToolTipText("Copy texture when dropped");
1136
+ textureCB.addItemListener(this);
1137
+
1138
+ panel.Return();
1139
+
6511140 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
6521141 boxCB.setToolTipText("Display bounding boxes");
6531142 boxCB.addItemListener(this);
6541143
6551144 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1145
+ zoomBoxCB.setToolTipText("Display only for wheel");
6571146 zoomBoxCB.addItemListener(this);
6581147
6591148 if (true) // Globals.ADVANCED)
6601149 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- supportCB.addItemListener(this);
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);
6641157
6651158 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6661159 // localCB.addItemListener(this);
6671160
1161
+ panel.Return();
1162
+
6681163 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6691164 crowdCB.setToolTipText("Used for crowds");
6701165 crowdCB.addItemListener(this);
....@@ -681,6 +1176,8 @@
6811176 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6821177 // speakerMocapCB.addItemListener(this);
6831178
1179
+ panel.Return();
1180
+
6841181 if (false)
6851182 {
6861183 // handled in scripts
....@@ -695,42 +1192,85 @@
6951192 //constraints.gridy += 1;
6961193 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6971194 smoothfocusCB.addItemListener(this);
1195
+ panel.Return();
6981196 }
6991197
7001198 //constraints.gridx += 1;
7011199 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7021200 // debugCB.addItemListener(this);
7031201
1202
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1203
+ trackCB.setToolTipText("Enable tracking target");
1204
+ trackCB.addItemListener(this);
1205
+
7041206 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1207
+ oeilCB.setToolTipText("Move camera when tracking");
7051208 oeilCB.addItemListener(this);
7061209
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
+ {
7071230 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7081231 lookAtCB.setToolTipText("Look-at target");
7091232 lookAtCB.addItemListener(this);
1233
+ }
7101234
7111235 }
7121236
7131237 cGridBag fill = new cGridBag();
714
-
7151238 fill.preferredHeight = 200;
1239
+ cGridBag fill2 = new cGridBag();
1240
+ fill2.preferredHeight = 200;
1241
+ cGridBag fill3 = new cGridBag();
1242
+ fill3.preferredHeight = 200;
7161243
7171244 panel.add(fill);
1245
+ panel.add(fill2);
1246
+ panel.add(fill3);
7181247
7191248 }
7201249
7211250 void EditObject(Object3D obj)
7221251 {
7231252 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
+
7241261 radioButton.SetObject(obj);
725
- radioButton.layout = sevenButton;
1262
+ radioButton.layout = sixButton; // sevenButton;
7261263 radioButton.SetCamera(cameraView.renderCamera, false);
7271264 radioButton.addActionListener(this);
7281265 radioPanel.add(radioButton);
7291266 buttonGroup.add(radioButton);
7301267 radioButton.doClick();
7311268 }
1269
+
7321270 void SetupViews(ObjEditor oe)
7331271 {
1272
+ theFrame = this;
1273
+
7341274 oe.SetupViews();
7351275
7361276 System.out.println("SetupViews");
....@@ -739,23 +1279,28 @@
7391279 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7401280 }
7411281
742
- JCheckBox liveCB;
743
- JCheckBox supportCB;
744
- JCheckBox localCB;
745
- JCheckBox crowdCB;
746
- JCheckBox smoothCB;
747
- JCheckBox fastCB;
748
- JCheckBox slowCB;
749
- JCheckBox boxCB;
750
- JCheckBox zoomBoxCB;
751
- JCheckBox trackCB;
752
- 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;
7531295 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
1296
+ cCheckBox speakerCameraCB;
1297
+ cCheckBox speakerFocusCB;
1298
+ cCheckBox debugCB;
1299
+
1300
+ cCheckBox oeilCB;
1301
+ cCheckBox shadowCB;
1302
+ cCheckBox autokeepCB;
1303
+ cCheckBox lookAtCB;
7591304
7601305 // static int COLOR = 1;
7611306 // static int MATERIAL = 2;
....@@ -763,9 +1308,9 @@
7631308
7641309 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7651310
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
1311
+ cCheckBox colorCB;
1312
+ cCheckBox materialCB;
1313
+ cCheckBox textureCB;
7691314
7701315 public void itemStateChanged(ItemEvent e)
7711316 {
....@@ -793,6 +1338,7 @@
7931338 } else if(e.getSource() == liveCB)
7941339 {
7951340 cameraView.ToggleLive();
1341
+ refreshContents(false);
7961342 }
7971343 else if(e.getSource() == supportCB)
7981344 {
....@@ -857,6 +1403,18 @@
8571403 {
8581404 cameraView.ToggleOeil();
8591405 }
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
+ }
8601418 else if(e.getSource() == lookAtCB)
8611419 {
8621420 cameraView.ToggleLookAt();
....@@ -873,7 +1431,8 @@
8731431
8741432 /**/
8751433 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
876
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1434
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1435
+ TreePath path = objEditor.jTree.getSelectionPath();
8771436 if ((path == null) || (path.getPathCount() <= 1)) {
8781437 // We can't move the root node or an empty selection
8791438 return;
....@@ -936,8 +1495,6 @@
9361495 }
9371496 }
9381497
939
- String string = (String) object;
940
-
9411498 System.out.println("Transfer = " + object + "; drop : " + target);
9421499 // if( object instanceof java.io.File[])
9431500 // {
....@@ -945,6 +1502,8 @@
9451502 // objEditor.DropFile((java.io.File[]) object, true);
9461503 // return;
9471504 // }
1505
+
1506
+ String string = object.toString();
9481507
9491508 // File path for Mac and Windows
9501509 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -990,23 +1549,33 @@
9901549
9911550 assert target == objEditor.jTree;
9921551 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1552
+ Object3D destinationLeaf;
9931553 try {
994
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1554
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9951555 } catch (Exception e) {
9961556 System.out.println("destinationPath : " + destinationPath);
9971557 return;
9981558 }
9991559
1000
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1560
+ for (int i=group.selection.size(); --i>=0;)
10011561 {
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
+// {
10021571 loadClipboard(true);
10031572 objEditor.jTree.setSelectionPath(destinationPath);
10041573 pasteInto(false, false);
1005
- } else {
1006
- loadClipboard(false);
1007
- objEditor.jTree.setSelectionPath(destinationPath);
1008
- pasteInto(false, false); // true); // ???
1009
- }
1574
+// } else {
1575
+// loadClipboard(false);
1576
+// objEditor.jTree.setSelectionPath(destinationPath);
1577
+// pasteInto(false, false); // true); // ???
1578
+// }
10101579 }
10111580 public void dropActionChanged(DropTargetDragEvent dtde)
10121581 // Called if the user has modified the current drop gesture
....@@ -1111,22 +1680,30 @@
11111680 {
11121681 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11131682 //heightFieldItem.addActionListener(this);
1114
- gridItem = menu.add(new MenuItem("Grid"));
1115
- gridItem.addActionListener(this);
1116
- rectoidItem = menu.add(new MenuItem("Box"));
1117
- rectoidItem.addActionListener(this);
1118
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1119
- ellipsoidItem.addActionListener(this);
1120
- coneItem = menu.add(new MenuItem("Cone"));
1121
- coneItem.addActionListener(this);
1122
- torusItem = menu.add(new MenuItem("Torus"));
1123
- torusItem.addActionListener(this);
1124
- superItem = menu.add(new MenuItem("Superellipsoid"));
1125
- 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
+ {
11261701 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11271702 kleinItem.addActionListener(this);
1128
- particleItem = menu.add(new MenuItem("Particle system"));
1129
- particleItem.addActionListener(this);
1703
+ }
1704
+
1705
+// particleItem = menu.add(new MenuItem("Particle system"));
1706
+// particleItem.addActionListener(this);
11301707 if (Globals.ADVANCED)
11311708 {
11321709 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1152,15 +1729,15 @@
11521729 }
11531730 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11541731 bezierItem.addActionListener(this);
1155
- overlayItem = menu.add(new MenuItem("Overlay"));
1156
- overlayItem.addActionListener(this);
1157
- lightItem = menu.add(new MenuItem("Light"));
1158
- lightItem.addActionListener(this);
1732
+// overlayItem = menu.add(new MenuItem("Overlay"));
1733
+// overlayItem.addActionListener(this);
1734
+// lightItem = menu.add(new MenuItem("Light"));
1735
+// lightItem.addActionListener(this);
11591736 menu.add("-");
11601737 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11611738 //superLoopItem.addActionListener(this);
1162
- loopItem = menu.add(new MenuItem("Loop"));
1163
- loopItem.addActionListener(this);
1739
+// loopItem = menu.add(new MenuItem("Loop"));
1740
+// loopItem.addActionListener(this);
11641741 doubleItem = menu.add(new MenuItem("Fork"));
11651742 doubleItem.addActionListener(this);
11661743 if (Globals.ADVANCED)
....@@ -1176,6 +1753,9 @@
11761753 animationItem.addItemListener(this);
11771754 animationItem.setState(Globals.ANIMATION);
11781755
1756
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1757
+ archiveItem.addActionListener(this);
1758
+
11791759 menu.add("-");
11801760 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11811761 parseverticesItem.addActionListener(this);
....@@ -1188,6 +1768,8 @@
11881768 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11891769 reduce34MorphItem.addActionListener(this);
11901770 menu.add("-");
1771
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1772
+ memoryItem.addActionListener(this);
11911773 menu.add(computeAOItem = new MenuItem("Compute AO"));
11921774 computeAOItem.addActionListener(this);
11931775
....@@ -1196,11 +1778,9 @@
11961778 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11971779 mirrorItem.addActionListener(this);
11981780 menu.add("-");
1199
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1200
- memoryItem.addActionListener(this);
12011781 menu.add(analyzeItem = new MenuItem("Analyze"));
12021782 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1783
+ menu.add(dumpItem = new MenuItem("Print"));
12041784 dumpItem.addActionListener(this);
12051785 // menu.add(pathItem = new MenuItem("From-to path"));
12061786 // pathItem.addActionListener(this);
....@@ -1341,9 +1921,34 @@
13411921 shadow.material = new cMaterial(obj.material);
13421922 shadow.material.diffuse = 0.0001f;
13431923 shadow.material.specular = 0.0001f;
1924
+ //shadow.projectedVertices[1].x = 300;
13441925
13451926 makeSomething(shadow);
13461927 }
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
+ }
13471952
13481953 /**
13491954 * applyExample
....@@ -1588,7 +2193,7 @@
15882193 {
15892194 ScreenFit();
15902195 } else
1591
- if (source == switchItem)
2196
+ if (source == switchViewItem)
15922197 {
15932198 cVector v1 = new cVector();
15942199 cVector v2 = new cVector();
....@@ -1597,11 +2202,11 @@
15972202 objEditor.cameraView.renderCamera.setAim(v2, v1);
15982203 objEditor.cameraView.repaint();
15992204 } else
1600
- if (source == rectoidItem)
2205
+ if (source == rectoidItem || source == boxButton)
16012206 {
16022207 makeSomething(new Box());
16032208 } else
1604
- if (source == particleItem)
2209
+ if (source == particleItem || source == particlesButton)
16052210 {
16062211 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16072212 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1680,27 +2285,27 @@
16802285
16812286 makeSomething(obj);
16822287 } else
1683
- if (source == gridItem)
2288
+ if (source == gridItem || source == gridButton)
16842289 {
16852290 makeSomething(new Grid());
16862291 } else
1687
- if (source == ellipsoidItem)
2292
+ if (source == ellipsoidItem || source == sphereButton)
16882293 {
16892294 makeSomething(new Sphere());
16902295 } else
1691
- if (source == coneItem)
2296
+ if (source == coneItem || source == coneButton)
16922297 {
16932298 makeSomething(new Cone());
16942299 } else
1695
- if (source == torusItem)
2300
+ if (source == torusItem || source == torusButton)
16962301 {
16972302 makeSomething(new Torus());
16982303 } else
1699
- if (source == superItem)
2304
+ if (source == superItem || source == superButton)
17002305 {
17012306 makeSomething(new Superellipsoid());
17022307 } else
1703
- if (source == kleinItem)
2308
+ if (source == kleinItem || source == kleinButton)
17042309 {
17052310 makeSomething(new Klein());
17062311 } else
....@@ -1720,7 +2325,7 @@
17202325 {
17212326 makeSomething(new BezierSurface());
17222327 } else
1723
- if (source == overlayItem)
2328
+ if (source == overlayItem || source == overlayButton)
17242329 {
17252330 /*
17262331 Object3D obj = new BezierSurface(5,8);
....@@ -1768,10 +2373,27 @@
17682373 s.setup();
17692374 makeSomething(s);
17702375 } else
1771
- if (source == lightItem)
2376
+ if (source == lightItem || source == lightButton)
17722377 {
17732378 makeSomething(new Light());
17742379 } 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
17752397 if (source == csgItem)
17762398 {
17772399 group(new CSG());
....@@ -1818,30 +2440,30 @@
18182440
18192441 group(g);
18202442 } else
1821
- if (source == loopItem)
2443
+ if (source == loopItem || source == loopButton)
18222444 {
18232445 Composite csg = new GroupLeaf();
18242446 csg.count = 5;
18252447 group(csg);
1826
- Composite child = new cGroup();
2448
+ Composite child = new cGroup("Branch");
18272449 csg.addChild(child);
18282450 child.addChild(csg);
18292451 } else
18302452 if (source == doubleItem)
18312453 {
1832
- Composite csg = new GroupLeaf();
2454
+ Composite csg = new GroupLeaf("Fork");
18332455 csg.count = 5;
18342456 group(csg);
1835
- Composite child = new cGroup();
2457
+ Composite child = new cGroup("Branch A");
18362458 csg.addChild(child);
18372459 child.addChild(csg);
1838
- child = new cGroup();
2460
+ child = new cGroup("Branch B");
18392461 csg.addChild(child);
18402462 child.addChild(csg);
18412463 } else
18422464 if (source == tripleItem)
18432465 {
1844
- Composite csg = new GroupLeaf();
2466
+ Composite csg = new GroupLeaf("Trident");
18452467 csg.count = 4;
18462468 group(csg);
18472469 Composite child = new cGroup();
....@@ -1854,35 +2476,10 @@
18542476 csg.addChild(child);
18552477 child.addChild(csg);
18562478 } else
1857
-
1858
- if (source == importGFDItem)
1859
- {
1860
- ImportGFD();
1861
- } else
1862
- if (source == importVRMLX3DItem)
1863
- {
1864
- ImportVRMLX3D();
1865
- } else
1866
- if (source == import3DSItem)
1867
- {
1868
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1869
- } else
1870
- if (source == importOBJItem)
1871
- {
1872
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1874
- browser.setVisible(true);
1875
- String filename = browser.getFile();
1876
- if (filename != null && filename.length() > 0)
1877
- {
1878
- String fullname = browser.getDirectory() + filename;
1879
- makeSomething(ReadOBJ(fullname), true);
1880
- }
1881
- } else
18822479 if (source == computeAOItem)
18832480 {
18842481 Globals.drawMode = CameraPane.OCCLUSION;
1885
- Globals.theRenderer.repaint();
2482
+ cameraView.repaint();
18862483 } else
18872484 if (source == recompileItem)
18882485 {
....@@ -1916,6 +2513,46 @@
19162513 {
19172514 DumpObject();
19182515 } 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
19192556 if (source == oneStepButton)
19202557 {
19212558 Globals.ONESTEP = true;
....@@ -1923,17 +2560,14 @@
19232560 } else
19242561 if (source == screenfitButton)
19252562 {
1926
- //Reload(lastConverter, lastFilename, true);
19272563 ScreenFit();
19282564 } else
19292565 if (source == screenfitpointButton)
19302566 {
1931
- //Reload(lastConverter, lastFilename, true);
19322567 ScreenFitPoint();
19332568 } else
19342569 if (source == snapobjectButton)
19352570 {
1936
- //Reload(lastConverter, lastFilename, true);
19372571 SnapObject();
19382572 } else
19392573 // if (event.getSource() == recompileButton)
....@@ -1969,6 +2603,14 @@
19692603 if (source == cutItem || source == clearButton)
19702604 {
19712605 loadClipboard(true);
2606
+ } else
2607
+ if (source == undoItem)
2608
+ {
2609
+ Undo();
2610
+ } else
2611
+ if (source == redoItem)
2612
+ {
2613
+ Redo();
19722614 } else
19732615 if (source == duplicateItem)
19742616 {
....@@ -2281,7 +2923,7 @@
22812923 {
22822924 RevertMeshes();
22832925 } else
2284
- if (source == resetMeshItem)
2926
+ if (source == resetAllItem)
22852927 {
22862928 ResetAll();
22872929 } else
....@@ -2289,7 +2931,7 @@
22892931 {
22902932 StepAll();
22912933 } else
2292
- if (source == clearItem) // || event.getSource() == clearButton)
2934
+ if (source == deleteItem) // || event.getSource() == clearButton)
22932935 {
22942936 //int indices[] = jList.getSelectedIndices();
22952937 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2301,9 +2943,9 @@
23012943 {
23022944 ClearSelection(true);
23032945 } else
2304
- if (source == grabItem)
2946
+ if (source == grabItem || source == groupButton)
23052947 {
2306
- group(new cGroup(), true);
2948
+ group(new cGroup(), false); // true);
23072949 } else
23082950 if (source == hideItem)
23092951 {
....@@ -2321,11 +2963,11 @@
23212963 {
23222964 makeSomething(new Camera());
23232965 } else
2324
- if (source == compositeItem)
2966
+ if (source == compositeItem || source == compositeButton)
23252967 {
23262968 group(new Composite());
23272969 } else
2328
- if (source == randomItem)
2970
+ if (source == switchItem || source == switchButton)
23292971 {
23302972 RandomNode random = new RandomNode();
23312973 group(random);
....@@ -2427,7 +3069,7 @@
24273069 {
24283070 group(new cLinker());
24293071 } else
2430
- if (source == textureItem)
3072
+ if (source == textureItem || source == textureButton)
24313073 {
24323074 group(new TextureNode());
24333075 } else
....@@ -2447,17 +3089,30 @@
24473089 {
24483090 CastShadow(2);
24493091 } else
2450
- if (source == ungroupItem)
3092
+ if (source == ungroupItem || source == ungroupButton)
24513093 {
2452
- //ungroup();
3094
+ boolean hasRoot = false;
3095
+
24533096 for (int i=0; i<group.selection.size(); i++)
24543097 {
2455
- Ungroup(group.selection.get(i));
3098
+ if (group.selection.get(i) == group)
3099
+ {
3100
+ hasRoot = true;
3101
+ break;
3102
+ }
24563103 }
24573104
2458
- ClearSelection(false);
2459
-
2460
- 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
+ }
24613116 } else
24623117 if (source == genUVItem)
24633118 {
....@@ -2469,7 +3124,7 @@
24693124 } else
24703125 if (source == genNormalsMESHItem)
24713126 {
2472
- GenNormals(true); // TODO
3127
+ GenNormalsMESH();
24733128 } else
24743129 if (source == genNormalsORGANItem)
24753130 {
....@@ -2534,6 +3189,22 @@
25343189 if (source == unmarkleavesItem)
25353190 {
25363191 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);
25373208 } else
25383209 if (source == flipVItem)
25393210 {
....@@ -2742,7 +3413,7 @@
27423413 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27433414 {
27443415 obj = (Object3D)e.nextElement();
2745
- obj.SetBumpTexture(null);
3416
+ obj.ResetBumpTexture();
27463417 }
27473418
27483419 refreshContents();
....@@ -2758,6 +3429,31 @@
27583429
27593430 refreshContents();
27603431 } 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
27613457 if (source == flashSelectionButton)
27623458 {
27633459 CameraPane.flash = true;
....@@ -2769,6 +3465,10 @@
27693465 if (source == twoButton)
27703466 {
27713467 radio.layout = twoButton;
3468
+
3469
+ if (CameraPane.FULLSCREEN)
3470
+ fullscreenLayout = radio.layout;
3471
+
27723472 // bug
27733473 //gridPanel.setDividerLocation(1.0);
27743474 //bigPanel.setDividerLocation(0.0);
....@@ -2801,10 +3501,31 @@
28013501 bigThree.ClearUI();
28023502 bigThree.add(centralPanel);
28033503 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
+
28043522 } else
28053523 if (source == threeButton)
28063524 {
28073525 radio.layout = threeButton;
3526
+
3527
+ if (CameraPane.FULLSCREEN)
3528
+ fullscreenLayout = radio.layout;
28083529
28093530 // bigThree.remove(scenePanel);
28103531 // bigThree.remove(centralPanel);
....@@ -2834,13 +3555,18 @@
28343555 // centralPanel.setVisible(true);
28353556 // XYZPanel.setVisible(true);
28363557 bigThree.ClearUI();
3558
+ bigThree.add(scenePanel);
28373559 bigThree.add(centralPanel);
2838
- bigThree.add(XYZPanel);
28393560 bigThree.FlushUI();
3561
+
3562
+ cameraView.requestFocusInWindow();
28403563 } else
28413564 if (source == fourButton)
28423565 {
28433566 radio.layout = fourButton;
3567
+
3568
+ if (CameraPane.FULLSCREEN)
3569
+ fullscreenLayout = radio.layout;
28443570
28453571 // bigThree.remove(scenePanel);
28463572 // bigThree.remove(centralPanel);
....@@ -2872,10 +3598,15 @@
28723598 bigThree.ClearUI();
28733599 bigThree.add(scenePanel);
28743600 bigThree.FlushUI();
3601
+
3602
+ cameraView.requestFocusInWindow();
28753603 } else
28763604 if (source == sixButton)
28773605 {
28783606 radio.layout = sixButton;
3607
+
3608
+ if (CameraPane.FULLSCREEN)
3609
+ fullscreenLayout = radio.layout;
28793610
28803611 // bigThree.remove(scenePanel);
28813612 // bigThree.remove(centralPanel);
....@@ -2905,13 +3636,18 @@
29053636 // centralPanel.setVisible(true);
29063637 // XYZPanel.setVisible(false);
29073638 bigThree.ClearUI();
2908
- bigThree.add(scenePanel);
29093639 bigThree.add(centralPanel);
3640
+ bigThree.add(scenePanel);
29103641 bigThree.FlushUI();
3642
+
3643
+ cameraView.requestFocusInWindow();
29113644 } else
29123645 if (source == sevenButton)
29133646 {
29143647 radio.layout = sevenButton;
3648
+
3649
+ if (CameraPane.FULLSCREEN)
3650
+ fullscreenLayout = radio.layout;
29153651
29163652 // bigThree.remove(scenePanel);
29173653 // bigThree.remove(centralPanel);
....@@ -2945,6 +3681,8 @@
29453681 bigThree.add(centralPanel);
29463682 bigThree.add(XYZPanel);
29473683 bigThree.FlushUI();
3684
+
3685
+ cameraView.requestFocusInWindow();
29483686 } else
29493687 if (source == rootButton)
29503688 {
....@@ -2956,6 +3694,7 @@
29563694 EditObject(obj);
29573695 }
29583696
3697
+ cameraView.requestFocusInWindow();
29593698 refreshContents(true);
29603699 } else
29613700 if (source == closeButton)
....@@ -2965,22 +3704,37 @@
29653704 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663705 {
29673706 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3707
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693708 {
3709
+ // Patch to avoid bug with transparency.
3710
+ if (!ab.hadMaterial)
3711
+ {
3712
+ ab.object.material = null;
3713
+ }
3714
+
29703715 buttonGroup.remove(ab);
29713716 radioPanel.remove(ab);
29723717
2973
- ab.GetObject().editWindow = null;
3718
+ //ab.GetObject().editWindow = null;
3719
+ ab.GetObject().manipWindow = null;
29743720 // ab.GetObject().objectUI = null; // ?????????
29753721
29763722 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773723 break;
29783724 }
29793725 }
3726
+
3727
+ cameraView.requestFocusInWindow();
29803728 refreshContents(true);
29813729 } else
29823730 if (source == editItem || source == editButton)
29833731 {
3732
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3733
+ {
3734
+ Object3D child = (Object3D)e.nextElement();
3735
+ child.pinned = true;
3736
+ }
3737
+
29843738 EditSelection(false);
29853739 } else
29863740 if (source == uneditButton)
....@@ -2990,10 +3744,11 @@
29903744 Object3D child = (Object3D)e.nextElement();
29913745 if(child.editWindow != null)
29923746 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3747
+ child.pinned = false;
29933748 child.CloseUI();
29943749 listUI.remove(child);
29953750
2996
- child.editWindow = null; // ???????????
3751
+ //child.editWindow = null; // ???????????
29973752 }
29983753 objEditor.ctrlPanel.FlushUI();
29993754 //objEditor.jTree.clearSelection();
....@@ -3006,6 +3761,7 @@
30063761 //copy.ClearUI();
30073762 for (Object3D obj : listUI)
30083763 {
3764
+ obj.pinned = false;
30093765 obj.CloseUI();
30103766 }
30113767 listUI.clear();
....@@ -3015,7 +3771,7 @@
30153771 {
30163772 assert(copy == group);
30173773
3018
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3774
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30193775
30203776 for (Object3D obj : listUI)
30213777 {
....@@ -3064,6 +3820,9 @@
30643820 }
30653821
30663822 copy = group;
3823
+
3824
+ SetUndoStates();
3825
+
30673826 //Globals.theRenderer.object = group;
30683827 if(!useclient)
30693828 {
....@@ -3079,20 +3838,46 @@
30793838 frontView.object = group;
30803839 sideView.object = group;
30813840 }
3082
- group.editWindow = this;
3841
+
3842
+// fix "+" issue
3843
+ //group.editWindow = this;
3844
+ group.manipWindow = this;
3845
+
30833846 /*
30843847 currentLayout = radio.layout;
30853848 if (currentLayout == null)
30863849 currentLayout = sevenButton;
30873850 */
30883851 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);
30893859 keepparent = group.parent;
30903860 // PARENT = NULL or not???
30913861 //group.parent = null; // ROOT
30923862 //group.attributes = -1;
30933863 ResetModel();
3864
+
3865
+ cameraView.requestFocusInWindow();
30943866 refreshContents(true);
3095
- }
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
+ }
30963881 else
30973882 {
30983883 //return super.action(event, arg);
....@@ -3101,7 +3886,6 @@
31013886 }
31023887
31033888 boolean useclient = false;
3104
- cRadio radio;
31053889
31063890 void ToggleRoot()
31073891 {
....@@ -3340,7 +4124,8 @@
33404124
33414125 int size = obj.MemorySize();
33424126
3343
- 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)");
33444129 }
33454130 }
33464131 catch (Exception e)
....@@ -3421,6 +4206,13 @@
34214206 void GenNormals(boolean crease)
34224207 {
34234208 group.GenNormalsS(crease);
4209
+
4210
+ refreshContents();
4211
+ }
4212
+
4213
+ void GenNormalsMESH()
4214
+ {
4215
+ group.GenNormalsMeshS();
34244216
34254217 refreshContents();
34264218 }
....@@ -3652,7 +4444,16 @@
36524444 String pigment = Object3D.GetPigment(tex);
36534445 //String bump = Object3D.GetBump(tex);
36544446
3655
- 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
+ }
36564457
36574458 double s = v.s;
36584459
....@@ -4039,6 +4840,18 @@
40394840 refreshContents();
40404841 }
40414842
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);
4852
+ refreshContents();
4853
+ }
4854
+
40424855 void SetTexRes(int tr)
40434856 {
40444857 group.selection.SetTexRes(tr);
....@@ -4110,28 +4923,25 @@
41104923 // }
41114924 // }
41124925
4113
- static boolean allparams = true;
4114
-
4115
- static Vector<Object3D> listUI = new Vector<Object3D>();
4116
-
41174926 void EditSelection(boolean newWindow)
41184927 {
4928
+ if (group.selection == null)
4929
+ {
4930
+ EditElement(group, newWindow); // ? new
4931
+ return;
4932
+ }
4933
+
41194934 // aConstraints.gridy = 0;
41204935 for (int i=0; i<group.selection.size(); i++)
41214936 {
41224937 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41234938 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4124
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4939
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41254940
41264941 Object3D elem = (Object3D)group.selection.elementAt(i);
4127
- if(elem != group)
4942
+ if(elem != group || !newWindow)
41284943 {
4129
- // if (!(elem instanceof Composite))
4130
- // newWindow = false;
4131
- listUI.add(elem);
4132
- elem.openEditWindow(this, newWindow); //, false);
4133
- System.out.println("edit : " + elem);
4134
- elem.editWindow.refreshContents(true); // ? new
4944
+ EditElement(elem, newWindow); // ? new
41354945 }
41364946 }
41374947 }
....@@ -4206,7 +5016,8 @@
42065016 //new Exception().printStackTrace();
42075017
42085018 freezemodel = true;
4209
-
5019
+ ClearUnpinned();
5020
+
42105021 /**/
42115022 //switch (event.id)
42125023 {
....@@ -4214,7 +5025,6 @@
42145025 //case 702: // Event.LIST_DESELECT
42155026 group.deselectAll();
42165027 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4217
- objEditor.ClearInfo(); // .GetMaterial());
42185028 if (tps != null)
42195029 {
42205030 for (int i=0; i < tps.length; i++)
....@@ -4223,10 +5033,8 @@
42235033
42245034 //if (child.parent != null)
42255035 //child.parent.addSelectee(child);
5036
+ objEditor.SetMaterial(child);
42265037 group.addSelectee(child);
4227
- objEditor.SetMaterial(child); // .GetMaterial());
4228
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4229
- System.err.println("info : " + child.GetPath());
42305038 }
42315039 }
42325040 // else
....@@ -4236,20 +5044,28 @@
42365044 // System.err.println("info : " + group.GetPath());
42375045 // }
42385046
4239
- objEditor.SetText(); // jan 2014
4240
-
4241
- 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))
42425048 CameraPane.flash = true;
42435049
4244
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5050
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42455051 // a camera
42465052 {
4247
- CameraPane.camerachangeframe = 0; // don't refuse it
4248
- 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
+ }
42495058 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42505059 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42515060 }
42525061
5062
+ if (tps != null && tps.length == 1)
5063
+ {
5064
+ EditSelection(false);
5065
+ }
5066
+
5067
+ SetPinStates(tps != null && tps.length > 0);
5068
+
42535069 refreshContents();
42545070 //return true;
42555071 }
....@@ -4258,6 +5074,35 @@
42585074
42595075 freezemodel = false;
42605076 }
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
+ }
42615106
42625107 void linkSomething(Object3D thing)
42635108 {
....@@ -4329,6 +5174,7 @@
43295174 {
43305175 if (group.selection.isEmpty())
43315176 return;
5177
+
43325178 Grafreed.clipboardIsTempGroup = false;
43335179 Composite tGroup = null;
43345180 if (group.selection.size() > 0) // 1)
....@@ -4339,6 +5185,8 @@
43395185
43405186 if (cut)
43415187 {
5188
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5189
+// Save();
43425190 //int indices[] = jList.getSelectedIndices();
43435191 //for (int i = indices.length - 1; i >= 0; i--)
43445192 //jList.remove(indices[i]);
....@@ -4428,8 +5276,10 @@
44285276 }
44295277
44305278 }
5279
+
44315280 if (Grafreed.clipboardIsTempGroup)
44325281 Grafreed.clipboard = tGroup;
5282
+
44335283 if (cut)
44345284 {
44355285 ResetModel();
....@@ -4439,6 +5289,10 @@
44395289
44405290 void paste(boolean expand)
44415291 {
5292
+ if (Globals.REPLACEONMAKE)
5293
+ Save();
5294
+ boolean keep = Globals.REPLACEONMAKE;
5295
+ Globals.REPLACEONMAKE = false;
44425296 // if (GrafreeD.clipboard == null)
44435297 // return;
44445298 boolean first = true;
....@@ -4498,6 +5352,7 @@
44985352 Grafreed.clipboard.get(0).parent = keepparent;
44995353 }
45005354
5355
+ Globals.REPLACEONMAKE = keep;
45015356 ResetModel();
45025357 refreshContents();
45035358 }
....@@ -4633,6 +5488,10 @@
46335488
46345489 void group(Object3D csg, boolean grab)
46355490 {
5491
+ if (Globals.REPLACEONMAKE)
5492
+ Save();
5493
+ boolean keep = Globals.REPLACEONMAKE;
5494
+ Globals.REPLACEONMAKE = false;
46365495 if (//false) // why??
46375496 !group.selection.isEmpty())
46385497 {
....@@ -4746,10 +5605,15 @@
47465605 //node.add(csg);
47475606 //makeSomething(node);
47485607 makeSomething(csg);
5608
+ Globals.REPLACEONMAKE = keep;
47495609 }
47505610
47515611 void Ungroup(Object3D g)
47525612 {
5613
+ if (Globals.REPLACEONMAKE)
5614
+ Save();
5615
+ boolean keep = Globals.REPLACEONMAKE;
5616
+ Globals.REPLACEONMAKE = false;
47535617 if (g instanceof HiddenObject)
47545618 {
47555619 HiddenObject h = (HiddenObject) g;
....@@ -4766,6 +5630,7 @@
47665630 objEditor.makeSomething(g.get(i), false);
47675631 }
47685632 }
5633
+ Globals.REPLACEONMAKE = keep;
47695634 }
47705635
47715636 void ungroup()
....@@ -4961,21 +5826,6 @@
49615826 }
49625827 */
49635828
4964
- void ImportGFD()
4965
- {
4966
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4967
- browser.show();
4968
- String filename = browser.getFile();
4969
- if (filename != null && filename.length() > 0)
4970
- {
4971
- String fullname = browser.getDirectory() + filename;
4972
-
4973
- //Object3D readobj =
4974
- objEditor.ReadGFD(fullname, objEditor);
4975
- //makeSomething(readobj);
4976
- }
4977
- }
4978
-
49795829 /*
49805830 public void Callback(Object obj)
49815831 {
....@@ -4999,23 +5849,6 @@
49995849 }
50005850 */
50015851
5002
- void ImportVRMLX3D()
5003
- {
5004
- if (Grafreed.standAlone)
5005
- {
5006
- /**/
5007
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5008
- browser.show();
5009
- String filename = browser.getFile();
5010
- if (filename != null && filename.length() > 0)
5011
- {
5012
- String fullname = browser.getDirectory() + filename;
5013
- LoadVRMLX3D(fullname);
5014
- }
5015
- /**/
5016
- }
5017
- }
5018
-
50195852 String GetFile(String dialogName)
50205853 {
50215854 if (Grafreed.standAlone)
....@@ -5086,7 +5919,44 @@
50865919 cButton clearpanelButton;
50875920 cButton unselectButton;
50885921
5922
+ cButton restoreCameraButton;
5923
+
5924
+ cButton saveButton;
50895925 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;
50905960
50915961 cButton screenfitButton;
50925962 cButton screenfitpointButton;
....@@ -5099,14 +5969,6 @@
50995969
51005970 cButton setsupportButton;
51015971
5102
- cButton twoButton;
5103
- cButton sixButton;
5104
- cButton threeButton;
5105
- cButton sevenButton;
5106
- cButton fourButton; // full panel
5107
- cButton oneButton; // full XYZ
5108
- //cButton currentLayout;
5109
-
51105972 //
51115973 //Composite
51125974 Object3D // to do !!
....@@ -5116,9 +5978,11 @@
51165978 //JTree jTree;
51175979 private MenuItem lookAtItem;
51185980 private MenuItem lookFromItem;
5119
- private MenuItem switchItem;
5981
+ private MenuItem switchViewItem;
51205982 private MenuItem cutItem;
5121
- private MenuItem duplicateItem;
5983
+ private MenuItem undoItem;
5984
+ private MenuItem redoItem;
5985
+ private JMenuItem duplicateItem;
51225986 private MenuItem cloneItem;
51235987 private MenuItem cloneSupportItem;
51245988 private MenuItem overwriteGeoItem;
....@@ -5131,7 +5995,7 @@
51315995 private MenuItem linkverticesItem;
51325996 private MenuItem relinkverticesItem;
51335997 private MenuItem setMasterItem;
5134
- private MenuItem resetMeshItem;
5998
+ private MenuItem resetAllItem;
51355999 private MenuItem stepAllItem;
51366000 private MenuItem revertMeshItem;
51376001 private MenuItem poseMeshItem;
....@@ -5146,7 +6010,7 @@
51466010 private MenuItem pasteLinkItem;
51476011 private MenuItem pasteCloneItem;
51486012 private MenuItem pasteExpandItem;
5149
- private MenuItem clearItem;
6013
+ private MenuItem deleteItem;
51506014 private MenuItem clearAllItem;
51516015 private MenuItem genUVItem;
51526016 private MenuItem genNormalsMESHItem;
....@@ -5181,6 +6045,10 @@
51816045 private MenuItem showleavesItem;
51826046 private MenuItem markleavesItem;
51836047 private MenuItem unmarkleavesItem;
6048
+ private MenuItem rewindleavesItem;
6049
+ private MenuItem unrewindleavesItem;
6050
+ private MenuItem randomleavesItem;
6051
+ private MenuItem unrandomleavesItem;
51846052
51856053 private MenuItem flipVItem;
51866054 private MenuItem unflipVItem;
....@@ -5202,7 +6070,7 @@
52026070 private MenuItem frontItem;
52036071 private MenuItem cameraItem;
52046072 private MenuItem compositeItem;
5205
- private MenuItem randomItem;
6073
+ private MenuItem switchItem;
52066074 private MenuItem physicsItem;
52076075 private MenuItem frameselectorItem;
52086076 private MenuItem scriptNodeItem;
....@@ -5226,6 +6094,8 @@
52266094 private MenuItem attachBumpItem;
52276095 private MenuItem detachBumpItem;
52286096 private MenuItem pigmentBumpItem;
6097
+ private MenuItem embedTexturesItem;
6098
+ private MenuItem deEmbedTexturesItem;
52296099
52306100 private MenuItem particleItem;
52316101 private MenuItem ragdollItem;
....@@ -5264,11 +6134,6 @@
52646134 private MenuItem doubleItem;
52656135 private MenuItem tripleItem;
52666136
5267
- private MenuItem importGFDItem;
5268
- private MenuItem importVRMLX3DItem;
5269
- private MenuItem import3DSItem;
5270
- private MenuItem importOBJItem;
5271
-
52726137 private MenuItem computeAOItem;
52736138 private MenuItem recompileItem;
52746139 private MenuItem editScriptItem;
....@@ -5278,4 +6143,8 @@
52786143 private MenuItem analyzeItem;
52796144 private MenuItem dumpItem;
52806145 //boolean freezemodel = false;
6146
+
6147
+ Menu cameraMenu;
6148
+ MenuItem editCameraItem;
6149
+ MenuItem restoreCameraItem;
52816150 }