Normand Briere
2019-08-07 59de607850161a26863f92961d53caae7a2dabc8
GroupEditor.java
....@@ -16,6 +16,7 @@
1616 //import buoy.widget.BFileChooser;
1717
1818 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1920 ObjectUI,
2021 Runnable,
2122 ActionListener,
....@@ -23,6 +24,314 @@
2324 DragGestureListener, DragSourceListener, DropTargetListener,
2425 ItemListener // ListSelectionListener
2526 {
27
+
28
+ public void AddSkyboxButton(String f, String s, cGridBag row)
29
+ {
30
+ cButton skyboxButton;
31
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
33
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
+ skyboxButton.setToolTipText(s);
35
+ skyboxButton.addActionListener(new ActionListener()
36
+ {
37
+ @Override
38
+ public void actionPerformed(ActionEvent e)
39
+ {
40
+ ChangeSkybox(path);
41
+ }
42
+ });
43
+ }
44
+
45
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
46
+ {
47
+ cGridBag tab0 = new cGridBag().setVertical(true);
48
+
49
+ tab0.setName("Urban");
50
+ skyboxpanel.add(tab0);
51
+
52
+ cGridBag row0 = new cGridBag();
53
+ cGridBag row1 = new cGridBag();
54
+ cGridBag row2 = new cGridBag();
55
+ cGridBag row3 = new cGridBag();
56
+ cGridBag row4 = new cGridBag();
57
+ cGridBag row5 = new cGridBag();
58
+ cGridBag row6 = new cGridBag();
59
+
60
+ AddSkyboxButton("default", "rgb", row0);
61
+ //AddSkyboxButton("default", "cornell", row0);
62
+ AddSkyboxButton("penguins", "dust", row0);
63
+ AddSkyboxButton("penguins", "tropic", row0);
64
+ AddSkyboxButton("penguins", "yonder", row0);
65
+
66
+ AddSkyboxButton("default", "uffizi", row1);
67
+ AddSkyboxButton("bridge", "Bridge", row1);
68
+ AddSkyboxButton("bridge", "Bridge2", row1);
69
+ AddSkyboxButton("urban", "GamlaStan2", row1);
70
+
71
+ AddSkyboxButton("urban", "Parliament", row2);
72
+ AddSkyboxButton("urban", "Roundabout", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
74
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
75
+
76
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
77
+ AddSkyboxButton("urban", "UnionSquare", row3);
78
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
79
+ AddSkyboxButton("park", "BerzeliiPark", row3);
80
+
81
+ AddSkyboxButton("park", "Buddha", row4);
82
+ AddSkyboxButton("park", "CNTower2", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
84
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
85
+
86
+ AddSkyboxButton("park", "Park", row5);
87
+ AddSkyboxButton("park", "Pond", row5);
88
+ AddSkyboxButton("park", "Skansen", row5);
89
+ AddSkyboxButton("park", "Skansen2", row5);
90
+
91
+ AddSkyboxButton("park", "Skansen3", row6);
92
+ AddSkyboxButton("park", "Skansen4", row6);
93
+ AddSkyboxButton("park", "Skansen5", row6);
94
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
95
+
96
+ tab0.add(row0);
97
+ tab0.add(row1);
98
+ tab0.add(row2);
99
+ tab0.add(row3);
100
+ tab0.add(row4);
101
+ tab0.add(row5);
102
+ tab0.add(row6);
103
+
104
+ for (int i=5; --i>=0;)
105
+ {
106
+ //oe.toolboxPanel.Return();
107
+ //tab0.add(new cGridBag());
108
+ }
109
+ }
110
+
111
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
112
+ {
113
+ cGridBag tab0 = new cGridBag().setVertical(true);
114
+
115
+ tab0.setName("Nature");
116
+ skyboxpanel.add(tab0);
117
+
118
+ cGridBag row0 = new cGridBag();
119
+ cGridBag row1 = new cGridBag();
120
+ cGridBag row2 = new cGridBag();
121
+ cGridBag row3 = new cGridBag();
122
+ cGridBag row4 = new cGridBag();
123
+ cGridBag row5 = new cGridBag();
124
+ cGridBag row6 = new cGridBag();
125
+
126
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
127
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
128
+ AddSkyboxButton("beach", "PalmTrees", row0);
129
+ AddSkyboxButton("beach", "Tenerife", row0);
130
+
131
+ AddSkyboxButton("beach", "Tenerife2", row1);
132
+ AddSkyboxButton("beach", "Tenerife3", row1);
133
+ AddSkyboxButton("field", "FishPond", row1);
134
+ AddSkyboxButton("field", "Footballfield", row1);
135
+
136
+ AddSkyboxButton("field", "Meadow", row2);
137
+ AddSkyboxButton("field", "Sorsele", row2);
138
+ AddSkyboxButton("field", "Sorsele2", row2);
139
+ AddSkyboxButton("field", "Sorsele3", row2);
140
+
141
+ AddSkyboxButton("forest", "Brudslojan", row3);
142
+ AddSkyboxButton("forest", "Langholmen2", row3);
143
+ AddSkyboxButton("forest", "Plants", row3);
144
+ AddSkyboxButton("mountain", "Maskonaive", row3);
145
+
146
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
147
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
148
+ AddSkyboxButton("mountain", "Teide", row4);
149
+ AddSkyboxButton("park", "Tantolunden4", row4);
150
+
151
+ AddSkyboxButton("park", "Stairs", row5);
152
+ AddSkyboxButton("default", "skycube", row6);
153
+ AddSkyboxButton("rocky", "Langholmen", row5);
154
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
155
+
156
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
157
+ AddSkyboxButton("default", "CloudyHills", row6);
158
+ AddSkyboxButton("daz", "Autumn", row6);
159
+ AddSkyboxButton("daz", "MountainTrail", row6);
160
+ /*
161
+Autumn
162
+Greenlands
163
+MountainTrail
164
+Oasis
165
+TheRock
166
+TopOfTheWorld
167
+Winter
168
+ */
169
+
170
+ tab0.add(row0);
171
+ tab0.add(row1);
172
+ tab0.add(row2);
173
+ tab0.add(row3);
174
+ tab0.add(row4);
175
+ tab0.add(row5);
176
+ tab0.add(row6);
177
+
178
+ for (int i=5; --i>=0;)
179
+ {
180
+ //oe.toolboxPanel.Return();
181
+ //tab0.add(new cGridBag());
182
+ }
183
+ }
184
+
185
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
186
+ {
187
+ cGridBag tab0 = new cGridBag().setVertical(true);
188
+
189
+ tab0.setName("Night");
190
+ skyboxpanel.add(tab0);
191
+
192
+ cGridBag row0 = new cGridBag();
193
+ cGridBag row1 = new cGridBag();
194
+ cGridBag row2 = new cGridBag();
195
+ cGridBag row3 = new cGridBag();
196
+ cGridBag row4 = new cGridBag();
197
+ cGridBag row5 = new cGridBag();
198
+ cGridBag row6 = new cGridBag();
199
+
200
+ AddSkyboxButton("night", "NightPath", row0);
201
+ AddSkyboxButton("night", "PondNight", row0);
202
+ AddSkyboxButton("night", "Powerlines", row0);
203
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
204
+
205
+ AddSkyboxButton("urban", "CNTower", row1);
206
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
207
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
208
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
209
+
210
+ AddSkyboxButton("penguins", "kenon_star", row2);
211
+ AddSkyboxButton("persson", "corona", row2);
212
+ AddSkyboxButton("persson", "spaceskybox", row2);
213
+ AddSkyboxButton("indoors", "Vasa", row2);
214
+
215
+ AddSkyboxButton("winter", "Backyard", row3);
216
+ AddSkyboxButton("winter", "Creek", row3);
217
+ AddSkyboxButton("winter", "FootballField3", row3);
218
+ AddSkyboxButton("winter", "Forest", row3);
219
+
220
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
221
+ AddSkyboxButton("winter", "House", row4);
222
+ AddSkyboxButton("winter", "IceLake", row4);
223
+ AddSkyboxButton("winter", "IceRiver", row4);
224
+
225
+ AddSkyboxButton("winter", "Park3", row5);
226
+ AddSkyboxButton("winter", "PondWinter", row5);
227
+ AddSkyboxButton("winter", "Tantolunden5", row5);
228
+ AddSkyboxButton("winter", "Vindelalven", row5);
229
+
230
+ AddSkyboxButton("daz", "TheRock", row6);
231
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
232
+ AddSkyboxButton("daz", "Winter", row6);
233
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
234
+
235
+ tab0.add(row0);
236
+ tab0.add(row1);
237
+ tab0.add(row2);
238
+ tab0.add(row3);
239
+ tab0.add(row4);
240
+ tab0.add(row5);
241
+ tab0.add(row6);
242
+
243
+ for (int i=5; --i>=0;)
244
+ {
245
+ //oe.toolboxPanel.Return();
246
+ //tab0.add(new cGridBag());
247
+ }
248
+ }
249
+
250
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
251
+ {
252
+ cGridBag tab0 = new cGridBag().setVertical(true);
253
+
254
+ tab0.setName("Others");
255
+ skyboxpanel.add(tab0);
256
+
257
+ cGridBag row0 = new cGridBag();
258
+ cGridBag row1 = new cGridBag();
259
+ cGridBag row2 = new cGridBag();
260
+ cGridBag row3 = new cGridBag();
261
+ cGridBag row4 = new cGridBag();
262
+ cGridBag row5 = new cGridBag();
263
+ cGridBag row6 = new cGridBag();
264
+
265
+ AddSkyboxButton("mayhem", "afterrain", row0);
266
+ AddSkyboxButton("mayhem", "aqua4", row0);
267
+ AddSkyboxButton("mayhem", "aqua9", row0);
268
+ AddSkyboxButton("mayhem", "flame", row0);
269
+
270
+ AddSkyboxButton("mayhem", "h2s", row1);
271
+ AddSkyboxButton("mayhem", "prehistoric", row1);
272
+ AddSkyboxButton("mayhem", "scorched", row1);
273
+ AddSkyboxButton("penguins", "desertdawn", row1);
274
+
275
+ AddSkyboxButton("persson", "Citadella", row2);
276
+ AddSkyboxButton("persson", "Citadella2", row2);
277
+ AddSkyboxButton("persson", "clouds1", row2);
278
+ AddSkyboxButton("penguins", "wrath", row2);
279
+
280
+ AddSkyboxButton("persson", "FishermansBastion", row3);
281
+ AddSkyboxButton("persson", "HeroesSquare", row3);
282
+ AddSkyboxButton("indoors", "DallasW", row3);
283
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
284
+
285
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
286
+ AddSkyboxButton("persson", "PereaBeach1", row4);
287
+ AddSkyboxButton("persson", "PereaBeach2", row4);
288
+ AddSkyboxButton("persson", "redeclipse", row4);
289
+
290
+ AddSkyboxButton("daz", "Greenlands", row5);
291
+ AddSkyboxButton("daz", "Oasis", row5);
292
+ AddSkyboxButton("elyvisions", "arch3", row5);
293
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
294
+
295
+ AddSkyboxButton("elyvisions", "rainbow", row6);
296
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
297
+ AddSkyboxButton("elyvisions", "heaven", row6);
298
+ AddSkyboxButton("elyvisions", "hot", row6);
299
+
300
+ tab0.add(row0);
301
+ tab0.add(row1);
302
+ tab0.add(row2);
303
+ tab0.add(row3);
304
+ tab0.add(row4);
305
+ tab0.add(row5);
306
+ tab0.add(row6);
307
+
308
+ for (int i=5; --i>=0;)
309
+ {
310
+ //oe.toolboxPanel.Return();
311
+ //tab0.add(new cGridBag());
312
+ }
313
+ }
314
+
315
+ public void CallBack(String[] path)
316
+ {
317
+ for (int i = 0; i < path.length; i++)
318
+ {
319
+ System.out.print(path[i] + "/");
320
+ }
321
+
322
+ System.out.println();
323
+ }
324
+
325
+ public void ChangeSkybox(String skybox)
326
+ {
327
+ //cameraView.envyoff = false;
328
+ group.skyboxname = skybox;
329
+ group.skyboxext = "jpg";
330
+ cameraView.repaint();
331
+
332
+ Grafreed.ParseResources("textures", this);
333
+ }
334
+
26335 //ObjEditor objEditor;
27336 public void closeUI2()
28337 {
....@@ -60,6 +369,12 @@
60369 this.copy = this.group = group;
61370 //selectees = this.group.selectees;
62371
372
+ if (copy.versionlist == null)
373
+ {
374
+ copy.versionlist = new Object3D[100];
375
+ copy.versionindex = -1;
376
+ }
377
+
63378 if(ui)
64379 SetupUI(objEditor);
65380 }
....@@ -74,16 +389,28 @@
74389 this.copy = this.group = copy;
75390 //selectees = this.group.selectees;
76391
77
- SetupMenu2(objEditor);
392
+ SetupMenu2(this); //objEditor);
78393 SetupUI2(objEditor);
79394 objEditor.SetupUI(true);
80395 SetupViews(objEditor);
81396
82397 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
398
+
399
+ if (copy.versionlist == null)
400
+ {
401
+ copy.versionlist = new Object3D[100];
402
+ copy.versionindex = -1;
403
+
404
+ Save(true);
405
+ }
83406 }
84407
85408 void CloneSelection(boolean supports)
86409 {
410
+ if (Globals.REPLACEONMAKE)
411
+ Save();
412
+ boolean keep = Globals.REPLACEONMAKE;
413
+ Globals.REPLACEONMAKE = false;
87414 // Object3D keep = GrafreeD.clipboard;
88415 //Object3D obj;
89416 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +421,19 @@
94421
95422 makeSomething(clone, i==group.selection.size()-1);
96423 }
424
+ Globals.REPLACEONMAKE = keep;
97425 }
98426
99427 void CloneClipboard(boolean supports)
100428 {
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));
429
+ assert(Grafreed.clipboard.parent == null);
430
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
431
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
432
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
433
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106434 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
435
+ makeSomething(CloneObject(Grafreed.clipboard, false));
436
+ Grafreed.clipboard.get(0).parent = keepparent;
109437 }
110438
111439 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +447,7 @@
119447 // obj.support = null;
120448 if (!supports)
121449 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
450
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123451 obj.parent = parent;
124452 // obj.support = support;
125453 // clone.support = support; // aout 2013
....@@ -148,40 +476,37 @@
148476
149477 //JTextField nameField;
150478
151
- void SetupMenu2(ObjEditor oe)
479
+ void SetupMenu2(GroupEditor oe)
152480 {
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
-
481
+ oe.jTree = new cTree();
482
+
168483 Menu menu;
169484 oe.menuBar.add(menu = new Menu("Edit"));
170485 //editItem = menu.add(new MenuItem("Edit"));
171486 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
487
+
488
+// undoItem = menu.add(new MenuItem("Undo"));
489
+// undoItem.addActionListener(this);
490
+// redoItem = menu.add(new MenuItem("Redo"));
491
+// redoItem.addActionListener(this);
492
+// menu.add("-");
493
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173494 duplicateItem.addActionListener(this);
495
+ cloneItem = menu.add(new MenuItem("Clone"));
496
+ cloneItem.addActionListener(this);
497
+ if (Globals.ADVANCED)
498
+ {
499
+ cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
500
+ cloneSupportItem.addActionListener(this);
501
+ }
502
+ menu.add("-");
174503 cutItem = menu.add(new MenuItem("Cut"));
175504 cutItem.addActionListener(this);
176505 copyItem = menu.add(new MenuItem("Copy"));
177506 copyItem.addActionListener(this);
178507 pasteItem = menu.add(new MenuItem("Paste"));
179508 pasteItem.addActionListener(this);
180
- menu.add("-");
181
- cloneItem = menu.add(new MenuItem("Clone"));
182
- cloneItem.addActionListener(this);
183
- cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
184
- cloneSupportItem.addActionListener(this);
509
+
185510 menu.add("-");
186511 pasteIntoItem = menu.add(new MenuItem("Paste into"));
187512 pasteIntoItem.addActionListener(this);
....@@ -192,8 +517,8 @@
192517 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
193518 // pasteExpandItem.addActionListener(this);
194519 menu.add("-");
195
- clearItem = menu.add(new MenuItem("Clear"));
196
- clearItem.addActionListener(this);
520
+ deleteItem = menu.add(new MenuItem("Delete"));
521
+ deleteItem.addActionListener(this);
197522
198523 if (Globals.ADVANCED)
199524 {
....@@ -201,14 +526,97 @@
201526 clearAllItem = menu.add(new MenuItem("Clear All"));
202527 clearAllItem.addActionListener(this);
203528 }
529
+
530
+ menuBar.add(cameraMenu = new Menu("View"));
531
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
532
+ //zBufferItem.addActionListener(this);
533
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
534
+ //normalLensItem.addActionListener(this);
535
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
536
+ restoreCameraItem.addActionListener(this);
537
+
538
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
539
+// toggleFullScreenItem.addItemListener(this);
540
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
541
+// cameraMenu.add("-");
542
+//
543
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
544
+// toggleTextureItem.addItemListener(this);
545
+// toggleTextureItem.setState(CameraPane.textureon);
546
+//
547
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
548
+// toggleSwitchItem.addItemListener(this);
549
+// toggleSwitchItem.setState(CameraPane.SWITCH);
550
+
551
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
552
+ toggleHandleItem.addItemListener(this);
553
+ toggleHandleItem.setState(CameraPane.HANDLES);
554
+
555
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
556
+ togglePaintItem.addItemListener(this);
557
+ togglePaintItem.setState(CameraPane.PAINTMODE);
558
+
559
+ if (Globals.ADVANCED)
560
+ {
561
+ cameraMenu.add("-");
562
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
563
+ toggleLiveItem.addItemListener(this);
564
+ toggleLiveItem.setState(Globals.isLIVE());
204565
566
+ cameraMenu.add(stepItem = new MenuItem("Step"));
567
+ stepItem.addActionListener(this);
568
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
569
+ // toggleDLItem.addItemListener(this);
570
+ // toggleDLItem.setState(false);
571
+
572
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
573
+ toggleRenderItem.addItemListener(this);
574
+ toggleRenderItem.setState(!CameraPane.frozen);
575
+
576
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
577
+ toggleDebugItem.addItemListener(this);
578
+ toggleDebugItem.setState(Globals.DEBUG);
579
+
580
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
581
+ toggleFrustumItem.addItemListener(this);
582
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
583
+
584
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
585
+ toggleFootContactItem.addItemListener(this);
586
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
587
+
588
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
589
+ toggleTimelineItem.addItemListener(this);
590
+ }
591
+
592
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
593
+// toggleRootItem.addItemListener(this);
594
+// toggleRootItem.setState(false);
595
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
596
+// animationItem.addItemListener(this);
597
+// animationItem.setState(CameraPane.ANIMATION);
598
+ cameraMenu.add("-");
599
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
600
+ editCameraItem.addActionListener(this);
601
+
602
+ if (Globals.ADVANCED)
603
+ {
604
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
605
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
606
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
607
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
608
+ oe.cameraMenu.add("-");
609
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
610
+ openWindowItem.addActionListener(this);
611
+ editLeafItem.addActionListener(this);
612
+ lookAtItem.addActionListener(this);
613
+ //lookFromItem.addActinoListener(this);
614
+ //switchViewItem.addActionListener(this);
615
+ }
616
+
205617 oe.menuBar.add(menu = new Menu("Setting"));
206618 if (Globals.ADVANCED)
207619 {
208
- resetMeshItem = menu.add(new MenuItem("Reset All"));
209
- resetMeshItem.addActionListener(this);
210
- stepAllItem = menu.add(new MenuItem("Step All"));
211
- stepAllItem.addActionListener(this);
212620 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
213621 revertMeshItem.addActionListener(this);
214622 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -248,21 +656,29 @@
248656 }
249657
250658 oe.menuBar.add(menu = new Menu("Group"));
251
- grabItem = menu.add(new MenuItem("Grab"));
252
- grabItem.addActionListener(this);
659
+// grabItem = menu.add(new MenuItem("Grab"));
660
+// grabItem.addActionListener(this);
253661 backItem = menu.add(new MenuItem("Back"));
254662 backItem.addActionListener(this);
255663 frontItem = menu.add(new MenuItem("Front"));
256664 frontItem.addActionListener(this);
257
- compositeItem = menu.add(new MenuItem("Composite"));
258
- compositeItem.addActionListener(this);
665
+// compositeItem = menu.add(new MenuItem("Composite"));
666
+// compositeItem.addActionListener(this);
667
+
668
+ if (Globals.ADVANCED)
669
+ {
259670 hideItem = menu.add(new MenuItem("Hidden Group"));
260671 hideItem.addActionListener(this);
672
+ }
261673 ungroupItem = menu.add(new MenuItem("Ungroup"));
262674 ungroupItem.addActionListener(this);
263
- menu.add("-");
264
- randomItem = menu.add(new MenuItem("Switch node"));
265
- randomItem.addActionListener(this);
675
+
676
+// menu.add("-");
677
+//
678
+// switchItem = menu.add(new MenuItem("Switch node"));
679
+// switchItem.addActionListener(this);
680
+ if (Globals.ADVANCED)
681
+ {
266682 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
267683 switchGeoItem.addActionListener(this);
268684 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -270,49 +686,52 @@
270686 morphItem = menu.add(new MenuItem("Morph Group"));
271687 morphItem.addActionListener(this);
272688
273
- if (Globals.ADVANCED)
274
- {
689
+ menu.add("-");
275690 physicsItem = menu.add(new MenuItem("Physics"));
276691 physicsItem.addActionListener(this);
277692 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
278693 frameselectorItem.addActionListener(this);
279694 scriptNodeItem = menu.add(new MenuItem("Script Node"));
280695 scriptNodeItem.addActionListener(this);
281
- cameraItem = menu.add(new MenuItem("Camera"));
282
- cameraItem.addActionListener(this);
283696 }
284697
285698 oe.menuBar.add(menu = new Menu("Object"));
286
- textureItem = menu.add(new MenuItem("Texture"));
287
- textureItem.addActionListener(this);
699
+// textureItem = menu.add(new MenuItem("Texture"));
700
+// textureItem.addActionListener(this);
288701 billboardItem = menu.add(new MenuItem("Billboard"));
289702 billboardItem.addActionListener(this);
290703 csgItem = menu.add(new MenuItem("CSG"));
291704 csgItem.addActionListener(this);
292
- shadowXItem = menu.add(new MenuItem("Shadow X"));
705
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
293706 shadowXItem.addActionListener(this);
294
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
707
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
295708 shadowYItem.addActionListener(this);
296
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
709
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
297710 shadowZItem.addActionListener(this);
298
- if (Globals.ADVANCED)
299
- {
300
- linkerItem = menu.add(new MenuItem("Linker"));
301
- linkerItem.addActionListener(this);
302711 attributeItem = menu.add(new MenuItem("Attribute"));
303712 attributeItem.addActionListener(this);
713
+
714
+ if (Globals.ADVANCED)
715
+ {
716
+ menu.add("-");
717
+ linkerItem = menu.add(new MenuItem("Linker"));
718
+ linkerItem.addActionListener(this);
304719 templateItem = menu.add(new MenuItem("Template"));
305720 templateItem.addActionListener(this);
306721 pointflowItem = menu.add(new MenuItem("Point Flow"));
307722 pointflowItem.addActionListener(this);
308
- menu.add("-");
309723 }
724
+ menu.add("-");
310725 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
311726 resetTransformItem.addActionListener(this);
312727 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
313728 resetCentroidItem.addActionListener(this);
314
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
315
- transformgeometryItem.addActionListener(this);
729
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
730
+ resetCentroidXZItem.addActionListener(this);
731
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
732
+ transformGeometryItem.addActionListener(this);
733
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
734
+ transformChildrenItem.addActionListener(this);
316735
317736 oe.menuBar.add(menu = new Menu("Geometry"));
318737 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -325,7 +744,7 @@
325744 genNormalsMESHItem.addActionListener(this);
326745 if (Globals.ADVANCED)
327746 {
328
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
747
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
329748 genNormalsMINEItem.addActionListener(this);
330749 }
331750 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -361,6 +780,10 @@
361780 oe.menuBar.add(menu = new Menu("Attributes"));
362781 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
363782 clearMaterialsItem.addActionListener(this);
783
+ resetAllItem = menu.add(new MenuItem("Reset All"));
784
+ resetAllItem.addActionListener(this);
785
+ stepAllItem = menu.add(new MenuItem("Step All"));
786
+ stepAllItem.addActionListener(this);
364787 menu.add("-");
365788 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
366789 liveleavesItem.addActionListener(this);
....@@ -381,6 +804,14 @@
381804 markleavesItem.addActionListener(this);
382805 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
383806 unmarkleavesItem.addActionListener(this);
807
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
808
+ rewindleavesItem.addActionListener(this);
809
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
810
+ unrewindleavesItem.addActionListener(this);
811
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
812
+ randomleavesItem.addActionListener(this);
813
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
814
+ unrandomleavesItem.addActionListener(this);
384815 menu.add("-");
385816 flipVItem = menu.add(new MenuItem("Flip V"));
386817 flipVItem.addActionListener(this);
....@@ -406,47 +837,56 @@
406837 attachBumpItem.addActionListener(this);
407838 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
408839 pigmentBumpItem.addActionListener(this);
840
+ //embedTexturesItem
409841 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
410842 detachPigmentItem.addActionListener(this);
411843 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
412844 detachBumpItem.addActionListener(this);
845
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
846
+ embedTexturesItem.addActionListener(this);
847
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
848
+ deEmbedTexturesItem.addActionListener(this);
413849 menu.add("-");
414850 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
415851 sortbysizeItem.addActionListener(this);
416852 sortbynameItem = menu.add(new MenuItem("Sort by name"));
417853 sortbynameItem.addActionListener(this);
854
+ menu.add("-");
855
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
856
+ shareGeometriesItem.addActionListener(this);
857
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
858
+ mergeGeometriesItem.addActionListener(this);
418859 if (Globals.ADVANCED)
419860 {
420
- menu.add("-");
861
+ // Pretty much the same as duplicate and clone.
421862 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
422863 extractGeometriesItem.addActionListener(this);
423864 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
424865 cloneGeometriesItem.addActionListener(this);
425
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
426
- shareGeometriesItem.addActionListener(this);
427
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
428
- mergeGeometriesItem.addActionListener(this);
429866 }
430867
431868 oe.menuBar.add(menu = new Menu("Insert"));
432869 buildCreateMenu(menu);
433870
434
- oe.menuBar.add(menu = new Menu("Include"));
435
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
436
- importGFDItem.addActionListener(this);
437
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
438
- importVRMLX3DItem.addActionListener(this);
439
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
440
- importOBJItem.addActionListener(this);
441
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
442
- import3DSItem.addActionListener(this);
443
-
444871 oe.menuBar.add(menu = new Menu("Tools"));
445872 buildToolsMenu(menu);
446873 }
447874
875
+
448876 void SetupUI2(ObjEditor oe)
449877 {
878
+ // June 2019
879
+ if (oe == null)
880
+ {
881
+ //super.SetupUI2(this);
882
+ //return;
883
+ }
884
+
885
+ if (copy != group)
886
+ {
887
+ //super.SetupUI2(this);
888
+ }
889
+
450890 //new Exception().printStackTrace();
451891
452892 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -475,97 +915,242 @@
475915 oe.radioPanel.add(dummyButton);
476916 oe.buttonGroup.add(dummyButton);
477917 */
918
+ cGridBag copyOptionsPanel = new cGridBag();
919
+
920
+ copyOptionsPanel.preferredHeight = 2;
921
+
478922 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
479923
480
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
481
- liveCB.setToolTipText("Enabled animation");
924
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
925
+ //minButton.setToolTipText("Minimize window");
926
+ //minButton.addActionListener(this);
927
+
928
+ if (Globals.ADVANCED)
929
+ {
930
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ maxButton.setToolTipText("Maximize window");
932
+ maxButton.addActionListener(this);
933
+ }
934
+
935
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
936
+ fullButton.setToolTipText("Full-screen window");
937
+ fullButton.addActionListener(this);
938
+
939
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
940
+ screenfitButton.setToolTipText("Screen fit");
941
+ screenfitButton.addActionListener(this);
942
+
943
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
944
+ restoreCameraButton.setToolTipText("Restore viewpoint");
945
+ restoreCameraButton.addActionListener(this);
946
+
947
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
948
+ saveVersionButton.setToolTipText("Duplicate current version");
949
+ saveVersionButton.addActionListener(this);
950
+
951
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
952
+ deleteVersionButton.setToolTipText("Delete current version");
953
+ deleteVersionButton.addActionListener(this);
954
+
955
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
956
+ previousVersionButton.setToolTipText("Previous version");
957
+ previousVersionButton.addActionListener(this);
958
+ previousVersionButton.setEnabled(false);
959
+
960
+ cGridBag updown = new cGridBag().setVertical(true);
961
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
962
+ restoreButton.setToolTipText("Undo (restore current version)");
963
+ restoreButton.addActionListener(this);
964
+ //restoreButton.setEnabled(false);
965
+
966
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
967
+ replaceButton.setToolTipText("Save (replace current version)");
968
+ replaceButton.addActionListener(this);
969
+ //replaceButton.setEnabled(false);
970
+
971
+ copyOptionsPanel.add(updown);
972
+
973
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
974
+ nextVersionButton.setToolTipText("Next version");
975
+ nextVersionButton.addActionListener(this);
976
+ nextVersionButton.setEnabled(false);
977
+
978
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
979
+ liveCB.setToolTipText("Enable animation");
482980 liveCB.addItemListener(this);
483981
484
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
982
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
485983 oneStepButton.setToolTipText("Animate one step forward");
486984 oneStepButton.addActionListener(this);
487985
488
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
986
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
489987 fastCB.setToolTipText("Fast mode");
490988 fastCB.addItemListener(this);
491989
492
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
493
- trackCB.setToolTipText("Enable tracking");
494
- trackCB.addItemListener(this);
495
-
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
497
- screenfitButton.setToolTipText("Screen fit");
498
- screenfitButton.addActionListener(this);
990
+ //oe.toolboxPanel.Return();
991
+
992
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
993
+// trackCB.setToolTipText("Enable tracking");
994
+// trackCB.addItemListener(this);
499995
500996 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
501997 // screenfitpointButton.addActionListener(this);
502998
503999 if (Globals.ADVANCED)
5041000 {
505
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1001
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5061002 snapobjectButton.addActionListener(this);
5071003 snapobjectButton.setToolTipText("Snap Object");
1004
+
1005
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1006
+ fourButton.addActionListener(this);
1007
+ fourButton.setToolTipText("Show control panel only");
5081008 }
5091009
510
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
511
- flashSelectionButton.setToolTipText("Show selection");
512
- flashSelectionButton.addActionListener(this);
1010
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
5131011
514
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
515
-
516
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
517
- twoButton.setToolTipText("Show center view only");
1012
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
+ twoButton.setToolTipText("Show 3D view only");
5181014 twoButton.addActionListener(this);
519
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
520
- fourButton.addActionListener(this);
521
- fourButton.setToolTipText("Show left panel only");
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
523
- sixButton.setToolTipText("2-column layout left");
524
- sixButton.addActionListener(this);
525
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
526
- threeButton.setToolTipText("2-column layout right");
1015
+ this.fullscreenLayout = twoButton;
1016
+
1017
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ threeButton.setToolTipText("Show controls and 3D view");
5271019 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
529
- sevenButton.setToolTipText("3-column layout");
530
- sevenButton.addActionListener(this);
1020
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1021
+ sixButton.setToolTipText("Show 3D view and controls");
1022
+ sixButton.addActionListener(this);
1023
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1024
+// sevenButton.setToolTipText("3-column layout");
1025
+// sevenButton.addActionListener(this);
5311026 //
5321027
533
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
534
- rootButton.setToolTipText("Edit selection in new tab");
1028
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ rootButton.setToolTipText("Open selection in new tab");
5351030 rootButton.addActionListener(this);
5361031
537
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1032
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5381033 closeButton.setToolTipText("Close tab");
5391034 closeButton.addActionListener(this);
5401035 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5411036 //clearButton.addActionListener(this);
542
-
543
- cGridBag commandsPanel = new cGridBag();
1037
+
1038
+ cGridBag row1 = new cGridBag();
5441039
545
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
546
- editButton.setToolTipText("Edit selection");
1040
+ // INSERT
1041
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
+ gridButton.setToolTipText("Create grid");
1043
+ gridButton.addActionListener(this);
1044
+
1045
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1046
+ boxButton.setToolTipText("Create box");
1047
+ boxButton.addActionListener(this);
1048
+
1049
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ sphereButton.setToolTipText("Create sphere");
1051
+ sphereButton.addActionListener(this);
1052
+
1053
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+ coneButton.setToolTipText("Create cone");
1055
+ coneButton.addActionListener(this);
1056
+
1057
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ torusButton.setToolTipText("Create torus");
1059
+ torusButton.addActionListener(this);
1060
+
1061
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1062
+ superButton.setToolTipText("Create superellipsoid");
1063
+ superButton.addActionListener(this);
1064
+
1065
+ if (Globals.ADVANCED)
1066
+ {
1067
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ kleinButton.setToolTipText("Create Klein bottle");
1069
+ kleinButton.addActionListener(this);
1070
+ }
1071
+
1072
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1073
+ particlesButton.setToolTipText("Create particle system");
1074
+ particlesButton.addActionListener(this);
1075
+
1076
+ oe.toolboxPanel.add(row1);
1077
+
1078
+ cGridBag row2 = new cGridBag();
1079
+
1080
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1081
+ groupButton.setToolTipText("Create group");
1082
+ groupButton.addActionListener(this);
1083
+
1084
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1085
+ compositeButton.setToolTipText("Create composite");
1086
+ compositeButton.addActionListener(this);
1087
+
1088
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1089
+ switchButton.setToolTipText("Create item switcher");
1090
+ switchButton.addActionListener(this);
1091
+
1092
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+ loopButton.setToolTipText("Create loop");
1094
+ loopButton.addActionListener(this);
1095
+
1096
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1097
+ textureButton.setToolTipText("Create texture");
1098
+ textureButton.addActionListener(this);
1099
+
1100
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1101
+ overlayButton.setToolTipText("Create overlay");
1102
+ overlayButton.addActionListener(this);
1103
+
1104
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1105
+ lightButton.setToolTipText("Create light");
1106
+ lightButton.addActionListener(this);
1107
+
1108
+ oe.toolboxPanel.add(row2);
1109
+
1110
+ // ENVYMAPS
1111
+ cGridBag skyboxpane = new cGridBag();
1112
+ skyboxpane.preferredHeight = 100;
1113
+
1114
+ oe.skyboxPanel.add(skyboxpane);
1115
+
1116
+ JTabbedPane skyboxpanel = new JTabbedPane();
1117
+ skyboxpane.add(skyboxpanel);
1118
+
1119
+ AddSkyboxTab0(skyboxpanel);
1120
+ AddSkyboxTab1(skyboxpanel);
1121
+ AddSkyboxTab2(skyboxpanel);
1122
+ AddSkyboxTab3(skyboxpanel);
1123
+
1124
+ // EDIT panel
1125
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1126
+ editButton.setToolTipText("Pin selection controls");
5471127 editButton.addActionListener(this);
5481128
549
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
550
- uneditButton.setToolTipText("Unedit selection");
1129
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1130
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5511131 uneditButton.addActionListener(this);
5521132
553
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
554
- allParamsButton.setToolTipText("Edit all params");
1133
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1134
+ allParamsButton.setToolTipText("Show all controle");
5551135 allParamsButton.addActionListener(this);
5561136
557
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1137
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5581138 clearPanelButton.setToolTipText("Clear edit panel");
5591139 clearPanelButton.addActionListener(this);
5601140
561
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
562
- unselectButton.setToolTipText("Unselect");
563
- unselectButton.addActionListener(this);
1141
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1142
+ //unselectButton.setToolTipText("Unselect");
1143
+ //unselectButton.addActionListener(this);
5641144
565
- commandsPanel.preferredHeight = 1;
1145
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1146
+ flashSelectionButton.setToolTipText("Highlight selection");
1147
+ flashSelectionButton.addActionListener(this);
5661148
567
- oe.treePanel.add(commandsPanel);
568
- oe.treePanel.Return();
1149
+ editCommandsPanel.preferredHeight = 1;
1150
+
1151
+ SetPinStates(false);
1152
+// oe.treePanel.add(commandsPanel);
1153
+// oe.treePanel.Return();
5691154
5701155 // oe.aConstraints.gridx += 1;
5711156 // oe.aConstraints.weighty = 0;
....@@ -582,32 +1167,20 @@
5821167
5831168 JScrollPane jSP;
5841169 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
585
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1170
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5861171 ResetModel();
5871172
5881173 oe.treePanel.add(jSPPanel);
5891174 oe.treePanel.Return();
5901175
591
- cGridBag copyOptionsPanel = new cGridBag();
592
-
593
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
594
- colorCB.setToolTipText("Copy color when dropped");
595
- colorCB.addItemListener(this);
596
-
597
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
598
- materialCB.setToolTipText("Copy material when dropped");
599
- materialCB.addItemListener(this);
600
-
601
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
602
- textureCB.setToolTipText("Copy texture when dropped");
603
- textureCB.addItemListener(this);
604
-
605
- copyOptionsPanel.preferredHeight = 1;
6061176 oe.treePanel.add(copyOptionsPanel);
6071177 oe.treePanel.Return();
1178
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1179
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1180
+ sliderPane.preferredHeight = 1;
6081181
609
-// mainPanel.setDividerLocation(0.5); //1.0);
610
-// mainPanel.setResizeWeight(0.5);
1182
+// mainPanel.setDividerLocation(0.1); //1.0);
1183
+ mainPanel.setResizeWeight(0.4);
6111184
6121185 //jList.addListSelectionListener(this);
6131186 oe.jTree.addTreeSelectionListener(this);
....@@ -615,7 +1188,7 @@
6151188 //jTree.setEditable(true);
6161189 oe.jTree.setDragEnabled(true);
6171190 //jTree.setPreferredSize(new Dimension(10,10));
618
- jSP.setPreferredSize(new Dimension(100,200));
1191
+ //jSP.setPreferredSize(new Dimension(100,200));
6191192
6201193 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6211194
....@@ -627,29 +1200,49 @@
6271200 dgr.addDragGestureListener(this);
6281201 }catch(Exception e) {}
6291202 */
630
- radio.layout = sevenButton;
1203
+ radio.layout = threeButton; // sixButton;
6311204 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6321205 }
6331206
6341207 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6351208 {
1209
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1210
+ colorCB.setToolTipText("Copy color when dropped");
1211
+ colorCB.addItemListener(this);
1212
+
1213
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1214
+ materialCB.setToolTipText("Copy material when dropped");
1215
+ materialCB.addItemListener(this);
1216
+
1217
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1218
+ textureCB.setToolTipText("Copy texture when dropped");
1219
+ textureCB.addItemListener(this);
1220
+
1221
+ panel.Return();
1222
+
6361223 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
6371224 boxCB.setToolTipText("Display bounding boxes");
6381225 boxCB.addItemListener(this);
6391226
6401227 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
641
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1228
+ zoomBoxCB.setToolTipText("Display only for wheel");
6421229 zoomBoxCB.addItemListener(this);
6431230
644
- if (Globals.ADVANCED)
1231
+ if (true) // Globals.ADVANCED)
6451232 {
646
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
647
- supportCB.setToolTipText("Enable rigging");
648
- supportCB.addItemListener(this);
1233
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1234
+// supportCB.setToolTipText("Enable rigging");
1235
+// supportCB.addItemListener(this);
1236
+
1237
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1238
+ freezeCB.setToolTipText("Fast moving camera");
1239
+ freezeCB.addItemListener(this);
6491240
6501241 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6511242 // localCB.addItemListener(this);
6521243
1244
+ panel.Return();
1245
+
6531246 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6541247 crowdCB.setToolTipText("Used for crowds");
6551248 crowdCB.addItemListener(this);
....@@ -658,14 +1251,19 @@
6581251 smoothCB.setToolTipText("Snapping delay");
6591252 smoothCB.addItemListener(this);
6601253
661
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
662
- slowCB.setToolTipText("Smooth interpolation");
663
- slowCB.addItemListener(this);
1254
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1255
+// slowCB.setToolTipText("Smooth interpolation");
1256
+// slowCB.addItemListener(this);
1257
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1258
+ minshaderCB.setToolTipText("Minimal fast shader");
1259
+ minshaderCB.addItemListener(this);
6641260
6651261 // constraints.gridy += 1;
6661262 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6671263 // speakerMocapCB.addItemListener(this);
6681264
1265
+ panel.Return();
1266
+
6691267 if (false)
6701268 {
6711269 // handled in scripts
....@@ -680,42 +1278,85 @@
6801278 //constraints.gridy += 1;
6811279 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6821280 smoothfocusCB.addItemListener(this);
1281
+ panel.Return();
6831282 }
6841283
6851284 //constraints.gridx += 1;
6861285 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6871286 // debugCB.addItemListener(this);
6881287
1288
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1289
+ trackCB.setToolTipText("Enable tracking target");
1290
+ trackCB.addItemListener(this);
1291
+
6891292 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1293
+ oeilCB.setToolTipText("Move camera when tracking");
6901294 oeilCB.addItemListener(this);
6911295
1296
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1297
+ shadowCB.setToolTipText("When live compute shadows");
1298
+ shadowCB.addItemListener(this);
1299
+
1300
+ panel.Return();
1301
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1302
+ toggleTextureCB.setToolTipText("Load textures");
1303
+ toggleTextureCB.addItemListener(this);
1304
+
1305
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1306
+ toggleSwitchCB.setToolTipText("Choose a single item");
1307
+ toggleSwitchCB.addItemListener(this);
1308
+
1309
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1310
+ autokeepCB.setToolTipText("On structure change");
1311
+ autokeepCB.addItemListener(this);
1312
+
1313
+ panel.Return();
1314
+ if (Globals.ADVANCED)
1315
+ {
6921316 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
6931317 lookAtCB.setToolTipText("Look-at target");
6941318 lookAtCB.addItemListener(this);
1319
+ }
6951320
6961321 }
6971322
6981323 cGridBag fill = new cGridBag();
699
-
7001324 fill.preferredHeight = 200;
1325
+ cGridBag fill2 = new cGridBag();
1326
+ fill2.preferredHeight = 200;
1327
+ cGridBag fill3 = new cGridBag();
1328
+ fill3.preferredHeight = 200;
7011329
7021330 panel.add(fill);
1331
+ panel.add(fill2);
1332
+ panel.add(fill3);
7031333
7041334 }
7051335
7061336 void EditObject(Object3D obj)
7071337 {
7081338 cRadio radioButton = new cRadio(obj.name);
1339
+
1340
+ // June 2019. Patch to avoid bug with transparency.
1341
+ radioButton.hadMaterial = obj.material != null;
1342
+ if (!radioButton.hadMaterial)
1343
+ {
1344
+ obj.material = new cMaterial();
1345
+ }
1346
+
7091347 radioButton.SetObject(obj);
710
- radioButton.layout = sevenButton;
1348
+ radioButton.layout = threeButton; // sixButton;
7111349 radioButton.SetCamera(cameraView.renderCamera, false);
7121350 radioButton.addActionListener(this);
7131351 radioPanel.add(radioButton);
7141352 buttonGroup.add(radioButton);
7151353 radioButton.doClick();
7161354 }
1355
+
7171356 void SetupViews(ObjEditor oe)
7181357 {
1358
+ theFrame = this;
1359
+
7191360 oe.SetupViews();
7201361
7211362 System.out.println("SetupViews");
....@@ -724,23 +1365,30 @@
7241365 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7251366 }
7261367
727
- JCheckBox liveCB;
728
- JCheckBox supportCB;
729
- JCheckBox localCB;
730
- JCheckBox crowdCB;
731
- JCheckBox smoothCB;
732
- JCheckBox fastCB;
733
- JCheckBox slowCB;
734
- JCheckBox boxCB;
735
- JCheckBox zoomBoxCB;
736
- JCheckBox trackCB;
737
- JCheckBox smoothfocusCB;
1368
+ cToggleButton liveCB;
1369
+ cCheckBox supportCB;
1370
+ cCheckBox localCB;
1371
+ cCheckBox crowdCB;
1372
+ cCheckBox smoothCB;
1373
+ cCheckBox minshaderCB;
1374
+
1375
+ cToggleButton fastCB;
1376
+ cCheckBox slowCB;
1377
+ cCheckBox boxCB;
1378
+ cCheckBox zoomBoxCB;
1379
+ cCheckBox freezeCB;
1380
+ //cToggleButton trackCB;
1381
+ cCheckBox trackCB;
1382
+ cCheckBox smoothfocusCB;
7381383 // JCheckBox speakerMocapCB;
739
- JCheckBox speakerCameraCB;
740
- JCheckBox speakerFocusCB;
741
- JCheckBox debugCB;
742
- JCheckBox oeilCB;
743
- JCheckBox lookAtCB;
1384
+ cCheckBox speakerCameraCB;
1385
+ cCheckBox speakerFocusCB;
1386
+ cCheckBox debugCB;
1387
+
1388
+ cCheckBox oeilCB;
1389
+ cCheckBox shadowCB;
1390
+ cCheckBox autokeepCB;
1391
+ cCheckBox lookAtCB;
7441392
7451393 // static int COLOR = 1;
7461394 // static int MATERIAL = 2;
....@@ -748,9 +1396,9 @@
7481396
7491397 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7501398
751
- JCheckBox colorCB;
752
- JCheckBox materialCB;
753
- JCheckBox textureCB;
1399
+ cCheckBox colorCB;
1400
+ cCheckBox materialCB;
1401
+ cCheckBox textureCB;
7541402
7551403 public void itemStateChanged(ItemEvent e)
7561404 {
....@@ -778,6 +1426,7 @@
7781426 } else if(e.getSource() == liveCB)
7791427 {
7801428 cameraView.ToggleLive();
1429
+ refreshContents(false);
7811430 }
7821431 else if(e.getSource() == supportCB)
7831432 {
....@@ -793,6 +1442,12 @@
7931442 {
7941443 cameraView.ToggleInertia();
7951444 cameraView.repaint();
1445
+ }
1446
+ else if(e.getSource() == minshaderCB)
1447
+ {
1448
+ Globals.MINSHADER ^= true;
1449
+ cameraView.programInitialized = false;
1450
+ cameraView.repaint();
7961451 }
7971452 else if(e.getSource() == localCB)
7981453 {
....@@ -842,6 +1497,18 @@
8421497 {
8431498 cameraView.ToggleOeil();
8441499 }
1500
+ else if(e.getSource() == shadowCB)
1501
+ {
1502
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1503
+ }
1504
+ else if(e.getSource() == freezeCB)
1505
+ {
1506
+ Globals.FREEZEONMOVE ^= true;
1507
+ }
1508
+ else if(e.getSource() == autokeepCB)
1509
+ {
1510
+ Globals.REPLACEONMAKE ^= true;
1511
+ }
8451512 else if(e.getSource() == lookAtCB)
8461513 {
8471514 cameraView.ToggleLookAt();
....@@ -858,7 +1525,8 @@
8581525
8591526 /**/
8601527 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
861
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1528
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1529
+ TreePath path = objEditor.jTree.getSelectionPath();
8621530 if ((path == null) || (path.getPathCount() <= 1)) {
8631531 // We can't move the root node or an empty selection
8641532 return;
....@@ -921,8 +1589,6 @@
9211589 }
9221590 }
9231591
924
- String string = (String) object;
925
-
9261592 System.out.println("Transfer = " + object + "; drop : " + target);
9271593 // if( object instanceof java.io.File[])
9281594 // {
....@@ -930,7 +1596,11 @@
9301596 // objEditor.DropFile((java.io.File[]) object, true);
9311597 // return;
9321598 // }
933
- if (string.charAt(0) == '/')
1599
+
1600
+ String string = object.toString();
1601
+
1602
+ // File path for Mac and Windows
1603
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9341604 {
9351605 // file(s)
9361606 String[] names = string.split("\n");
....@@ -957,7 +1627,7 @@
9571627
9581628 flashIt = false;
9591629 CameraPane pane = (CameraPane) target;
960
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1630
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9611631 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9621632
9631633 if (group.selection.size() == 1)
....@@ -973,23 +1643,33 @@
9731643
9741644 assert target == objEditor.jTree;
9751645 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1646
+ Object3D destinationLeaf;
9761647 try {
977
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1648
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9781649 } catch (Exception e) {
9791650 System.out.println("destinationPath : " + destinationPath);
9801651 return;
9811652 }
9821653
983
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1654
+ for (int i=group.selection.size(); --i>=0;)
9841655 {
1656
+ Object3D child = (Object3D)group.selection.elementAt(i);
1657
+
1658
+ // Cannot move into itself
1659
+ if (child == destinationLeaf)
1660
+ return;
1661
+ }
1662
+
1663
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1664
+// {
9851665 loadClipboard(true);
9861666 objEditor.jTree.setSelectionPath(destinationPath);
9871667 pasteInto(false, false);
988
- } else {
989
- loadClipboard(false);
990
- objEditor.jTree.setSelectionPath(destinationPath);
991
- pasteInto(false, false); // true); // ???
992
- }
1668
+// } else {
1669
+// loadClipboard(false);
1670
+// objEditor.jTree.setSelectionPath(destinationPath);
1671
+// pasteInto(false, false); // true); // ???
1672
+// }
9931673 }
9941674 public void dropActionChanged(DropTargetDragEvent dtde)
9951675 // Called if the user has modified the current drop gesture
....@@ -1094,22 +1774,30 @@
10941774 {
10951775 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10961776 //heightFieldItem.addActionListener(this);
1097
- gridItem = menu.add(new MenuItem("Grid"));
1098
- gridItem.addActionListener(this);
1099
- rectoidItem = menu.add(new MenuItem("Box"));
1100
- rectoidItem.addActionListener(this);
1101
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1102
- ellipsoidItem.addActionListener(this);
1103
- coneItem = menu.add(new MenuItem("Cone"));
1104
- coneItem.addActionListener(this);
1105
- torusItem = menu.add(new MenuItem("Torus"));
1106
- torusItem.addActionListener(this);
1107
- superItem = menu.add(new MenuItem("Superellipsoid"));
1108
- superItem.addActionListener(this);
1777
+// gridItem = menu.add(new MenuItem("Grid"));
1778
+// gridItem.addActionListener(this);
1779
+// rectoidItem = menu.add(new MenuItem("Box"));
1780
+// rectoidItem.addActionListener(this);
1781
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1782
+// ellipsoidItem.addActionListener(this);
1783
+// coneItem = menu.add(new MenuItem("Cone"));
1784
+// coneItem.addActionListener(this);
1785
+// torusItem = menu.add(new MenuItem("Torus"));
1786
+// torusItem.addActionListener(this);
1787
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1788
+// superItem.addActionListener(this);
1789
+
1790
+ cameraItem = menu.add(new MenuItem("Camera"));
1791
+ cameraItem.addActionListener(this);
1792
+
1793
+ if (!Globals.ADVANCED)
1794
+ {
11091795 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11101796 kleinItem.addActionListener(this);
1111
- particleItem = menu.add(new MenuItem("Particle system"));
1112
- particleItem.addActionListener(this);
1797
+ }
1798
+
1799
+// particleItem = menu.add(new MenuItem("Particle system"));
1800
+// particleItem.addActionListener(this);
11131801 if (Globals.ADVANCED)
11141802 {
11151803 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1135,15 +1823,15 @@
11351823 }
11361824 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11371825 bezierItem.addActionListener(this);
1138
- overlayItem = menu.add(new MenuItem("Overlay"));
1139
- overlayItem.addActionListener(this);
1140
- lightItem = menu.add(new MenuItem("Light"));
1141
- lightItem.addActionListener(this);
1826
+// overlayItem = menu.add(new MenuItem("Overlay"));
1827
+// overlayItem.addActionListener(this);
1828
+// lightItem = menu.add(new MenuItem("Light"));
1829
+// lightItem.addActionListener(this);
11421830 menu.add("-");
11431831 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11441832 //superLoopItem.addActionListener(this);
1145
- loopItem = menu.add(new MenuItem("Loop"));
1146
- loopItem.addActionListener(this);
1833
+// loopItem = menu.add(new MenuItem("Loop"));
1834
+// loopItem.addActionListener(this);
11471835 doubleItem = menu.add(new MenuItem("Fork"));
11481836 doubleItem.addActionListener(this);
11491837 if (Globals.ADVANCED)
....@@ -1159,18 +1847,23 @@
11591847 animationItem.addItemListener(this);
11601848 animationItem.setState(Globals.ANIMATION);
11611849
1850
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1851
+ archiveItem.addActionListener(this);
1852
+
11621853 menu.add("-");
11631854 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11641855 parseverticesItem.addActionListener(this);
11651856 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11661857 textureFieldItem.addActionListener(this);
1167
- alignItem = menu.add(new MenuItem("Align Object"));
1858
+ alignItem = menu.add(new MenuItem("Align Objects"));
11681859 alignItem.addActionListener(this);
11691860 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11701861 reduceMorphItem.addActionListener(this);
11711862 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11721863 reduce34MorphItem.addActionListener(this);
1173
-
1864
+ menu.add("-");
1865
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1866
+ memoryItem.addActionListener(this);
11741867 menu.add(computeAOItem = new MenuItem("Compute AO"));
11751868 computeAOItem.addActionListener(this);
11761869
....@@ -1179,11 +1872,9 @@
11791872 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11801873 mirrorItem.addActionListener(this);
11811874 menu.add("-");
1182
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1183
- memoryItem.addActionListener(this);
11841875 menu.add(analyzeItem = new MenuItem("Analyze"));
11851876 analyzeItem.addActionListener(this);
1186
- menu.add(dumpItem = new MenuItem("Dump"));
1877
+ menu.add(dumpItem = new MenuItem("Print"));
11871878 dumpItem.addActionListener(this);
11881879 // menu.add(pathItem = new MenuItem("From-to path"));
11891880 // pathItem.addActionListener(this);
....@@ -1324,9 +2015,34 @@
13242015 shadow.material = new cMaterial(obj.material);
13252016 shadow.material.diffuse = 0.0001f;
13262017 shadow.material.specular = 0.0001f;
2018
+ //shadow.projectedVertices[1].x = 300;
13272019
13282020 makeSomething(shadow);
13292021 }
2022
+
2023
+ private void ClearUnpinned()
2024
+ {
2025
+ //for (Object3D obj : listUI)
2026
+ for (int i=listUI.size(); --i>=0;)
2027
+ {
2028
+ Object3D obj = listUI.elementAt(i);
2029
+ if (!obj.pinned)
2030
+ {
2031
+ obj.CloseUI();
2032
+ listUI.remove(i);
2033
+ }
2034
+ }
2035
+ }
2036
+
2037
+ private void EditElement(Object3D elem, boolean newWindow)
2038
+ {
2039
+ // if (!(elem instanceof Composite))
2040
+ // newWindow = false;
2041
+ listUI.add(elem);
2042
+ elem.openEditWindow(this, newWindow); //, false);
2043
+ System.out.println("edit : " + elem);
2044
+ elem.editWindow.refreshContents(true); // ? new
2045
+ }
13302046
13312047 /**
13322048 * applyExample
....@@ -1530,9 +2246,9 @@
15302246
15312247 void Overwrite(int mask)
15322248 {
1533
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2249
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15342250 {
1535
- Object3D content = GrafreeD.clipboard.get(0);
2251
+ Object3D content = Grafreed.clipboard.get(0);
15362252
15372253 if (content instanceof cGroup && ((cGroup)content).transientlink )
15382254 content = ((cGroup)content).get(0);
....@@ -1571,7 +2287,7 @@
15712287 {
15722288 ScreenFit();
15732289 } else
1574
- if (source == switchItem)
2290
+ if (source == switchViewItem)
15752291 {
15762292 cVector v1 = new cVector();
15772293 cVector v2 = new cVector();
....@@ -1580,11 +2296,11 @@
15802296 objEditor.cameraView.renderCamera.setAim(v2, v1);
15812297 objEditor.cameraView.repaint();
15822298 } else
1583
- if (source == rectoidItem)
2299
+ if (source == rectoidItem || source == boxButton)
15842300 {
15852301 makeSomething(new Box());
15862302 } else
1587
- if (source == particleItem)
2303
+ if (source == particleItem || source == particlesButton)
15882304 {
15892305 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15902306 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1663,27 +2379,27 @@
16632379
16642380 makeSomething(obj);
16652381 } else
1666
- if (source == gridItem)
2382
+ if (source == gridItem || source == gridButton)
16672383 {
16682384 makeSomething(new Grid());
16692385 } else
1670
- if (source == ellipsoidItem)
2386
+ if (source == ellipsoidItem || source == sphereButton)
16712387 {
16722388 makeSomething(new Sphere());
16732389 } else
1674
- if (source == coneItem)
2390
+ if (source == coneItem || source == coneButton)
16752391 {
16762392 makeSomething(new Cone());
16772393 } else
1678
- if (source == torusItem)
2394
+ if (source == torusItem || source == torusButton)
16792395 {
16802396 makeSomething(new Torus());
16812397 } else
1682
- if (source == superItem)
2398
+ if (source == superItem || source == superButton)
16832399 {
16842400 makeSomething(new Superellipsoid());
16852401 } else
1686
- if (source == kleinItem)
2402
+ if (source == kleinItem || source == kleinButton)
16872403 {
16882404 makeSomething(new Klein());
16892405 } else
....@@ -1703,7 +2419,7 @@
17032419 {
17042420 makeSomething(new BezierSurface());
17052421 } else
1706
- if (source == overlayItem)
2422
+ if (source == overlayItem || source == overlayButton)
17072423 {
17082424 /*
17092425 Object3D obj = new BezierSurface(5,8);
....@@ -1751,10 +2467,27 @@
17512467 s.setup();
17522468 makeSomething(s);
17532469 } else
1754
- if (source == lightItem)
2470
+ if (source == lightItem || source == lightButton)
17552471 {
17562472 makeSomething(new Light());
17572473 } else
2474
+// if (source == skybox1Button ||
2475
+// source == skybox2Button ||
2476
+// source == skybox3Button ||
2477
+// source == skybox4Button ||
2478
+// source == skybox5Button ||
2479
+// source == skybox6Button ||
2480
+// source == skybox7Button ||
2481
+// source == skybox11Button ||
2482
+// source == skybox12Button ||
2483
+// source == skybox13Button ||
2484
+// source == skybox14Button ||
2485
+// source == skybox15Button ||
2486
+// source == skybox16Button ||
2487
+// source == skybox17Button)
2488
+// {
2489
+// ChangeSkybox(source);
2490
+// } else
17582491 if (source == csgItem)
17592492 {
17602493 group(new CSG());
....@@ -1801,30 +2534,30 @@
18012534
18022535 group(g);
18032536 } else
1804
- if (source == loopItem)
2537
+ if (source == loopItem || source == loopButton)
18052538 {
18062539 Composite csg = new GroupLeaf();
18072540 csg.count = 5;
18082541 group(csg);
1809
- Composite child = new cGroup();
2542
+ Composite child = new cGroup("Branch");
18102543 csg.addChild(child);
18112544 child.addChild(csg);
18122545 } else
18132546 if (source == doubleItem)
18142547 {
1815
- Composite csg = new GroupLeaf();
2548
+ Composite csg = new GroupLeaf("Fork");
18162549 csg.count = 5;
18172550 group(csg);
1818
- Composite child = new cGroup();
2551
+ Composite child = new cGroup("Branch A");
18192552 csg.addChild(child);
18202553 child.addChild(csg);
1821
- child = new cGroup();
2554
+ child = new cGroup("Branch B");
18222555 csg.addChild(child);
18232556 child.addChild(csg);
18242557 } else
18252558 if (source == tripleItem)
18262559 {
1827
- Composite csg = new GroupLeaf();
2560
+ Composite csg = new GroupLeaf("Trident");
18282561 csg.count = 4;
18292562 group(csg);
18302563 Composite child = new cGroup();
....@@ -1837,27 +2570,10 @@
18372570 csg.addChild(child);
18382571 child.addChild(csg);
18392572 } else
1840
-
1841
- if (source == importGFDItem)
1842
- {
1843
- ImportGFD();
1844
- } else
1845
- if (source == importVRMLX3DItem)
1846
- {
1847
- ImportVRMLX3D();
1848
- } else
1849
- if (source == import3DSItem)
1850
- {
1851
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1852
- } else
1853
- if (source == importOBJItem)
1854
- {
1855
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1856
- } else
18572573 if (source == computeAOItem)
18582574 {
18592575 Globals.drawMode = CameraPane.OCCLUSION;
1860
- Globals.theRenderer.repaint();
2576
+ cameraView.repaint();
18612577 } else
18622578 if (source == recompileItem)
18632579 {
....@@ -1872,7 +2588,7 @@
18722588 if (source == invariantsItem)
18732589 {
18742590 System.out.println("Invariants:");
1875
- GrafreeD.grafreeD.universe.invariants();
2591
+ Grafreed.grafreed.universe.invariants();
18762592 } else
18772593 if (source == memoryItem)
18782594 {
....@@ -1891,6 +2607,53 @@
18912607 {
18922608 DumpObject();
18932609 } else
2610
+ if (source == minButton)
2611
+ {
2612
+ Minimize();
2613
+ } else
2614
+ if (source == maxButton)
2615
+ {
2616
+ Maximize();
2617
+ } else
2618
+ if (source == fullButton)
2619
+ {
2620
+ ToggleFullScreen();
2621
+ } else
2622
+ if (source == previousVersionButton)
2623
+ {
2624
+ // Go to previous version
2625
+ //if (!Undo())
2626
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2627
+ PreviousVersion();
2628
+ } else
2629
+ if (source == restoreButton)
2630
+ {
2631
+ // Restore current version
2632
+ Restore();
2633
+ //restoreButton.setEnabled(false);
2634
+ } else
2635
+ if (source == replaceButton)
2636
+ {
2637
+ // Overwrite current version
2638
+ Replace();
2639
+ //replaceButton.setEnabled(false);
2640
+ } else
2641
+ if (source == nextVersionButton)
2642
+ {
2643
+ // Go to next version
2644
+ NextVersion();
2645
+ } else
2646
+ if (source == saveVersionButton)
2647
+ {
2648
+ // Save a new version
2649
+ if (!Save(true))
2650
+ java.awt.Toolkit.getDefaultToolkit().beep();
2651
+ } else
2652
+ if (source == deleteVersionButton)
2653
+ {
2654
+ // Delete a new version
2655
+ DeleteVersion();
2656
+ } else
18942657 if (source == oneStepButton)
18952658 {
18962659 Globals.ONESTEP = true;
....@@ -1898,17 +2661,14 @@
18982661 } else
18992662 if (source == screenfitButton)
19002663 {
1901
- //Reload(lastConverter, lastFilename, true);
19022664 ScreenFit();
19032665 } else
19042666 if (source == screenfitpointButton)
19052667 {
1906
- //Reload(lastConverter, lastFilename, true);
19072668 ScreenFitPoint();
19082669 } else
19092670 if (source == snapobjectButton)
19102671 {
1911
- //Reload(lastConverter, lastFilename, true);
19122672 SnapObject();
19132673 } else
19142674 // if (event.getSource() == recompileButton)
....@@ -1945,12 +2705,20 @@
19452705 {
19462706 loadClipboard(true);
19472707 } else
2708
+ if (source == undoItem)
2709
+ {
2710
+ PreviousVersion();
2711
+ } else
2712
+ if (source == redoItem)
2713
+ {
2714
+ NextVersion();
2715
+ } else
19482716 if (source == duplicateItem)
19492717 {
1950
- Object3D keep = GrafreeD.clipboard;
2718
+ Object3D keep = Grafreed.clipboard;
19512719 loadClipboard(false);
19522720 paste(false);
1953
- GrafreeD.clipboard = keep;
2721
+ Grafreed.clipboard = keep;
19542722 } else
19552723 if (source == cloneItem)
19562724 {
....@@ -2170,9 +2938,9 @@
21702938 // group.selection.get(0).setMasterThis(content); // should be identity
21712939 // refreshContents();
21722940 // }
2173
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2941
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21742942 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
2943
+ Object3D content = Grafreed.clipboard.get(0);
21762944
21772945 if (content instanceof cGroup && ((cGroup)content).transientlink )
21782946 content = ((cGroup)content).get(0);
....@@ -2222,9 +2990,9 @@
22222990 } else
22232991 if (source == setMasterItem)
22242992 {
2225
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2993
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22262994 {
2227
- Object3D content = GrafreeD.clipboard.get(0);
2995
+ Object3D content = Grafreed.clipboard.get(0);
22282996
22292997 if (content instanceof cGroup && ((cGroup)content).transientlink )
22302998 content = ((cGroup)content).get(0);
....@@ -2237,9 +3005,9 @@
22373005 {
22383006 if (group.selection.size() == 1)
22393007 {
2240
- if (GrafreeD.clipboard.size() == 1)
3008
+ if (Grafreed.clipboard.size() == 1)
22413009 {
2242
- Object3D content = GrafreeD.clipboard.get(0);
3010
+ Object3D content = Grafreed.clipboard.get(0);
22433011
22443012 if (content instanceof cGroup && ((cGroup)content).transientlink )
22453013 content = ((cGroup)content).get(0);
....@@ -2256,7 +3024,7 @@
22563024 {
22573025 RevertMeshes();
22583026 } else
2259
- if (source == resetMeshItem)
3027
+ if (source == resetAllItem)
22603028 {
22613029 ResetAll();
22623030 } else
....@@ -2264,7 +3032,7 @@
22643032 {
22653033 StepAll();
22663034 } else
2267
- if (source == clearItem) // || event.getSource() == clearButton)
3035
+ if (source == deleteItem) // || event.getSource() == clearButton)
22683036 {
22693037 //int indices[] = jList.getSelectedIndices();
22703038 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2276,9 +3044,9 @@
22763044 {
22773045 ClearSelection(true);
22783046 } else
2279
- if (source == grabItem)
3047
+ if (source == grabItem || source == groupButton)
22803048 {
2281
- group(new cGroup(), true);
3049
+ group(new cGroup(), false); // true);
22823050 } else
22833051 if (source == hideItem)
22843052 {
....@@ -2296,11 +3064,11 @@
22963064 {
22973065 makeSomething(new Camera());
22983066 } else
2299
- if (source == compositeItem)
3067
+ if (source == compositeItem || source == compositeButton)
23003068 {
23013069 group(new Composite());
23023070 } else
2303
- if (source == randomItem)
3071
+ if (source == switchItem || source == switchButton)
23043072 {
23053073 RandomNode random = new RandomNode();
23063074 group(random);
....@@ -2402,7 +3170,7 @@
24023170 {
24033171 group(new cLinker());
24043172 } else
2405
- if (source == textureItem)
3173
+ if (source == textureItem || source == textureButton)
24063174 {
24073175 group(new TextureNode());
24083176 } else
....@@ -2422,17 +3190,30 @@
24223190 {
24233191 CastShadow(2);
24243192 } else
2425
- if (source == ungroupItem)
3193
+ if (source == ungroupItem || source == ungroupButton)
24263194 {
2427
- //ungroup();
3195
+ boolean hasRoot = false;
3196
+
24283197 for (int i=0; i<group.selection.size(); i++)
24293198 {
2430
- Ungroup(group.selection.get(i));
3199
+ if (group.selection.get(i) == group)
3200
+ {
3201
+ hasRoot = true;
3202
+ break;
3203
+ }
24313204 }
24323205
2433
- ClearSelection(false);
2434
-
2435
- refreshContents();
3206
+ if (!hasRoot)
3207
+ {
3208
+ for (int i=0; i<group.selection.size(); i++)
3209
+ {
3210
+ Ungroup(group.selection.get(i));
3211
+ }
3212
+
3213
+ ClearSelection(false);
3214
+
3215
+ refreshContents();
3216
+ }
24363217 } else
24373218 if (source == genUVItem)
24383219 {
....@@ -2444,7 +3225,7 @@
24443225 } else
24453226 if (source == genNormalsMESHItem)
24463227 {
2447
- GenNormals(true); // TODO
3228
+ GenNormalsMESH();
24483229 } else
24493230 if (source == genNormalsORGANItem)
24503231 {
....@@ -2509,6 +3290,22 @@
25093290 if (source == unmarkleavesItem)
25103291 {
25113292 MarkLeaves(false);
3293
+ } else
3294
+ if (source == rewindleavesItem)
3295
+ {
3296
+ RewindLeaves(true);
3297
+ } else
3298
+ if (source == unrewindleavesItem)
3299
+ {
3300
+ RewindLeaves(false);
3301
+ } else
3302
+ if (source == randomleavesItem)
3303
+ {
3304
+ RandomLeaves(true);
3305
+ } else
3306
+ if (source == unrandomleavesItem)
3307
+ {
3308
+ RandomLeaves(false);
25123309 } else
25133310 if (source == flipVItem)
25143311 {
....@@ -2594,9 +3391,13 @@
25943391 {
25953392 SmoothMesh();
25963393 } else
2597
- if (source == transformgeometryItem)
3394
+ if (source == transformGeometryItem)
25983395 {
25993396 TransformGeometry();
3397
+ } else
3398
+ if (source == transformChildrenItem)
3399
+ {
3400
+ TransformChildren();
26003401 } else
26013402 if (source == resetTransformItem)
26023403 {
....@@ -2604,7 +3405,11 @@
26043405 } else
26053406 if (source == resetCentroidItem)
26063407 {
2607
- ResetCentroid();
3408
+ ResetCentroid(true);
3409
+ } else
3410
+ if (source == resetCentroidXZItem)
3411
+ {
3412
+ ResetCentroid(false);
26083413 } else
26093414 if (source == resetParentItem)
26103415 {
....@@ -2709,7 +3514,7 @@
27093514 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27103515 {
27113516 obj = (Object3D)e.nextElement();
2712
- obj.SetBumpTexture(null);
3517
+ obj.ResetBumpTexture();
27133518 }
27143519
27153520 refreshContents();
....@@ -2725,6 +3530,31 @@
27253530
27263531 refreshContents();
27273532 } else
3533
+ if (source == embedTexturesItem)
3534
+ {
3535
+ Object3D obj;
3536
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3537
+ {
3538
+ obj = (Object3D)e.nextElement();
3539
+ obj.EmbedTextures(true);
3540
+ }
3541
+
3542
+ refreshContents();
3543
+ } else
3544
+ if (source == deEmbedTexturesItem)
3545
+ {
3546
+ Object3D obj;
3547
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3548
+ {
3549
+ obj = (Object3D)e.nextElement();
3550
+ obj.EmbedTextures(false);
3551
+ }
3552
+
3553
+ CameraPane.texturepigment.clear();
3554
+ CameraPane.texturebump.clear();
3555
+
3556
+ refreshContents();
3557
+ } else
27283558 if (source == flashSelectionButton)
27293559 {
27303560 CameraPane.flash = true;
....@@ -2736,6 +3566,10 @@
27363566 if (source == twoButton)
27373567 {
27383568 radio.layout = twoButton;
3569
+
3570
+ if (CameraPane.FULLSCREEN)
3571
+ fullscreenLayout = radio.layout;
3572
+
27393573 // bug
27403574 //gridPanel.setDividerLocation(1.0);
27413575 //bigPanel.setDividerLocation(0.0);
....@@ -2768,10 +3602,31 @@
27683602 bigThree.ClearUI();
27693603 bigThree.add(centralPanel);
27703604 bigThree.FlushUI();
3605
+
3606
+ cameraView.requestFocusInWindow();
3607
+
3608
+// refreshContents(true);
3609
+//
3610
+// try
3611
+// {
3612
+// java.awt.Robot bot = new java.awt.Robot();
3613
+// int mask = InputEvent.BUTTON1_MASK;
3614
+// bot.mouseMove(100, 100);
3615
+// bot.mousePress(mask);
3616
+// bot.mouseRelease(mask);
3617
+// }
3618
+// catch (Exception e)
3619
+// {
3620
+//
3621
+// }
3622
+
27713623 } else
27723624 if (source == threeButton)
27733625 {
27743626 radio.layout = threeButton;
3627
+
3628
+ if (CameraPane.FULLSCREEN)
3629
+ fullscreenLayout = radio.layout;
27753630
27763631 // bigThree.remove(scenePanel);
27773632 // bigThree.remove(centralPanel);
....@@ -2801,13 +3656,18 @@
28013656 // centralPanel.setVisible(true);
28023657 // XYZPanel.setVisible(true);
28033658 bigThree.ClearUI();
3659
+ bigThree.add(scenePanel);
28043660 bigThree.add(centralPanel);
2805
- bigThree.add(XYZPanel);
28063661 bigThree.FlushUI();
3662
+
3663
+ cameraView.requestFocusInWindow();
28073664 } else
28083665 if (source == fourButton)
28093666 {
28103667 radio.layout = fourButton;
3668
+
3669
+ if (CameraPane.FULLSCREEN)
3670
+ fullscreenLayout = radio.layout;
28113671
28123672 // bigThree.remove(scenePanel);
28133673 // bigThree.remove(centralPanel);
....@@ -2839,10 +3699,15 @@
28393699 bigThree.ClearUI();
28403700 bigThree.add(scenePanel);
28413701 bigThree.FlushUI();
3702
+
3703
+ cameraView.requestFocusInWindow();
28423704 } else
28433705 if (source == sixButton)
28443706 {
28453707 radio.layout = sixButton;
3708
+
3709
+ if (CameraPane.FULLSCREEN)
3710
+ fullscreenLayout = radio.layout;
28463711
28473712 // bigThree.remove(scenePanel);
28483713 // bigThree.remove(centralPanel);
....@@ -2872,13 +3737,18 @@
28723737 // centralPanel.setVisible(true);
28733738 // XYZPanel.setVisible(false);
28743739 bigThree.ClearUI();
2875
- bigThree.add(scenePanel);
28763740 bigThree.add(centralPanel);
3741
+ bigThree.add(scenePanel);
28773742 bigThree.FlushUI();
3743
+
3744
+ cameraView.requestFocusInWindow();
28783745 } else
28793746 if (source == sevenButton)
28803747 {
28813748 radio.layout = sevenButton;
3749
+
3750
+ if (CameraPane.FULLSCREEN)
3751
+ fullscreenLayout = radio.layout;
28823752
28833753 // bigThree.remove(scenePanel);
28843754 // bigThree.remove(centralPanel);
....@@ -2912,6 +3782,8 @@
29123782 bigThree.add(centralPanel);
29133783 bigThree.add(XYZPanel);
29143784 bigThree.FlushUI();
3785
+
3786
+ cameraView.requestFocusInWindow();
29153787 } else
29163788 if (source == rootButton)
29173789 {
....@@ -2923,6 +3795,7 @@
29233795 EditObject(obj);
29243796 }
29253797
3798
+ cameraView.requestFocusInWindow();
29263799 refreshContents(true);
29273800 } else
29283801 if (source == closeButton)
....@@ -2932,22 +3805,37 @@
29323805 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29333806 {
29343807 ab = (cRadio)e.nextElement();
2935
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3808
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29363809 {
3810
+ // Patch to avoid bug with transparency.
3811
+ if (!ab.hadMaterial)
3812
+ {
3813
+ ab.object.material = null;
3814
+ }
3815
+
29373816 buttonGroup.remove(ab);
29383817 radioPanel.remove(ab);
29393818
2940
- ab.GetObject().editWindow = null;
3819
+ //ab.GetObject().editWindow = null;
3820
+ ab.GetObject().manipWindow = null;
29413821 // ab.GetObject().objectUI = null; // ?????????
29423822
29433823 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29443824 break;
29453825 }
29463826 }
3827
+
3828
+ cameraView.requestFocusInWindow();
29473829 refreshContents(true);
29483830 } else
29493831 if (source == editItem || source == editButton)
29503832 {
3833
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3834
+ {
3835
+ Object3D child = (Object3D)e.nextElement();
3836
+ child.pinned = true;
3837
+ }
3838
+
29513839 EditSelection(false);
29523840 } else
29533841 if (source == uneditButton)
....@@ -2956,11 +3844,12 @@
29563844 {
29573845 Object3D child = (Object3D)e.nextElement();
29583846 if(child.editWindow != null)
2959
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3847
+ child.pinned = false;
29603848 child.CloseUI();
29613849 listUI.remove(child);
3850
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29623851
2963
- child.editWindow = null; // ???????????
3852
+ //child.editWindow = null; // ???????????
29643853 }
29653854 objEditor.ctrlPanel.FlushUI();
29663855 //objEditor.jTree.clearSelection();
....@@ -2973,16 +3862,18 @@
29733862 //copy.ClearUI();
29743863 for (Object3D obj : listUI)
29753864 {
3865
+ obj.pinned = false;
29763866 obj.CloseUI();
29773867 }
29783868 listUI.clear();
3869
+ SetPinStates(group.selection.size() > 0);
29793870 refreshContents(true);
29803871 } else
29813872 if (source == allParamsButton)
29823873 {
29833874 assert(copy == group);
29843875
2985
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3876
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29863877
29873878 for (Object3D obj : listUI)
29883879 {
....@@ -3031,6 +3922,9 @@
30313922 }
30323923
30333924 copy = group;
3925
+
3926
+ SetUndoStates();
3927
+
30343928 //Globals.theRenderer.object = group;
30353929 if(!useclient)
30363930 {
....@@ -3046,20 +3940,49 @@
30463940 frontView.object = group;
30473941 sideView.object = group;
30483942 }
3049
- group.editWindow = this;
3943
+
3944
+// fix "+" issue
3945
+ //group.editWindow = this;
3946
+ group.manipWindow = this;
3947
+
30503948 /*
30513949 currentLayout = radio.layout;
30523950 if (currentLayout == null)
30533951 currentLayout = sevenButton;
30543952 */
30553953 radio.layout.doClick();
3954
+
3955
+ ClearUnpinned();
3956
+
3957
+ //Grafreed.Assert(group != null);
3958
+ //Grafreed.Assert(group.selection != null);
3959
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3960
+ if (group.selection == null || group.selection.size() == 1)
3961
+ EditSelection(false);
30563962 keepparent = group.parent;
30573963 // PARENT = NULL or not???
30583964 //group.parent = null; // ROOT
30593965 //group.attributes = -1;
30603966 ResetModel();
3967
+
3968
+ cameraView.requestFocusInWindow();
30613969 refreshContents(true);
3062
- }
3970
+ } else if (event.getSource() == editCameraItem)
3971
+ {
3972
+ cameraView.ProtectCamera();
3973
+ cameraView.requestFocusInWindow();
3974
+ cameraView.repaint();
3975
+ return;
3976
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3977
+ {
3978
+ cameraView.RevertCamera();
3979
+ cameraView.requestFocusInWindow();
3980
+ cameraView.repaint();
3981
+ return;
3982
+ // } else if (event.getSource() == textureButton)
3983
+ // {
3984
+ // return; // true;
3985
+ }
30633986 else
30643987 {
30653988 //return super.action(event, arg);
....@@ -3068,7 +3991,6 @@
30683991 }
30693992
30703993 boolean useclient = false;
3071
- cRadio radio;
30723994
30733995 void ToggleRoot()
30743996 {
....@@ -3120,6 +4042,28 @@
31204042 refreshContents();
31214043 }
31224044
4045
+ void TransformChildren()
4046
+ {
4047
+ Object3D obj;
4048
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4049
+ {
4050
+ obj = (Object3D)e.nextElement();
4051
+ obj.KeepTextureMatrices();
4052
+ obj.TransformChildren();
4053
+ obj.RestoreTextureMatrices();
4054
+
4055
+// if (obj.parent == null)
4056
+// {
4057
+// System.out.println("NULL PARENT!");
4058
+// new Exception().printStackTrace();
4059
+// }
4060
+// else
4061
+// TouchTransform(obj);
4062
+// //obj.parent.Touch();
4063
+ }
4064
+
4065
+ refreshContents();
4066
+ }
31234067
31244068 void ResetTransform()
31254069 {
....@@ -3232,7 +4176,7 @@
32324176 refreshContents();
32334177 }
32344178
3235
- void ResetCentroid()
4179
+ void ResetCentroid(boolean full)
32364180 {
32374181 Object3D obj;
32384182 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3247,12 +4191,16 @@
32474191 LA.matIdentity(Object3D.mat);
32484192 obj.getBounds(minima, maxima, false);
32494193 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3250
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4194
+ if (full)
4195
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32514196 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32524197 obj.TransformMesh(Object3D.mat);
4198
+
32534199 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3254
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4200
+ if (full)
4201
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32554202 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4203
+
32564204 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32574205 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32584206 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3281,7 +4229,8 @@
32814229
32824230 int size = obj.MemorySize();
32834231
3284
- System.err.println((size/1024) + " KB is the size of " + obj);
4232
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4233
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32854234 }
32864235 }
32874236 catch (Exception e)
....@@ -3318,9 +4267,9 @@
33184267 obj = (Object3D)e.nextElement();
33194268
33204269 System.out.println("Object is: " + obj);
3321
- GrafreeD.AnalyzeObject(obj);
4270
+ Grafreed.AnalyzeObject(obj);
33224271 System.out.println("Boundary rep: " + obj.bRep);
3323
- GrafreeD.AnalyzeObject(obj.bRep);
4272
+ Grafreed.AnalyzeObject(obj.bRep);
33244273
33254274 // System.err.println((size/1024) + " KB is the size of " + obj);
33264275 }
....@@ -3362,6 +4311,13 @@
33624311 void GenNormals(boolean crease)
33634312 {
33644313 group.GenNormalsS(crease);
4314
+
4315
+ refreshContents();
4316
+ }
4317
+
4318
+ void GenNormalsMESH()
4319
+ {
4320
+ group.GenNormalsMeshS();
33654321
33664322 refreshContents();
33674323 }
....@@ -3534,8 +4490,8 @@
35344490
35354491 void ParseVertices()
35364492 {
3537
- boolean epsequal = GrafreeD.epsequal;
3538
- GrafreeD.epsequal = true;
4493
+ boolean epsequal = Grafreed.epsequal;
4494
+ Grafreed.epsequal = true;
35394495
35404496 for (int i=0; i<group.selection.size(); i++)
35414497 {
....@@ -3560,7 +4516,7 @@
35604516 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35614517 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35624518
3563
- g.add(GrafreeD.clipboard);
4519
+ g.add(Grafreed.clipboard);
35644520
35654521 buffer.add(g);
35664522 }
....@@ -3575,7 +4531,7 @@
35754531 makeSomething(buffer, i==group.selection.size()-1);
35764532 }
35774533
3578
- GrafreeD.epsequal = epsequal;
4534
+ Grafreed.epsequal = epsequal;
35794535
35804536 refreshContents();
35814537 }
....@@ -3593,7 +4549,16 @@
35934549 String pigment = Object3D.GetPigment(tex);
35944550 //String bump = Object3D.GetBump(tex);
35954551
3596
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4552
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4553
+
4554
+ try
4555
+ {
4556
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4557
+ }
4558
+ catch (Exception e)
4559
+ {
4560
+ System.err.println("FAIL: " + node);
4561
+ }
35974562
35984563 double s = v.s;
35994564
....@@ -3725,7 +4690,7 @@
37254690 return;
37264691
37274692 Object3D poses = group.selection.get(0);
3728
- Object3D ref = GrafreeD.clipboard.get(0);
4693
+ Object3D ref = Grafreed.clipboard.get(0);
37294694
37304695 Object3D newgroup = new Object3D("Po:" + poses.name);
37314696
....@@ -3919,9 +4884,9 @@
39194884
39204885 void ClipMesh()
39214886 {
3922
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4887
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39234888 {
3924
- Object3D content = GrafreeD.clipboard.get(0);
4889
+ Object3D content = Grafreed.clipboard.get(0);
39254890
39264891 if (content instanceof cGroup && ((cGroup)content).transientlink )
39274892 content = ((cGroup)content).get(0);
....@@ -3930,7 +4895,7 @@
39304895 // {
39314896 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39324897 // }
3933
- group.selection.ClipMesh(GrafreeD.clipboard);
4898
+ group.selection.ClipMesh(Grafreed.clipboard);
39344899 }
39354900 // group.selection.ClipMesh(GrafreeD.clipboard);
39364901 System.out.println("DONE.");
....@@ -3977,6 +4942,18 @@
39774942 void MarkLeaves(boolean hide)
39784943 {
39794944 group.selection.MarkLeaves(hide);
4945
+ refreshContents();
4946
+ }
4947
+
4948
+ void RewindLeaves(boolean hide)
4949
+ {
4950
+ group.selection.RewindLeaves(hide);
4951
+ refreshContents();
4952
+ }
4953
+
4954
+ void RandomLeaves(boolean hide)
4955
+ {
4956
+ group.selection.RandomLeaves(hide);
39804957 refreshContents();
39814958 }
39824959
....@@ -4051,28 +5028,25 @@
40515028 // }
40525029 // }
40535030
4054
- static boolean allparams = true;
4055
-
4056
- static Vector<Object3D> listUI = new Vector<Object3D>();
4057
-
40585031 void EditSelection(boolean newWindow)
40595032 {
5033
+ if (group.selection == null)
5034
+ {
5035
+ EditElement(group, newWindow); // ? new
5036
+ return;
5037
+ }
5038
+
40605039 // aConstraints.gridy = 0;
40615040 for (int i=0; i<group.selection.size(); i++)
40625041 {
40635042 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40645043 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4065
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5044
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40665045
40675046 Object3D elem = (Object3D)group.selection.elementAt(i);
4068
- if(elem != group)
5047
+ if(elem != group || !newWindow)
40695048 {
4070
- // if (!(elem instanceof Composite))
4071
- // newWindow = false;
4072
- listUI.add(elem);
4073
- elem.openEditWindow(this, newWindow); //, false);
4074
- System.out.println("edit : " + elem);
4075
- elem.editWindow.refreshContents(true); // ? new
5049
+ EditElement(elem, newWindow); // ? new
40765050 }
40775051 }
40785052 }
....@@ -4135,9 +5109,7 @@
41355109
41365110 freezemodel = false;
41375111 }
4138
-
4139
- boolean flashIt = true;
4140
-
5112
+
41415113 public void valueChanged(TreeSelectionEvent e)
41425114 //public boolean handleEvent(Event event)
41435115 {
....@@ -4147,7 +5119,8 @@
41475119 //new Exception().printStackTrace();
41485120
41495121 freezemodel = true;
4150
-
5122
+ ClearUnpinned();
5123
+
41515124 /**/
41525125 //switch (event.id)
41535126 {
....@@ -4155,7 +5128,6 @@
41555128 //case 702: // Event.LIST_DESELECT
41565129 group.deselectAll();
41575130 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4158
- objEditor.ClearInfo(); // .GetMaterial());
41595131 if (tps != null)
41605132 {
41615133 for (int i=0; i < tps.length; i++)
....@@ -4164,10 +5136,8 @@
41645136
41655137 //if (child.parent != null)
41665138 //child.parent.addSelectee(child);
5139
+ objEditor.SetMaterial(child);
41675140 group.addSelectee(child);
4168
- objEditor.SetMaterial(child); // .GetMaterial());
4169
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4170
- System.err.println("info : " + child.GetPath());
41715141 }
41725142 }
41735143 // else
....@@ -4177,20 +5147,28 @@
41775147 // System.err.println("info : " + group.GetPath());
41785148 // }
41795149
4180
- objEditor.SetText(); // jan 2014
4181
-
4182
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5150
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41835151 CameraPane.flash = true;
41845152
4185
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5153
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41865154 // a camera
41875155 {
4188
- CameraPane.camerachangeframe = 0; // don't refuse it
4189
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5156
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5157
+ {
5158
+ CameraPane.camerachangeframe = 0; // don't refuse it
5159
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5160
+ }
41905161 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41915162 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41925163 }
41935164
5165
+ if (tps != null && tps.length == 1)
5166
+ {
5167
+ EditSelection(false);
5168
+ }
5169
+
5170
+ SetPinStates(tps != null && tps.length > 0);
5171
+
41945172 refreshContents();
41955173 //return true;
41965174 }
....@@ -4199,6 +5177,37 @@
41995177
42005178 freezemodel = false;
42015179 }
5180
+
5181
+ void SetPinStates(boolean enabled)
5182
+ {
5183
+ editButton.setEnabled(enabled);
5184
+ uneditButton.setEnabled(enabled);
5185
+ //unselectButton.setEnabled(enabled);
5186
+ flashSelectionButton.setEnabled(enabled);
5187
+
5188
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5189
+ }
5190
+
5191
+ void refreshContents(boolean cp)
5192
+ {
5193
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5194
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5195
+ {
5196
+ objEditor.ClearInfo(); // .GetMaterial());
5197
+
5198
+ for (int i=0; i < group.selection.Size(); i++)
5199
+ {
5200
+ Object3D child = (Object3D) group.selection.get(i);
5201
+
5202
+ objEditor.AddInfo(child, this, true);
5203
+ System.err.println("info : " + child.GetPath());
5204
+ }
5205
+
5206
+ objEditor.SetText(); // jan 2014
5207
+ }
5208
+
5209
+ super.refreshContents(cp);
5210
+ }
42025211
42035212 void linkSomething(Object3D thing)
42045213 {
....@@ -4270,16 +5279,19 @@
42705279 {
42715280 if (group.selection.isEmpty())
42725281 return;
4273
- GrafreeD.clipboardIsTempGroup = false;
5282
+
5283
+ Grafreed.clipboardIsTempGroup = false;
42745284 Composite tGroup = null;
42755285 if (group.selection.size() > 0) // 1)
42765286 {
42775287 tGroup = new cGroup();
4278
- GrafreeD.clipboardIsTempGroup = true;
5288
+ Grafreed.clipboardIsTempGroup = true;
42795289 }
42805290
42815291 if (cut)
42825292 {
5293
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5294
+// Save();
42835295 //int indices[] = jList.getSelectedIndices();
42845296 //for (int i = indices.length - 1; i >= 0; i--)
42855297 //jList.remove(indices[i]);
....@@ -4315,16 +5327,16 @@
43155327 //System.out.println("cut " + child);
43165328 //System.out.println("parent = " + child.parent);
43175329 // tmp.addChild(child);
4318
- if (GrafreeD.clipboardIsTempGroup)
5330
+ if (Grafreed.clipboardIsTempGroup)
43195331 tGroup.add/*Child*/(tmp);
43205332 else
4321
- GrafreeD.clipboard = tmp;
5333
+ Grafreed.clipboard = tmp;
43225334 }
43235335 else
4324
- if (GrafreeD.clipboardIsTempGroup)
5336
+ if (Grafreed.clipboardIsTempGroup)
43255337 tGroup.add/*Child*/(child);
43265338 else
4327
- GrafreeD.clipboard = child;
5339
+ Grafreed.clipboard = child;
43285340 }
43295341
43305342 //ResetModel();
....@@ -4356,21 +5368,23 @@
43565368 //System.out.println("cut " + elem);
43575369 //System.out.println("parent = " + elem.parent);
43585370 // tmp.addChild(elem);
4359
- if (GrafreeD.clipboardIsTempGroup)
5371
+ if (Grafreed.clipboardIsTempGroup)
43605372 tGroup.add/*Child*/(tmp);
43615373 else
4362
- GrafreeD.clipboard = tmp;
5374
+ Grafreed.clipboard = tmp;
43635375 }
43645376 else
4365
- if (GrafreeD.clipboardIsTempGroup)
5377
+ if (Grafreed.clipboardIsTempGroup)
43665378 tGroup.add/*Child*/(child);
43675379 else
4368
- GrafreeD.clipboard = child;
5380
+ Grafreed.clipboard = child;
43695381 }
43705382
43715383 }
4372
- if (GrafreeD.clipboardIsTempGroup)
4373
- GrafreeD.clipboard = tGroup;
5384
+
5385
+ if (Grafreed.clipboardIsTempGroup)
5386
+ Grafreed.clipboard = tGroup;
5387
+
43745388 if (cut)
43755389 {
43765390 ResetModel();
....@@ -4380,11 +5394,15 @@
43805394
43815395 void paste(boolean expand)
43825396 {
5397
+ if (Globals.REPLACEONMAKE)
5398
+ Save();
5399
+ boolean keep = Globals.REPLACEONMAKE;
5400
+ Globals.REPLACEONMAKE = false;
43835401 // if (GrafreeD.clipboard == null)
43845402 // return;
43855403 boolean first = true;
43865404
4387
- if (GrafreeD.clipboardIsTempGroup)
5405
+ if (Grafreed.clipboardIsTempGroup)
43885406 {
43895407 Composite temp;
43905408
....@@ -4395,7 +5413,7 @@
43955413 temp = (Composite)Applet3D.clipboard.deepCopy();
43965414 */
43975415 Object3D elem;
4398
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5416
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43995417 {
44005418 Object3D child = (Object3D)e.nextElement();
44015419
....@@ -4429,16 +5447,17 @@
44295447 //Object3D cb = Applet3D.clipboard;
44305448 //temp.addChild(cb);
44315449 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4432
- assert(GrafreeD.clipboard.parent == null);
4433
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4434
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4435
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4436
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5450
+ assert(Grafreed.clipboard.parent == null);
5451
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5452
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5453
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5454
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44375455 else
4438
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4439
- GrafreeD.clipboard.get(0).parent = keepparent;
5456
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5457
+ Grafreed.clipboard.get(0).parent = keepparent;
44405458 }
44415459
5460
+ Globals.REPLACEONMAKE = keep;
44425461 ResetModel();
44435462 refreshContents();
44445463 }
....@@ -4485,9 +5504,9 @@
44855504 {
44865505 boolean first = true;
44875506
4488
- if (GrafreeD.clipboardIsTempGroup)
5507
+ if (Grafreed.clipboardIsTempGroup)
44895508 {
4490
- Composite temp = (Composite)GrafreeD.clipboard;
5509
+ Composite temp = (Composite)Grafreed.clipboard;
44915510 Object3D copy;
44925511 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44935512 {
....@@ -4497,7 +5516,7 @@
44975516 }
44985517 } else
44995518 {
4500
- linkSomething(GrafreeD.clipboard); //.get(0));
5519
+ linkSomething(Grafreed.clipboard); //.get(0));
45015520 }
45025521 }
45035522 }
....@@ -4574,6 +5593,10 @@
45745593
45755594 void group(Object3D csg, boolean grab)
45765595 {
5596
+ if (Globals.REPLACEONMAKE)
5597
+ Save();
5598
+ boolean keep = Globals.REPLACEONMAKE;
5599
+ Globals.REPLACEONMAKE = false;
45775600 if (//false) // why??
45785601 !group.selection.isEmpty())
45795602 {
....@@ -4687,10 +5710,15 @@
46875710 //node.add(csg);
46885711 //makeSomething(node);
46895712 makeSomething(csg);
5713
+ Globals.REPLACEONMAKE = keep;
46905714 }
46915715
46925716 void Ungroup(Object3D g)
46935717 {
5718
+ if (Globals.REPLACEONMAKE)
5719
+ Save();
5720
+ boolean keep = Globals.REPLACEONMAKE;
5721
+ Globals.REPLACEONMAKE = false;
46945722 if (g instanceof HiddenObject)
46955723 {
46965724 HiddenObject h = (HiddenObject) g;
....@@ -4707,6 +5735,7 @@
47075735 objEditor.makeSomething(g.get(i), false);
47085736 }
47095737 }
5738
+ Globals.REPLACEONMAKE = keep;
47105739 }
47115740
47125741 void ungroup()
....@@ -4902,21 +5931,6 @@
49025931 }
49035932 */
49045933
4905
- void ImportGFD()
4906
- {
4907
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4908
- browser.show();
4909
- String filename = browser.getFile();
4910
- if (filename != null && filename.length() > 0)
4911
- {
4912
- String fullname = browser.getDirectory() + filename;
4913
-
4914
- //Object3D readobj =
4915
- objEditor.ReadGFD(fullname, objEditor);
4916
- //makeSomething(readobj);
4917
- }
4918
- }
4919
-
49205934 /*
49215935 public void Callback(Object obj)
49225936 {
....@@ -4940,26 +5954,9 @@
49405954 }
49415955 */
49425956
4943
- void ImportVRMLX3D()
4944
- {
4945
- if (GrafreeD.standAlone)
4946
- {
4947
- /**/
4948
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4949
- browser.show();
4950
- String filename = browser.getFile();
4951
- if (filename != null && filename.length() > 0)
4952
- {
4953
- String fullname = browser.getDirectory() + filename;
4954
- LoadVRMLX3D(fullname);
4955
- }
4956
- /**/
4957
- }
4958
- }
4959
-
49605957 String GetFile(String dialogName)
49615958 {
4962
- if (GrafreeD.standAlone)
5959
+ if (Grafreed.standAlone)
49635960 {
49645961 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49655962 browser.show();
....@@ -5027,7 +6024,43 @@
50276024 cButton clearpanelButton;
50286025 cButton unselectButton;
50296026
6027
+ cButton restoreCameraButton;
6028
+
50306029 cButton oneStepButton;
6030
+
6031
+ cButton groupButton;
6032
+ cButton ungroupButton;
6033
+ cButton compositeButton;
6034
+ cButton switchButton;
6035
+ cButton loopButton;
6036
+ cButton textureButton;
6037
+
6038
+ cButton skybox1Button;
6039
+ cButton skybox2Button;
6040
+ cButton skybox3Button;
6041
+ cButton skybox4Button;
6042
+ cButton skybox5Button;
6043
+ cButton skybox6Button;
6044
+ cButton skybox7Button;
6045
+
6046
+ cButton skybox11Button;
6047
+ cButton skybox12Button;
6048
+ cButton skybox13Button;
6049
+ cButton skybox14Button;
6050
+ cButton skybox15Button;
6051
+ cButton skybox16Button;
6052
+ cButton skybox17Button;
6053
+
6054
+ cButton gridButton;
6055
+ cButton boxButton;
6056
+ cButton sphereButton;
6057
+ cButton coneButton;
6058
+ cButton torusButton;
6059
+ cButton superButton;
6060
+ cButton kleinButton;
6061
+ cButton particlesButton;
6062
+ cButton overlayButton;
6063
+ cButton lightButton;
50316064
50326065 cButton screenfitButton;
50336066 cButton screenfitpointButton;
....@@ -5040,14 +6073,6 @@
50406073
50416074 cButton setsupportButton;
50426075
5043
- cButton twoButton;
5044
- cButton sixButton;
5045
- cButton threeButton;
5046
- cButton sevenButton;
5047
- cButton fourButton; // full panel
5048
- cButton oneButton; // full XYZ
5049
- //cButton currentLayout;
5050
-
50516076 //
50526077 //Composite
50536078 Object3D // to do !!
....@@ -5057,9 +6082,11 @@
50576082 //JTree jTree;
50586083 private MenuItem lookAtItem;
50596084 private MenuItem lookFromItem;
5060
- private MenuItem switchItem;
6085
+ private MenuItem switchViewItem;
50616086 private MenuItem cutItem;
5062
- private MenuItem duplicateItem;
6087
+ private MenuItem undoItem;
6088
+ private MenuItem redoItem;
6089
+ private JMenuItem duplicateItem;
50636090 private MenuItem cloneItem;
50646091 private MenuItem cloneSupportItem;
50656092 private MenuItem overwriteGeoItem;
....@@ -5072,7 +6099,7 @@
50726099 private MenuItem linkverticesItem;
50736100 private MenuItem relinkverticesItem;
50746101 private MenuItem setMasterItem;
5075
- private MenuItem resetMeshItem;
6102
+ private MenuItem resetAllItem;
50766103 private MenuItem stepAllItem;
50776104 private MenuItem revertMeshItem;
50786105 private MenuItem poseMeshItem;
....@@ -5087,7 +6114,7 @@
50876114 private MenuItem pasteLinkItem;
50886115 private MenuItem pasteCloneItem;
50896116 private MenuItem pasteExpandItem;
5090
- private MenuItem clearItem;
6117
+ private MenuItem deleteItem;
50916118 private MenuItem clearAllItem;
50926119 private MenuItem genUVItem;
50936120 private MenuItem genNormalsMESHItem;
....@@ -5122,6 +6149,10 @@
51226149 private MenuItem showleavesItem;
51236150 private MenuItem markleavesItem;
51246151 private MenuItem unmarkleavesItem;
6152
+ private MenuItem rewindleavesItem;
6153
+ private MenuItem unrewindleavesItem;
6154
+ private MenuItem randomleavesItem;
6155
+ private MenuItem unrandomleavesItem;
51256156
51266157 private MenuItem flipVItem;
51276158 private MenuItem unflipVItem;
....@@ -5133,15 +6164,17 @@
51336164 private MenuItem panoTexturesItem;
51346165
51356166 private MenuItem resetCentroidItem;
5136
- private MenuItem transformgeometryItem;
6167
+ private MenuItem resetCentroidXZItem;
51376168 private MenuItem resetTransformItem;
6169
+ private MenuItem transformGeometryItem;
6170
+ private MenuItem transformChildrenItem;
51386171 private MenuItem hideItem;
51396172 private MenuItem grabItem;
51406173 private MenuItem backItem;
51416174 private MenuItem frontItem;
51426175 private MenuItem cameraItem;
51436176 private MenuItem compositeItem;
5144
- private MenuItem randomItem;
6177
+ private MenuItem switchItem;
51456178 private MenuItem physicsItem;
51466179 private MenuItem frameselectorItem;
51476180 private MenuItem scriptNodeItem;
....@@ -5165,6 +6198,8 @@
51656198 private MenuItem attachBumpItem;
51666199 private MenuItem detachBumpItem;
51676200 private MenuItem pigmentBumpItem;
6201
+ private MenuItem embedTexturesItem;
6202
+ private MenuItem deEmbedTexturesItem;
51686203
51696204 private MenuItem particleItem;
51706205 private MenuItem ragdollItem;
....@@ -5203,11 +6238,6 @@
52036238 private MenuItem doubleItem;
52046239 private MenuItem tripleItem;
52056240
5206
- private MenuItem importGFDItem;
5207
- private MenuItem importVRMLX3DItem;
5208
- private MenuItem import3DSItem;
5209
- private MenuItem importOBJItem;
5210
-
52116241 private MenuItem computeAOItem;
52126242 private MenuItem recompileItem;
52136243 private MenuItem editScriptItem;
....@@ -5217,4 +6247,8 @@
52176247 private MenuItem analyzeItem;
52186248 private MenuItem dumpItem;
52196249 //boolean freezemodel = false;
6250
+
6251
+ Menu cameraMenu;
6252
+ MenuItem editCameraItem;
6253
+ MenuItem restoreCameraItem;
52206254 }