Normand Briere
2019-08-08 8294241adc5fe698b70e13ebd6780af46ab83f7e
GroupEditor.java
....@@ -12,9 +12,11 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1820 ObjectUI,
1921 Runnable,
2022 ActionListener,
....@@ -22,6 +24,335 @@
2224 DragGestureListener, DragSourceListener, DropTargetListener,
2325 ItemListener // ListSelectionListener
2426 {
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 AddTextureButton(String f, final String t, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(f + "s");
51
+ textureButton.addActionListener(new ActionListener()
52
+ {
53
+ @Override
54
+ public void actionPerformed(ActionEvent e)
55
+ {
56
+ ChangeTexture(path + t);
57
+ }
58
+ });
59
+ }
60
+
61
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
62
+ {
63
+ cGridBag tab0 = new cGridBag().setVertical(true);
64
+
65
+ tab0.setName("Urban");
66
+ skyboxpanel.add(tab0);
67
+
68
+ cGridBag row0 = new cGridBag();
69
+ cGridBag row1 = new cGridBag();
70
+ cGridBag row2 = new cGridBag();
71
+ cGridBag row3 = new cGridBag();
72
+ cGridBag row4 = new cGridBag();
73
+ cGridBag row5 = new cGridBag();
74
+ cGridBag row6 = new cGridBag();
75
+
76
+ AddSkyboxButton("default", "rgb", row0);
77
+ //AddSkyboxButton("default", "cornell", row0);
78
+ AddSkyboxButton("penguins", "dust", row0);
79
+ AddSkyboxButton("penguins", "tropic", row0);
80
+ AddSkyboxButton("penguins", "yonder", row0);
81
+
82
+ AddSkyboxButton("default", "uffizi", row1);
83
+ AddSkyboxButton("bridge", "Bridge", row1);
84
+ AddSkyboxButton("bridge", "Bridge2", row1);
85
+ AddSkyboxButton("urban", "GamlaStan2", row1);
86
+
87
+ AddSkyboxButton("urban", "Parliament", row2);
88
+ AddSkyboxButton("urban", "Roundabout", row2);
89
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
90
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
91
+
92
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
93
+ AddSkyboxButton("urban", "UnionSquare", row3);
94
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
95
+ AddSkyboxButton("park", "BerzeliiPark", row3);
96
+
97
+ AddSkyboxButton("park", "Buddha", row4);
98
+ AddSkyboxButton("park", "CNTower2", row4);
99
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
100
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
101
+
102
+ AddSkyboxButton("park", "Park", row5);
103
+ AddSkyboxButton("park", "Pond", row5);
104
+ AddSkyboxButton("park", "Skansen", row5);
105
+ AddSkyboxButton("park", "Skansen2", row5);
106
+
107
+ AddSkyboxButton("park", "Skansen3", row6);
108
+ AddSkyboxButton("park", "Skansen4", row6);
109
+ AddSkyboxButton("park", "Skansen5", row6);
110
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
111
+
112
+ tab0.add(row0);
113
+ tab0.add(row1);
114
+ tab0.add(row2);
115
+ tab0.add(row3);
116
+ tab0.add(row4);
117
+ tab0.add(row5);
118
+ tab0.add(row6);
119
+
120
+ for (int i=5; --i>=0;)
121
+ {
122
+ //oe.toolboxPanel.Return();
123
+ //tab0.add(new cGridBag());
124
+ }
125
+ }
126
+
127
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
128
+ {
129
+ cGridBag tab0 = new cGridBag().setVertical(true);
130
+
131
+ tab0.setName("Nature");
132
+ skyboxpanel.add(tab0);
133
+
134
+ cGridBag row0 = new cGridBag();
135
+ cGridBag row1 = new cGridBag();
136
+ cGridBag row2 = new cGridBag();
137
+ cGridBag row3 = new cGridBag();
138
+ cGridBag row4 = new cGridBag();
139
+ cGridBag row5 = new cGridBag();
140
+ cGridBag row6 = new cGridBag();
141
+
142
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
143
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
144
+ AddSkyboxButton("beach", "PalmTrees", row0);
145
+ AddSkyboxButton("beach", "Tenerife", row0);
146
+
147
+ AddSkyboxButton("beach", "Tenerife2", row1);
148
+ AddSkyboxButton("beach", "Tenerife3", row1);
149
+ AddSkyboxButton("field", "FishPond", row1);
150
+ AddSkyboxButton("field", "Footballfield", row1);
151
+
152
+ AddSkyboxButton("field", "Meadow", row2);
153
+ AddSkyboxButton("field", "Sorsele", row2);
154
+ AddSkyboxButton("field", "Sorsele2", row2);
155
+ AddSkyboxButton("field", "Sorsele3", row2);
156
+
157
+ AddSkyboxButton("forest", "Brudslojan", row3);
158
+ AddSkyboxButton("forest", "Langholmen2", row3);
159
+ AddSkyboxButton("forest", "Plants", row3);
160
+ AddSkyboxButton("mountain", "Maskonaive", row3);
161
+
162
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
163
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
164
+ AddSkyboxButton("mountain", "Teide", row4);
165
+ AddSkyboxButton("park", "Tantolunden4", row4);
166
+
167
+ AddSkyboxButton("park", "Stairs", row5);
168
+ AddSkyboxButton("default", "skycube", row6);
169
+ AddSkyboxButton("rocky", "Langholmen", row5);
170
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
171
+
172
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
173
+ AddSkyboxButton("default", "CloudyHills", row6);
174
+ AddSkyboxButton("daz", "Autumn", row6);
175
+ AddSkyboxButton("daz", "MountainTrail", row6);
176
+ /*
177
+Autumn
178
+Greenlands
179
+MountainTrail
180
+Oasis
181
+TheRock
182
+TopOfTheWorld
183
+Winter
184
+ */
185
+
186
+ tab0.add(row0);
187
+ tab0.add(row1);
188
+ tab0.add(row2);
189
+ tab0.add(row3);
190
+ tab0.add(row4);
191
+ tab0.add(row5);
192
+ tab0.add(row6);
193
+
194
+ for (int i=5; --i>=0;)
195
+ {
196
+ //oe.toolboxPanel.Return();
197
+ //tab0.add(new cGridBag());
198
+ }
199
+ }
200
+
201
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
202
+ {
203
+ cGridBag tab0 = new cGridBag().setVertical(true);
204
+
205
+ tab0.setName("Night");
206
+ skyboxpanel.add(tab0);
207
+
208
+ cGridBag row0 = new cGridBag();
209
+ cGridBag row1 = new cGridBag();
210
+ cGridBag row2 = new cGridBag();
211
+ cGridBag row3 = new cGridBag();
212
+ cGridBag row4 = new cGridBag();
213
+ cGridBag row5 = new cGridBag();
214
+ cGridBag row6 = new cGridBag();
215
+
216
+ AddSkyboxButton("night", "NightPath", row0);
217
+ AddSkyboxButton("night", "PondNight", row0);
218
+ AddSkyboxButton("night", "Powerlines", row0);
219
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
220
+
221
+ AddSkyboxButton("urban", "CNTower", row1);
222
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
223
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
224
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
225
+
226
+ AddSkyboxButton("penguins", "kenon_star", row2);
227
+ AddSkyboxButton("persson", "corona", row2);
228
+ AddSkyboxButton("persson", "spaceskybox", row2);
229
+ AddSkyboxButton("indoors", "Vasa", row2);
230
+
231
+ AddSkyboxButton("winter", "Backyard", row3);
232
+ AddSkyboxButton("winter", "Creek", row3);
233
+ AddSkyboxButton("winter", "FootballField3", row3);
234
+ AddSkyboxButton("winter", "Forest", row3);
235
+
236
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
237
+ AddSkyboxButton("winter", "House", row4);
238
+ AddSkyboxButton("winter", "IceLake", row4);
239
+ AddSkyboxButton("winter", "IceRiver", row4);
240
+
241
+ AddSkyboxButton("winter", "Park3", row5);
242
+ AddSkyboxButton("winter", "PondWinter", row5);
243
+ AddSkyboxButton("winter", "Tantolunden5", row5);
244
+ AddSkyboxButton("winter", "Vindelalven", row5);
245
+
246
+ AddSkyboxButton("daz", "TheRock", row6);
247
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
248
+ AddSkyboxButton("daz", "Winter", row6);
249
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
250
+
251
+ tab0.add(row0);
252
+ tab0.add(row1);
253
+ tab0.add(row2);
254
+ tab0.add(row3);
255
+ tab0.add(row4);
256
+ tab0.add(row5);
257
+ tab0.add(row6);
258
+
259
+ for (int i=5; --i>=0;)
260
+ {
261
+ //oe.toolboxPanel.Return();
262
+ //tab0.add(new cGridBag());
263
+ }
264
+ }
265
+
266
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
267
+ {
268
+ cGridBag tab0 = new cGridBag().setVertical(true);
269
+
270
+ tab0.setName("Others");
271
+ skyboxpanel.add(tab0);
272
+
273
+ cGridBag row0 = new cGridBag();
274
+ cGridBag row1 = new cGridBag();
275
+ cGridBag row2 = new cGridBag();
276
+ cGridBag row3 = new cGridBag();
277
+ cGridBag row4 = new cGridBag();
278
+ cGridBag row5 = new cGridBag();
279
+ cGridBag row6 = new cGridBag();
280
+
281
+ AddSkyboxButton("mayhem", "afterrain", row0);
282
+ AddSkyboxButton("mayhem", "aqua4", row0);
283
+ AddSkyboxButton("mayhem", "aqua9", row0);
284
+ AddSkyboxButton("mayhem", "flame", row0);
285
+
286
+ AddSkyboxButton("mayhem", "h2s", row1);
287
+ AddSkyboxButton("mayhem", "prehistoric", row1);
288
+ AddSkyboxButton("mayhem", "scorched", row1);
289
+ AddSkyboxButton("penguins", "desertdawn", row1);
290
+
291
+ AddSkyboxButton("persson", "Citadella", row2);
292
+ AddSkyboxButton("persson", "Citadella2", row2);
293
+ AddSkyboxButton("persson", "clouds1", row2);
294
+ AddSkyboxButton("penguins", "wrath", row2);
295
+
296
+ AddSkyboxButton("persson", "FishermansBastion", row3);
297
+ AddSkyboxButton("persson", "HeroesSquare", row3);
298
+ AddSkyboxButton("indoors", "DallasW", row3);
299
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
300
+
301
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
302
+ AddSkyboxButton("persson", "PereaBeach1", row4);
303
+ AddSkyboxButton("persson", "PereaBeach2", row4);
304
+ AddSkyboxButton("persson", "redeclipse", row4);
305
+
306
+ AddSkyboxButton("daz", "Greenlands", row5);
307
+ AddSkyboxButton("daz", "Oasis", row5);
308
+ AddSkyboxButton("elyvisions", "arch3", row5);
309
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
310
+
311
+ AddSkyboxButton("elyvisions", "rainbow", row6);
312
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
313
+ AddSkyboxButton("elyvisions", "heaven", row6);
314
+ AddSkyboxButton("elyvisions", "hot", row6);
315
+
316
+ tab0.add(row0);
317
+ tab0.add(row1);
318
+ tab0.add(row2);
319
+ tab0.add(row3);
320
+ tab0.add(row4);
321
+ tab0.add(row5);
322
+ tab0.add(row6);
323
+
324
+ for (int i=5; --i>=0;)
325
+ {
326
+ //oe.toolboxPanel.Return();
327
+ //tab0.add(new cGridBag());
328
+ }
329
+ }
330
+
331
+ public void ChangeSkybox(String skybox)
332
+ {
333
+ //cameraView.envyoff = false;
334
+ group.skyboxname = skybox;
335
+ group.skyboxext = "jpg";
336
+ cameraView.repaint();
337
+ }
338
+
339
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
340
+ {
341
+ JTabbedPane skyboxpane = new JTabbedPane();
342
+
343
+ AddSkyboxTab0(skyboxpane);
344
+ AddSkyboxTab1(skyboxpane);
345
+ AddSkyboxTab2(skyboxpane);
346
+ AddSkyboxTab3(skyboxpane);
347
+
348
+ skyboxPanel.add(skyboxpane);
349
+ }
350
+
351
+ public void ChangeTexture(String texture)
352
+ {
353
+ cameraView.repaint();
354
+ }
355
+
25356 //ObjEditor objEditor;
26357 public void closeUI2()
27358 {
....@@ -59,6 +390,12 @@
59390 this.copy = this.group = group;
60391 //selectees = this.group.selectees;
61392
393
+ if (copy.versionlist == null)
394
+ {
395
+ copy.versionlist = new Object3D[100];
396
+ copy.versionindex = -1;
397
+ }
398
+
62399 if(ui)
63400 SetupUI(objEditor);
64401 }
....@@ -73,16 +410,28 @@
73410 this.copy = this.group = copy;
74411 //selectees = this.group.selectees;
75412
76
- SetupMenu2(objEditor);
413
+ SetupMenu2(this); //objEditor);
77414 SetupUI2(objEditor);
78415 objEditor.SetupUI(true);
79416 SetupViews(objEditor);
80417
81418 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
419
+
420
+ if (copy.versionlist == null)
421
+ {
422
+ copy.versionlist = new Object3D[100];
423
+ copy.versionindex = -1;
424
+
425
+ Save(true);
426
+ }
82427 }
83428
84429 void CloneSelection(boolean supports)
85430 {
431
+ if (Globals.REPLACEONMAKE)
432
+ Save();
433
+ boolean keep = Globals.REPLACEONMAKE;
434
+ Globals.REPLACEONMAKE = false;
86435 // Object3D keep = GrafreeD.clipboard;
87436 //Object3D obj;
88437 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +442,19 @@
93442
94443 makeSomething(clone, i==group.selection.size()-1);
95444 }
445
+ Globals.REPLACEONMAKE = keep;
96446 }
97447
98448 void CloneClipboard(boolean supports)
99449 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
450
+ assert(Grafreed.clipboard.parent == null);
451
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
452
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
453
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
454
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105455 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
456
+ makeSomething(CloneObject(Grafreed.clipboard, false));
457
+ Grafreed.clipboard.get(0).parent = keepparent;
108458 }
109459
110460 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +468,7 @@
118468 // obj.support = null;
119469 if (!supports)
120470 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
471
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122472 obj.parent = parent;
123473 // obj.support = support;
124474 // clone.support = support; // aout 2013
....@@ -147,30 +497,29 @@
147497
148498 //JTextField nameField;
149499
150
- void SetupMenu2(ObjEditor oe)
500
+ void SetupMenu2(GroupEditor oe)
151501 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
502
+ oe.jTree = new cTree();
503
+
163504 Menu menu;
164505 oe.menuBar.add(menu = new Menu("Edit"));
165506 //editItem = menu.add(new MenuItem("Edit"));
166507 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
508
+
509
+// undoItem = menu.add(new MenuItem("Undo"));
510
+// undoItem.addActionListener(this);
511
+// redoItem = menu.add(new MenuItem("Redo"));
512
+// redoItem.addActionListener(this);
513
+// menu.add("-");
514
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168515 duplicateItem.addActionListener(this);
169
- menu.add("-");
170516 cloneItem = menu.add(new MenuItem("Clone"));
171517 cloneItem.addActionListener(this);
518
+ if (Globals.ADVANCED)
519
+ {
172520 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173521 cloneSupportItem.addActionListener(this);
522
+ }
174523 menu.add("-");
175524 cutItem = menu.add(new MenuItem("Cut"));
176525 cutItem.addActionListener(this);
....@@ -178,27 +527,123 @@
178527 copyItem.addActionListener(this);
179528 pasteItem = menu.add(new MenuItem("Paste"));
180529 pasteItem.addActionListener(this);
530
+
531
+ menu.add("-");
532
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
533
+ pasteIntoItem.addActionListener(this);
181534 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182535 pasteLinkItem.addActionListener(this);
183536 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184537 pasteCloneItem.addActionListener(this);
185538 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186539 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
540
+ menu.add("-");
541
+ deleteItem = menu.add(new MenuItem("Delete"));
542
+ deleteItem.addActionListener(this);
543
+
544
+ if (Globals.ADVANCED)
545
+ {
546
+ // Deletes the cameras...
189547 clearAllItem = menu.add(new MenuItem("Clear All"));
190548 clearAllItem.addActionListener(this);
549
+ }
550
+
551
+ menuBar.add(cameraMenu = new Menu("View"));
552
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
553
+ //zBufferItem.addActionListener(this);
554
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
555
+ //normalLensItem.addActionListener(this);
556
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
557
+ restoreCameraItem.addActionListener(this);
558
+
559
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
560
+// toggleFullScreenItem.addItemListener(this);
561
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
562
+// cameraMenu.add("-");
563
+//
564
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
565
+// toggleTextureItem.addItemListener(this);
566
+// toggleTextureItem.setState(CameraPane.textureon);
567
+//
568
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
569
+// toggleSwitchItem.addItemListener(this);
570
+// toggleSwitchItem.setState(CameraPane.SWITCH);
571
+
572
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
573
+ toggleHandleItem.addItemListener(this);
574
+ toggleHandleItem.setState(CameraPane.HANDLES);
575
+
576
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
577
+ togglePaintItem.addItemListener(this);
578
+ togglePaintItem.setState(CameraPane.PAINTMODE);
579
+
580
+ if (Globals.ADVANCED)
581
+ {
582
+ cameraMenu.add("-");
583
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
584
+ toggleLiveItem.addItemListener(this);
585
+ toggleLiveItem.setState(Globals.isLIVE());
191586
587
+ cameraMenu.add(stepItem = new MenuItem("Step"));
588
+ stepItem.addActionListener(this);
589
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
590
+ // toggleDLItem.addItemListener(this);
591
+ // toggleDLItem.setState(false);
592
+
593
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
594
+ toggleRenderItem.addItemListener(this);
595
+ toggleRenderItem.setState(!CameraPane.frozen);
596
+
597
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
598
+ toggleDebugItem.addItemListener(this);
599
+ toggleDebugItem.setState(Globals.DEBUG);
600
+
601
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
602
+ toggleFrustumItem.addItemListener(this);
603
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
604
+
605
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
606
+ toggleFootContactItem.addItemListener(this);
607
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
608
+
609
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
610
+ toggleTimelineItem.addItemListener(this);
611
+ }
612
+
613
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
614
+// toggleRootItem.addItemListener(this);
615
+// toggleRootItem.setState(false);
616
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
617
+// animationItem.addItemListener(this);
618
+// animationItem.setState(CameraPane.ANIMATION);
619
+ cameraMenu.add("-");
620
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
621
+ editCameraItem.addActionListener(this);
622
+
623
+ if (Globals.ADVANCED)
624
+ {
625
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
626
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
627
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
628
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
629
+ oe.cameraMenu.add("-");
630
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
631
+ openWindowItem.addActionListener(this);
632
+ editLeafItem.addActionListener(this);
633
+ lookAtItem.addActionListener(this);
634
+ //lookFromItem.addActinoListener(this);
635
+ //switchViewItem.addActionListener(this);
636
+ }
637
+
192638 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
639
+ if (Globals.ADVANCED)
640
+ {
197641 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198642 revertMeshItem.addActionListener(this);
199643 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200644 resetreferencesItem.addActionListener(this);
201645 menu.add("-");
646
+ }
202647 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203648 overwriteGeoItem.addActionListener(this);
204649 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,79 +655,104 @@
210655 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211656 overwriteUVItem.addActionListener(this);
212657 menu.add("-");
658
+ if (Globals.ADVANCED)
659
+ {
213660 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214661 generateMeshItem.addActionListener(this);
215662 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216663 poseMeshItem.addActionListener(this);
217664 menu.add("-");
665
+ }
218666 resetsupportItem = menu.add(new MenuItem("Reset support"));
219667 resetsupportItem.addActionListener(this);
220668 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221669 linkverticesItem.addActionListener(this);
222670 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223671 relinkverticesItem.addActionListener(this);
672
+
673
+ if (Globals.ADVANCED)
674
+ {
224675 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225676 setMasterItem.addActionListener(this);
677
+ }
226678
227679 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
680
+// grabItem = menu.add(new MenuItem("Grab"));
681
+// grabItem.addActionListener(this);
230682 backItem = menu.add(new MenuItem("Back"));
231683 backItem.addActionListener(this);
232684 frontItem = menu.add(new MenuItem("Front"));
233685 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
686
+// compositeItem = menu.add(new MenuItem("Composite"));
687
+// compositeItem.addActionListener(this);
688
+
689
+ if (Globals.ADVANCED)
690
+ {
691
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237692 hideItem.addActionListener(this);
693
+ }
238694 ungroupItem = menu.add(new MenuItem("Ungroup"));
239695 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
696
+
697
+// menu.add("-");
698
+//
699
+// switchItem = menu.add(new MenuItem("Switch node"));
700
+// switchItem.addActionListener(this);
701
+ if (Globals.ADVANCED)
702
+ {
247703 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248704 switchGeoItem.addActionListener(this);
249705 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250706 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
707
+ morphItem = menu.add(new MenuItem("Morph Group"));
252708 morphItem.addActionListener(this);
709
+
710
+ menu.add("-");
711
+ physicsItem = menu.add(new MenuItem("Physics"));
712
+ physicsItem.addActionListener(this);
713
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
714
+ frameselectorItem.addActionListener(this);
253715 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254716 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
717
+ }
257718
258719 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
720
+// textureItem = menu.add(new MenuItem("Texture"));
721
+// textureItem.addActionListener(this);
261722 billboardItem = menu.add(new MenuItem("Billboard"));
262723 billboardItem.addActionListener(this);
263724 csgItem = menu.add(new MenuItem("CSG"));
264725 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
726
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266727 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
728
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268729 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
730
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270731 shadowZItem.addActionListener(this);
732
+ attributeItem = menu.add(new MenuItem("Attribute"));
733
+ attributeItem.addActionListener(this);
734
+
735
+ if (Globals.ADVANCED)
736
+ {
737
+ menu.add("-");
271738 linkerItem = menu.add(new MenuItem("Linker"));
272739 linkerItem.addActionListener(this);
273740 templateItem = menu.add(new MenuItem("Template"));
274741 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277742 pointflowItem = menu.add(new MenuItem("Point Flow"));
278743 pointflowItem.addActionListener(this);
744
+ }
279745 menu.add("-");
280746 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281747 resetTransformItem.addActionListener(this);
282748 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283749 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.addActionListener(this);
750
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
751
+ resetCentroidXZItem.addActionListener(this);
752
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
753
+ transformGeometryItem.addActionListener(this);
754
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
755
+ transformChildrenItem.addActionListener(this);
286756
287757 oe.menuBar.add(menu = new Menu("Geometry"));
288758 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +763,11 @@
293763 genNormalsCADItem.addActionListener(this);
294764 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295765 genNormalsMESHItem.addActionListener(this);
296
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
766
+ if (Globals.ADVANCED)
767
+ {
768
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
297769 genNormalsMINEItem.addActionListener(this);
770
+ }
298771 stripifyItem = menu.add(new MenuItem("Stripify"));
299772 stripifyItem.addActionListener(this);
300773 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +789,34 @@
316789 reduce34MeshItem.addActionListener(this);
317790 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318791 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321792 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322793 clipMeshItem.addActionListener(this);
794
+
795
+ if (Globals.ADVANCED)
796
+ {
797
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
798
+ smoothMeshItem.addActionListener(this);
799
+ }
323800
324801 oe.menuBar.add(menu = new Menu("Attributes"));
325802 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326803 clearMaterialsItem.addActionListener(this);
804
+ resetAllItem = menu.add(new MenuItem("Reset All"));
805
+ resetAllItem.addActionListener(this);
806
+ stepAllItem = menu.add(new MenuItem("Step All"));
807
+ stepAllItem.addActionListener(this);
327808 menu.add("-");
328809 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329810 liveleavesItem.addActionListener(this);
330811 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331812 unliveleavesItem.addActionListener(this);
813
+ if (Globals.ADVANCED)
814
+ {
332815 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333816 supportleavesItem.addActionListener(this);
334817 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335818 unsupportleavesItem.addActionListener(this);
819
+ }
336820 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337821 hideleavesItem.addActionListener(this);
338822 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +825,14 @@
341825 markleavesItem.addActionListener(this);
342826 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343827 unmarkleavesItem.addActionListener(this);
828
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
829
+ rewindleavesItem.addActionListener(this);
830
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
831
+ unrewindleavesItem.addActionListener(this);
832
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
833
+ randomleavesItem.addActionListener(this);
834
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
835
+ unrandomleavesItem.addActionListener(this);
344836 menu.add("-");
345837 flipVItem = menu.add(new MenuItem("Flip V"));
346838 flipVItem.addActionListener(this);
....@@ -366,45 +858,117 @@
366858 attachBumpItem.addActionListener(this);
367859 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
368860 pigmentBumpItem.addActionListener(this);
861
+ //embedTexturesItem
369862 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
370863 detachPigmentItem.addActionListener(this);
371864 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
372865 detachBumpItem.addActionListener(this);
866
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
867
+ embedTexturesItem.addActionListener(this);
868
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
869
+ deEmbedTexturesItem.addActionListener(this);
373870 menu.add("-");
374871 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
375872 sortbysizeItem.addActionListener(this);
376873 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377874 sortbynameItem.addActionListener(this);
378875 menu.add("-");
876
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
877
+ shareGeometriesItem.addActionListener(this);
878
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
879
+ mergeGeometriesItem.addActionListener(this);
880
+ if (Globals.ADVANCED)
881
+ {
882
+ // Pretty much the same as duplicate and clone.
379883 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380884 extractGeometriesItem.addActionListener(this);
381885 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382886 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
887
+ }
387888
388889 oe.menuBar.add(menu = new Menu("Insert"));
389890 buildCreateMenu(menu);
390891
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402892 oe.menuBar.add(menu = new Menu("Tools"));
403893 buildToolsMenu(menu);
404894 }
405895
896
+ JTabbedPane resourcecontainer;
897
+ cGridBag currenttab;
898
+ boolean added; // patch for jar
899
+
900
+ int tabcount = 0;
901
+ int colcount = 0;
902
+ int rowcount = 0;
903
+
904
+ int columns = 5;
905
+ int rows = 7;
906
+
907
+ public void ResourceCallBack(String[] path)
908
+ {
909
+ for (int i = 0; i < path.length; i++)
910
+ System.out.print(path[i] + "/");
911
+ System.out.println();
912
+ if (rowcount == 0)
913
+ {
914
+ currenttab = new cGridBag();
915
+ added = false;
916
+ String tabname = String.valueOf((char)('A'+tabcount));
917
+ currenttab.setName(tabname);
918
+ rowcount = 1;
919
+ }
920
+
921
+ if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
922
+ {
923
+ if (!added)
924
+ {
925
+ added = true;
926
+ resourcecontainer.add(currenttab);
927
+ String tabname = String.valueOf((char)('A'+tabcount));
928
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
929
+ }
930
+
931
+ AddTextureButton(path[0], path[1], currenttab);
932
+ if (++colcount >= columns)
933
+ {
934
+ colcount = 0;
935
+ currenttab.Return();
936
+
937
+ if (rowcount++ >= rows)
938
+ {
939
+ rowcount = 0;
940
+ }
941
+ }
942
+ }
943
+ else
944
+ {
945
+// if (!path[path.length-1].equals("icons"))
946
+// resourcecontainer.Return();
947
+ }
948
+ }
949
+
950
+ void CreateTexturePanel(cGridBag container)
951
+ {
952
+ resourcecontainer = new JTabbedPane();
953
+ container.add(resourcecontainer);
954
+
955
+ Grafreed.ParseResources("textures", this);
956
+ }
957
+
406958 void SetupUI2(ObjEditor oe)
407959 {
960
+ // June 2019
961
+ if (oe == null)
962
+ {
963
+ //super.SetupUI2(this);
964
+ //return;
965
+ }
966
+
967
+ if (copy != group)
968
+ {
969
+ //super.SetupUI2(this);
970
+ }
971
+
408972 //new Exception().printStackTrace();
409973
410974 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,150 +997,239 @@
433997 oe.radioPanel.add(dummyButton);
434998 oe.buttonGroup.add(dummyButton);
435999 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
1000
+ cGridBag copyOptionsPanel = new cGridBag();
1001
+
1002
+ copyOptionsPanel.preferredHeight = 2;
4391003
440
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
1004
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
1005
+
1006
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
+ //minButton.setToolTipText("Minimize window");
1008
+ //minButton.addActionListener(this);
1009
+
1010
+ if (Globals.ADVANCED)
1011
+ {
1012
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
+ maxButton.setToolTipText("Maximize window");
1014
+ maxButton.addActionListener(this);
1015
+ }
1016
+
1017
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ fullButton.setToolTipText("Full-screen window");
1019
+ fullButton.addActionListener(this);
1020
+
1021
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1022
+ screenfitButton.setToolTipText("Screen fit");
1023
+ screenfitButton.addActionListener(this);
1024
+
1025
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1026
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1027
+ restoreCameraButton.addActionListener(this);
1028
+
1029
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
+ saveVersionButton.setToolTipText("Duplicate current version");
1031
+ saveVersionButton.addActionListener(this);
1032
+
1033
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1034
+ deleteVersionButton.setToolTipText("Delete current version");
1035
+ deleteVersionButton.addActionListener(this);
1036
+
1037
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1038
+ previousVersionButton.setToolTipText("Previous version");
1039
+ previousVersionButton.addActionListener(this);
1040
+ previousVersionButton.setEnabled(false);
1041
+
1042
+ cGridBag updown = new cGridBag().setVertical(true);
1043
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1044
+ restoreButton.setToolTipText("Undo (restore current version)");
1045
+ restoreButton.addActionListener(this);
1046
+ //restoreButton.setEnabled(false);
1047
+
1048
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+ replaceButton.setToolTipText("Save (replace current version)");
1050
+ replaceButton.addActionListener(this);
1051
+ //replaceButton.setEnabled(false);
1052
+
1053
+ copyOptionsPanel.add(updown);
1054
+
1055
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ nextVersionButton.setToolTipText("Next version");
1057
+ nextVersionButton.addActionListener(this);
1058
+ nextVersionButton.setEnabled(false);
1059
+
1060
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1061
+ liveCB.setToolTipText("Enable animation");
4411062 liveCB.addItemListener(this);
4421063
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
445
- supportCB.addItemListener(this);
446
-
447
- // oe.aConstraints.gridx += 1;
448
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
449
- // localCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
453
- crowdCB.addItemListener(this);
454
-
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
457
- smoothCB.addItemListener(this);
458
-
459
- oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
1064
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
+ oneStepButton.setToolTipText("Animate one step forward");
1066
+ oneStepButton.addActionListener(this);
1067
+
1068
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
1069
+ fastCB.setToolTipText("Fast mode");
4611070 fastCB.addItemListener(this);
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
464
- slowCB.addItemListener(this);
465
- oe.aConstraints.gridx += 1;
466
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
467
- boxCB.addItemListener(this);
1071
+
1072
+ //oe.toolboxPanel.Return();
1073
+
1074
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1075
+// trackCB.setToolTipText("Enable tracking");
1076
+// trackCB.addItemListener(this);
4681077
469
-// oe.aConstraints.gridx += 1;
470
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
471
-// speakerMocapCB.addItemListener(this);
472
-
473
- if (false)
474
- {
475
- // handled in scripts
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
478
- speakerCameraCB.addItemListener(this);
479
-
480
- oe.aConstraints.gridx += 1;
481
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
482
- speakerFocusCB.addItemListener(this);
483
-
484
- oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
486
- smoothfocusCB.addItemListener(this);
487
- }
488
-
489
-//oe.aConstraints.gridx += 1;
490
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
491
-// debugCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
495
- oeilCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
499
- lookAtCB.addItemListener(this);
500
-
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
503
- trackCB.addItemListener(this);
504
-
505
- oe.aConstraints.gridx += 1;
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
507
- screenfitButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
5091078 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
5101079 // screenfitpointButton.addActionListener(this);
511
-// oe.aConstraints.gridx += 1;
512
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
513
- snapobjectButton.addActionListener(this);
514
- oe.aConstraints.gridx += 1;
5151080
516
- //aConstraints.gridx = 0;
517
- //aConstraints.gridy += 1;
518
- oe.aConstraints.weighty = 0;
519
- oe.aConstraints.gridwidth = 1;
520
-
521
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
522
- flashSelectionButton.addActionListener(this);
523
- oe.aConstraints.gridx += 1;
524
- oe.aConstraints.weighty = 0;
525
- oe.aConstraints.gridwidth = 1;
526
-
527
- //
528
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
529
- twoButton.addActionListener(this);
530
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
1081
+ if (Globals.ADVANCED)
1082
+ {
1083
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ snapobjectButton.addActionListener(this);
1085
+ snapobjectButton.setToolTipText("Snap Object");
1086
+
1087
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5311088 fourButton.addActionListener(this);
532
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
533
- sixButton.addActionListener(this);
534
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
1089
+ fourButton.setToolTipText("Show control panel only");
1090
+ }
1091
+
1092
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
1093
+
1094
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1095
+ twoButton.setToolTipText("Show 3D view only");
1096
+ twoButton.addActionListener(this);
1097
+ this.fullscreenLayout = twoButton;
1098
+
1099
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
+ threeButton.setToolTipText("Show controls and 3D view");
5351101 threeButton.addActionListener(this);
536
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
537
- sevenButton.addActionListener(this);
1102
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1103
+ sixButton.setToolTipText("Show 3D view and controls");
1104
+ sixButton.addActionListener(this);
1105
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
+// sevenButton.setToolTipText("3-column layout");
1107
+// sevenButton.addActionListener(this);
5381108 //
5391109
540
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
1110
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1111
+ rootButton.setToolTipText("Open selection in new tab");
5411112 rootButton.addActionListener(this);
542
- oe.aConstraints.gridx += 1;
543
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1113
+
1114
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
+ closeButton.setToolTipText("Close tab");
5441116 closeButton.addActionListener(this);
5451117 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5461118 //clearButton.addActionListener(this);
547
- oe.aConstraints.gridx += 1;
548
-
549
- oe.aConstraints.gridx = 1; //
550
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
551
- editButton.addActionListener(this);
552
- oe.aConstraints.gridx += 1;
553
- oe.aConstraints.weighty = 0;
554
- oe.aConstraints.gridwidth = 1;
5551119
556
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1120
+ cGridBag row1 = new cGridBag();
1121
+
1122
+ // INSERT
1123
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ gridButton.setToolTipText("Create grid");
1125
+ gridButton.addActionListener(this);
1126
+
1127
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1128
+ boxButton.setToolTipText("Create box");
1129
+ boxButton.addActionListener(this);
1130
+
1131
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1132
+ sphereButton.setToolTipText("Create sphere");
1133
+ sphereButton.addActionListener(this);
1134
+
1135
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ coneButton.setToolTipText("Create cone");
1137
+ coneButton.addActionListener(this);
1138
+
1139
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ torusButton.setToolTipText("Create torus");
1141
+ torusButton.addActionListener(this);
1142
+
1143
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1144
+ superButton.setToolTipText("Create superellipsoid");
1145
+ superButton.addActionListener(this);
1146
+
1147
+ if (Globals.ADVANCED)
1148
+ {
1149
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1150
+ kleinButton.setToolTipText("Create Klein bottle");
1151
+ kleinButton.addActionListener(this);
1152
+ }
1153
+
1154
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1155
+ particlesButton.setToolTipText("Create particle system");
1156
+ particlesButton.addActionListener(this);
1157
+
1158
+ oe.toolboxPanel.add(row1);
1159
+
1160
+ cGridBag row2 = new cGridBag();
1161
+
1162
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1163
+ groupButton.setToolTipText("Create group");
1164
+ groupButton.addActionListener(this);
1165
+
1166
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1167
+ compositeButton.setToolTipText("Create composite");
1168
+ compositeButton.addActionListener(this);
1169
+
1170
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1171
+ switchButton.setToolTipText("Create item switcher");
1172
+ switchButton.addActionListener(this);
1173
+
1174
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ loopButton.setToolTipText("Create loop");
1176
+ loopButton.addActionListener(this);
1177
+
1178
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1179
+ textureButton.setToolTipText("Create texture");
1180
+ textureButton.addActionListener(this);
1181
+
1182
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ overlayButton.setToolTipText("Create overlay");
1184
+ overlayButton.addActionListener(this);
1185
+
1186
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ lightButton.setToolTipText("Create light");
1188
+ lightButton.addActionListener(this);
1189
+
1190
+ oe.toolboxPanel.add(row2);
1191
+
1192
+ cGridBag textures = new cGridBag();
1193
+
1194
+ CreateTexturePanel(textures);
1195
+
1196
+ oe.toolboxPanel.add(textures);
1197
+
1198
+ textures.preferredHeight = 100;
1199
+
1200
+ CreateSkyboxPanel(oe.skyboxPanel);
1201
+
1202
+ // EDIT panel
1203
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1204
+ editButton.setToolTipText("Pin selection controls");
1205
+ editButton.addActionListener(this);
1206
+
1207
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1208
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5571209 uneditButton.addActionListener(this);
5581210
559
- oe.aConstraints.gridx += 1;
560
- oe.aConstraints.weighty = 0;
561
- oe.aConstraints.gridwidth = 1;
562
-
563
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
564
- clearPanelButton.addActionListener(this);
565
-
566
- oe.aConstraints.gridx += 1;
567
- oe.aConstraints.weighty = 0;
568
- oe.aConstraints.gridwidth = 1;
569
-
570
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1211
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1212
+ allParamsButton.setToolTipText("Show all controls");
5711213 allParamsButton.addActionListener(this);
5721214
573
- oe.aConstraints.gridx += 1;
574
- oe.aConstraints.weighty = 0;
575
- oe.aConstraints.gridwidth = 1;
576
-
577
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
578
- unselectButton.addActionListener(this);
1215
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1216
+ clearPanelButton.setToolTipText("Clear all controls");
1217
+ clearPanelButton.addActionListener(this);
5791218
1219
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ //unselectButton.setToolTipText("Unselect");
1221
+ //unselectButton.addActionListener(this);
1222
+
1223
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ flashSelectionButton.setToolTipText("Highlight selection");
1225
+ flashSelectionButton.addActionListener(this);
1226
+
1227
+ editCommandsPanel.preferredHeight = 1;
1228
+
1229
+ SetPinStates(false);
1230
+// oe.treePanel.add(commandsPanel);
1231
+// oe.treePanel.Return();
1232
+
5801233 // oe.aConstraints.gridx += 1;
5811234 // oe.aConstraints.weighty = 0;
5821235 // oe.aConstraints.gridwidth = 1;
....@@ -588,47 +1241,32 @@
5881241 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5891242 // gcButton.addActionListener(this);
5901243
591
- oe.aConstraints.gridx = 0;
592
- oe.aConstraints.gridy += 1;
593
-
594
- //ctrlPanel.add(objList = new List(5, true));
595
- oe.aConstraints.gridwidth = 100;
596
- // oe.aConstraints.gridheight = 100;
597
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
598
- oe.aConstraints.gridheight = 1;
599
- oe.aConstraints.weighty = 0.5;
600
- oe.aConstraints.gridx = 0;
601
- JScrollPane jSP;
1244
+ cGridBag jSPPanel = new cGridBag();
1245
+
1246
+ JScrollPane jSP;
6021247 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
603
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1248
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6041249 ResetModel();
605
- oe.aConstraints.weighty = 0.5;
606
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
607
- oe.aConstraints.gridy += 1;
608
- oe.aConstraints.gridwidth = 1;
609
-
610
- oe.aConstraints.weighty = 0;
611
- oe.aConstraints.gridwidth = 2;
612
-
613
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
614
- colorCB.addItemListener(this);
615
- oe.aConstraints.gridx += 2;
616
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
617
- materialCB.addItemListener(this);
618
- oe.aConstraints.gridx += 2;
619
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
620
- textureCB.addItemListener(this);
621
-
622
- oe.aConstraints.gridx = 0;
623
- oe.aConstraints.gridy += 1;
6241250
1251
+ oe.treePanel.add(jSPPanel);
1252
+ oe.treePanel.Return();
1253
+
1254
+ oe.treePanel.add(copyOptionsPanel);
1255
+ oe.treePanel.Return();
1256
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1257
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1258
+ sliderPane.preferredHeight = 1;
1259
+
1260
+// mainPanel.setDividerLocation(0.1); //1.0);
1261
+ mainPanel.setResizeWeight(0.4);
1262
+
6251263 //jList.addListSelectionListener(this);
6261264 oe.jTree.addTreeSelectionListener(this);
6271265 //jTree.setRootVisible(false);
6281266 //jTree.setEditable(true);
6291267 oe.jTree.setDragEnabled(true);
6301268 //jTree.setPreferredSize(new Dimension(10,10));
631
- jSP.setPreferredSize(new Dimension(100,200));
1269
+ //jSP.setPreferredSize(new Dimension(100,200));
6321270
6331271 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6341272
....@@ -640,23 +1278,163 @@
6401278 dgr.addDragGestureListener(this);
6411279 }catch(Exception e) {}
6421280 */
643
- radio.layout = sevenButton;
1281
+ radio.layout = threeButton; // sixButton;
6441282 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6451283 }
1284
+
1285
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1286
+ {
1287
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1288
+ colorCB.setToolTipText("Copy color when dropped");
1289
+ colorCB.addItemListener(this);
1290
+
1291
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1292
+ materialCB.setToolTipText("Copy material when dropped");
1293
+ materialCB.addItemListener(this);
1294
+
1295
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1296
+ textureCB.setToolTipText("Copy texture when dropped");
1297
+ textureCB.addItemListener(this);
1298
+
1299
+ panel.Return();
1300
+
1301
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1302
+ boxCB.setToolTipText("Display bounding boxes");
1303
+ boxCB.addItemListener(this);
1304
+
1305
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1306
+ zoomBoxCB.setToolTipText("Display only for wheel");
1307
+ zoomBoxCB.addItemListener(this);
1308
+
1309
+ if (true) // Globals.ADVANCED)
1310
+ {
1311
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1312
+// supportCB.setToolTipText("Enable rigging");
1313
+// supportCB.addItemListener(this);
1314
+
1315
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1316
+ freezeCB.setToolTipText("Fast moving camera");
1317
+ freezeCB.addItemListener(this);
1318
+
1319
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1320
+ // localCB.addItemListener(this);
1321
+
1322
+ panel.Return();
1323
+
1324
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1325
+ crowdCB.setToolTipText("Used for crowds");
1326
+ crowdCB.addItemListener(this);
1327
+
1328
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1329
+ smoothCB.setToolTipText("Snapping delay");
1330
+ smoothCB.addItemListener(this);
1331
+
1332
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1333
+// slowCB.setToolTipText("Smooth interpolation");
1334
+// slowCB.addItemListener(this);
1335
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1336
+ minshaderCB.setToolTipText("Minimal fast shader");
1337
+ minshaderCB.addItemListener(this);
1338
+
1339
+// constraints.gridy += 1;
1340
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1341
+// speakerMocapCB.addItemListener(this);
1342
+
1343
+ panel.Return();
1344
+
1345
+ if (false)
1346
+ {
1347
+ // handled in scripts
1348
+ //constraints.gridy += 1;
1349
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1350
+ speakerCameraCB.addItemListener(this);
1351
+
1352
+ //constraints.gridy += 1;
1353
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1354
+ speakerFocusCB.addItemListener(this);
1355
+
1356
+ //constraints.gridy += 1;
1357
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1358
+ smoothfocusCB.addItemListener(this);
1359
+ panel.Return();
1360
+ }
1361
+
1362
+//constraints.gridx += 1;
1363
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1364
+// debugCB.addItemListener(this);
1365
+
1366
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1367
+ trackCB.setToolTipText("Enable tracking target");
1368
+ trackCB.addItemListener(this);
1369
+
1370
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1371
+ oeilCB.setToolTipText("Move camera when tracking");
1372
+ oeilCB.addItemListener(this);
1373
+
1374
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1375
+ shadowCB.setToolTipText("When live compute shadows");
1376
+ shadowCB.addItemListener(this);
1377
+
1378
+ panel.Return();
1379
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1380
+ toggleTextureCB.setToolTipText("Load textures");
1381
+ toggleTextureCB.addItemListener(this);
1382
+
1383
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1384
+ toggleSwitchCB.setToolTipText("Choose a single item");
1385
+ toggleSwitchCB.addItemListener(this);
1386
+
1387
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1388
+ autokeepCB.setToolTipText("On structure change");
1389
+ autokeepCB.addItemListener(this);
1390
+
1391
+ panel.Return();
1392
+ if (Globals.ADVANCED)
1393
+ {
1394
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1395
+ lookAtCB.setToolTipText("Look-at target");
1396
+ lookAtCB.addItemListener(this);
1397
+ }
1398
+
1399
+ }
1400
+
1401
+ cGridBag fill = new cGridBag();
1402
+ fill.preferredHeight = 200;
1403
+ cGridBag fill2 = new cGridBag();
1404
+ fill2.preferredHeight = 200;
1405
+ cGridBag fill3 = new cGridBag();
1406
+ fill3.preferredHeight = 200;
1407
+
1408
+ panel.add(fill);
1409
+ panel.add(fill2);
1410
+ panel.add(fill3);
1411
+
1412
+ }
6461413
6471414 void EditObject(Object3D obj)
6481415 {
649
- cRadio dummyButton = new cRadio(obj.name);
650
- dummyButton.SetObject(obj);
651
- dummyButton.layout = sevenButton;
652
- dummyButton.SetCamera(cameraView.renderCamera, false);
653
- dummyButton.addActionListener(this);
654
- radioPanel.add(dummyButton);
655
- buttonGroup.add(dummyButton);
656
- dummyButton.doClick();
1416
+ cRadio radioButton = new cRadio(obj.name);
1417
+
1418
+ // June 2019. Patch to avoid bug with transparency.
1419
+ radioButton.hadMaterial = obj.material != null;
1420
+ if (!radioButton.hadMaterial)
1421
+ {
1422
+ obj.material = new cMaterial();
1423
+ }
1424
+
1425
+ radioButton.SetObject(obj);
1426
+ radioButton.layout = threeButton; // sixButton;
1427
+ radioButton.SetCamera(cameraView.renderCamera, false);
1428
+ radioButton.addActionListener(this);
1429
+ radioPanel.add(radioButton);
1430
+ buttonGroup.add(radioButton);
1431
+ radioButton.doClick();
6571432 }
1433
+
6581434 void SetupViews(ObjEditor oe)
6591435 {
1436
+ theFrame = this;
1437
+
6601438 oe.SetupViews();
6611439
6621440 System.out.println("SetupViews");
....@@ -665,22 +1443,30 @@
6651443 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6661444 }
6671445
668
- JCheckBox liveCB;
669
- JCheckBox supportCB;
670
- JCheckBox localCB;
671
- JCheckBox crowdCB;
672
- JCheckBox smoothCB;
673
- JCheckBox fastCB;
674
- JCheckBox slowCB;
675
- JCheckBox boxCB;
676
- JCheckBox trackCB;
677
- JCheckBox smoothfocusCB;
1446
+ cToggleButton liveCB;
1447
+ cCheckBox supportCB;
1448
+ cCheckBox localCB;
1449
+ cCheckBox crowdCB;
1450
+ cCheckBox smoothCB;
1451
+ cCheckBox minshaderCB;
1452
+
1453
+ cToggleButton fastCB;
1454
+ cCheckBox slowCB;
1455
+ cCheckBox boxCB;
1456
+ cCheckBox zoomBoxCB;
1457
+ cCheckBox freezeCB;
1458
+ //cToggleButton trackCB;
1459
+ cCheckBox trackCB;
1460
+ cCheckBox smoothfocusCB;
6781461 // JCheckBox speakerMocapCB;
679
- JCheckBox speakerCameraCB;
680
- JCheckBox speakerFocusCB;
681
- JCheckBox debugCB;
682
- JCheckBox oeilCB;
683
- JCheckBox lookAtCB;
1462
+ cCheckBox speakerCameraCB;
1463
+ cCheckBox speakerFocusCB;
1464
+ cCheckBox debugCB;
1465
+
1466
+ cCheckBox oeilCB;
1467
+ cCheckBox shadowCB;
1468
+ cCheckBox autokeepCB;
1469
+ cCheckBox lookAtCB;
6841470
6851471 // static int COLOR = 1;
6861472 // static int MATERIAL = 2;
....@@ -688,9 +1474,9 @@
6881474
6891475 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6901476
691
- JCheckBox colorCB;
692
- JCheckBox materialCB;
693
- JCheckBox textureCB;
1477
+ cCheckBox colorCB;
1478
+ cCheckBox materialCB;
1479
+ cCheckBox textureCB;
6941480
6951481 public void itemStateChanged(ItemEvent e)
6961482 {
....@@ -715,10 +1501,10 @@
7151501 dropAttributes |= Object3D.TEXTURE;
7161502 else
7171503 dropAttributes &= ~Object3D.TEXTURE;
718
- }
719
- else if(e.getSource() == liveCB)
1504
+ } else if(e.getSource() == liveCB)
7201505 {
7211506 cameraView.ToggleLive();
1507
+ refreshContents(false);
7221508 }
7231509 else if(e.getSource() == supportCB)
7241510 {
....@@ -734,6 +1520,12 @@
7341520 {
7351521 cameraView.ToggleInertia();
7361522 cameraView.repaint();
1523
+ }
1524
+ else if(e.getSource() == minshaderCB)
1525
+ {
1526
+ Globals.MINSHADER ^= true;
1527
+ cameraView.programInitialized = false;
1528
+ cameraView.repaint();
7371529 }
7381530 else if(e.getSource() == localCB)
7391531 {
....@@ -753,6 +1545,10 @@
7531545 Recompile();
7541546 cameraView.repaint();
7551547 // refreshContents();
1548
+ }
1549
+ else if(e.getSource() == zoomBoxCB)
1550
+ {
1551
+ cameraView.ToggleZoomBoxMode();
7561552 }
7571553 else if(e.getSource() == smoothfocusCB)
7581554 {
....@@ -779,6 +1575,18 @@
7791575 {
7801576 cameraView.ToggleOeil();
7811577 }
1578
+ else if(e.getSource() == shadowCB)
1579
+ {
1580
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1581
+ }
1582
+ else if(e.getSource() == freezeCB)
1583
+ {
1584
+ Globals.FREEZEONMOVE ^= true;
1585
+ }
1586
+ else if(e.getSource() == autokeepCB)
1587
+ {
1588
+ Globals.REPLACEONMAKE ^= true;
1589
+ }
7821590 else if(e.getSource() == lookAtCB)
7831591 {
7841592 cameraView.ToggleLookAt();
....@@ -795,7 +1603,8 @@
7951603
7961604 /**/
7971605 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
798
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1606
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1607
+ TreePath path = objEditor.jTree.getSelectionPath();
7991608 if ((path == null) || (path.getPathCount() <= 1)) {
8001609 // We can't move the root node or an empty selection
8011610 return;
....@@ -858,8 +1667,6 @@
8581667 }
8591668 }
8601669
861
- String string = (String) object;
862
-
8631670 System.out.println("Transfer = " + object + "; drop : " + target);
8641671 // if( object instanceof java.io.File[])
8651672 // {
....@@ -867,7 +1674,11 @@
8671674 // objEditor.DropFile((java.io.File[]) object, true);
8681675 // return;
8691676 // }
870
- if (string.charAt(0) == '/')
1677
+
1678
+ String string = object.toString();
1679
+
1680
+ // File path for Mac and Windows
1681
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8711682 {
8721683 // file(s)
8731684 String[] names = string.split("\n");
....@@ -894,7 +1705,7 @@
8941705
8951706 flashIt = false;
8961707 CameraPane pane = (CameraPane) target;
897
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1708
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8981709 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8991710
9001711 if (group.selection.size() == 1)
....@@ -910,23 +1721,33 @@
9101721
9111722 assert target == objEditor.jTree;
9121723 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1724
+ Object3D destinationLeaf;
9131725 try {
914
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1726
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9151727 } catch (Exception e) {
9161728 System.out.println("destinationPath : " + destinationPath);
9171729 return;
9181730 }
9191731
920
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1732
+ for (int i=group.selection.size(); --i>=0;)
9211733 {
1734
+ Object3D child = (Object3D)group.selection.elementAt(i);
1735
+
1736
+ // Cannot move into itself
1737
+ if (child == destinationLeaf)
1738
+ return;
1739
+ }
1740
+
1741
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1742
+// {
9221743 loadClipboard(true);
9231744 objEditor.jTree.setSelectionPath(destinationPath);
924
- pasteInto(false);
925
- } else {
926
- loadClipboard(false);
927
- objEditor.jTree.setSelectionPath(destinationPath);
928
- pasteInto(false); // true); // ???
929
- }
1745
+ pasteInto(false, false);
1746
+// } else {
1747
+// loadClipboard(false);
1748
+// objEditor.jTree.setSelectionPath(destinationPath);
1749
+// pasteInto(false, false); // true); // ???
1750
+// }
9301751 }
9311752 public void dropActionChanged(DropTargetDragEvent dtde)
9321753 // Called if the user has modified the current drop gesture
....@@ -1031,85 +1852,107 @@
10311852 {
10321853 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10331854 //heightFieldItem.addActionListener(this);
1034
- gridItem = menu.add(new MenuItem("Grid"));
1035
- gridItem.addActionListener(this);
1036
- rectoidItem = menu.add(new MenuItem("Box"));
1037
- rectoidItem.addActionListener(this);
1038
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1039
- ellipsoidItem.addActionListener(this);
1040
- coneItem = menu.add(new MenuItem("Cone"));
1041
- coneItem.addActionListener(this);
1042
- torusItem = menu.add(new MenuItem("Torus"));
1043
- torusItem.addActionListener(this);
1044
- superItem = menu.add(new MenuItem("Superellipsoid"));
1045
- superItem.addActionListener(this);
1855
+// gridItem = menu.add(new MenuItem("Grid"));
1856
+// gridItem.addActionListener(this);
1857
+// rectoidItem = menu.add(new MenuItem("Box"));
1858
+// rectoidItem.addActionListener(this);
1859
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1860
+// ellipsoidItem.addActionListener(this);
1861
+// coneItem = menu.add(new MenuItem("Cone"));
1862
+// coneItem.addActionListener(this);
1863
+// torusItem = menu.add(new MenuItem("Torus"));
1864
+// torusItem.addActionListener(this);
1865
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1866
+// superItem.addActionListener(this);
1867
+
1868
+ cameraItem = menu.add(new MenuItem("Camera"));
1869
+ cameraItem.addActionListener(this);
1870
+
1871
+ if (!Globals.ADVANCED)
1872
+ {
10461873 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10471874 kleinItem.addActionListener(this);
1048
- particleItem = menu.add(new MenuItem("Particle system"));
1049
- particleItem.addActionListener(this);
1875
+ }
1876
+
1877
+// particleItem = menu.add(new MenuItem("Particle system"));
1878
+// particleItem.addActionListener(this);
1879
+ if (Globals.ADVANCED)
1880
+ {
10501881 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10511882 ragdollItem.addActionListener(this);
10521883 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10531884 ragdoll2Item.addActionListener(this);
1885
+ }
10541886 menu.add("-");
1055
- meshItem = menu.add(new MenuItem("Mesh"));
1887
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10561888 meshItem.addActionListener(this);
10571889 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10581890 // meshGroupItem.addActionListener(this);
1891
+ if (Globals.ADVANCED)
1892
+ {
10591893 springItem = menu.add(new MenuItem("Spring"));
10601894 springItem.addActionListener(this);
10611895 flagItem = menu.add(new MenuItem("Flag"));
10621896 flagItem.addActionListener(this);
1063
- bezierItem = menu.add(new MenuItem("Patch"));
1064
- bezierItem.addActionListener(this);
1065
- checkerItem = menu.add(new MenuItem("Checker"));
1066
- checkerItem.addActionListener(this);
10671897 blobItem = menu.add(new MenuItem("Blob"));
10681898 blobItem.addActionListener(this);
10691899 latheItem = menu.add(new MenuItem("Lathe"));
10701900 latheItem.addActionListener(this);
1071
- lightItem = menu.add(new MenuItem("Light"));
1072
- lightItem.addActionListener(this);
1901
+ }
1902
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1903
+ bezierItem.addActionListener(this);
1904
+// overlayItem = menu.add(new MenuItem("Overlay"));
1905
+// overlayItem.addActionListener(this);
1906
+// lightItem = menu.add(new MenuItem("Light"));
1907
+// lightItem.addActionListener(this);
10731908 menu.add("-");
10741909 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10751910 //superLoopItem.addActionListener(this);
1076
- loopItem = menu.add(new MenuItem("Loop"));
1077
- loopItem.addActionListener(this);
1911
+// loopItem = menu.add(new MenuItem("Loop"));
1912
+// loopItem.addActionListener(this);
10781913 doubleItem = menu.add(new MenuItem("Fork"));
10791914 doubleItem.addActionListener(this);
1915
+ if (Globals.ADVANCED)
1916
+ {
10801917 tripleItem = menu.add(new MenuItem("Trident"));
10811918 tripleItem.addActionListener(this);
1919
+ }
10821920 }
10831921
10841922 void buildToolsMenu(Menu menu)
10851923 {
10861924 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10871925 animationItem.addItemListener(this);
1088
- animationItem.setState(CameraPane.ANIMATION);
1926
+ animationItem.setState(Globals.ANIMATION);
1927
+
1928
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1929
+ archiveItem.addActionListener(this);
10891930
10901931 menu.add("-");
10911932 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10921933 parseverticesItem.addActionListener(this);
10931934 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10941935 textureFieldItem.addActionListener(this);
1095
- alignItem = menu.add(new MenuItem("Align"));
1936
+ alignItem = menu.add(new MenuItem("Align Objects"));
10961937 alignItem.addActionListener(this);
1097
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1098
- mirrorItem.addActionListener(this);
10991938 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11001939 reduceMorphItem.addActionListener(this);
11011940 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11021941 reduce34MorphItem.addActionListener(this);
1103
-
1104
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1105
- computeAOItem.addActionListener(this);
11061942 menu.add("-");
1107
-
11081943 menu.add(memoryItem = new MenuItem("Memory Usage"));
11091944 memoryItem.addActionListener(this);
1945
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1946
+ computeAOItem.addActionListener(this);
1947
+
1948
+ if (Globals.ADVANCED)
1949
+ {
1950
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1951
+ mirrorItem.addActionListener(this);
1952
+ menu.add("-");
11101953 menu.add(analyzeItem = new MenuItem("Analyze"));
11111954 analyzeItem.addActionListener(this);
1112
- menu.add(dumpItem = new MenuItem("Dump"));
1955
+ menu.add(dumpItem = new MenuItem("Print"));
11131956 dumpItem.addActionListener(this);
11141957 // menu.add(pathItem = new MenuItem("From-to path"));
11151958 // pathItem.addActionListener(this);
....@@ -1118,6 +1961,8 @@
11181961 resetParentItem.addActionListener(this);
11191962 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11201963 repairParentItem.addActionListener(this);
1964
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1965
+ repairShadowItem.addActionListener(this);
11211966 menu.add(invariantsItem = new MenuItem("Invariants"));
11221967 invariantsItem.addActionListener(this);
11231968 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1125,6 +1970,7 @@
11251970 menu.add("-");
11261971 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11271972 editScriptItem.addActionListener(this);
1973
+ }
11281974 }
11291975
11301976 void ScreenFit()
....@@ -1247,9 +2093,34 @@
12472093 shadow.material = new cMaterial(obj.material);
12482094 shadow.material.diffuse = 0.0001f;
12492095 shadow.material.specular = 0.0001f;
2096
+ //shadow.projectedVertices[1].x = 300;
12502097
12512098 makeSomething(shadow);
12522099 }
2100
+
2101
+ private void ClearUnpinned()
2102
+ {
2103
+ //for (Object3D obj : listUI)
2104
+ for (int i=listUI.size(); --i>=0;)
2105
+ {
2106
+ Object3D obj = listUI.elementAt(i);
2107
+ if (!obj.pinned)
2108
+ {
2109
+ obj.CloseUI();
2110
+ listUI.remove(i);
2111
+ }
2112
+ }
2113
+ }
2114
+
2115
+ private void EditElement(Object3D elem, boolean newWindow)
2116
+ {
2117
+ // if (!(elem instanceof Composite))
2118
+ // newWindow = false;
2119
+ listUI.add(elem);
2120
+ elem.openEditWindow(this, newWindow); //, false);
2121
+ System.out.println("edit : " + elem);
2122
+ elem.editWindow.refreshContents(true); // ? new
2123
+ }
12532124
12542125 /**
12552126 * applyExample
....@@ -1453,9 +2324,9 @@
14532324
14542325 void Overwrite(int mask)
14552326 {
1456
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2327
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14572328 {
1458
- Object3D content = GrafreeD.clipboard.get(0);
2329
+ Object3D content = Grafreed.clipboard.get(0);
14592330
14602331 if (content instanceof cGroup && ((cGroup)content).transientlink )
14612332 content = ((cGroup)content).get(0);
....@@ -1478,6 +2349,7 @@
14782349 //
14792350 public void actionPerformed(ActionEvent event) // , Object arg)
14802351 {
2352
+ Object source = event.getSource();
14812353 /*
14822354 if (event.getSource() == nameField)
14832355 {
....@@ -1489,11 +2361,11 @@
14892361 }
14902362 else
14912363 */
1492
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2364
+ if (source == lookAtItem || source == lookFromItem)
14932365 {
14942366 ScreenFit();
14952367 } else
1496
- if (event.getSource() == switchItem)
2368
+ if (source == switchViewItem)
14972369 {
14982370 cVector v1 = new cVector();
14992371 cVector v2 = new cVector();
....@@ -1502,11 +2374,11 @@
15022374 objEditor.cameraView.renderCamera.setAim(v2, v1);
15032375 objEditor.cameraView.repaint();
15042376 } else
1505
- if (event.getSource() == rectoidItem)
2377
+ if (source == rectoidItem || source == boxButton)
15062378 {
15072379 makeSomething(new Box());
15082380 } else
1509
- if (event.getSource() == particleItem)
2381
+ if (source == particleItem || source == particlesButton)
15102382 {
15112383 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15122384 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1527,9 +2399,9 @@
15272399 applyExample(particleGeom, "SMOKE");
15282400 makeSomething(particleGeom);
15292401 } else
1530
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2402
+ if (source == ragdollItem || source == ragdoll2Item)
15312403 {
1532
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2404
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15332405
15342406 ragdoll.toParent = LA.newMatrix();
15352407 ragdoll.fromParent = LA.newMatrix();
....@@ -1547,7 +2419,7 @@
15472419 } else
15482420 /*
15492421 */
1550
- if (event.getSource() == heightFieldItem)
2422
+ if (source == heightFieldItem)
15512423 {
15522424 Object3D obj = new Object3D();
15532425
....@@ -1585,31 +2457,31 @@
15852457
15862458 makeSomething(obj);
15872459 } else
1588
- if (event.getSource() == gridItem)
2460
+ if (source == gridItem || source == gridButton)
15892461 {
15902462 makeSomething(new Grid());
15912463 } else
1592
- if (event.getSource() == ellipsoidItem)
2464
+ if (source == ellipsoidItem || source == sphereButton)
15932465 {
15942466 makeSomething(new Sphere());
15952467 } else
1596
- if (event.getSource() == coneItem)
2468
+ if (source == coneItem || source == coneButton)
15972469 {
15982470 makeSomething(new Cone());
15992471 } else
1600
- if (event.getSource() == torusItem)
2472
+ if (source == torusItem || source == torusButton)
16012473 {
16022474 makeSomething(new Torus());
16032475 } else
1604
- if (event.getSource() == superItem)
2476
+ if (source == superItem || source == superButton)
16052477 {
16062478 makeSomething(new Superellipsoid());
16072479 } else
1608
- if (event.getSource() == kleinItem)
2480
+ if (source == kleinItem || source == kleinButton)
16092481 {
16102482 makeSomething(new Klein());
16112483 } else
1612
- if (event.getSource() == blobItem)
2484
+ if (source == blobItem)
16132485 {
16142486 Blob blob = new Blob();
16152487 BlobComponent comp = new BlobComponent();
....@@ -1617,15 +2489,15 @@
16172489 //blob.retile();
16182490 makeSomething(blob);
16192491 } else
1620
- if (event.getSource() == latheItem)
2492
+ if (source == latheItem)
16212493 {
16222494 makeSomething(new Lathe());
16232495 } else
1624
- if (event.getSource() == bezierItem)
2496
+ if (source == bezierItem)
16252497 {
16262498 makeSomething(new BezierSurface());
16272499 } else
1628
- if (event.getSource() == checkerItem)
2500
+ if (source == overlayItem || source == overlayButton)
16292501 {
16302502 /*
16312503 Object3D obj = new BezierSurface(5,8);
....@@ -1640,7 +2512,7 @@
16402512 */
16412513 makeSomething(new Checker());
16422514 } else
1643
- if (event.getSource() == meshItem)
2515
+ if (source == meshItem)
16442516 {
16452517 Object3D itemtomake = new Object3D();
16462518 Object3D child;
....@@ -1661,35 +2533,52 @@
16612533 makeSomething(child);
16622534 }
16632535 } else
1664
- if (event.getSource() == springItem)
2536
+ if (source == springItem)
16652537 {
16662538 cSpring s = new cSpring();
16672539 s.setup();
16682540 makeSomething(s);
16692541 } else
1670
- if (event.getSource() == flagItem)
2542
+ if (source == flagItem)
16712543 {
16722544 cSpring s = new cFlag();
16732545 s.setup();
16742546 makeSomething(s);
16752547 } else
1676
- if (event.getSource() == lightItem)
2548
+ if (source == lightItem || source == lightButton)
16772549 {
16782550 makeSomething(new Light());
16792551 } else
1680
- if (event.getSource() == csgItem)
2552
+// if (source == skybox1Button ||
2553
+// source == skybox2Button ||
2554
+// source == skybox3Button ||
2555
+// source == skybox4Button ||
2556
+// source == skybox5Button ||
2557
+// source == skybox6Button ||
2558
+// source == skybox7Button ||
2559
+// source == skybox11Button ||
2560
+// source == skybox12Button ||
2561
+// source == skybox13Button ||
2562
+// source == skybox14Button ||
2563
+// source == skybox15Button ||
2564
+// source == skybox16Button ||
2565
+// source == skybox17Button)
2566
+// {
2567
+// ChangeSkybox(source);
2568
+// } else
2569
+ if (source == csgItem)
16812570 {
16822571 group(new CSG());
16832572 } else
1684
- if (event.getSource() == templateItem)
2573
+ if (source == templateItem)
16852574 {
16862575 group(new cTemplate());
16872576 } else
1688
- if (event.getSource() == attributeItem)
2577
+ if (source == attributeItem)
16892578 {
16902579 makeSomething(new Attribute());
16912580 } else
1692
- if (event.getSource() == pointflowItem)
2581
+ if (source == pointflowItem)
16932582 {
16942583 makeSomething(new PointFlow());
16952584 } else
....@@ -1701,7 +2590,7 @@
17012590 } else
17022591 */
17032592
1704
- if (event.getSource() == superLoopItem)
2593
+ if (source == superLoopItem)
17052594 {
17062595 Composite g = new cGroup();
17072596 for (int i=0; i<15; i++)
....@@ -1723,30 +2612,30 @@
17232612
17242613 group(g);
17252614 } else
1726
- if (event.getSource() == loopItem)
2615
+ if (source == loopItem || source == loopButton)
17272616 {
17282617 Composite csg = new GroupLeaf();
17292618 csg.count = 5;
17302619 group(csg);
1731
- Composite child = new cGroup();
2620
+ Composite child = new cGroup("Branch");
17322621 csg.addChild(child);
17332622 child.addChild(csg);
17342623 } else
1735
- if (event.getSource() == doubleItem)
2624
+ if (source == doubleItem)
17362625 {
1737
- Composite csg = new GroupLeaf();
2626
+ Composite csg = new GroupLeaf("Fork");
17382627 csg.count = 5;
17392628 group(csg);
1740
- Composite child = new cGroup();
2629
+ Composite child = new cGroup("Branch A");
17412630 csg.addChild(child);
17422631 child.addChild(csg);
1743
- child = new cGroup();
2632
+ child = new cGroup("Branch B");
17442633 csg.addChild(child);
17452634 child.addChild(csg);
17462635 } else
1747
- if (event.getSource() == tripleItem)
2636
+ if (source == tripleItem)
17482637 {
1749
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Trident");
17502639 csg.count = 4;
17512640 group(csg);
17522641 Composite child = new cGroup();
....@@ -1759,73 +2648,105 @@
17592648 csg.addChild(child);
17602649 child.addChild(csg);
17612650 } else
1762
-
1763
- if (event.getSource() == importGFDItem)
2651
+ if (source == computeAOItem)
17642652 {
1765
- ImportGFD();
2653
+ Globals.drawMode = CameraPane.OCCLUSION;
2654
+ cameraView.repaint();
17662655 } else
1767
- if (event.getSource() == importVRMLX3DItem)
1768
- {
1769
- ImportVRMLX3D();
1770
- } else
1771
- if (event.getSource() == import3DSItem)
1772
- {
1773
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1774
- } else
1775
- if (event.getSource() == importOBJItem)
1776
- {
1777
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1778
- } else
1779
- if (event.getSource() == computeAOItem)
1780
- {
1781
- CameraPane.drawMode = CameraPane.OCCLUSION;
1782
- CameraPane.theRenderer.repaint();
1783
- } else
1784
- if (event.getSource() == recompileItem)
2656
+ if (source == recompileItem)
17852657 {
17862658 Recompile();
17872659 refreshContents();
17882660 } else
1789
- if (event.getSource() == editScriptItem)
2661
+ if (source == editScriptItem)
17902662 {
17912663 OpenDialog();
17922664 refreshContents();
17932665 } else
1794
- if (event.getSource() == invariantsItem)
2666
+ if (source == invariantsItem)
17952667 {
17962668 System.out.println("Invariants:");
1797
- GrafreeD.theApplet3D.universe.invariants();
2669
+ Grafreed.grafreed.universe.invariants();
17982670 } else
1799
- if (event.getSource() == memoryItem)
2671
+ if (source == memoryItem)
18002672 {
18012673 //System.out.println("Invariants:");
18022674 PrintMemory();
18032675 } else
1804
- if (event.getSource() == pathItem)
2676
+ if (source == pathItem)
18052677 {
18062678 PrintPath();
18072679 } else
1808
- if (event.getSource() == analyzeItem)
2680
+ if (source == analyzeItem)
18092681 {
18102682 AnalyzeObject();
18112683 } else
1812
- if (event.getSource() == dumpItem)
2684
+ if (source == dumpItem)
18132685 {
18142686 DumpObject();
18152687 } else
1816
- if (event.getSource() == screenfitButton)
2688
+ if (source == minButton)
18172689 {
1818
- //Reload(lastConverter, lastFilename, true);
2690
+ Minimize();
2691
+ } else
2692
+ if (source == maxButton)
2693
+ {
2694
+ Maximize();
2695
+ } else
2696
+ if (source == fullButton)
2697
+ {
2698
+ ToggleFullScreen();
2699
+ } else
2700
+ if (source == previousVersionButton)
2701
+ {
2702
+ // Go to previous version
2703
+ //if (!Undo())
2704
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2705
+ PreviousVersion();
2706
+ } else
2707
+ if (source == restoreButton)
2708
+ {
2709
+ // Restore current version
2710
+ Restore();
2711
+ //restoreButton.setEnabled(false);
2712
+ } else
2713
+ if (source == replaceButton)
2714
+ {
2715
+ // Overwrite current version
2716
+ Replace();
2717
+ //replaceButton.setEnabled(false);
2718
+ } else
2719
+ if (source == nextVersionButton)
2720
+ {
2721
+ // Go to next version
2722
+ NextVersion();
2723
+ } else
2724
+ if (source == saveVersionButton)
2725
+ {
2726
+ // Save a new version
2727
+ if (!Save(true))
2728
+ java.awt.Toolkit.getDefaultToolkit().beep();
2729
+ } else
2730
+ if (source == deleteVersionButton)
2731
+ {
2732
+ // Delete a new version
2733
+ DeleteVersion();
2734
+ } else
2735
+ if (source == oneStepButton)
2736
+ {
2737
+ Globals.ONESTEP = true;
2738
+ cameraView.repaint();
2739
+ } else
2740
+ if (source == screenfitButton)
2741
+ {
18192742 ScreenFit();
18202743 } else
1821
- if (event.getSource() == screenfitpointButton)
2744
+ if (source == screenfitpointButton)
18222745 {
1823
- //Reload(lastConverter, lastFilename, true);
18242746 ScreenFitPoint();
18252747 } else
1826
- if (event.getSource() == snapobjectButton)
2748
+ if (source == snapobjectButton)
18272749 {
1828
- //Reload(lastConverter, lastFilename, true);
18292750 SnapObject();
18302751 } else
18312752 // if (event.getSource() == recompileButton)
....@@ -1834,13 +2755,13 @@
18342755 // Recompile();
18352756 // refreshContents();
18362757 // } else
1837
- if (event.getSource() == gcButton)
2758
+ if (source == gcButton)
18382759 {
18392760 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18402761 System.gc();
18412762 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18422763 } else
1843
- if (event.getSource() == editLeafItem)
2764
+ if (source == editLeafItem)
18442765 {
18452766 Object3D obj;
18462767 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1854,62 +2775,74 @@
18542775 }
18552776 refreshContents(true);
18562777 } else
1857
- if (event.getSource() == openWindowItem)
2778
+ if (source == openWindowItem)
18582779 {
18592780 EditSelection(true);
18602781 } else
1861
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2782
+ if (source == cutItem || source == clearButton)
18622783 {
18632784 loadClipboard(true);
18642785 } else
1865
- if (event.getSource() == duplicateItem)
2786
+ if (source == undoItem)
18662787 {
1867
- Object3D keep = GrafreeD.clipboard;
2788
+ PreviousVersion();
2789
+ } else
2790
+ if (source == redoItem)
2791
+ {
2792
+ NextVersion();
2793
+ } else
2794
+ if (source == duplicateItem)
2795
+ {
2796
+ Object3D keep = Grafreed.clipboard;
18682797 loadClipboard(false);
18692798 paste(false);
1870
- GrafreeD.clipboard = keep;
2799
+ Grafreed.clipboard = keep;
18712800 } else
1872
- if (event.getSource() == cloneItem)
2801
+ if (source == cloneItem)
18732802 {
18742803 CloneSelection(false);
18752804 } else
1876
- if (event.getSource() == cloneSupportItem)
2805
+ if (source == cloneSupportItem)
18772806 {
18782807 CloneSelection(true);
18792808 } else
1880
- if (event.getSource() == copyItem)
2809
+ if (source == copyItem)
18812810 {
18822811 loadClipboard(false);
18832812 } else
1884
- if (event.getSource() == pasteItem)
2813
+ if (source == pasteItem)
18852814 {
18862815 paste(false);
18872816 } else
1888
- if (event.getSource() == pasteLinkItem)
2817
+ if (source == pasteIntoItem)
18892818 {
1890
- pasteInto(false);
2819
+ pasteInto(true, false);
18912820 } else
1892
- if (event.getSource() == pasteCloneItem)
2821
+ if (source == pasteLinkItem)
18932822 {
1894
- pasteInto(true);
2823
+ pasteInto(false, false);
18952824 } else
1896
- if (event.getSource() == pasteExpandItem)
2825
+ if (source == pasteCloneItem)
2826
+ {
2827
+ pasteInto(true, true);
2828
+ } else
2829
+ if (source == pasteExpandItem)
18972830 {
18982831 paste(true);
18992832 } else
1900
- if (event.getSource() == synchronizeItem)
2833
+ if (source == synchronizeItem)
19012834 {
19022835 Overwrite(Object3D.TRANSFORM);
19032836 } else
1904
- if (event.getSource() == overwriteNameItem)
2837
+ if (source == overwriteNameItem)
19052838 {
19062839 Overwrite(Object3D.NAME);
19072840 } else
1908
- if (event.getSource() == overwriteUVItem)
2841
+ if (source == overwriteUVItem)
19092842 {
19102843 Overwrite(Object3D.UV);
19112844 } else
1912
- if (event.getSource() == overwriteMatItem)
2845
+ if (source == overwriteMatItem)
19132846 {
19142847 /* july 2015
19152848 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1929,7 +2862,7 @@
19292862
19302863 Overwrite(dropAttributes);
19312864 }
1932
- if (event.getSource() == overwriteGeoItem)
2865
+ if (source == overwriteGeoItem)
19332866 {
19342867 Overwrite(Object3D.GEOMETRY);
19352868 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1946,7 +2879,7 @@
19462879 // refreshContents();
19472880 // }
19482881 } else
1949
- if (event.getSource() == generateMeshItem)
2882
+ if (source == generateMeshItem)
19502883 {
19512884 //if (group.selection.size() == 1)
19522885 // for (int i=0; i<group.selection.size(); i++)
....@@ -1957,7 +2890,7 @@
19572890 ResetModel();
19582891 refreshContents();
19592892 } else
1960
- if (event.getSource() == extractGeometriesItem)
2893
+ if (source == extractGeometriesItem)
19612894 {
19622895 boolean one = false;
19632896
....@@ -1984,7 +2917,7 @@
19842917 ResetModel();
19852918 refreshContents();
19862919 } else
1987
- if (event.getSource() == cloneGeometriesItem)
2920
+ if (source == cloneGeometriesItem)
19882921 {
19892922 boolean one = false;
19902923
....@@ -2010,7 +2943,7 @@
20102943 ResetModel();
20112944 refreshContents();
20122945 } else
2013
- if (event.getSource() == shareGeometriesItem)
2946
+ if (source == shareGeometriesItem)
20142947 {
20152948 boolean one = false;
20162949
....@@ -2040,7 +2973,7 @@
20402973 refreshContents();
20412974 }
20422975 } else
2043
- if (event.getSource() == mergeGeometriesItem)
2976
+ if (source == mergeGeometriesItem)
20442977 {
20452978 boolean one = false;
20462979
....@@ -2070,7 +3003,7 @@
20703003 ResetModel();
20713004 refreshContents();
20723005 } else
2073
- if (event.getSource() == linkverticesItem)
3006
+ if (source == linkverticesItem)
20743007 {
20753008 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20763009 // {
....@@ -2083,48 +3016,48 @@
20833016 // group.selection.get(0).setMasterThis(content); // should be identity
20843017 // refreshContents();
20853018 // }
2086
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3019
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20873020 {
2088
- Object3D content = GrafreeD.clipboard.get(0);
3021
+ Object3D content = Grafreed.clipboard.get(0);
20893022
20903023 if (content instanceof cGroup && ((cGroup)content).transientlink )
20913024 content = ((cGroup)content).get(0);
20923025
2093
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
3026
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20943027 for (int i=0; i<group.selection.size(); i++)
20953028 {
2096
- boolean random = CameraPane.RANDOM;
2097
- CameraPane.RANDOM = false; // parse all random nodes
3029
+ boolean random = CameraPane.SWITCH;
3030
+ CameraPane.SWITCH = false; // parse all random nodes
20983031 group.selection.get(i).linkVerticesThis(content);
20993032 // group.selection.get(i).setMasterThis(content); // should be identity
2100
- CameraPane.RANDOM = random;
3033
+ CameraPane.SWITCH = random;
21013034 }
2102
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3035
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21033036 refreshContents();
21043037 }
21053038 } else
2106
- if (event.getSource() == resetsupportItem)
3039
+ if (source == resetsupportItem)
21073040 {
21083041 for (int i=0; i<group.selection.size(); i++)
21093042 {
2110
- boolean random = CameraPane.RANDOM;
2111
- CameraPane.RANDOM = false; // parse all random nodes
3043
+ boolean random = CameraPane.SWITCH;
3044
+ CameraPane.SWITCH = false; // parse all random nodes
21123045 group.selection.get(i).linkVerticesThis(null);
2113
- CameraPane.RANDOM = random;
3046
+ CameraPane.SWITCH = random;
21143047 }
21153048
21163049 refreshContents();
21173050 } else
2118
- if (event.getSource() == relinkverticesItem)
3051
+ if (source == relinkverticesItem)
21193052 {
2120
- boolean random = CameraPane.RANDOM;
2121
- CameraPane.RANDOM = false; // parse all random nodes
3053
+ boolean random = CameraPane.SWITCH;
3054
+ CameraPane.SWITCH = false; // parse all random nodes
21223055 group.selection.RelinkToSupport();
2123
- CameraPane.RANDOM = random;
3056
+ CameraPane.SWITCH = random;
21243057
21253058 refreshContents();
21263059 } else
2127
- if (event.getSource() == resetreferencesItem)
3060
+ if (source == resetreferencesItem)
21283061 {
21293062 for (int i=0; i<group.selection.size(); i++)
21303063 {
....@@ -2133,11 +3066,11 @@
21333066
21343067 refreshContents();
21353068 } else
2136
- if (event.getSource() == setMasterItem)
3069
+ if (source == setMasterItem)
21373070 {
2138
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
3071
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21393072 {
2140
- Object3D content = GrafreeD.clipboard.get(0);
3073
+ Object3D content = Grafreed.clipboard.get(0);
21413074
21423075 if (content instanceof cGroup && ((cGroup)content).transientlink )
21433076 content = ((cGroup)content).get(0);
....@@ -2146,13 +3079,13 @@
21463079 refreshContents();
21473080 }
21483081 } else
2149
- if (event.getSource() == poseMeshItem)
3082
+ if (source == poseMeshItem)
21503083 {
21513084 if (group.selection.size() == 1)
21523085 {
2153
- if (GrafreeD.clipboard.size() == 1)
3086
+ if (Grafreed.clipboard.size() == 1)
21543087 {
2155
- Object3D content = GrafreeD.clipboard.get(0);
3088
+ Object3D content = Grafreed.clipboard.get(0);
21563089
21573090 if (content instanceof cGroup && ((cGroup)content).transientlink )
21583091 content = ((cGroup)content).get(0);
....@@ -2165,19 +3098,19 @@
21653098 }
21663099
21673100 } else
2168
- if (event.getSource() == revertMeshItem)
3101
+ if (source == revertMeshItem)
21693102 {
21703103 RevertMeshes();
21713104 } else
2172
- if (event.getSource() == resetMeshItem)
3105
+ if (source == resetAllItem)
21733106 {
21743107 ResetAll();
21753108 } else
2176
- if (event.getSource() == stepAllItem)
3109
+ if (source == stepAllItem)
21773110 {
21783111 StepAll();
21793112 } else
2180
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3113
+ if (source == deleteItem) // || event.getSource() == clearButton)
21813114 {
21823115 //int indices[] = jList.getSelectedIndices();
21833116 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2185,46 +3118,46 @@
21853118
21863119 ClearSelection(false);
21873120 } else
2188
- if (event.getSource() == clearAllItem)
3121
+ if (source == clearAllItem)
21893122 {
21903123 ClearSelection(true);
21913124 } else
2192
- if (event.getSource() == grabItem)
3125
+ if (source == grabItem || source == groupButton)
21933126 {
2194
- group(new cGroup(), true);
3127
+ group(new cGroup(), false); // true);
21953128 } else
2196
- if (event.getSource() == hideItem)
3129
+ if (source == hideItem)
21973130 {
21983131 group(new HiddenObject());
21993132 } else
2200
- if (event.getSource() == frontItem)
3133
+ if (source == frontItem)
22013134 {
22023135 front();
22033136 } else
2204
- if (event.getSource() == backItem)
3137
+ if (source == backItem)
22053138 {
22063139 back();
22073140 } else
2208
- if (event.getSource() == cameraItem)
3141
+ if (source == cameraItem)
22093142 {
22103143 makeSomething(new Camera());
22113144 } else
2212
- if (event.getSource() == compositeItem)
3145
+ if (source == compositeItem || source == compositeButton)
22133146 {
22143147 group(new Composite());
22153148 } else
2216
- if (event.getSource() == randomItem)
3149
+ if (source == switchItem || source == switchButton)
22173150 {
22183151 RandomNode random = new RandomNode();
22193152 group(random);
22203153 if (random.size() > 0)
2221
- random.name = random.get(0).name + "Rnd";
3154
+ random.name = random.get(0).name + "Switch";
22223155 } else
2223
- if (event.getSource() == physicsItem)
3156
+ if (source == physicsItem)
22243157 {
22253158 group(new PhysicsNode());
22263159 } else
2227
- if (event.getSource() == frameselectorItem)
3160
+ if (source == frameselectorItem)
22283161 {
22293162 for (int i=0; i<group.selection.size(); i++)
22303163 {
....@@ -2236,7 +3169,7 @@
22363169 ResetModel();
22373170 refreshContents();
22383171 } else
2239
- if (event.getSource() == switchGeoItem)
3172
+ if (source == switchGeoItem)
22403173 {
22413174 for (int i=0; i<group.selection.size(); i++)
22423175 {
....@@ -2248,7 +3181,7 @@
22483181 ResetModel();
22493182 refreshContents();
22503183 } else
2251
- if (event.getSource() == switchTransfoItem)
3184
+ if (source == switchTransfoItem)
22523185 {
22533186 for (int i=0; i<group.selection.size(); i++)
22543187 {
....@@ -2260,7 +3193,7 @@
22603193 ResetModel();
22613194 refreshContents();
22623195 } else
2263
- if (event.getSource() == morphItem)
3196
+ if (source == morphItem)
22643197 {
22653198 for (int i=0; i<group.selection.size(); i++)
22663199 {
....@@ -2272,7 +3205,7 @@
22723205 ResetModel();
22733206 refreshContents();
22743207 } else
2275
- if (event.getSource() == scriptNodeItem)
3208
+ if (source == scriptNodeItem)
22763209 {
22773210 boolean atleastone = false;
22783211
....@@ -2311,215 +3244,252 @@
23113244 }
23123245 }
23133246 } else
2314
- if (event.getSource() == linkerItem)
3247
+ if (source == linkerItem)
23153248 {
23163249 group(new cLinker());
23173250 } else
2318
- if (event.getSource() == textureItem)
3251
+ if (source == textureItem || source == textureButton)
23193252 {
23203253 group(new TextureNode());
23213254 } else
2322
- if (event.getSource() == billboardItem)
3255
+ if (source == billboardItem)
23233256 {
23243257 group(new BillboardNode());
23253258 } else
2326
- if (event.getSource() == shadowXItem)
3259
+ if (source == shadowXItem)
23273260 {
23283261 CastShadow(0);
23293262 } else
2330
- if (event.getSource() == shadowYItem)
3263
+ if (source == shadowYItem)
23313264 {
23323265 CastShadow(1);
23333266 } else
2334
- if (event.getSource() == shadowZItem)
3267
+ if (source == shadowZItem)
23353268 {
23363269 CastShadow(2);
23373270 } else
2338
- if (event.getSource() == ungroupItem)
3271
+ if (source == ungroupItem || source == ungroupButton)
23393272 {
2340
- //ungroup();
3273
+ boolean hasRoot = false;
3274
+
23413275 for (int i=0; i<group.selection.size(); i++)
23423276 {
2343
- Ungroup(group.selection.get(i));
3277
+ if (group.selection.get(i) == group)
3278
+ {
3279
+ hasRoot = true;
3280
+ break;
3281
+ }
23443282 }
23453283
2346
- ClearSelection(false);
2347
-
2348
- refreshContents();
3284
+ if (!hasRoot)
3285
+ {
3286
+ for (int i=0; i<group.selection.size(); i++)
3287
+ {
3288
+ Ungroup(group.selection.get(i));
3289
+ }
3290
+
3291
+ ClearSelection(false);
3292
+
3293
+ refreshContents();
3294
+ }
23493295 } else
2350
- if (event.getSource() == genUVItem)
3296
+ if (source == genUVItem)
23513297 {
23523298 GenUV();
23533299 } else
2354
- if (event.getSource() == genNormalsCADItem)
3300
+ if (source == genNormalsCADItem)
23553301 {
23563302 GenNormals(true);
23573303 } else
2358
- if (event.getSource() == genNormalsMESHItem)
3304
+ if (source == genNormalsMESHItem)
23593305 {
2360
- GenNormals(true); // TODO
3306
+ GenNormalsMESH();
23613307 } else
2362
- if (event.getSource() == genNormalsORGANItem)
3308
+ if (source == genNormalsORGANItem)
23633309 {
23643310 GenNormals(false);
23653311 } else
2366
- if (event.getSource() == genNormalsMINEItem)
3312
+ if (source == genNormalsMINEItem)
23673313 {
23683314 GenNormalsMINE();
23693315 } else
2370
- if (event.getSource() == stripifyItem)
3316
+ if (source == stripifyItem)
23713317 {
23723318 Stripify();
23733319 } else
2374
- if (event.getSource() == unstripifyItem)
3320
+ if (source == unstripifyItem)
23753321 {
23763322 Unstripify();
23773323 } else
2378
- if (event.getSource() == trimItem)
3324
+ if (source == trimItem)
23793325 {
23803326 Trim();
23813327 } else
2382
- if (event.getSource() == untrimItem)
3328
+ if (source == untrimItem)
23833329 {
23843330 Untrim();
23853331 } else
2386
- if (event.getSource() == clearColorsItem)
3332
+ if (source == clearColorsItem)
23873333 {
23883334 ClearColors();
23893335 } else
2390
- if (event.getSource() == clearMaterialsItem)
3336
+ if (source == clearMaterialsItem)
23913337 {
23923338 ClearMaterials();
23933339 } else
2394
- if (event.getSource() == liveleavesItem)
3340
+ if (source == liveleavesItem)
23953341 {
23963342 LiveLeaves(true);
23973343 } else
2398
- if (event.getSource() == unliveleavesItem)
3344
+ if (source == unliveleavesItem)
23993345 {
24003346 LiveLeaves(false);
24013347 } else
2402
- if (event.getSource() == supportleavesItem)
3348
+ if (source == supportleavesItem)
24033349 {
24043350 SupportLeaves(true);
24053351 } else
2406
- if (event.getSource() == unsupportleavesItem)
3352
+ if (source == unsupportleavesItem)
24073353 {
24083354 SupportLeaves(false);
24093355 } else
2410
- if (event.getSource() == hideleavesItem)
3356
+ if (source == hideleavesItem)
24113357 {
24123358 HideLeaves(true);
24133359 } else
2414
- if (event.getSource() == showleavesItem)
3360
+ if (source == showleavesItem)
24153361 {
24163362 HideLeaves(false);
24173363 } else
2418
- if (event.getSource() == markleavesItem)
3364
+ if (source == markleavesItem)
24193365 {
24203366 MarkLeaves(true);
24213367 } else
2422
- if (event.getSource() == unmarkleavesItem)
3368
+ if (source == unmarkleavesItem)
24233369 {
24243370 MarkLeaves(false);
24253371 } else
2426
- if (event.getSource() == flipVItem)
3372
+ if (source == rewindleavesItem)
3373
+ {
3374
+ RewindLeaves(true);
3375
+ } else
3376
+ if (source == unrewindleavesItem)
3377
+ {
3378
+ RewindLeaves(false);
3379
+ } else
3380
+ if (source == randomleavesItem)
3381
+ {
3382
+ RandomLeaves(true);
3383
+ } else
3384
+ if (source == unrandomleavesItem)
3385
+ {
3386
+ RandomLeaves(false);
3387
+ } else
3388
+ if (source == flipVItem)
24273389 {
24283390 FlipV(true);
24293391 } else
2430
- if (event.getSource() == unflipVItem)
3392
+ if (source == unflipVItem)
24313393 {
24323394 FlipV(false);
24333395 } else
2434
- if (event.getSource() == lowTexturesItem)
3396
+ if (source == lowTexturesItem)
24353397 {
24363398 SetTexRes(0);
24373399 } else
2438
- if (event.getSource() == normalTexturesItem)
3400
+ if (source == normalTexturesItem)
24393401 {
24403402 SetTexRes(1);
24413403 } else
2442
- if (event.getSource() == highTexturesItem)
3404
+ if (source == highTexturesItem)
24433405 {
24443406 SetTexRes(2);
24453407 } else
2446
- if (event.getSource() == veryhighTexturesItem)
3408
+ if (source == veryhighTexturesItem)
24473409 {
24483410 SetTexRes(3);
24493411 } else
2450
- if (event.getSource() == maxTexturesItem)
3412
+ if (source == maxTexturesItem)
24513413 {
24523414 SetTexRes(4);
24533415 } else
2454
- if (event.getSource() == panoTexturesItem)
3416
+ if (source == panoTexturesItem)
24553417 {
24563418 SetTexRes(5);
24573419 } else
2458
- if (event.getSource() == reverseNormalsItem)
3420
+ if (source == reverseNormalsItem)
24593421 {
24603422 ReverseNormals();
24613423 } else
2462
- if (event.getSource() == parseverticesItem)
3424
+ if (source == parseverticesItem)
24633425 {
24643426 ParseVertices();
24653427 } else
2466
- if (event.getSource() == textureFieldItem)
3428
+ if (source == textureFieldItem)
24673429 {
24683430 TextureVertices();
24693431 } else
2470
- if (event.getSource() == alignItem)
3432
+ if (source == alignItem)
24713433 {
24723434 Align();
24733435 } else
2474
- if (event.getSource() == mirrorItem)
3436
+ if (source == mirrorItem)
24753437 {
24763438 MirrorPoses();
24773439 } else
2478
- if (event.getSource() == reduceMorphItem)
3440
+ if (source == reduceMorphItem)
24793441 {
24803442 MeshReduction(false);
24813443 } else
2482
- if (event.getSource() == reduce34MorphItem)
3444
+ if (source == reduce34MorphItem)
24833445 {
24843446 MeshReduction(true);
24853447 } else
2486
- if (event.getSource() == reverseTrianglesItem)
3448
+ if (source == reverseTrianglesItem)
24873449 {
24883450 ReverseTriangles();
24893451 } else
2490
- if (event.getSource() == reduceMeshItem)
3452
+ if (source == reduceMeshItem)
24913453 {
24923454 ReduceMesh(false);
24933455 } else
2494
- if (event.getSource() == reduce34MeshItem)
3456
+ if (source == reduce34MeshItem)
24953457 {
24963458 ReduceMesh(true);
24973459 } else
2498
- if (event.getSource() == increaseMeshItem)
3460
+ if (source == increaseMeshItem)
24993461 {
25003462 IncreaseMesh();
25013463 } else
2502
- if (event.getSource() == clipMeshItem)
3464
+ if (source == clipMeshItem)
25033465 {
25043466 ClipMesh();
25053467 } else
2506
- if (event.getSource() == smoothMeshItem)
3468
+ if (source == smoothMeshItem)
25073469 {
25083470 SmoothMesh();
25093471 } else
2510
- if (event.getSource() == transformgeometryItem)
3472
+ if (source == transformGeometryItem)
25113473 {
25123474 TransformGeometry();
25133475 } else
2514
- if (event.getSource() == resetTransformItem)
3476
+ if (source == transformChildrenItem)
3477
+ {
3478
+ TransformChildren();
3479
+ } else
3480
+ if (source == resetTransformItem)
25153481 {
25163482 ResetTransform();
25173483 } else
2518
- if (event.getSource() == resetCentroidItem)
3484
+ if (source == resetCentroidItem)
25193485 {
2520
- ResetCentroid();
3486
+ ResetCentroid(true);
25213487 } else
2522
- if (event.getSource() == resetParentItem)
3488
+ if (source == resetCentroidXZItem)
3489
+ {
3490
+ ResetCentroid(false);
3491
+ } else
3492
+ if (source == resetParentItem)
25233493 {
25243494 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25253495 {
....@@ -2529,7 +3499,7 @@
25293499
25303500 refreshContents();
25313501 } else
2532
- if (event.getSource() == repairParentItem)
3502
+ if (source == repairParentItem)
25333503 {
25343504 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25353505 {
....@@ -2543,7 +3513,21 @@
25433513
25443514 refreshContents();
25453515 } else
2546
- if (event.getSource() == sortbysizeItem)
3516
+ if (source == repairShadowItem)
3517
+ {
3518
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3519
+ {
3520
+ Object3D obj = (Object3D)e.nextElement();
3521
+ obj.RepairShadow();
3522
+// for (int i=0; i<obj.size(); i++)
3523
+// {
3524
+// obj.get(i).parent = obj;
3525
+// }
3526
+ }
3527
+
3528
+ refreshContents();
3529
+ } else
3530
+ if (source == sortbysizeItem)
25473531 {
25483532 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25493533 {
....@@ -2555,7 +3539,7 @@
25553539 ResetModel();
25563540 refreshContents();
25573541 } else
2558
- if (event.getSource() == sortbynameItem)
3542
+ if (source == sortbynameItem)
25593543 {
25603544 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25613545 {
....@@ -2567,7 +3551,7 @@
25673551 ResetModel();
25683552 refreshContents();
25693553 } else
2570
- if (event.getSource() == attachPigmentItem)
3554
+ if (source == attachPigmentItem)
25713555 {
25723556 String texture = GetFile("Attach pigment");
25733557 Object3D obj;
....@@ -2579,7 +3563,7 @@
25793563
25803564 refreshContents();
25813565 } else
2582
- if (event.getSource() == detachPigmentItem)
3566
+ if (source == detachPigmentItem)
25833567 {
25843568 Object3D obj;
25853569 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2590,7 +3574,7 @@
25903574
25913575 refreshContents();
25923576 } else
2593
- if (event.getSource() == attachBumpItem)
3577
+ if (source == attachBumpItem)
25943578 {
25953579 String texture = GetFile("Attach bump");
25963580 Object3D obj;
....@@ -2602,18 +3586,18 @@
26023586
26033587 refreshContents();
26043588 } else
2605
- if (event.getSource() == detachBumpItem)
3589
+ if (source == detachBumpItem)
26063590 {
26073591 Object3D obj;
26083592 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26093593 {
26103594 obj = (Object3D)e.nextElement();
2611
- obj.SetBumpTexture(null);
3595
+ obj.ResetBumpTexture();
26123596 }
26133597
26143598 refreshContents();
26153599 } else
2616
- if (event.getSource() == pigmentBumpItem)
3600
+ if (source == pigmentBumpItem)
26173601 {
26183602 Object3D obj;
26193603 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2624,158 +3608,262 @@
26243608
26253609 refreshContents();
26263610 } else
2627
- if (event.getSource() == flashSelectionButton)
3611
+ if (source == embedTexturesItem)
3612
+ {
3613
+ Object3D obj;
3614
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3615
+ {
3616
+ obj = (Object3D)e.nextElement();
3617
+ obj.EmbedTextures(true);
3618
+ }
3619
+
3620
+ refreshContents();
3621
+ } else
3622
+ if (source == deEmbedTexturesItem)
3623
+ {
3624
+ Object3D obj;
3625
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3626
+ {
3627
+ obj = (Object3D)e.nextElement();
3628
+ obj.EmbedTextures(false);
3629
+ }
3630
+
3631
+ CameraPane.texturepigment.clear();
3632
+ CameraPane.texturebump.clear();
3633
+
3634
+ refreshContents();
3635
+ } else
3636
+ if (source == flashSelectionButton)
26283637 {
26293638 CameraPane.flash = true;
26303639 refreshContents();
26313640 } else
2632
- if (event.getSource() == oneButton)
3641
+ if (source == oneButton)
26333642 {
26343643 } else
2635
- if (event.getSource() == twoButton)
3644
+ if (source == twoButton)
26363645 {
26373646 radio.layout = twoButton;
3647
+
3648
+ if (CameraPane.FULLSCREEN)
3649
+ fullscreenLayout = radio.layout;
3650
+
26383651 // bug
26393652 //gridPanel.setDividerLocation(1.0);
26403653 //bigPanel.setDividerLocation(0.0);
2641
- bigThree.remove(jtp);
2642
- bigThree.remove(cameraPanel);
2643
- bigThree.remove(XYZPanel);
2644
- aWindowConstraints.gridx = 0;
2645
- aWindowConstraints.gridy = 0;
2646
- aWindowConstraints.gridwidth = 1;
2647
- // aConstraints.gridheight = 3;
2648
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2649
- aWindowConstraints.weightx = 0;
2650
- aWindowConstraints.weighty = 1;
2651
- //bigThree.add(jtp, aWindowConstraints);
2652
- aWindowConstraints.weightx = 1;
2653
- aWindowConstraints.gridwidth = 3;
2654
- // aConstraints.gridheight = 3;
2655
- aWindowConstraints.gridx = 1;
2656
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2657
- bigThree.add(cameraPanel, aWindowConstraints);
2658
- aWindowConstraints.weightx = 0;
2659
- aWindowConstraints.gridx = 4;
2660
- aWindowConstraints.gridwidth = 1;
2661
- // aConstraints.gridheight = 3;
2662
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2663
- //bigThree.add(XYZPanel, aWindowConstraints);
2664
- bigThree.revalidate();
3654
+// bigThree.remove(scenePanel);
3655
+// bigThree.remove(centralPanel);
3656
+// bigThree.remove(XYZPanel);
3657
+// aWindowConstraints.gridx = 0;
3658
+// aWindowConstraints.gridy = 0;
3659
+// aWindowConstraints.gridwidth = 1;
3660
+// // aConstraints.gridheight = 3;
3661
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3662
+// aWindowConstraints.weightx = 0;
3663
+// aWindowConstraints.weighty = 1;
3664
+// //bigThree.add(jtp, aWindowConstraints);
3665
+// aWindowConstraints.weightx = 1;
3666
+// aWindowConstraints.gridwidth = 3;
3667
+// // aConstraints.gridheight = 3;
3668
+// aWindowConstraints.gridx = 1;
3669
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3670
+// bigThree.add(centralPanel, aWindowConstraints);
3671
+// aWindowConstraints.weightx = 0;
3672
+// aWindowConstraints.gridx = 4;
3673
+// aWindowConstraints.gridwidth = 1;
3674
+// // aConstraints.gridheight = 3;
3675
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3676
+// //bigThree.add(XYZPanel, aWindowConstraints);
3677
+// scenePanel.setVisible(false);
3678
+// centralPanel.setVisible(true);
3679
+// XYZPanel.setVisible(false);
3680
+ bigThree.ClearUI();
3681
+ bigThree.add(centralPanel);
3682
+ bigThree.FlushUI();
3683
+
3684
+ cameraView.requestFocusInWindow();
3685
+
3686
+// refreshContents(true);
3687
+//
3688
+// try
3689
+// {
3690
+// java.awt.Robot bot = new java.awt.Robot();
3691
+// int mask = InputEvent.BUTTON1_MASK;
3692
+// bot.mouseMove(100, 100);
3693
+// bot.mousePress(mask);
3694
+// bot.mouseRelease(mask);
3695
+// }
3696
+// catch (Exception e)
3697
+// {
3698
+//
3699
+// }
3700
+
26653701 } else
2666
- if (event.getSource() == threeButton)
3702
+ if (source == threeButton)
26673703 {
26683704 radio.layout = threeButton;
2669
- bigThree.remove(jtp);
2670
- bigThree.remove(cameraPanel);
2671
- bigThree.remove(XYZPanel);
2672
- aWindowConstraints.gridx = 0;
2673
- aWindowConstraints.gridy = 0;
2674
- aWindowConstraints.gridwidth = 1;
2675
- // aConstraints.gridheight = 3;
2676
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2677
- aWindowConstraints.weightx = 0;
2678
- aWindowConstraints.weighty = 1;
2679
- //bigThree.add(jtp, aWindowConstraints);
2680
- aWindowConstraints.weightx = 1;
2681
- aWindowConstraints.gridwidth = 3;
2682
- // aConstraints.gridheight = 3;
2683
- aWindowConstraints.gridx = 1;
2684
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2685
- bigThree.add(cameraPanel, aWindowConstraints);
2686
- aWindowConstraints.weightx = 0;
2687
- aWindowConstraints.gridx = 4;
2688
- aWindowConstraints.gridwidth = 1;
2689
- // aConstraints.gridheight = 3;
2690
- aConstraints.fill = GridBagConstraints.VERTICAL;
2691
- bigThree.add(XYZPanel, aWindowConstraints);
2692
- bigThree.revalidate();
3705
+
3706
+ if (CameraPane.FULLSCREEN)
3707
+ fullscreenLayout = radio.layout;
3708
+
3709
+// bigThree.remove(scenePanel);
3710
+// bigThree.remove(centralPanel);
3711
+// bigThree.remove(XYZPanel);
3712
+// aWindowConstraints.gridx = 0;
3713
+// aWindowConstraints.gridy = 0;
3714
+// aWindowConstraints.gridwidth = 1;
3715
+// // aConstraints.gridheight = 3;
3716
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3717
+// aWindowConstraints.weightx = 0;
3718
+// aWindowConstraints.weighty = 1;
3719
+// //bigThree.add(jtp, aWindowConstraints);
3720
+// aWindowConstraints.weightx = 1;
3721
+// aWindowConstraints.gridwidth = 3;
3722
+// // aConstraints.gridheight = 3;
3723
+// aWindowConstraints.gridx = 1;
3724
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3725
+// bigThree.add(centralPanel, aWindowConstraints);
3726
+// aWindowConstraints.weightx = 0;
3727
+// aWindowConstraints.gridx = 4;
3728
+// aWindowConstraints.gridwidth = 1;
3729
+// // aConstraints.gridheight = 3;
3730
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3731
+// bigThree.add(XYZPanel, aWindowConstraints);
3732
+// bigThree.validate();
3733
+// scenePanel.setVisible(false);
3734
+// centralPanel.setVisible(true);
3735
+// XYZPanel.setVisible(true);
3736
+ bigThree.ClearUI();
3737
+ bigThree.add(scenePanel);
3738
+ bigThree.add(centralPanel);
3739
+ bigThree.FlushUI();
3740
+
3741
+ cameraView.requestFocusInWindow();
26933742 } else
2694
- if (event.getSource() == fourButton)
3743
+ if (source == fourButton)
26953744 {
26963745 radio.layout = fourButton;
2697
- bigThree.remove(jtp);
2698
- bigThree.remove(cameraPanel);
2699
- bigThree.remove(XYZPanel);
2700
- aWindowConstraints.gridx = 0;
2701
- aWindowConstraints.gridy = 0;
2702
- aWindowConstraints.gridwidth = 1;
2703
- // aWindowConstraints.gridheight = 3;
2704
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2705
- aWindowConstraints.weightx = 1;
2706
- aWindowConstraints.weighty = 1;
2707
- bigThree.add(jtp, aWindowConstraints);
2708
- aWindowConstraints.weightx = 1;
2709
- aWindowConstraints.gridwidth = 3;
2710
- // aConstraints.gridheight = 3;
2711
- aWindowConstraints.gridx = 1;
2712
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2713
- //bigThree.add(cameraPanel, aWindowConstraints);
2714
- aWindowConstraints.weightx = 0;
2715
- aWindowConstraints.gridx = 4;
2716
- aWindowConstraints.gridwidth = 1;
2717
- // aWindowConstraints.gridheight = 3;
2718
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2719
- //bigThree.add(XYZPanel, aWindowConstraints);
2720
- bigThree.revalidate();
3746
+
3747
+ if (CameraPane.FULLSCREEN)
3748
+ fullscreenLayout = radio.layout;
3749
+
3750
+// bigThree.remove(scenePanel);
3751
+// bigThree.remove(centralPanel);
3752
+// bigThree.remove(XYZPanel);
3753
+// aWindowConstraints.gridx = 0;
3754
+// aWindowConstraints.gridy = 0;
3755
+// aWindowConstraints.gridwidth = 1;
3756
+// // aWindowConstraints.gridheight = 3;
3757
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3758
+// aWindowConstraints.weightx = 1;
3759
+// aWindowConstraints.weighty = 1;
3760
+// bigThree.add(scenePanel, aWindowConstraints);
3761
+// aWindowConstraints.weightx = 1;
3762
+// aWindowConstraints.gridwidth = 3;
3763
+// // aConstraints.gridheight = 3;
3764
+// aWindowConstraints.gridx = 1;
3765
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3766
+// //bigThree.add(cameraPanel, aWindowConstraints);
3767
+// aWindowConstraints.weightx = 0;
3768
+// aWindowConstraints.gridx = 4;
3769
+// aWindowConstraints.gridwidth = 1;
3770
+// // aWindowConstraints.gridheight = 3;
3771
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3772
+// //bigThree.add(XYZPanel, aWindowConstraints);
3773
+// bigThree.validate();
3774
+// scenePanel.setVisible(true);
3775
+// centralPanel.setVisible(false);
3776
+// XYZPanel.setVisible(false);
3777
+ bigThree.ClearUI();
3778
+ bigThree.add(scenePanel);
3779
+ bigThree.FlushUI();
3780
+
3781
+ cameraView.requestFocusInWindow();
27213782 } else
2722
- if (event.getSource() == sixButton)
3783
+ if (source == sixButton)
27233784 {
27243785 radio.layout = sixButton;
2725
- bigThree.remove(jtp);
2726
- bigThree.remove(cameraPanel);
2727
- bigThree.remove(XYZPanel);
2728
- aWindowConstraints.gridx = 0;
2729
- aWindowConstraints.gridy = 0;
2730
- aWindowConstraints.gridwidth = 1;
2731
- // aConstraints.gridheight = 3;
2732
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2733
- aWindowConstraints.weightx = 0;
2734
- aWindowConstraints.weighty = 1;
2735
- bigThree.add(jtp, aWindowConstraints);
2736
- aWindowConstraints.weightx = 1;
2737
- aWindowConstraints.gridwidth = 3;
2738
- // aWindowConstraints.gridheight = 3;
2739
- aWindowConstraints.gridx = 1;
2740
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2741
- bigThree.add(cameraPanel, aWindowConstraints);
2742
- aWindowConstraints.weightx = 0;
2743
- aWindowConstraints.gridx = 4;
2744
- aWindowConstraints.gridwidth = 1;
2745
- // aWindowConstraints.gridheight = 3;
2746
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2747
- //bigThree.add(XYZPanel, aConstraints);
2748
- bigThree.revalidate();
3786
+
3787
+ if (CameraPane.FULLSCREEN)
3788
+ fullscreenLayout = radio.layout;
3789
+
3790
+// bigThree.remove(scenePanel);
3791
+// bigThree.remove(centralPanel);
3792
+// bigThree.remove(XYZPanel);
3793
+// aWindowConstraints.gridx = 0;
3794
+// aWindowConstraints.gridy = 0;
3795
+// aWindowConstraints.gridwidth = 1;
3796
+// // aConstraints.gridheight = 3;
3797
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3798
+// aWindowConstraints.weightx = 0;
3799
+// aWindowConstraints.weighty = 1;
3800
+// bigThree.add(scenePanel, aWindowConstraints);
3801
+// aWindowConstraints.weightx = 1;
3802
+// aWindowConstraints.gridwidth = 3;
3803
+// // aWindowConstraints.gridheight = 3;
3804
+// aWindowConstraints.gridx = 1;
3805
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3806
+// bigThree.add(centralPanel, aWindowConstraints);
3807
+// aWindowConstraints.weightx = 0;
3808
+// aWindowConstraints.gridx = 4;
3809
+// aWindowConstraints.gridwidth = 1;
3810
+// // aWindowConstraints.gridheight = 3;
3811
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3812
+// //bigThree.add(XYZPanel, aConstraints);
3813
+// bigThree.validate();
3814
+// scenePanel.setVisible(true);
3815
+// centralPanel.setVisible(true);
3816
+// XYZPanel.setVisible(false);
3817
+ bigThree.ClearUI();
3818
+ bigThree.add(centralPanel);
3819
+ bigThree.add(scenePanel);
3820
+ bigThree.FlushUI();
3821
+
3822
+ cameraView.requestFocusInWindow();
27493823 } else
2750
- if (event.getSource() == sevenButton)
3824
+ if (source == sevenButton)
27513825 {
27523826 radio.layout = sevenButton;
2753
- bigThree.remove(jtp);
2754
- bigThree.remove(cameraPanel);
2755
- bigThree.remove(XYZPanel);
2756
- aWindowConstraints.gridx = 0;
2757
- aWindowConstraints.gridy = 0;
2758
- aWindowConstraints.gridwidth = 1;
2759
- // aWindowConstraints.gridheight = 3;
2760
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2761
- aWindowConstraints.weightx = 0;
2762
- aWindowConstraints.weighty = 1;
2763
- bigThree.add(jtp, aWindowConstraints);
2764
- aWindowConstraints.weightx = 1;
2765
- aWindowConstraints.gridwidth = 3;
2766
- // aWindowConstraints.gridheight = 3;
2767
- aWindowConstraints.gridx = 1;
2768
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2769
- bigThree.add(cameraPanel, aWindowConstraints);
2770
- aWindowConstraints.weightx = 0;
2771
- aWindowConstraints.gridx = 4;
2772
- aWindowConstraints.gridwidth = 1;
2773
- // aConstraints.gridheight = 3;
2774
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2775
- bigThree.add(XYZPanel, aWindowConstraints);
2776
- bigThree.revalidate();
3827
+
3828
+ if (CameraPane.FULLSCREEN)
3829
+ fullscreenLayout = radio.layout;
3830
+
3831
+// bigThree.remove(scenePanel);
3832
+// bigThree.remove(centralPanel);
3833
+// bigThree.remove(XYZPanel);
3834
+// aWindowConstraints.gridx = 0;
3835
+// aWindowConstraints.gridy = 0;
3836
+// aWindowConstraints.gridwidth = 1;
3837
+// // aWindowConstraints.gridheight = 3;
3838
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3839
+// aWindowConstraints.weightx = 0;
3840
+// aWindowConstraints.weighty = 1;
3841
+// bigThree.add(scenePanel, aWindowConstraints);
3842
+// aWindowConstraints.weightx = 1;
3843
+// aWindowConstraints.gridwidth = 3;
3844
+// // aWindowConstraints.gridheight = 3;
3845
+// aWindowConstraints.gridx = 1;
3846
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3847
+// bigThree.add(centralPanel, aWindowConstraints);
3848
+// aWindowConstraints.weightx = 0;
3849
+// aWindowConstraints.gridx = 4;
3850
+// aWindowConstraints.gridwidth = 1;
3851
+// // aConstraints.gridheight = 3;
3852
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3853
+// bigThree.add(XYZPanel, aWindowConstraints);
3854
+// bigThree.validate();
3855
+// scenePanel.setVisible(true);
3856
+// centralPanel.setVisible(true);
3857
+// XYZPanel.setVisible(true);
3858
+ bigThree.ClearUI();
3859
+ bigThree.add(scenePanel);
3860
+ bigThree.add(centralPanel);
3861
+ bigThree.add(XYZPanel);
3862
+ bigThree.FlushUI();
3863
+
3864
+ cameraView.requestFocusInWindow();
27773865 } else
2778
- if (event.getSource() == rootButton)
3866
+ if (source == rootButton)
27793867 {
27803868 Object3D obj;
27813869 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2785,66 +3873,85 @@
27853873 EditObject(obj);
27863874 }
27873875
3876
+ cameraView.requestFocusInWindow();
27883877 refreshContents(true);
27893878 } else
2790
- if (event.getSource() == closeButton)
3879
+ if (source == closeButton)
27913880 {
27923881 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27933882 cRadio ab;
27943883 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27953884 {
27963885 ab = (cRadio)e.nextElement();
2797
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3886
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27983887 {
3888
+ // Patch to avoid bug with transparency.
3889
+ if (!ab.hadMaterial)
3890
+ {
3891
+ ab.object.material = null;
3892
+ }
3893
+
27993894 buttonGroup.remove(ab);
28003895 radioPanel.remove(ab);
28013896
2802
- ab.GetObject().editWindow = null;
3897
+ //ab.GetObject().editWindow = null;
3898
+ ab.GetObject().manipWindow = null;
28033899 // ab.GetObject().objectUI = null; // ?????????
28043900
28053901 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28063902 break;
28073903 }
28083904 }
3905
+
3906
+ cameraView.requestFocusInWindow();
28093907 refreshContents(true);
28103908 } else
2811
- if (event.getSource() == editItem || event.getSource() == editButton)
3909
+ if (source == editItem || source == editButton)
28123910 {
3911
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3912
+ {
3913
+ Object3D child = (Object3D)e.nextElement();
3914
+ child.pinned = true;
3915
+ }
3916
+
28133917 EditSelection(false);
28143918 } else
2815
- if (event.getSource() == uneditButton)
3919
+ if (source == uneditButton)
28163920 {
28173921 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28183922 {
28193923 Object3D child = (Object3D)e.nextElement();
28203924 if(child.editWindow != null)
2821
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3925
+ child.pinned = false;
28223926 child.CloseUI();
28233927 listUI.remove(child);
3928
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28243929
2825
- child.editWindow = null; // ???????????
3930
+ //child.editWindow = null; // ???????????
28263931 }
2827
- objEditor.ctrlPanel.revalidate();
3932
+ objEditor.ctrlPanel.FlushUI();
28283933 //objEditor.jTree.clearSelection();
28293934 //objEditor.ResetSliders();
28303935 refreshContents(true);
28313936 } else
2832
- if (event.getSource() == clearPanelButton)
3937
+ if (source == clearPanelButton)
28333938 {
28343939 assert(copy == group);
28353940 //copy.ClearUI();
28363941 for (Object3D obj : listUI)
28373942 {
3943
+ obj.pinned = false;
28383944 obj.CloseUI();
28393945 }
28403946 listUI.clear();
3947
+ SetPinStates(group.selection.size() > 0);
28413948 refreshContents(true);
28423949 } else
2843
- if (event.getSource() == allParamsButton)
3950
+ if (source == allParamsButton)
28443951 {
28453952 assert(copy == group);
28463953
2847
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3954
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28483955
28493956 for (Object3D obj : listUI)
28503957 {
....@@ -2861,19 +3968,19 @@
28613968
28623969 refreshContents(true);
28633970 } else
2864
- if (event.getSource() == unselectButton)
3971
+ if (source == unselectButton)
28653972 {
28663973 objEditor.jTree.clearSelection();
28673974 // ?? oct 2012 GrafreeD.clipboard.clear();
28683975 objEditor.ResetSliders();
28693976 refreshContents(true);
28703977 } else
2871
- if(event.getSource() instanceof cRadio)
3978
+ if(source instanceof cRadio)
28723979 {
28733980 group.parent = keepparent;
28743981 group.attributes = 0;
28753982 //group.editWindow = null;
2876
- /*cRadio*/ radio = (cRadio)event.getSource();
3983
+ /*cRadio*/ radio = (cRadio)source;
28773984 Object3D obj = radio.GetObject();
28783985 System.out.println("Edit " + obj);
28793986 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2893,7 +4000,10 @@
28934000 }
28944001
28954002 copy = group;
2896
- //CameraPane.theRenderer.object = group;
4003
+
4004
+ SetUndoStates();
4005
+
4006
+ //Globals.theRenderer.object = group;
28974007 if(!useclient)
28984008 {
28994009 cameraView.renderCamera = radio.camera;
....@@ -2902,25 +4012,55 @@
29024012 cameraView.cameras[cameraView.cameracount] = radio.camera;
29034013 cameraView.targetLookAt.set(radio.camera.lookAt);
29044014 cameraView.object = group;
2905
- cameraView.lighttouched = true;
4015
+ //cameraView.lighttouched = true;
4016
+ Globals.lighttouched = true;
29064017 topView.object = group;
29074018 frontView.object = group;
29084019 sideView.object = group;
29094020 }
2910
- group.editWindow = this;
4021
+
4022
+// fix "+" issue
4023
+ //group.editWindow = this;
4024
+ group.manipWindow = this;
4025
+
29114026 /*
29124027 currentLayout = radio.layout;
29134028 if (currentLayout == null)
29144029 currentLayout = sevenButton;
29154030 */
29164031 radio.layout.doClick();
4032
+
4033
+ ClearUnpinned();
4034
+
4035
+ //Grafreed.Assert(group != null);
4036
+ //Grafreed.Assert(group.selection != null);
4037
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4038
+ if (group.selection == null || group.selection.size() == 1)
4039
+ EditSelection(false);
29174040 keepparent = group.parent;
29184041 // PARENT = NULL or not???
29194042 //group.parent = null; // ROOT
29204043 //group.attributes = -1;
29214044 ResetModel();
4045
+
4046
+ cameraView.requestFocusInWindow();
29224047 refreshContents(true);
2923
- }
4048
+ } else if (event.getSource() == editCameraItem)
4049
+ {
4050
+ cameraView.ProtectCamera();
4051
+ cameraView.requestFocusInWindow();
4052
+ cameraView.repaint();
4053
+ return;
4054
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4055
+ {
4056
+ cameraView.RevertCamera();
4057
+ cameraView.requestFocusInWindow();
4058
+ cameraView.repaint();
4059
+ return;
4060
+ // } else if (event.getSource() == textureButton)
4061
+ // {
4062
+ // return; // true;
4063
+ }
29244064 else
29254065 {
29264066 //return super.action(event, arg);
....@@ -2929,7 +4069,6 @@
29294069 }
29304070
29314071 boolean useclient = false;
2932
- cRadio radio;
29334072
29344073 void ToggleRoot()
29354074 {
....@@ -2938,7 +4077,7 @@
29384077 if (useclient)
29394078 {
29404079 cameraView.object = client;
2941
- cameraView.lighttouched = true;
4080
+ Globals.lighttouched = true;
29424081 //topView.object = client;
29434082 //frontView.object = client;
29444083 //sideView.object = client;
....@@ -2946,7 +4085,7 @@
29464085 else
29474086 {
29484087 cameraView.object = group;
2949
- cameraView.lighttouched = true;
4088
+ Globals.lighttouched = true;
29504089 //topView.object = group;
29514090 //frontView.object = group;
29524091 //sideView.object = group;
....@@ -2981,6 +4120,28 @@
29814120 refreshContents();
29824121 }
29834122
4123
+ void TransformChildren()
4124
+ {
4125
+ Object3D obj;
4126
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4127
+ {
4128
+ obj = (Object3D)e.nextElement();
4129
+ obj.KeepTextureMatrices();
4130
+ obj.TransformChildren();
4131
+ obj.RestoreTextureMatrices();
4132
+
4133
+// if (obj.parent == null)
4134
+// {
4135
+// System.out.println("NULL PARENT!");
4136
+// new Exception().printStackTrace();
4137
+// }
4138
+// else
4139
+// TouchTransform(obj);
4140
+// //obj.parent.Touch();
4141
+ }
4142
+
4143
+ refreshContents();
4144
+ }
29844145
29854146 void ResetTransform()
29864147 {
....@@ -3093,7 +4254,7 @@
30934254 refreshContents();
30944255 }
30954256
3096
- void ResetCentroid()
4257
+ void ResetCentroid(boolean full)
30974258 {
30984259 Object3D obj;
30994260 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3108,12 +4269,16 @@
31084269 LA.matIdentity(Object3D.mat);
31094270 obj.getBounds(minima, maxima, false);
31104271 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3111
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4272
+ if (full)
4273
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31124274 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31134275 obj.TransformMesh(Object3D.mat);
4276
+
31144277 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3115
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4278
+ if (full)
4279
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31164280 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4281
+
31174282 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31184283 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31194284 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3142,7 +4307,8 @@
31424307
31434308 int size = obj.MemorySize();
31444309
3145
- System.err.println((size/1024) + " KB is the size of " + obj);
4310
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4311
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
31464312 }
31474313 }
31484314 catch (Exception e)
....@@ -3179,9 +4345,9 @@
31794345 obj = (Object3D)e.nextElement();
31804346
31814347 System.out.println("Object is: " + obj);
3182
- GrafreeD.AnalyzeObject(obj);
4348
+ Grafreed.AnalyzeObject(obj);
31834349 System.out.println("Boundary rep: " + obj.bRep);
3184
- GrafreeD.AnalyzeObject(obj.bRep);
4350
+ Grafreed.AnalyzeObject(obj.bRep);
31854351
31864352 // System.err.println((size/1024) + " KB is the size of " + obj);
31874353 }
....@@ -3223,6 +4389,13 @@
32234389 void GenNormals(boolean crease)
32244390 {
32254391 group.GenNormalsS(crease);
4392
+
4393
+ refreshContents();
4394
+ }
4395
+
4396
+ void GenNormalsMESH()
4397
+ {
4398
+ group.GenNormalsMeshS();
32264399
32274400 refreshContents();
32284401 }
....@@ -3395,8 +4568,8 @@
33954568
33964569 void ParseVertices()
33974570 {
3398
- boolean epsequal = GrafreeD.epsequal;
3399
- GrafreeD.epsequal = true;
4571
+ boolean epsequal = Grafreed.epsequal;
4572
+ Grafreed.epsequal = true;
34004573
34014574 for (int i=0; i<group.selection.size(); i++)
34024575 {
....@@ -3421,7 +4594,7 @@
34214594 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34224595 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34234596
3424
- g.add(GrafreeD.clipboard);
4597
+ g.add(Grafreed.clipboard);
34254598
34264599 buffer.add(g);
34274600 }
....@@ -3436,7 +4609,7 @@
34364609 makeSomething(buffer, i==group.selection.size()-1);
34374610 }
34384611
3439
- GrafreeD.epsequal = epsequal;
4612
+ Grafreed.epsequal = epsequal;
34404613
34414614 refreshContents();
34424615 }
....@@ -3454,7 +4627,16 @@
34544627 String pigment = Object3D.GetPigment(tex);
34554628 //String bump = Object3D.GetBump(tex);
34564629
3457
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4630
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4631
+
4632
+ try
4633
+ {
4634
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4635
+ }
4636
+ catch (Exception e)
4637
+ {
4638
+ System.err.println("FAIL: " + node);
4639
+ }
34584640
34594641 double s = v.s;
34604642
....@@ -3542,11 +4724,11 @@
35424724
35434725 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35444726
3545
- boolean random = CameraPane.RANDOM;
3546
- CameraPane.RANDOM = false; // parse all random nodes
4727
+ boolean random = CameraPane.SWITCH;
4728
+ CameraPane.SWITCH = false; // parse all random nodes
35474729 lowres.linkVerticesThis(null);
35484730 lowres.linkVerticesThis(sn);
3549
- CameraPane.RANDOM = random;
4731
+ CameraPane.SWITCH = random;
35504732
35514733 System.err.flush();
35524734
....@@ -3586,7 +4768,7 @@
35864768 return;
35874769
35884770 Object3D poses = group.selection.get(0);
3589
- Object3D ref = GrafreeD.clipboard.get(0);
4771
+ Object3D ref = Grafreed.clipboard.get(0);
35904772
35914773 Object3D newgroup = new Object3D("Po:" + poses.name);
35924774
....@@ -3755,7 +4937,7 @@
37554937 group.selection.RelinkToSupport(); // july 2014
37564938 System.out.println("DONE.");
37574939 refreshContents();
3758
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4940
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
37594941 }
37604942
37614943 void ReduceMesh(boolean reduction34)
....@@ -3780,9 +4962,9 @@
37804962
37814963 void ClipMesh()
37824964 {
3783
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4965
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37844966 {
3785
- Object3D content = GrafreeD.clipboard.get(0);
4967
+ Object3D content = Grafreed.clipboard.get(0);
37864968
37874969 if (content instanceof cGroup && ((cGroup)content).transientlink )
37884970 content = ((cGroup)content).get(0);
....@@ -3791,7 +4973,7 @@
37914973 // {
37924974 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37934975 // }
3794
- group.selection.ClipMesh(GrafreeD.clipboard);
4976
+ group.selection.ClipMesh(Grafreed.clipboard);
37954977 }
37964978 // group.selection.ClipMesh(GrafreeD.clipboard);
37974979 System.out.println("DONE.");
....@@ -3838,6 +5020,18 @@
38385020 void MarkLeaves(boolean hide)
38395021 {
38405022 group.selection.MarkLeaves(hide);
5023
+ refreshContents();
5024
+ }
5025
+
5026
+ void RewindLeaves(boolean hide)
5027
+ {
5028
+ group.selection.RewindLeaves(hide);
5029
+ refreshContents();
5030
+ }
5031
+
5032
+ void RandomLeaves(boolean hide)
5033
+ {
5034
+ group.selection.RandomLeaves(hide);
38415035 refreshContents();
38425036 }
38435037
....@@ -3912,28 +5106,25 @@
39125106 // }
39135107 // }
39145108
3915
- static boolean allparams = true;
3916
-
3917
- static Vector<Object3D> listUI = new Vector<Object3D>();
3918
-
39195109 void EditSelection(boolean newWindow)
39205110 {
5111
+ if (group.selection == null)
5112
+ {
5113
+ EditElement(group, newWindow); // ? new
5114
+ return;
5115
+ }
5116
+
39215117 // aConstraints.gridy = 0;
39225118 for (int i=0; i<group.selection.size(); i++)
39235119 {
39245120 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39255121 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3926
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5122
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39275123
39285124 Object3D elem = (Object3D)group.selection.elementAt(i);
3929
- if(elem != group)
5125
+ if(elem != group || !newWindow)
39305126 {
3931
- // if (!(elem instanceof Composite))
3932
- // newWindow = false;
3933
- listUI.add(elem);
3934
- elem.openEditWindow(this, newWindow); //, false);
3935
- System.out.println("edit : " + elem);
3936
- elem.editWindow.refreshContents(true); // ? new
5127
+ EditElement(elem, newWindow); // ? new
39375128 }
39385129 }
39395130 }
....@@ -3996,9 +5187,7 @@
39965187
39975188 freezemodel = false;
39985189 }
3999
-
4000
- boolean flashIt = true;
4001
-
5190
+
40025191 public void valueChanged(TreeSelectionEvent e)
40035192 //public boolean handleEvent(Event event)
40045193 {
....@@ -4008,7 +5197,8 @@
40085197 //new Exception().printStackTrace();
40095198
40105199 freezemodel = true;
4011
-
5200
+ ClearUnpinned();
5201
+
40125202 /**/
40135203 //switch (event.id)
40145204 {
....@@ -4016,7 +5206,6 @@
40165206 //case 702: // Event.LIST_DESELECT
40175207 group.deselectAll();
40185208 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4019
- objEditor.ClearInfo(); // .GetMaterial());
40205209 if (tps != null)
40215210 {
40225211 for (int i=0; i < tps.length; i++)
....@@ -4025,33 +5214,39 @@
40255214
40265215 //if (child.parent != null)
40275216 //child.parent.addSelectee(child);
5217
+ objEditor.SetMaterial(child);
40285218 group.addSelectee(child);
4029
- objEditor.SetMaterial(child); // .GetMaterial());
4030
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4031
- System.err.println("info : " + child.GetPath());
40325219 }
40335220 }
4034
- else
4035
- {
4036
- objEditor.SetMaterial(group); // .GetMaterial());
4037
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4038
- System.err.println("info : " + group.GetPath());
4039
- }
5221
+// else
5222
+// {
5223
+// objEditor.SetMaterial(group); // .GetMaterial());
5224
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5225
+// System.err.println("info : " + group.GetPath());
5226
+// }
40405227
4041
- objEditor.SetText(); // jan 2014
4042
-
4043
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5228
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
40445229 CameraPane.flash = true;
40455230
4046
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5231
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40475232 // a camera
40485233 {
4049
- CameraPane.camerachangeframe = 0; // don't refuse it
4050
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4051
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4052
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
5234
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5235
+ {
5236
+ CameraPane.camerachangeframe = 0; // don't refuse it
5237
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5238
+ }
5239
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5240
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
40535241 }
40545242
5243
+ if (tps != null && tps.length == 1)
5244
+ {
5245
+ EditSelection(false);
5246
+ }
5247
+
5248
+ SetPinStates(tps != null && tps.length > 0);
5249
+
40555250 refreshContents();
40565251 //return true;
40575252 }
....@@ -4060,6 +5255,37 @@
40605255
40615256 freezemodel = false;
40625257 }
5258
+
5259
+ void SetPinStates(boolean enabled)
5260
+ {
5261
+ editButton.setEnabled(enabled);
5262
+ uneditButton.setEnabled(enabled);
5263
+ //unselectButton.setEnabled(enabled);
5264
+ flashSelectionButton.setEnabled(enabled);
5265
+
5266
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5267
+ }
5268
+
5269
+ void refreshContents(boolean cp)
5270
+ {
5271
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5272
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5273
+ {
5274
+ objEditor.ClearInfo(); // .GetMaterial());
5275
+
5276
+ for (int i=0; i < group.selection.Size(); i++)
5277
+ {
5278
+ Object3D child = (Object3D) group.selection.get(i);
5279
+
5280
+ objEditor.AddInfo(child, this, true);
5281
+ System.err.println("info : " + child.GetPath());
5282
+ }
5283
+
5284
+ objEditor.SetText(); // jan 2014
5285
+ }
5286
+
5287
+ super.refreshContents(cp);
5288
+ }
40635289
40645290 void linkSomething(Object3D thing)
40655291 {
....@@ -4131,16 +5357,19 @@
41315357 {
41325358 if (group.selection.isEmpty())
41335359 return;
4134
- GrafreeD.clipboardIsTempGroup = false;
5360
+
5361
+ Grafreed.clipboardIsTempGroup = false;
41355362 Composite tGroup = null;
41365363 if (group.selection.size() > 0) // 1)
41375364 {
41385365 tGroup = new cGroup();
4139
- GrafreeD.clipboardIsTempGroup = true;
5366
+ Grafreed.clipboardIsTempGroup = true;
41405367 }
41415368
41425369 if (cut)
41435370 {
5371
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5372
+// Save();
41445373 //int indices[] = jList.getSelectedIndices();
41455374 //for (int i = indices.length - 1; i >= 0; i--)
41465375 //jList.remove(indices[i]);
....@@ -4176,16 +5405,16 @@
41765405 //System.out.println("cut " + child);
41775406 //System.out.println("parent = " + child.parent);
41785407 // tmp.addChild(child);
4179
- if (GrafreeD.clipboardIsTempGroup)
5408
+ if (Grafreed.clipboardIsTempGroup)
41805409 tGroup.add/*Child*/(tmp);
41815410 else
4182
- GrafreeD.clipboard = tmp;
5411
+ Grafreed.clipboard = tmp;
41835412 }
41845413 else
4185
- if (GrafreeD.clipboardIsTempGroup)
5414
+ if (Grafreed.clipboardIsTempGroup)
41865415 tGroup.add/*Child*/(child);
41875416 else
4188
- GrafreeD.clipboard = child;
5417
+ Grafreed.clipboard = child;
41895418 }
41905419
41915420 //ResetModel();
....@@ -4217,21 +5446,23 @@
42175446 //System.out.println("cut " + elem);
42185447 //System.out.println("parent = " + elem.parent);
42195448 // tmp.addChild(elem);
4220
- if (GrafreeD.clipboardIsTempGroup)
5449
+ if (Grafreed.clipboardIsTempGroup)
42215450 tGroup.add/*Child*/(tmp);
42225451 else
4223
- GrafreeD.clipboard = tmp;
5452
+ Grafreed.clipboard = tmp;
42245453 }
42255454 else
4226
- if (GrafreeD.clipboardIsTempGroup)
5455
+ if (Grafreed.clipboardIsTempGroup)
42275456 tGroup.add/*Child*/(child);
42285457 else
4229
- GrafreeD.clipboard = child;
5458
+ Grafreed.clipboard = child;
42305459 }
42315460
42325461 }
4233
- if (GrafreeD.clipboardIsTempGroup)
4234
- GrafreeD.clipboard = tGroup;
5462
+
5463
+ if (Grafreed.clipboardIsTempGroup)
5464
+ Grafreed.clipboard = tGroup;
5465
+
42355466 if (cut)
42365467 {
42375468 ResetModel();
....@@ -4241,11 +5472,15 @@
42415472
42425473 void paste(boolean expand)
42435474 {
5475
+ if (Globals.REPLACEONMAKE)
5476
+ Save();
5477
+ boolean keep = Globals.REPLACEONMAKE;
5478
+ Globals.REPLACEONMAKE = false;
42445479 // if (GrafreeD.clipboard == null)
42455480 // return;
42465481 boolean first = true;
42475482
4248
- if (GrafreeD.clipboardIsTempGroup)
5483
+ if (Grafreed.clipboardIsTempGroup)
42495484 {
42505485 Composite temp;
42515486
....@@ -4256,7 +5491,7 @@
42565491 temp = (Composite)Applet3D.clipboard.deepCopy();
42575492 */
42585493 Object3D elem;
4259
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5494
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
42605495 {
42615496 Object3D child = (Object3D)e.nextElement();
42625497
....@@ -4290,21 +5525,22 @@
42905525 //Object3D cb = Applet3D.clipboard;
42915526 //temp.addChild(cb);
42925527 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4293
- assert(GrafreeD.clipboard.parent == null);
4294
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4295
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4296
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4297
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5528
+ assert(Grafreed.clipboard.parent == null);
5529
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5530
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5531
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5532
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42985533 else
4299
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4300
- GrafreeD.clipboard.get(0).parent = keepparent;
5534
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5535
+ Grafreed.clipboard.get(0).parent = keepparent;
43015536 }
43025537
5538
+ Globals.REPLACEONMAKE = keep;
43035539 ResetModel();
43045540 refreshContents();
43055541 }
43065542
4307
- void pasteInto(boolean copyit)
5543
+ void pasteInto(boolean copyit, boolean clone)
43085544 {
43095545 // if (GrafreeD.clipboard == null)
43105546 // return;
....@@ -4333,15 +5569,22 @@
43335569 if (copyit)
43345570 {
43355571 // paste(false);
4336
- CloneClipboard(false); // sept 2014
5572
+ if (clone)
5573
+ {
5574
+ CloneClipboard(false); // sept 2014
5575
+ }
5576
+ else
5577
+ {
5578
+ paste(false);
5579
+ }
43375580 }
43385581 else
43395582 {
43405583 boolean first = true;
43415584
4342
- if (GrafreeD.clipboardIsTempGroup)
5585
+ if (Grafreed.clipboardIsTempGroup)
43435586 {
4344
- Composite temp = (Composite)GrafreeD.clipboard;
5587
+ Composite temp = (Composite)Grafreed.clipboard;
43455588 Object3D copy;
43465589 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43475590 {
....@@ -4351,7 +5594,7 @@
43515594 }
43525595 } else
43535596 {
4354
- linkSomething(GrafreeD.clipboard); //.get(0));
5597
+ linkSomething(Grafreed.clipboard); //.get(0));
43555598 }
43565599 }
43575600 }
....@@ -4428,6 +5671,10 @@
44285671
44295672 void group(Object3D csg, boolean grab)
44305673 {
5674
+ if (Globals.REPLACEONMAKE)
5675
+ Save();
5676
+ boolean keep = Globals.REPLACEONMAKE;
5677
+ Globals.REPLACEONMAKE = false;
44315678 if (//false) // why??
44325679 !group.selection.isEmpty())
44335680 {
....@@ -4541,10 +5788,15 @@
45415788 //node.add(csg);
45425789 //makeSomething(node);
45435790 makeSomething(csg);
5791
+ Globals.REPLACEONMAKE = keep;
45445792 }
45455793
45465794 void Ungroup(Object3D g)
45475795 {
5796
+ if (Globals.REPLACEONMAKE)
5797
+ Save();
5798
+ boolean keep = Globals.REPLACEONMAKE;
5799
+ Globals.REPLACEONMAKE = false;
45485800 if (g instanceof HiddenObject)
45495801 {
45505802 HiddenObject h = (HiddenObject) g;
....@@ -4561,6 +5813,7 @@
45615813 objEditor.makeSomething(g.get(i), false);
45625814 }
45635815 }
5816
+ Globals.REPLACEONMAKE = keep;
45645817 }
45655818
45665819 void ungroup()
....@@ -4756,21 +6009,6 @@
47566009 }
47576010 */
47586011
4759
- void ImportGFD()
4760
- {
4761
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4762
- browser.show();
4763
- String filename = browser.getFile();
4764
- if (filename != null && filename.length() > 0)
4765
- {
4766
- String fullname = browser.getDirectory() + filename;
4767
-
4768
- //Object3D readobj =
4769
- objEditor.ReadGFD(fullname, objEditor);
4770
- //makeSomething(readobj);
4771
- }
4772
- }
4773
-
47746012 /*
47756013 public void Callback(Object obj)
47766014 {
....@@ -4794,26 +6032,9 @@
47946032 }
47956033 */
47966034
4797
- void ImportVRMLX3D()
4798
- {
4799
- if (GrafreeD.standAlone)
4800
- {
4801
- /**/
4802
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4803
- browser.show();
4804
- String filename = browser.getFile();
4805
- if (filename != null && filename.length() > 0)
4806
- {
4807
- String fullname = browser.getDirectory() + filename;
4808
- LoadVRMLX3D(fullname);
4809
- }
4810
- /**/
4811
- }
4812
- }
4813
-
48146035 String GetFile(String dialogName)
48156036 {
4816
- if (GrafreeD.standAlone)
6037
+ if (Grafreed.standAlone)
48176038 {
48186039 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48196040 browser.show();
....@@ -4877,10 +6098,48 @@
48776098 cButton flashSelectionButton;
48786099 cButton editButton;
48796100 cButton uneditButton;
6101
+ JCheckBox allParamsButton;
48806102 cButton clearpanelButton;
4881
- cButton allParamsButton;
48826103 cButton unselectButton;
48836104
6105
+ cButton restoreCameraButton;
6106
+
6107
+ cButton oneStepButton;
6108
+
6109
+ cButton groupButton;
6110
+ cButton ungroupButton;
6111
+ cButton compositeButton;
6112
+ cButton switchButton;
6113
+ cButton loopButton;
6114
+ cButton textureButton;
6115
+
6116
+ cButton skybox1Button;
6117
+ cButton skybox2Button;
6118
+ cButton skybox3Button;
6119
+ cButton skybox4Button;
6120
+ cButton skybox5Button;
6121
+ cButton skybox6Button;
6122
+ cButton skybox7Button;
6123
+
6124
+ cButton skybox11Button;
6125
+ cButton skybox12Button;
6126
+ cButton skybox13Button;
6127
+ cButton skybox14Button;
6128
+ cButton skybox15Button;
6129
+ cButton skybox16Button;
6130
+ cButton skybox17Button;
6131
+
6132
+ cButton gridButton;
6133
+ cButton boxButton;
6134
+ cButton sphereButton;
6135
+ cButton coneButton;
6136
+ cButton torusButton;
6137
+ cButton superButton;
6138
+ cButton kleinButton;
6139
+ cButton particlesButton;
6140
+ cButton overlayButton;
6141
+ cButton lightButton;
6142
+
48846143 cButton screenfitButton;
48856144 cButton screenfitpointButton;
48866145 cButton snapobjectButton;
....@@ -4892,14 +6151,6 @@
48926151
48936152 cButton setsupportButton;
48946153
4895
- cButton twoButton;
4896
- cButton sixButton;
4897
- cButton threeButton;
4898
- cButton sevenButton;
4899
- cButton fourButton; // full panel
4900
- cButton oneButton; // full XYZ
4901
- //cButton currentLayout;
4902
-
49036154 //
49046155 //Composite
49056156 Object3D // to do !!
....@@ -4909,9 +6160,11 @@
49096160 //JTree jTree;
49106161 private MenuItem lookAtItem;
49116162 private MenuItem lookFromItem;
4912
- private MenuItem switchItem;
6163
+ private MenuItem switchViewItem;
49136164 private MenuItem cutItem;
4914
- private MenuItem duplicateItem;
6165
+ private MenuItem undoItem;
6166
+ private MenuItem redoItem;
6167
+ private JMenuItem duplicateItem;
49156168 private MenuItem cloneItem;
49166169 private MenuItem cloneSupportItem;
49176170 private MenuItem overwriteGeoItem;
....@@ -4924,7 +6177,7 @@
49246177 private MenuItem linkverticesItem;
49256178 private MenuItem relinkverticesItem;
49266179 private MenuItem setMasterItem;
4927
- private MenuItem resetMeshItem;
6180
+ private MenuItem resetAllItem;
49286181 private MenuItem stepAllItem;
49296182 private MenuItem revertMeshItem;
49306183 private MenuItem poseMeshItem;
....@@ -4935,10 +6188,11 @@
49356188 private MenuItem mergeGeometriesItem;
49366189 private MenuItem copyItem;
49376190 private MenuItem pasteItem;
6191
+ private MenuItem pasteIntoItem;
49386192 private MenuItem pasteLinkItem;
49396193 private MenuItem pasteCloneItem;
49406194 private MenuItem pasteExpandItem;
4941
- private MenuItem clearItem;
6195
+ private MenuItem deleteItem;
49426196 private MenuItem clearAllItem;
49436197 private MenuItem genUVItem;
49446198 private MenuItem genNormalsMESHItem;
....@@ -4973,6 +6227,10 @@
49736227 private MenuItem showleavesItem;
49746228 private MenuItem markleavesItem;
49756229 private MenuItem unmarkleavesItem;
6230
+ private MenuItem rewindleavesItem;
6231
+ private MenuItem unrewindleavesItem;
6232
+ private MenuItem randomleavesItem;
6233
+ private MenuItem unrandomleavesItem;
49766234
49776235 private MenuItem flipVItem;
49786236 private MenuItem unflipVItem;
....@@ -4984,15 +6242,17 @@
49846242 private MenuItem panoTexturesItem;
49856243
49866244 private MenuItem resetCentroidItem;
4987
- private MenuItem transformgeometryItem;
6245
+ private MenuItem resetCentroidXZItem;
49886246 private MenuItem resetTransformItem;
6247
+ private MenuItem transformGeometryItem;
6248
+ private MenuItem transformChildrenItem;
49896249 private MenuItem hideItem;
49906250 private MenuItem grabItem;
49916251 private MenuItem backItem;
49926252 private MenuItem frontItem;
49936253 private MenuItem cameraItem;
49946254 private MenuItem compositeItem;
4995
- private MenuItem randomItem;
6255
+ private MenuItem switchItem;
49966256 private MenuItem physicsItem;
49976257 private MenuItem frameselectorItem;
49986258 private MenuItem scriptNodeItem;
....@@ -5007,6 +6267,7 @@
50076267
50086268 private MenuItem resetParentItem;
50096269 private MenuItem repairParentItem;
6270
+ private MenuItem repairShadowItem;
50106271 private MenuItem sortbysizeItem;
50116272 private MenuItem sortbynameItem;
50126273
....@@ -5015,6 +6276,8 @@
50156276 private MenuItem attachBumpItem;
50166277 private MenuItem detachBumpItem;
50176278 private MenuItem pigmentBumpItem;
6279
+ private MenuItem embedTexturesItem;
6280
+ private MenuItem deEmbedTexturesItem;
50186281
50196282 private MenuItem particleItem;
50206283 private MenuItem ragdollItem;
....@@ -5031,7 +6294,7 @@
50316294 private MenuItem blobItem;
50326295 private MenuItem latheItem;
50336296 private MenuItem bezierItem;
5034
- private MenuItem checkerItem;
6297
+ private MenuItem overlayItem;
50356298 private MenuItem meshItem;
50366299 // private MenuItem meshGroupItem;
50376300 private MenuItem springItem;
....@@ -5053,11 +6316,6 @@
50536316 private MenuItem doubleItem;
50546317 private MenuItem tripleItem;
50556318
5056
- private MenuItem importGFDItem;
5057
- private MenuItem importVRMLX3DItem;
5058
- private MenuItem import3DSItem;
5059
- private MenuItem importOBJItem;
5060
-
50616319 private MenuItem computeAOItem;
50626320 private MenuItem recompileItem;
50636321 private MenuItem editScriptItem;
....@@ -5067,4 +6325,8 @@
50676325 private MenuItem analyzeItem;
50686326 private MenuItem dumpItem;
50696327 //boolean freezemodel = false;
6328
+
6329
+ Menu cameraMenu;
6330
+ MenuItem editCameraItem;
6331
+ MenuItem restoreCameraItem;
50706332 }