Normand Briere
2019-08-09 912749d2520afedd9b56458d771400c261fe2b88
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
17
-class GroupEditor extends ObjEditor implements iParse, //iCallBack,
18
+class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1820 ObjectUI,
1921 Runnable,
2022 ActionListener,
....@@ -22,6 +24,341 @@
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, String c, final String t, int count, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(c + count);
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
+ for (int i=0; i<group.selection.size(); i++)
354
+ {
355
+ Object3D obj = group.selection.get(i);
356
+ obj.SetPigmentTexture("@" + texture);
357
+ }
358
+
359
+ refreshContents();
360
+ }
361
+
25362 //ObjEditor objEditor;
26363 public void closeUI2()
27364 {
....@@ -59,6 +396,12 @@
59396 this.copy = this.group = group;
60397 //selectees = this.group.selectees;
61398
399
+ if (copy.versionlist == null)
400
+ {
401
+ copy.versionlist = new Object3D[100];
402
+ copy.versionindex = -1;
403
+ }
404
+
62405 if(ui)
63406 SetupUI(objEditor);
64407 }
....@@ -73,17 +416,29 @@
73416 this.copy = this.group = copy;
74417 //selectees = this.group.selectees;
75418
76
- SetupMenu2(objEditor);
419
+ SetupMenu2(this); //objEditor);
77420 SetupUI2(objEditor);
78421 objEditor.SetupUI(true);
79422 SetupViews(objEditor);
80423
81424 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
425
+
426
+ if (copy.versionlist == null)
427
+ {
428
+ copy.versionlist = new Object3D[100];
429
+ copy.versionindex = -1;
430
+
431
+ Save(true);
432
+ }
82433 }
83434
84435 void CloneSelection(boolean supports)
85436 {
86
- // Object3D keep = GraphreeD.clipboard;
437
+ if (Globals.REPLACEONMAKE)
438
+ Save();
439
+ boolean keep = Globals.REPLACEONMAKE;
440
+ Globals.REPLACEONMAKE = false;
441
+ // Object3D keep = GrafreeD.clipboard;
87442 //Object3D obj;
88443 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
89444 {
....@@ -93,18 +448,19 @@
93448
94449 makeSomething(clone, i==group.selection.size()-1);
95450 }
451
+ Globals.REPLACEONMAKE = keep;
96452 }
97453
98454 void CloneClipboard(boolean supports)
99455 {
100
- assert(GraphreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
102
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GraphreeD.clipboard.get(0), false));
456
+ assert(Grafreed.clipboard.parent == null);
457
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
458
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
459
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
460
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105461 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
462
+ makeSomething(CloneObject(Grafreed.clipboard, false));
463
+ Grafreed.clipboard.get(0).parent = keepparent;
108464 }
109465
110466 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +474,7 @@
118474 // obj.support = null;
119475 if (!supports)
120476 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
477
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122478 obj.parent = parent;
123479 // obj.support = support;
124480 // clone.support = support; // aout 2013
....@@ -147,30 +503,29 @@
147503
148504 //JTextField nameField;
149505
150
- void SetupMenu2(ObjEditor oe)
506
+ void SetupMenu2(GroupEditor oe)
151507 {
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);
508
+ oe.jTree = new cTree();
509
+
163510 Menu menu;
164511 oe.menuBar.add(menu = new Menu("Edit"));
165512 //editItem = menu.add(new MenuItem("Edit"));
166513 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
514
+
515
+// undoItem = menu.add(new MenuItem("Undo"));
516
+// undoItem.addActionListener(this);
517
+// redoItem = menu.add(new MenuItem("Redo"));
518
+// redoItem.addActionListener(this);
519
+// menu.add("-");
520
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168521 duplicateItem.addActionListener(this);
169
- menu.add("-");
170522 cloneItem = menu.add(new MenuItem("Clone"));
171523 cloneItem.addActionListener(this);
524
+ if (Globals.ADVANCED)
525
+ {
172526 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173527 cloneSupportItem.addActionListener(this);
528
+ }
174529 menu.add("-");
175530 cutItem = menu.add(new MenuItem("Cut"));
176531 cutItem.addActionListener(this);
....@@ -178,26 +533,123 @@
178533 copyItem.addActionListener(this);
179534 pasteItem = menu.add(new MenuItem("Paste"));
180535 pasteItem.addActionListener(this);
536
+
537
+ menu.add("-");
538
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
539
+ pasteIntoItem.addActionListener(this);
181540 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182541 pasteLinkItem.addActionListener(this);
183542 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184543 pasteCloneItem.addActionListener(this);
185544 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186545 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
546
+ menu.add("-");
547
+ deleteItem = menu.add(new MenuItem("Delete"));
548
+ deleteItem.addActionListener(this);
549
+
550
+ if (Globals.ADVANCED)
551
+ {
552
+ // Deletes the cameras...
189553 clearAllItem = menu.add(new MenuItem("Clear All"));
190554 clearAllItem.addActionListener(this);
191
- menu.add("-");
192
- resetMeshItem = menu.add(new MenuItem("Reset All"));
193
- resetMeshItem.addActionListener(this);
194
- stepAllItem = menu.add(new MenuItem("Step All"));
195
- stepAllItem.addActionListener(this);
555
+ }
556
+
557
+ menuBar.add(cameraMenu = new Menu("View"));
558
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
559
+ //zBufferItem.addActionListener(this);
560
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
561
+ //normalLensItem.addActionListener(this);
562
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
563
+ restoreCameraItem.addActionListener(this);
564
+
565
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
566
+// toggleFullScreenItem.addItemListener(this);
567
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
568
+// cameraMenu.add("-");
569
+//
570
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
571
+// toggleTextureItem.addItemListener(this);
572
+// toggleTextureItem.setState(CameraPane.textureon);
573
+//
574
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
575
+// toggleSwitchItem.addItemListener(this);
576
+// toggleSwitchItem.setState(CameraPane.SWITCH);
577
+
578
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
579
+ toggleHandleItem.addItemListener(this);
580
+ toggleHandleItem.setState(CameraPane.HANDLES);
581
+
582
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
583
+ togglePaintItem.addItemListener(this);
584
+ togglePaintItem.setState(CameraPane.PAINTMODE);
585
+
586
+ if (Globals.ADVANCED)
587
+ {
588
+ cameraMenu.add("-");
589
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
590
+ toggleLiveItem.addItemListener(this);
591
+ toggleLiveItem.setState(Globals.isLIVE());
592
+
593
+ cameraMenu.add(stepItem = new MenuItem("Step"));
594
+ stepItem.addActionListener(this);
595
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
596
+ // toggleDLItem.addItemListener(this);
597
+ // toggleDLItem.setState(false);
598
+
599
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
600
+ toggleRenderItem.addItemListener(this);
601
+ toggleRenderItem.setState(!CameraPane.frozen);
602
+
603
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
604
+ toggleDebugItem.addItemListener(this);
605
+ toggleDebugItem.setState(Globals.DEBUG);
606
+
607
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
608
+ toggleFrustumItem.addItemListener(this);
609
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
610
+
611
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
612
+ toggleFootContactItem.addItemListener(this);
613
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
614
+
615
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
616
+ toggleTimelineItem.addItemListener(this);
617
+ }
618
+
619
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
620
+// toggleRootItem.addItemListener(this);
621
+// toggleRootItem.setState(false);
622
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
623
+// animationItem.addItemListener(this);
624
+// animationItem.setState(CameraPane.ANIMATION);
625
+ cameraMenu.add("-");
626
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
627
+ editCameraItem.addActionListener(this);
628
+
629
+ if (Globals.ADVANCED)
630
+ {
631
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
632
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
633
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
634
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
635
+ oe.cameraMenu.add("-");
636
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
637
+ openWindowItem.addActionListener(this);
638
+ editLeafItem.addActionListener(this);
639
+ lookAtItem.addActionListener(this);
640
+ //lookFromItem.addActinoListener(this);
641
+ //switchViewItem.addActionListener(this);
642
+ }
643
+
644
+ oe.menuBar.add(menu = new Menu("Setting"));
645
+ if (Globals.ADVANCED)
646
+ {
196647 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197648 revertMeshItem.addActionListener(this);
198649 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199650 resetreferencesItem.addActionListener(this);
200651 menu.add("-");
652
+ }
201653 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202654 overwriteGeoItem.addActionListener(this);
203655 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,72 +661,104 @@
209661 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210662 overwriteUVItem.addActionListener(this);
211663 menu.add("-");
664
+ if (Globals.ADVANCED)
665
+ {
212666 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213667 generateMeshItem.addActionListener(this);
214668 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215669 poseMeshItem.addActionListener(this);
216670 menu.add("-");
671
+ }
217672 resetsupportItem = menu.add(new MenuItem("Reset support"));
218673 resetsupportItem.addActionListener(this);
219674 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220675 linkverticesItem.addActionListener(this);
676
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
677
+ relinkverticesItem.addActionListener(this);
678
+
679
+ if (Globals.ADVANCED)
680
+ {
221681 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222682 setMasterItem.addActionListener(this);
683
+ }
223684
224
- oe.menuBar.add(menu = new Menu("Object"));
225
- grabItem = menu.add(new MenuItem("Grab"));
226
- grabItem.addActionListener(this);
227
- frontItem = menu.add(new MenuItem("Front"));
228
- frontItem.addActionListener(this);
685
+ oe.menuBar.add(menu = new Menu("Group"));
686
+// grabItem = menu.add(new MenuItem("Grab"));
687
+// grabItem.addActionListener(this);
229688 backItem = menu.add(new MenuItem("Back"));
230689 backItem.addActionListener(this);
231
- compositeItem = menu.add(new MenuItem("Composite"));
232
- compositeItem.addActionListener(this);
233
- menu.add("-");
234
- randomItem = menu.add(new MenuItem("Random"));
235
- randomItem.addActionListener(this);
236
- physicsItem = menu.add(new MenuItem("Physics"));
237
- physicsItem.addActionListener(this);
238
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
239
- frameselectorItem.addActionListener(this);
690
+ frontItem = menu.add(new MenuItem("Front"));
691
+ frontItem.addActionListener(this);
692
+// compositeItem = menu.add(new MenuItem("Composite"));
693
+// compositeItem.addActionListener(this);
694
+
695
+ if (Globals.ADVANCED)
696
+ {
697
+ hideItem = menu.add(new MenuItem("Hidden Group"));
698
+ hideItem.addActionListener(this);
699
+ }
700
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
701
+ ungroupItem.addActionListener(this);
702
+
703
+// menu.add("-");
704
+//
705
+// switchItem = menu.add(new MenuItem("Switch node"));
706
+// switchItem.addActionListener(this);
707
+ if (Globals.ADVANCED)
708
+ {
240709 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241710 switchGeoItem.addActionListener(this);
242711 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243712 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
713
+ morphItem = menu.add(new MenuItem("Morph Group"));
245714 morphItem.addActionListener(this);
715
+
716
+ menu.add("-");
717
+ physicsItem = menu.add(new MenuItem("Physics"));
718
+ physicsItem.addActionListener(this);
719
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
720
+ frameselectorItem.addActionListener(this);
246721 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247722 scriptNodeItem.addActionListener(this);
248
- cameraItem = menu.add(new MenuItem("Camera"));
249
- cameraItem.addActionListener(this);
250
- menu.add("-");
251
- textureItem = menu.add(new MenuItem("Texture"));
252
- textureItem.addActionListener(this);
723
+ }
724
+
725
+ oe.menuBar.add(menu = new Menu("Object"));
726
+// textureItem = menu.add(new MenuItem("Texture"));
727
+// textureItem.addActionListener(this);
728
+ billboardItem = menu.add(new MenuItem("Billboard"));
729
+ billboardItem.addActionListener(this);
253730 csgItem = menu.add(new MenuItem("CSG"));
254731 csgItem.addActionListener(this);
255
- shadowXItem = menu.add(new MenuItem("Shadow X"));
732
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
256733 shadowXItem.addActionListener(this);
257
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
734
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
258735 shadowYItem.addActionListener(this);
259
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
736
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
260737 shadowZItem.addActionListener(this);
738
+ attributeItem = menu.add(new MenuItem("Attribute"));
739
+ attributeItem.addActionListener(this);
740
+
741
+ if (Globals.ADVANCED)
742
+ {
743
+ menu.add("-");
261744 linkerItem = menu.add(new MenuItem("Linker"));
262745 linkerItem.addActionListener(this);
263746 templateItem = menu.add(new MenuItem("Template"));
264747 templateItem.addActionListener(this);
265
- attributeItem = menu.add(new MenuItem("Attribute"));
266
- attributeItem.addActionListener(this);
267748 pointflowItem = menu.add(new MenuItem("Point Flow"));
268749 pointflowItem.addActionListener(this);
750
+ }
269751 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272752 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273753 resetTransformItem.addActionListener(this);
274754 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275755 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
756
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
757
+ resetCentroidXZItem.addActionListener(this);
758
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
759
+ transformGeometryItem.addActionListener(this);
760
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
761
+ transformChildrenItem.addActionListener(this);
278762
279763 oe.menuBar.add(menu = new Menu("Geometry"));
280764 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +767,13 @@
283767 genNormalsORGANItem.addActionListener(this);
284768 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285769 genNormalsCADItem.addActionListener(this);
770
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
771
+ genNormalsMESHItem.addActionListener(this);
772
+ if (Globals.ADVANCED)
773
+ {
774
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
775
+ genNormalsMINEItem.addActionListener(this);
776
+ }
286777 stripifyItem = menu.add(new MenuItem("Stripify"));
287778 stripifyItem.addActionListener(this);
288779 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +783,6 @@
292783 untrimItem = menu.add(new MenuItem("Untrim"));
293784 untrimItem.addActionListener(this);
294785 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297786 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298787 clearColorsItem.addActionListener(this);
299788 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +795,34 @@
306795 reduce34MeshItem.addActionListener(this);
307796 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308797 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311798 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312799 clipMeshItem.addActionListener(this);
800
+
801
+ if (Globals.ADVANCED)
802
+ {
803
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
804
+ smoothMeshItem.addActionListener(this);
805
+ }
806
+
807
+ oe.menuBar.add(menu = new Menu("Attributes"));
808
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
809
+ clearMaterialsItem.addActionListener(this);
810
+ resetAllItem = menu.add(new MenuItem("Reset All"));
811
+ resetAllItem.addActionListener(this);
812
+ stepAllItem = menu.add(new MenuItem("Step All"));
813
+ stepAllItem.addActionListener(this);
313814 menu.add("-");
314815 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315816 liveleavesItem.addActionListener(this);
316817 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317818 unliveleavesItem.addActionListener(this);
819
+ if (Globals.ADVANCED)
820
+ {
318821 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319822 supportleavesItem.addActionListener(this);
320823 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321824 unsupportleavesItem.addActionListener(this);
825
+ }
322826 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323827 hideleavesItem.addActionListener(this);
324828 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -327,32 +831,31 @@
327831 markleavesItem.addActionListener(this);
328832 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
329833 unmarkleavesItem.addActionListener(this);
834
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
835
+ rewindleavesItem.addActionListener(this);
836
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
837
+ unrewindleavesItem.addActionListener(this);
838
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
839
+ randomleavesItem.addActionListener(this);
840
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
841
+ unrandomleavesItem.addActionListener(this);
330842 menu.add("-");
331843 flipVItem = menu.add(new MenuItem("Flip V"));
332844 flipVItem.addActionListener(this);
333845 unflipVItem = menu.add(new MenuItem("Unflip V"));
334846 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
847
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336848 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
849
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338850 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
851
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340852 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
853
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342854 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
855
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344856 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
857
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346858 panoTexturesItem.addActionListener(this);
347
- menu.add("-");
348
- extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
349
- extractGeometriesItem.addActionListener(this);
350
- cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
351
- cloneGeometriesItem.addActionListener(this);
352
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
353
- shareGeometriesItem.addActionListener(this);
354
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
355
- mergeGeometriesItem.addActionListener(this);
356859
357860 oe.menuBar.add(menu = new Menu("Selection"));
358861 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -361,23 +864,123 @@
361864 attachBumpItem.addActionListener(this);
362865 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
363866 pigmentBumpItem.addActionListener(this);
867
+ //embedTexturesItem
364868 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
365869 detachPigmentItem.addActionListener(this);
366870 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
367871 detachBumpItem.addActionListener(this);
872
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
873
+ embedTexturesItem.addActionListener(this);
874
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
875
+ deEmbedTexturesItem.addActionListener(this);
368876 menu.add("-");
369877 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
370878 sortbysizeItem.addActionListener(this);
371879 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372880 sortbynameItem.addActionListener(this);
881
+ menu.add("-");
882
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
883
+ shareGeometriesItem.addActionListener(this);
884
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
885
+ mergeGeometriesItem.addActionListener(this);
886
+ if (Globals.ADVANCED)
887
+ {
888
+ // Pretty much the same as duplicate and clone.
889
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
890
+ extractGeometriesItem.addActionListener(this);
891
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
892
+ cloneGeometriesItem.addActionListener(this);
893
+ }
894
+
373895 oe.menuBar.add(menu = new Menu("Insert"));
374896 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
897
+
898
+ oe.menuBar.add(menu = new Menu("Tools"));
376899 buildToolsMenu(menu);
377900 }
378901
902
+ JTabbedPane resourcecontainer;
903
+ cGridBag currenttab;
904
+ boolean added; // patch for jar
905
+
906
+ int tabcount = 0;
907
+ int colcount = 0;
908
+ int rowcount = 0;
909
+ int texturecount = 0;
910
+
911
+ int columns = 5;
912
+ int rows = 7;
913
+
914
+ public void ResourceCallBack(String[] path)
915
+ {
916
+// for (int i = 0; i < path.length; i++)
917
+// System.out.print(path[i] + "/");
918
+// System.out.println();
919
+
920
+ if (//rowcount == 0 ||
921
+ path.length == 1)
922
+ {
923
+ currenttab = new cGridBag();
924
+ added = false;
925
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
926
+ currenttab.setName(tabname);
927
+ rowcount = 1;
928
+ colcount = 0;
929
+ texturecount = 0;
930
+ }
931
+
932
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
933
+ {
934
+ if (!added)
935
+ {
936
+ added = true;
937
+ resourcecontainer.add(currenttab);
938
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
940
+ }
941
+
942
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
943
+
944
+ if (++colcount >= columns)
945
+ {
946
+ colcount = 0;
947
+ currenttab.Return();
948
+
949
+ if (rowcount++ >= rows)
950
+ {
951
+ rowcount = 0;
952
+ }
953
+ }
954
+ }
955
+ else
956
+ {
957
+// if (!path[path.length-1].equals("icons"))
958
+// resourcecontainer.Return();
959
+ }
960
+ }
961
+
962
+ void CreateTexturePanel(cGridBag container)
963
+ {
964
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
965
+ container.add(resourcecontainer);
966
+
967
+ Grafreed.ParseResources("textures", this);
968
+ }
969
+
379970 void SetupUI2(ObjEditor oe)
380971 {
972
+ // June 2019
973
+ if (oe == null)
974
+ {
975
+ //super.SetupUI2(this);
976
+ //return;
977
+ }
978
+
979
+ if (copy != group)
980
+ {
981
+ //super.SetupUI2(this);
982
+ }
983
+
381984 //new Exception().printStackTrace();
382985
383986 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -406,150 +1009,239 @@
4061009 oe.radioPanel.add(dummyButton);
4071010 oe.buttonGroup.add(dummyButton);
4081011 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
1012
+ cGridBag copyOptionsPanel = new cGridBag();
1013
+
1014
+ copyOptionsPanel.preferredHeight = 2;
4121015
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
1016
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
1017
+
1018
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1019
+ //minButton.setToolTipText("Minimize window");
1020
+ //minButton.addActionListener(this);
1021
+
1022
+ if (Globals.ADVANCED)
1023
+ {
1024
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
+ maxButton.setToolTipText("Maximize window");
1026
+ maxButton.addActionListener(this);
1027
+ }
1028
+
1029
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
+ fullButton.setToolTipText("Full-screen window");
1031
+ fullButton.addActionListener(this);
1032
+
1033
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1034
+ screenfitButton.setToolTipText("Screen fit");
1035
+ screenfitButton.addActionListener(this);
1036
+
1037
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1038
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1039
+ restoreCameraButton.addActionListener(this);
1040
+
1041
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
+ saveVersionButton.setToolTipText("Duplicate current version");
1043
+ saveVersionButton.addActionListener(this);
1044
+
1045
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1046
+ deleteVersionButton.setToolTipText("Delete current version");
1047
+ deleteVersionButton.addActionListener(this);
1048
+
1049
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ previousVersionButton.setToolTipText("Previous version");
1051
+ previousVersionButton.addActionListener(this);
1052
+ previousVersionButton.setEnabled(false);
1053
+
1054
+ cGridBag updown = new cGridBag().setVertical(true);
1055
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ restoreButton.setToolTipText("Undo (restore current version)");
1057
+ restoreButton.addActionListener(this);
1058
+ //restoreButton.setEnabled(false);
1059
+
1060
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+ replaceButton.setToolTipText("Save (replace current version)");
1062
+ replaceButton.addActionListener(this);
1063
+ //replaceButton.setEnabled(false);
1064
+
1065
+ copyOptionsPanel.add(updown);
1066
+
1067
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ nextVersionButton.setToolTipText("Next version");
1069
+ nextVersionButton.addActionListener(this);
1070
+ nextVersionButton.setEnabled(false);
1071
+
1072
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1073
+ liveCB.setToolTipText("Enable animation");
4141074 liveCB.addItemListener(this);
4151075
416
- oe.aConstraints.gridx += 1;
417
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
418
- supportCB.addItemListener(this);
419
-
420
- // oe.aConstraints.gridx += 1;
421
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
422
- // localCB.addItemListener(this);
423
-
424
- oe.aConstraints.gridx += 1;
425
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
426
- crowdCB.addItemListener(this);
427
-
428
- oe.aConstraints.gridx += 1;
429
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
430
- smoothCB.addItemListener(this);
431
-
432
- oe.aConstraints.gridx += 1;
433
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
1076
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1077
+ oneStepButton.setToolTipText("Animate one step forward");
1078
+ oneStepButton.addActionListener(this);
1079
+
1080
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
1081
+ fastCB.setToolTipText("Fast mode");
4341082 fastCB.addItemListener(this);
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
437
- slowCB.addItemListener(this);
438
- oe.aConstraints.gridx += 1;
439
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
440
- boxCB.addItemListener(this);
1083
+
1084
+ //oe.toolboxPanel.Return();
1085
+
1086
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1087
+// trackCB.setToolTipText("Enable tracking");
1088
+// trackCB.addItemListener(this);
4411089
442
-// oe.aConstraints.gridx += 1;
443
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
444
-// speakerMocapCB.addItemListener(this);
445
-
446
- if (false)
447
- {
448
- // handled in scripts
449
- oe.aConstraints.gridx += 1;
450
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
451
- speakerCameraCB.addItemListener(this);
452
-
453
- oe.aConstraints.gridx += 1;
454
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
455
- speakerFocusCB.addItemListener(this);
456
-
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
459
- smoothfocusCB.addItemListener(this);
460
- }
461
-
462
-//oe.aConstraints.gridx += 1;
463
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
464
-// debugCB.addItemListener(this);
465
-
466
- oe.aConstraints.gridx += 1;
467
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
468
- oeilCB.addItemListener(this);
469
-
470
- oe.aConstraints.gridx += 1;
471
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
472
- lookAtCB.addItemListener(this);
473
-
474
- oe.aConstraints.gridx += 1;
475
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
476
- trackCB.addItemListener(this);
477
-
478
- oe.aConstraints.gridx += 1;
479
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
480
- screenfitButton.addActionListener(this);
481
- oe.aConstraints.gridx += 1;
4821090 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
4831091 // screenfitpointButton.addActionListener(this);
484
-// oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
486
- snapobjectButton.addActionListener(this);
487
- oe.aConstraints.gridx += 1;
4881092
489
- //aConstraints.gridx = 0;
490
- //aConstraints.gridy += 1;
491
- oe.aConstraints.weighty = 0;
492
- oe.aConstraints.gridwidth = 1;
493
-
494
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
495
- flashSelectionButton.addActionListener(this);
496
- oe.aConstraints.gridx += 1;
497
- oe.aConstraints.weighty = 0;
498
- oe.aConstraints.gridwidth = 1;
499
-
500
- //
501
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
502
- twoButton.addActionListener(this);
503
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
1093
+ if (Globals.ADVANCED)
1094
+ {
1095
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1096
+ snapobjectButton.addActionListener(this);
1097
+ snapobjectButton.setToolTipText("Snap Object");
1098
+
1099
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5041100 fourButton.addActionListener(this);
505
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
506
- sixButton.addActionListener(this);
507
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
1101
+ fourButton.setToolTipText("Show control panel only");
1102
+ }
1103
+
1104
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
1105
+
1106
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1107
+ twoButton.setToolTipText("Show 3D view only");
1108
+ twoButton.addActionListener(this);
1109
+ this.fullscreenLayout = twoButton;
1110
+
1111
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
+ threeButton.setToolTipText("Show controls and 3D view");
5081113 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
510
- sevenButton.addActionListener(this);
1114
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
+ sixButton.setToolTipText("Show 3D view and controls");
1116
+ sixButton.addActionListener(this);
1117
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+// sevenButton.setToolTipText("3-column layout");
1119
+// sevenButton.addActionListener(this);
5111120 //
5121121
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
1122
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1123
+ rootButton.setToolTipText("Open selection in new tab");
5141124 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1125
+
1126
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1127
+ closeButton.setToolTipText("Close tab");
5171128 closeButton.addActionListener(this);
5181129 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5191130 //clearButton.addActionListener(this);
520
- oe.aConstraints.gridx += 1;
521
-
522
- oe.aConstraints.gridx = 1; //
523
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
524
- editButton.addActionListener(this);
525
- oe.aConstraints.gridx += 1;
526
- oe.aConstraints.weighty = 0;
527
- oe.aConstraints.gridwidth = 1;
5281131
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1132
+ cGridBag row1 = new cGridBag();
1133
+
1134
+ // INSERT
1135
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ gridButton.setToolTipText("Create grid");
1137
+ gridButton.addActionListener(this);
1138
+
1139
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ boxButton.setToolTipText("Create box");
1141
+ boxButton.addActionListener(this);
1142
+
1143
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1144
+ sphereButton.setToolTipText("Create sphere");
1145
+ sphereButton.addActionListener(this);
1146
+
1147
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1148
+ coneButton.setToolTipText("Create cone");
1149
+ coneButton.addActionListener(this);
1150
+
1151
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ torusButton.setToolTipText("Create torus");
1153
+ torusButton.addActionListener(this);
1154
+
1155
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1156
+ superButton.setToolTipText("Create superellipsoid");
1157
+ superButton.addActionListener(this);
1158
+
1159
+ if (Globals.ADVANCED)
1160
+ {
1161
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1162
+ kleinButton.setToolTipText("Create Klein bottle");
1163
+ kleinButton.addActionListener(this);
1164
+ }
1165
+
1166
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1167
+ particlesButton.setToolTipText("Create particle system");
1168
+ particlesButton.addActionListener(this);
1169
+
1170
+ oe.toolboxPanel.add(row1);
1171
+
1172
+ cGridBag row2 = new cGridBag();
1173
+
1174
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ groupButton.setToolTipText("Create group");
1176
+ groupButton.addActionListener(this);
1177
+
1178
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1179
+ compositeButton.setToolTipText("Create composite");
1180
+ compositeButton.addActionListener(this);
1181
+
1182
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ switchButton.setToolTipText("Create item switcher");
1184
+ switchButton.addActionListener(this);
1185
+
1186
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ loopButton.setToolTipText("Create loop");
1188
+ loopButton.addActionListener(this);
1189
+
1190
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1191
+ textureButton.setToolTipText("Create texture");
1192
+ textureButton.addActionListener(this);
1193
+
1194
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1195
+ overlayButton.setToolTipText("Create overlay");
1196
+ overlayButton.addActionListener(this);
1197
+
1198
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1199
+ lightButton.setToolTipText("Create light");
1200
+ lightButton.addActionListener(this);
1201
+
1202
+ oe.toolboxPanel.add(row2);
1203
+
1204
+ cGridBag textures = new cGridBag();
1205
+
1206
+ CreateTexturePanel(textures);
1207
+
1208
+ oe.toolboxPanel.add(textures);
1209
+
1210
+ textures.preferredHeight = 100;
1211
+
1212
+ CreateSkyboxPanel(oe.skyboxPanel);
1213
+
1214
+ // EDIT panel
1215
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1216
+ editButton.setToolTipText("Pin selection controls");
1217
+ editButton.addActionListener(this);
1218
+
1219
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5301221 uneditButton.addActionListener(this);
5311222
532
- oe.aConstraints.gridx += 1;
533
- oe.aConstraints.weighty = 0;
534
- oe.aConstraints.gridwidth = 1;
535
-
536
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
537
- clearPanelButton.addActionListener(this);
538
-
539
- oe.aConstraints.gridx += 1;
540
- oe.aConstraints.weighty = 0;
541
- oe.aConstraints.gridwidth = 1;
542
-
543
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
1223
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1224
+ allParamsButton.setToolTipText("Show all controls");
5441225 allParamsButton.addActionListener(this);
5451226
546
- oe.aConstraints.gridx += 1;
547
- oe.aConstraints.weighty = 0;
548
- oe.aConstraints.gridwidth = 1;
549
-
550
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
551
- unselectButton.addActionListener(this);
1227
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1228
+ clearPanelButton.setToolTipText("Clear all controls");
1229
+ clearPanelButton.addActionListener(this);
5521230
1231
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ //unselectButton.setToolTipText("Unselect");
1233
+ //unselectButton.addActionListener(this);
1234
+
1235
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ flashSelectionButton.setToolTipText("Highlight selection");
1237
+ flashSelectionButton.addActionListener(this);
1238
+
1239
+ editCommandsPanel.preferredHeight = 1;
1240
+
1241
+ SetPinStates(false);
1242
+// oe.treePanel.add(commandsPanel);
1243
+// oe.treePanel.Return();
1244
+
5531245 // oe.aConstraints.gridx += 1;
5541246 // oe.aConstraints.weighty = 0;
5551247 // oe.aConstraints.gridwidth = 1;
....@@ -561,47 +1253,32 @@
5611253 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5621254 // gcButton.addActionListener(this);
5631255
564
- oe.aConstraints.gridx = 0;
565
- oe.aConstraints.gridy += 1;
566
-
567
- //ctrlPanel.add(objList = new List(5, true));
568
- oe.aConstraints.gridwidth = 100;
569
- // oe.aConstraints.gridheight = 100;
570
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
571
- oe.aConstraints.gridheight = 1;
572
- oe.aConstraints.weighty = 0.5;
573
- oe.aConstraints.gridx = 0;
574
- JScrollPane jSP;
1256
+ cGridBag jSPPanel = new cGridBag();
1257
+
1258
+ JScrollPane jSP;
5751259 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
576
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
1260
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5771261 ResetModel();
578
- oe.aConstraints.weighty = 0.5;
579
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
580
- oe.aConstraints.gridy += 1;
581
- oe.aConstraints.gridwidth = 1;
582
-
583
- oe.aConstraints.weighty = 0;
584
- oe.aConstraints.gridwidth = 2;
585
-
586
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
587
- colorCB.addItemListener(this);
588
- oe.aConstraints.gridx += 2;
589
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
590
- materialCB.addItemListener(this);
591
- oe.aConstraints.gridx += 2;
592
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
593
- textureCB.addItemListener(this);
594
-
595
- oe.aConstraints.gridx = 0;
596
- oe.aConstraints.gridy += 1;
5971262
1263
+ oe.treePanel.add(jSPPanel);
1264
+ oe.treePanel.Return();
1265
+
1266
+ oe.treePanel.add(copyOptionsPanel);
1267
+ oe.treePanel.Return();
1268
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1269
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1270
+ sliderPane.preferredHeight = 1;
1271
+
1272
+// mainPanel.setDividerLocation(0.1); //1.0);
1273
+ mainPanel.setResizeWeight(0.4);
1274
+
5981275 //jList.addListSelectionListener(this);
5991276 oe.jTree.addTreeSelectionListener(this);
6001277 //jTree.setRootVisible(false);
6011278 //jTree.setEditable(true);
6021279 oe.jTree.setDragEnabled(true);
6031280 //jTree.setPreferredSize(new Dimension(10,10));
604
- jSP.setPreferredSize(new Dimension(100,200));
1281
+ //jSP.setPreferredSize(new Dimension(100,200));
6051282
6061283 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6071284
....@@ -613,23 +1290,163 @@
6131290 dgr.addDragGestureListener(this);
6141291 }catch(Exception e) {}
6151292 */
616
- radio.layout = sevenButton;
1293
+ radio.layout = threeButton; // sixButton;
6171294 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6181295 }
1296
+
1297
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1298
+ {
1299
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1300
+ colorCB.setToolTipText("Copy color when dropped");
1301
+ colorCB.addItemListener(this);
1302
+
1303
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1304
+ materialCB.setToolTipText("Copy material when dropped");
1305
+ materialCB.addItemListener(this);
1306
+
1307
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1308
+ textureCB.setToolTipText("Copy texture when dropped");
1309
+ textureCB.addItemListener(this);
1310
+
1311
+ panel.Return();
1312
+
1313
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1314
+ boxCB.setToolTipText("Display bounding boxes");
1315
+ boxCB.addItemListener(this);
1316
+
1317
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1318
+ zoomBoxCB.setToolTipText("Display only for wheel");
1319
+ zoomBoxCB.addItemListener(this);
1320
+
1321
+ if (true) // Globals.ADVANCED)
1322
+ {
1323
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1324
+// supportCB.setToolTipText("Enable rigging");
1325
+// supportCB.addItemListener(this);
1326
+
1327
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1328
+ freezeCB.setToolTipText("Fast moving camera");
1329
+ freezeCB.addItemListener(this);
1330
+
1331
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1332
+ // localCB.addItemListener(this);
1333
+
1334
+ panel.Return();
1335
+
1336
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1337
+ crowdCB.setToolTipText("Used for crowds");
1338
+ crowdCB.addItemListener(this);
1339
+
1340
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1341
+ smoothCB.setToolTipText("Snapping delay");
1342
+ smoothCB.addItemListener(this);
1343
+
1344
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1345
+// slowCB.setToolTipText("Smooth interpolation");
1346
+// slowCB.addItemListener(this);
1347
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1348
+ minshaderCB.setToolTipText("Minimal fast shader");
1349
+ minshaderCB.addItemListener(this);
1350
+
1351
+// constraints.gridy += 1;
1352
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1353
+// speakerMocapCB.addItemListener(this);
1354
+
1355
+ panel.Return();
1356
+
1357
+ if (false)
1358
+ {
1359
+ // handled in scripts
1360
+ //constraints.gridy += 1;
1361
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1362
+ speakerCameraCB.addItemListener(this);
1363
+
1364
+ //constraints.gridy += 1;
1365
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1366
+ speakerFocusCB.addItemListener(this);
1367
+
1368
+ //constraints.gridy += 1;
1369
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1370
+ smoothfocusCB.addItemListener(this);
1371
+ panel.Return();
1372
+ }
1373
+
1374
+//constraints.gridx += 1;
1375
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1376
+// debugCB.addItemListener(this);
1377
+
1378
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1379
+ trackCB.setToolTipText("Enable tracking target");
1380
+ trackCB.addItemListener(this);
1381
+
1382
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1383
+ oeilCB.setToolTipText("Move camera when tracking");
1384
+ oeilCB.addItemListener(this);
1385
+
1386
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1387
+ shadowCB.setToolTipText("When live compute shadows");
1388
+ shadowCB.addItemListener(this);
1389
+
1390
+ panel.Return();
1391
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1392
+ toggleTextureCB.setToolTipText("Load textures");
1393
+ toggleTextureCB.addItemListener(this);
1394
+
1395
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1396
+ toggleSwitchCB.setToolTipText("Choose a single item");
1397
+ toggleSwitchCB.addItemListener(this);
1398
+
1399
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1400
+ autokeepCB.setToolTipText("On structure change");
1401
+ autokeepCB.addItemListener(this);
1402
+
1403
+ panel.Return();
1404
+ if (Globals.ADVANCED)
1405
+ {
1406
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1407
+ lookAtCB.setToolTipText("Look-at target");
1408
+ lookAtCB.addItemListener(this);
1409
+ }
1410
+
1411
+ }
1412
+
1413
+ cGridBag fill = new cGridBag();
1414
+ fill.preferredHeight = 200;
1415
+ cGridBag fill2 = new cGridBag();
1416
+ fill2.preferredHeight = 200;
1417
+ cGridBag fill3 = new cGridBag();
1418
+ fill3.preferredHeight = 200;
1419
+
1420
+ panel.add(fill);
1421
+ panel.add(fill2);
1422
+ panel.add(fill3);
1423
+
1424
+ }
6191425
6201426 void EditObject(Object3D obj)
6211427 {
622
- cRadio dummyButton = new cRadio(obj.name);
623
- dummyButton.SetObject(obj);
624
- dummyButton.layout = sevenButton;
625
- dummyButton.SetCamera(cameraView.renderCamera, false);
626
- dummyButton.addActionListener(this);
627
- radioPanel.add(dummyButton);
628
- buttonGroup.add(dummyButton);
629
- dummyButton.doClick();
1428
+ cRadio radioButton = new cRadio(obj.name);
1429
+
1430
+ // June 2019. Patch to avoid bug with transparency.
1431
+ radioButton.hadMaterial = obj.material != null;
1432
+ if (!radioButton.hadMaterial)
1433
+ {
1434
+ obj.material = new cMaterial();
1435
+ }
1436
+
1437
+ radioButton.SetObject(obj);
1438
+ radioButton.layout = threeButton; // sixButton;
1439
+ radioButton.SetCamera(cameraView.renderCamera, false);
1440
+ radioButton.addActionListener(this);
1441
+ radioPanel.add(radioButton);
1442
+ buttonGroup.add(radioButton);
1443
+ radioButton.doClick();
6301444 }
1445
+
6311446 void SetupViews(ObjEditor oe)
6321447 {
1448
+ theFrame = this;
1449
+
6331450 oe.SetupViews();
6341451
6351452 System.out.println("SetupViews");
....@@ -638,22 +1455,30 @@
6381455 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391456 }
6401457
641
- JCheckBox liveCB;
642
- JCheckBox supportCB;
643
- JCheckBox localCB;
644
- JCheckBox crowdCB;
645
- JCheckBox smoothCB;
646
- JCheckBox fastCB;
647
- JCheckBox slowCB;
648
- JCheckBox boxCB;
649
- JCheckBox trackCB;
650
- JCheckBox smoothfocusCB;
1458
+ cToggleButton liveCB;
1459
+ cCheckBox supportCB;
1460
+ cCheckBox localCB;
1461
+ cCheckBox crowdCB;
1462
+ cCheckBox smoothCB;
1463
+ cCheckBox minshaderCB;
1464
+
1465
+ cToggleButton fastCB;
1466
+ cCheckBox slowCB;
1467
+ cCheckBox boxCB;
1468
+ cCheckBox zoomBoxCB;
1469
+ cCheckBox freezeCB;
1470
+ //cToggleButton trackCB;
1471
+ cCheckBox trackCB;
1472
+ cCheckBox smoothfocusCB;
6511473 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1474
+ cCheckBox speakerCameraCB;
1475
+ cCheckBox speakerFocusCB;
1476
+ cCheckBox debugCB;
1477
+
1478
+ cCheckBox oeilCB;
1479
+ cCheckBox shadowCB;
1480
+ cCheckBox autokeepCB;
1481
+ cCheckBox lookAtCB;
6571482
6581483 // static int COLOR = 1;
6591484 // static int MATERIAL = 2;
....@@ -661,9 +1486,9 @@
6611486
6621487 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631488
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1489
+ cCheckBox colorCB;
1490
+ cCheckBox materialCB;
1491
+ cCheckBox textureCB;
6671492
6681493 public void itemStateChanged(ItemEvent e)
6691494 {
....@@ -688,10 +1513,10 @@
6881513 dropAttributes |= Object3D.TEXTURE;
6891514 else
6901515 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1516
+ } else if(e.getSource() == liveCB)
6931517 {
6941518 cameraView.ToggleLive();
1519
+ refreshContents(false);
6951520 }
6961521 else if(e.getSource() == supportCB)
6971522 {
....@@ -707,6 +1532,12 @@
7071532 {
7081533 cameraView.ToggleInertia();
7091534 cameraView.repaint();
1535
+ }
1536
+ else if(e.getSource() == minshaderCB)
1537
+ {
1538
+ Globals.MINSHADER ^= true;
1539
+ cameraView.programInitialized = false;
1540
+ cameraView.repaint();
7101541 }
7111542 else if(e.getSource() == localCB)
7121543 {
....@@ -726,6 +1557,10 @@
7261557 Recompile();
7271558 cameraView.repaint();
7281559 // refreshContents();
1560
+ }
1561
+ else if(e.getSource() == zoomBoxCB)
1562
+ {
1563
+ cameraView.ToggleZoomBoxMode();
7291564 }
7301565 else if(e.getSource() == smoothfocusCB)
7311566 {
....@@ -752,6 +1587,18 @@
7521587 {
7531588 cameraView.ToggleOeil();
7541589 }
1590
+ else if(e.getSource() == shadowCB)
1591
+ {
1592
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1593
+ }
1594
+ else if(e.getSource() == freezeCB)
1595
+ {
1596
+ Globals.FREEZEONMOVE ^= true;
1597
+ }
1598
+ else if(e.getSource() == autokeepCB)
1599
+ {
1600
+ Globals.REPLACEONMAKE ^= true;
1601
+ }
7551602 else if(e.getSource() == lookAtCB)
7561603 {
7571604 cameraView.ToggleLookAt();
....@@ -768,7 +1615,8 @@
7681615
7691616 /**/
7701617 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1618
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1619
+ TreePath path = objEditor.jTree.getSelectionPath();
7721620 if ((path == null) || (path.getPathCount() <= 1)) {
7731621 // We can't move the root node or an empty selection
7741622 return;
....@@ -831,8 +1679,6 @@
8311679 }
8321680 }
8331681
834
- String string = (String) object;
835
-
8361682 System.out.println("Transfer = " + object + "; drop : " + target);
8371683 // if( object instanceof java.io.File[])
8381684 // {
....@@ -840,7 +1686,11 @@
8401686 // objEditor.DropFile((java.io.File[]) object, true);
8411687 // return;
8421688 // }
843
- if (string.charAt(0) == '/')
1689
+
1690
+ String string = object.toString();
1691
+
1692
+ // File path for Mac and Windows
1693
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441694 {
8451695 // file(s)
8461696 String[] names = string.split("\n");
....@@ -867,7 +1717,7 @@
8671717
8681718 flashIt = false;
8691719 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1720
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711721 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721722
8731723 if (group.selection.size() == 1)
....@@ -883,23 +1733,33 @@
8831733
8841734 assert target == objEditor.jTree;
8851735 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1736
+ Object3D destinationLeaf;
8861737 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1738
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881739 } catch (Exception e) {
8891740 System.out.println("destinationPath : " + destinationPath);
8901741 return;
8911742 }
8921743
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1744
+ for (int i=group.selection.size(); --i>=0;)
8941745 {
1746
+ Object3D child = (Object3D)group.selection.elementAt(i);
1747
+
1748
+ // Cannot move into itself
1749
+ if (child == destinationLeaf)
1750
+ return;
1751
+ }
1752
+
1753
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1754
+// {
8951755 loadClipboard(true);
8961756 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1757
+ pasteInto(false, false);
1758
+// } else {
1759
+// loadClipboard(false);
1760
+// objEditor.jTree.setSelectionPath(destinationPath);
1761
+// pasteInto(false, false); // true); // ???
1762
+// }
9031763 }
9041764 public void dropActionChanged(DropTargetDragEvent dtde)
9051765 // Called if the user has modified the current drop gesture
....@@ -1002,90 +1862,109 @@
10021862
10031863 void buildCreateMenu(Menu menu)
10041864 {
1005
- gridItem = menu.add(new MenuItem("Grid"));
1006
- gridItem.addActionListener(this);
1007
- rectoidItem = menu.add(new MenuItem("Box"));
1008
- rectoidItem.addActionListener(this);
1009
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1010
- ellipsoidItem.addActionListener(this);
1011
- coneItem = menu.add(new MenuItem("Cone"));
1012
- coneItem.addActionListener(this);
1013
- torusItem = menu.add(new MenuItem("Torus"));
1014
- torusItem.addActionListener(this);
1015
- superItem = menu.add(new MenuItem("Superellipsoid"));
1016
- superItem.addActionListener(this);
1017
- particleItem = menu.add(new MenuItem("Particle system"));
1018
- particleItem.addActionListener(this);
1865
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1866
+ //heightFieldItem.addActionListener(this);
1867
+// gridItem = menu.add(new MenuItem("Grid"));
1868
+// gridItem.addActionListener(this);
1869
+// rectoidItem = menu.add(new MenuItem("Box"));
1870
+// rectoidItem.addActionListener(this);
1871
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1872
+// ellipsoidItem.addActionListener(this);
1873
+// coneItem = menu.add(new MenuItem("Cone"));
1874
+// coneItem.addActionListener(this);
1875
+// torusItem = menu.add(new MenuItem("Torus"));
1876
+// torusItem.addActionListener(this);
1877
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1878
+// superItem.addActionListener(this);
1879
+
1880
+ cameraItem = menu.add(new MenuItem("Camera"));
1881
+ cameraItem.addActionListener(this);
1882
+
1883
+ if (!Globals.ADVANCED)
1884
+ {
1885
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1886
+ kleinItem.addActionListener(this);
1887
+ }
1888
+
1889
+// particleItem = menu.add(new MenuItem("Particle system"));
1890
+// particleItem.addActionListener(this);
1891
+ if (Globals.ADVANCED)
1892
+ {
10191893 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201894 ragdollItem.addActionListener(this);
10211895 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221896 ragdoll2Item.addActionListener(this);
1897
+ }
10231898 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1899
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251900 meshItem.addActionListener(this);
10261901 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271902 // meshGroupItem.addActionListener(this);
1903
+ if (Globals.ADVANCED)
1904
+ {
10281905 springItem = menu.add(new MenuItem("Spring"));
10291906 springItem.addActionListener(this);
10301907 flagItem = menu.add(new MenuItem("Flag"));
10311908 flagItem.addActionListener(this);
1032
- bezierItem = menu.add(new MenuItem("Patch"));
1033
- bezierItem.addActionListener(this);
1034
- checkerItem = menu.add(new MenuItem("Checker"));
1035
- checkerItem.addActionListener(this);
10361909 blobItem = menu.add(new MenuItem("Blob"));
10371910 blobItem.addActionListener(this);
10381911 latheItem = menu.add(new MenuItem("Lathe"));
10391912 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1913
+ }
1914
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1915
+ bezierItem.addActionListener(this);
1916
+// overlayItem = menu.add(new MenuItem("Overlay"));
1917
+// overlayItem.addActionListener(this);
1918
+// lightItem = menu.add(new MenuItem("Light"));
1919
+// lightItem.addActionListener(this);
10421920 menu.add("-");
10431921 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441922 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1923
+// loopItem = menu.add(new MenuItem("Loop"));
1924
+// loopItem.addActionListener(this);
10471925 doubleItem = menu.add(new MenuItem("Fork"));
10481926 doubleItem.addActionListener(this);
1927
+ if (Globals.ADVANCED)
1928
+ {
10491929 tripleItem = menu.add(new MenuItem("Trident"));
10501930 tripleItem.addActionListener(this);
1051
- menu.add("-");
1052
- importGFDItem = menu.add(new MenuItem("GraphreeD Object..."));
1053
- importGFDItem.addActionListener(this);
1054
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
1055
- importVRMLX3DItem.addActionListener(this);
1056
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
1057
- importOBJItem.addActionListener(this);
1058
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
1059
- import3DSItem.addActionListener(this);
1931
+ }
10601932 }
10611933
10621934 void buildToolsMenu(Menu menu)
10631935 {
10641936 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651937 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1938
+ animationItem.setState(Globals.ANIMATION);
1939
+
1940
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1941
+ archiveItem.addActionListener(this);
10671942
10681943 menu.add("-");
10691944 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701945 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1946
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1947
+ textureFieldItem.addActionListener(this);
1948
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721949 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751950 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761951 reduceMorphItem.addActionListener(this);
10771952 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781953 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10821954 menu.add("-");
1083
-
10841955 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851956 memoryItem.addActionListener(this);
1957
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1958
+ computeAOItem.addActionListener(this);
1959
+
1960
+ if (Globals.ADVANCED)
1961
+ {
1962
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1963
+ mirrorItem.addActionListener(this);
1964
+ menu.add("-");
10861965 menu.add(analyzeItem = new MenuItem("Analyze"));
10871966 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1967
+ menu.add(dumpItem = new MenuItem("Print"));
10891968 dumpItem.addActionListener(this);
10901969 // menu.add(pathItem = new MenuItem("From-to path"));
10911970 // pathItem.addActionListener(this);
....@@ -1094,6 +1973,8 @@
10941973 resetParentItem.addActionListener(this);
10951974 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961975 repairParentItem.addActionListener(this);
1976
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1977
+ repairShadowItem.addActionListener(this);
10971978 menu.add(invariantsItem = new MenuItem("Invariants"));
10981979 invariantsItem.addActionListener(this);
10991980 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1982,7 @@
11011982 menu.add("-");
11021983 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031984 editScriptItem.addActionListener(this);
1985
+ }
11041986 }
11051987
11061988 void ScreenFit()
....@@ -1223,9 +2105,34 @@
12232105 shadow.material = new cMaterial(obj.material);
12242106 shadow.material.diffuse = 0.0001f;
12252107 shadow.material.specular = 0.0001f;
2108
+ //shadow.projectedVertices[1].x = 300;
12262109
12272110 makeSomething(shadow);
12282111 }
2112
+
2113
+ private void ClearUnpinned()
2114
+ {
2115
+ //for (Object3D obj : listUI)
2116
+ for (int i=listUI.size(); --i>=0;)
2117
+ {
2118
+ Object3D obj = listUI.elementAt(i);
2119
+ if (!obj.pinned)
2120
+ {
2121
+ obj.CloseUI();
2122
+ listUI.remove(i);
2123
+ }
2124
+ }
2125
+ }
2126
+
2127
+ private void EditElement(Object3D elem, boolean newWindow)
2128
+ {
2129
+ // if (!(elem instanceof Composite))
2130
+ // newWindow = false;
2131
+ listUI.add(elem);
2132
+ elem.openEditWindow(this, newWindow); //, false);
2133
+ System.out.println("edit : " + elem);
2134
+ elem.editWindow.refreshContents(true); // ? new
2135
+ }
12292136
12302137 /**
12312138 * applyExample
....@@ -1429,9 +2336,9 @@
14292336
14302337 void Overwrite(int mask)
14312338 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2339
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14332340 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
2341
+ Object3D content = Grafreed.clipboard.get(0);
14352342
14362343 if (content instanceof cGroup && ((cGroup)content).transientlink )
14372344 content = ((cGroup)content).get(0);
....@@ -1454,6 +2361,7 @@
14542361 //
14552362 public void actionPerformed(ActionEvent event) // , Object arg)
14562363 {
2364
+ Object source = event.getSource();
14572365 /*
14582366 if (event.getSource() == nameField)
14592367 {
....@@ -1465,11 +2373,11 @@
14652373 }
14662374 else
14672375 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2376
+ if (source == lookAtItem || source == lookFromItem)
14692377 {
14702378 ScreenFit();
14712379 } else
1472
- if (event.getSource() == switchItem)
2380
+ if (source == switchViewItem)
14732381 {
14742382 cVector v1 = new cVector();
14752383 cVector v2 = new cVector();
....@@ -1478,11 +2386,11 @@
14782386 objEditor.cameraView.renderCamera.setAim(v2, v1);
14792387 objEditor.cameraView.repaint();
14802388 } else
1481
- if (event.getSource() == rectoidItem)
2389
+ if (source == rectoidItem || source == boxButton)
14822390 {
14832391 makeSomething(new Box());
14842392 } else
1485
- if (event.getSource() == particleItem)
2393
+ if (source == particleItem || source == particlesButton)
14862394 {
14872395 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14882396 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +2411,9 @@
15032411 applyExample(particleGeom, "SMOKE");
15042412 makeSomething(particleGeom);
15052413 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2414
+ if (source == ragdollItem || source == ragdoll2Item)
15072415 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2416
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15092417
15102418 ragdoll.toParent = LA.newMatrix();
15112419 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +2429,71 @@
15212429 makeSomething(ragdoll);
15222430 //makeSomething(new VehicleDemo());
15232431 } else
1524
- if (event.getSource() == gridItem)
2432
+ /*
2433
+ */
2434
+ if (source == heightFieldItem)
2435
+ {
2436
+ Object3D obj = new Object3D();
2437
+
2438
+ obj.CreateMaterial();
2439
+ obj.bRep = new BoundaryRep();
2440
+
2441
+ obj.bRep.CreateMesh(new iHeightField()
2442
+ {
2443
+ public double f(double x, double y)
2444
+ {
2445
+ // The Mandelbrot set is represented by coloring
2446
+ // each point (x,y) according to the number of
2447
+ // iterations it takes before the while loop in
2448
+ // this method ends. For points that are actually
2449
+ // in the Mandelbrot set, or very close to it, the
2450
+ // count will reach the maximum value, 80. These
2451
+ // points will be colored purple. All other colors
2452
+ // represent points that are definitely NOT in the set.
2453
+ x -= 600;
2454
+ y -= 500;
2455
+ x /= 200;
2456
+ y /= 200;
2457
+ int count = 0;
2458
+ double zx = x;
2459
+ double zy = y;
2460
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2461
+ double new_zx = zx*zx - zy*zy + x;
2462
+ zy = 2*zx*zy + y;
2463
+ zx = new_zx;
2464
+ count++;
2465
+ }
2466
+ return count; // Math.sqrt(count);
2467
+ }
2468
+ }, 1000,1000);
2469
+
2470
+ makeSomething(obj);
2471
+ } else
2472
+ if (source == gridItem || source == gridButton)
15252473 {
15262474 makeSomething(new Grid());
15272475 } else
1528
- if (event.getSource() == ellipsoidItem)
2476
+ if (source == ellipsoidItem || source == sphereButton)
15292477 {
15302478 makeSomething(new Sphere());
15312479 } else
1532
- if (event.getSource() == coneItem)
2480
+ if (source == coneItem || source == coneButton)
15332481 {
15342482 makeSomething(new Cone());
15352483 } else
1536
- if (event.getSource() == torusItem)
2484
+ if (source == torusItem || source == torusButton)
15372485 {
15382486 makeSomething(new Torus());
15392487 } else
1540
- if (event.getSource() == superItem)
2488
+ if (source == superItem || source == superButton)
15412489 {
15422490 makeSomething(new Superellipsoid());
15432491 } else
1544
- if (event.getSource() == blobItem)
2492
+ if (source == kleinItem || source == kleinButton)
2493
+ {
2494
+ makeSomething(new Klein());
2495
+ } else
2496
+ if (source == blobItem)
15452497 {
15462498 Blob blob = new Blob();
15472499 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2501,15 @@
15492501 //blob.retile();
15502502 makeSomething(blob);
15512503 } else
1552
- if (event.getSource() == latheItem)
2504
+ if (source == latheItem)
15532505 {
15542506 makeSomething(new Lathe());
15552507 } else
1556
- if (event.getSource() == bezierItem)
2508
+ if (source == bezierItem)
15572509 {
15582510 makeSomething(new BezierSurface());
15592511 } else
1560
- if (event.getSource() == checkerItem)
2512
+ if (source == overlayItem || source == overlayButton)
15612513 {
15622514 /*
15632515 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2522,9 @@
15702522 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712523 LA.matInvert(obj.toParent, obj.fromParent);
15722524 */
1573
- makeSomething(new CheckerIG());
2525
+ makeSomething(new Checker());
15742526 } else
1575
- if (event.getSource() == meshItem)
2527
+ if (source == meshItem)
15762528 {
15772529 Object3D itemtomake = new Object3D();
15782530 Object3D child;
....@@ -1593,35 +2545,52 @@
15932545 makeSomething(child);
15942546 }
15952547 } else
1596
- if (event.getSource() == springItem)
2548
+ if (source == springItem)
15972549 {
15982550 cSpring s = new cSpring();
15992551 s.setup();
16002552 makeSomething(s);
16012553 } else
1602
- if (event.getSource() == flagItem)
2554
+ if (source == flagItem)
16032555 {
16042556 cSpring s = new cFlag();
16052557 s.setup();
16062558 makeSomething(s);
16072559 } else
1608
- if (event.getSource() == lightItem)
2560
+ if (source == lightItem || source == lightButton)
16092561 {
16102562 makeSomething(new Light());
16112563 } else
1612
- if (event.getSource() == csgItem)
2564
+// if (source == skybox1Button ||
2565
+// source == skybox2Button ||
2566
+// source == skybox3Button ||
2567
+// source == skybox4Button ||
2568
+// source == skybox5Button ||
2569
+// source == skybox6Button ||
2570
+// source == skybox7Button ||
2571
+// source == skybox11Button ||
2572
+// source == skybox12Button ||
2573
+// source == skybox13Button ||
2574
+// source == skybox14Button ||
2575
+// source == skybox15Button ||
2576
+// source == skybox16Button ||
2577
+// source == skybox17Button)
2578
+// {
2579
+// ChangeSkybox(source);
2580
+// } else
2581
+ if (source == csgItem)
16132582 {
16142583 group(new CSG());
16152584 } else
1616
- if (event.getSource() == templateItem)
2585
+ if (source == templateItem)
16172586 {
16182587 group(new cTemplate());
16192588 } else
1620
- if (event.getSource() == attributeItem)
2589
+ if (source == attributeItem)
16212590 {
16222591 makeSomething(new Attribute());
16232592 } else
1624
- if (event.getSource() == pointflowItem)
2593
+ if (source == pointflowItem)
16252594 {
16262595 makeSomething(new PointFlow());
16272596 } else
....@@ -1633,7 +2602,7 @@
16332602 } else
16342603 */
16352604
1636
- if (event.getSource() == superLoopItem)
2605
+ if (source == superLoopItem)
16372606 {
16382607 Composite g = new cGroup();
16392608 for (int i=0; i<15; i++)
....@@ -1655,30 +2624,30 @@
16552624
16562625 group(g);
16572626 } else
1658
- if (event.getSource() == loopItem)
2627
+ if (source == loopItem || source == loopButton)
16592628 {
16602629 Composite csg = new GroupLeaf();
16612630 csg.count = 5;
16622631 group(csg);
1663
- Composite child = new cGroup();
2632
+ Composite child = new cGroup("Branch");
16642633 csg.addChild(child);
16652634 child.addChild(csg);
16662635 } else
1667
- if (event.getSource() == doubleItem)
2636
+ if (source == doubleItem)
16682637 {
1669
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Fork");
16702639 csg.count = 5;
16712640 group(csg);
1672
- Composite child = new cGroup();
2641
+ Composite child = new cGroup("Branch A");
16732642 csg.addChild(child);
16742643 child.addChild(csg);
1675
- child = new cGroup();
2644
+ child = new cGroup("Branch B");
16762645 csg.addChild(child);
16772646 child.addChild(csg);
16782647 } else
1679
- if (event.getSource() == tripleItem)
2648
+ if (source == tripleItem)
16802649 {
1681
- Composite csg = new GroupLeaf();
2650
+ Composite csg = new GroupLeaf("Trident");
16822651 csg.count = 4;
16832652 group(csg);
16842653 Composite child = new cGroup();
....@@ -1691,73 +2660,105 @@
16912660 csg.addChild(child);
16922661 child.addChild(csg);
16932662 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2663
+ if (source == computeAOItem)
16962664 {
1697
- ImportGFD();
2665
+ Globals.drawMode = CameraPane.OCCLUSION;
2666
+ cameraView.repaint();
16982667 } else
1699
- if (event.getSource() == importVRMLX3DItem)
1700
- {
1701
- ImportVRMLX3D();
1702
- } else
1703
- if (event.getSource() == import3DSItem)
1704
- {
1705
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1706
- } else
1707
- if (event.getSource() == importOBJItem)
1708
- {
1709
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1710
- } else
1711
- if (event.getSource() == computeAOItem)
1712
- {
1713
- CameraPane.drawMode = CameraPane.OCCLUSION;
1714
- CameraPane.theRenderer.repaint();
1715
- } else
1716
- if (event.getSource() == recompileItem)
2668
+ if (source == recompileItem)
17172669 {
17182670 Recompile();
17192671 refreshContents();
17202672 } else
1721
- if (event.getSource() == editScriptItem)
2673
+ if (source == editScriptItem)
17222674 {
17232675 OpenDialog();
17242676 refreshContents();
17252677 } else
1726
- if (event.getSource() == invariantsItem)
2678
+ if (source == invariantsItem)
17272679 {
17282680 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2681
+ Grafreed.grafreed.universe.invariants();
17302682 } else
1731
- if (event.getSource() == memoryItem)
2683
+ if (source == memoryItem)
17322684 {
17332685 //System.out.println("Invariants:");
17342686 PrintMemory();
17352687 } else
1736
- if (event.getSource() == pathItem)
2688
+ if (source == pathItem)
17372689 {
17382690 PrintPath();
17392691 } else
1740
- if (event.getSource() == analyzeItem)
2692
+ if (source == analyzeItem)
17412693 {
17422694 AnalyzeObject();
17432695 } else
1744
- if (event.getSource() == dumpItem)
2696
+ if (source == dumpItem)
17452697 {
17462698 DumpObject();
17472699 } else
1748
- if (event.getSource() == screenfitButton)
2700
+ if (source == minButton)
17492701 {
1750
- //Reload(lastConverter, lastFilename, true);
2702
+ Minimize();
2703
+ } else
2704
+ if (source == maxButton)
2705
+ {
2706
+ Maximize();
2707
+ } else
2708
+ if (source == fullButton)
2709
+ {
2710
+ ToggleFullScreen();
2711
+ } else
2712
+ if (source == previousVersionButton)
2713
+ {
2714
+ // Go to previous version
2715
+ //if (!Undo())
2716
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2717
+ PreviousVersion();
2718
+ } else
2719
+ if (source == restoreButton)
2720
+ {
2721
+ // Restore current version
2722
+ Restore();
2723
+ //restoreButton.setEnabled(false);
2724
+ } else
2725
+ if (source == replaceButton)
2726
+ {
2727
+ // Overwrite current version
2728
+ Replace();
2729
+ //replaceButton.setEnabled(false);
2730
+ } else
2731
+ if (source == nextVersionButton)
2732
+ {
2733
+ // Go to next version
2734
+ NextVersion();
2735
+ } else
2736
+ if (source == saveVersionButton)
2737
+ {
2738
+ // Save a new version
2739
+ if (!Save(true))
2740
+ java.awt.Toolkit.getDefaultToolkit().beep();
2741
+ } else
2742
+ if (source == deleteVersionButton)
2743
+ {
2744
+ // Delete a new version
2745
+ DeleteVersion();
2746
+ } else
2747
+ if (source == oneStepButton)
2748
+ {
2749
+ Globals.ONESTEP = true;
2750
+ cameraView.repaint();
2751
+ } else
2752
+ if (source == screenfitButton)
2753
+ {
17512754 ScreenFit();
17522755 } else
1753
- if (event.getSource() == screenfitpointButton)
2756
+ if (source == screenfitpointButton)
17542757 {
1755
- //Reload(lastConverter, lastFilename, true);
17562758 ScreenFitPoint();
17572759 } else
1758
- if (event.getSource() == snapobjectButton)
2760
+ if (source == snapobjectButton)
17592761 {
1760
- //Reload(lastConverter, lastFilename, true);
17612762 SnapObject();
17622763 } else
17632764 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2767,13 @@
17662767 // Recompile();
17672768 // refreshContents();
17682769 // } else
1769
- if (event.getSource() == gcButton)
2770
+ if (source == gcButton)
17702771 {
17712772 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722773 System.gc();
17732774 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742775 } else
1775
- if (event.getSource() == editLeafItem)
2776
+ if (source == editLeafItem)
17762777 {
17772778 Object3D obj;
17782779 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2787,78 @@
17862787 }
17872788 refreshContents(true);
17882789 } else
1789
- if (event.getSource() == openWindowItem)
2790
+ if (source == openWindowItem)
17902791 {
17912792 EditSelection(true);
17922793 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2794
+ if (source == cutItem || source == clearButton)
17942795 {
17952796 loadClipboard(true);
17962797 } else
1797
- if (event.getSource() == duplicateItem)
2798
+ if (source == undoItem)
17982799 {
1799
- Object3D keep = GraphreeD.clipboard;
2800
+ PreviousVersion();
2801
+ } else
2802
+ if (source == redoItem)
2803
+ {
2804
+ NextVersion();
2805
+ } else
2806
+ if (source == duplicateItem)
2807
+ {
2808
+ Object3D keep = Grafreed.clipboard;
18002809 loadClipboard(false);
18012810 paste(false);
1802
- GraphreeD.clipboard = keep;
2811
+ Grafreed.clipboard = keep;
18032812 } else
1804
- if (event.getSource() == cloneItem)
2813
+ if (source == cloneItem)
18052814 {
18062815 CloneSelection(false);
18072816 } else
1808
- if (event.getSource() == cloneSupportItem)
2817
+ if (source == cloneSupportItem)
18092818 {
18102819 CloneSelection(true);
18112820 } else
1812
- if (event.getSource() == copyItem)
2821
+ if (source == copyItem)
18132822 {
18142823 loadClipboard(false);
18152824 } else
1816
- if (event.getSource() == pasteItem)
2825
+ if (source == pasteItem)
18172826 {
18182827 paste(false);
18192828 } else
1820
- if (event.getSource() == pasteLinkItem)
2829
+ if (source == pasteIntoItem)
18212830 {
1822
- pasteInto(false);
2831
+ pasteInto(true, false);
18232832 } else
1824
- if (event.getSource() == pasteCloneItem)
2833
+ if (source == pasteLinkItem)
18252834 {
1826
- pasteInto(true);
2835
+ pasteInto(false, false);
18272836 } else
1828
- if (event.getSource() == pasteExpandItem)
2837
+ if (source == pasteCloneItem)
2838
+ {
2839
+ pasteInto(true, true);
2840
+ } else
2841
+ if (source == pasteExpandItem)
18292842 {
18302843 paste(true);
18312844 } else
1832
- if (event.getSource() == synchronizeItem)
2845
+ if (source == synchronizeItem)
18332846 {
18342847 Overwrite(Object3D.TRANSFORM);
18352848 } else
1836
- if (event.getSource() == overwriteNameItem)
2849
+ if (source == overwriteNameItem)
18372850 {
18382851 Overwrite(Object3D.NAME);
18392852 } else
1840
- if (event.getSource() == overwriteUVItem)
2853
+ if (source == overwriteUVItem)
18412854 {
18422855 Overwrite(Object3D.UV);
18432856 } else
1844
- if (event.getSource() == overwriteMatItem)
2857
+ if (source == overwriteMatItem)
18452858 {
2859
+ /* july 2015
18462860 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2861
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482862 else
18492863 {
18502864 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2870,16 @@
18562870 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572871 }
18582872 }
2873
+ */
2874
+
2875
+ Overwrite(dropAttributes);
18592876 }
1860
- if (event.getSource() == overwriteGeoItem)
2877
+ if (source == overwriteGeoItem)
18612878 {
18622879 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2880
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642881 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2882
+// Object3D content = GrafreeD.clipboard.get(0);
18662883 //
18672884 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682885 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2891,7 @@
18742891 // refreshContents();
18752892 // }
18762893 } else
1877
- if (event.getSource() == generateMeshItem)
2894
+ if (source == generateMeshItem)
18782895 {
18792896 //if (group.selection.size() == 1)
18802897 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2902,7 @@
18852902 ResetModel();
18862903 refreshContents();
18872904 } else
1888
- if (event.getSource() == extractGeometriesItem)
2905
+ if (source == extractGeometriesItem)
18892906 {
18902907 boolean one = false;
18912908
....@@ -1912,7 +2929,7 @@
19122929 ResetModel();
19132930 refreshContents();
19142931 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2932
+ if (source == cloneGeometriesItem)
19162933 {
19172934 boolean one = false;
19182935
....@@ -1938,32 +2955,37 @@
19382955 ResetModel();
19392956 refreshContents();
19402957 } else
1941
- if (event.getSource() == shareGeometriesItem)
2958
+ if (source == shareGeometriesItem)
19422959 {
19432960 boolean one = false;
19442961
19452962 if (group.selection.size() == 1)
19462963 one = true;
19472964
2965
+ Object3D merge = null;
2966
+
19482967 Object3D content = new cGroup();
19492968
19502969 for (int i=0; i<group.selection.size(); i++)
19512970 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2971
+ merge = new Merge(group.selection.get(i));
19532972
19542973 if (one)
1955
- makeSomething(sel, false);
2974
+ makeSomething(merge, false);
19562975 else
1957
- content.addChild(sel);
2976
+ content.addChild(merge);
19582977 }
19592978
19602979 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2980
+ makeSomething(content, true);
2981
+ else
2982
+ {
2983
+ ResetModel();
2984
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2985
+ refreshContents();
2986
+ }
19652987 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2988
+ if (source == mergeGeometriesItem)
19672989 {
19682990 boolean one = false;
19692991
....@@ -1993,11 +3015,11 @@
19933015 ResetModel();
19943016 refreshContents();
19953017 } else
1996
- if (event.getSource() == linkverticesItem)
3018
+ if (source == linkverticesItem)
19973019 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3020
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19993021 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
3022
+// Object3D content = GrafreeD.clipboard.get(0);
20013023 //
20023024 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20033025 // content = ((cGroup)content).get(0);
....@@ -2006,39 +3028,48 @@
20063028 // group.selection.get(0).setMasterThis(content); // should be identity
20073029 // refreshContents();
20083030 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3031
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20103032 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
3033
+ Object3D content = Grafreed.clipboard.get(0);
20123034
20133035 if (content instanceof cGroup && ((cGroup)content).transientlink )
20143036 content = ((cGroup)content).get(0);
20153037
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
3038
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20173039 for (int i=0; i<group.selection.size(); i++)
20183040 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
3041
+ boolean random = CameraPane.SWITCH;
3042
+ CameraPane.SWITCH = false; // parse all random nodes
20213043 group.selection.get(i).linkVerticesThis(content);
20223044 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
3045
+ CameraPane.SWITCH = random;
20243046 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3047
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20263048 refreshContents();
20273049 }
20283050 } else
2029
- if (event.getSource() == resetsupportItem)
3051
+ if (source == resetsupportItem)
20303052 {
20313053 for (int i=0; i<group.selection.size(); i++)
20323054 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
3055
+ boolean random = CameraPane.SWITCH;
3056
+ CameraPane.SWITCH = false; // parse all random nodes
20353057 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
3058
+ CameraPane.SWITCH = random;
20373059 }
20383060
20393061 refreshContents();
20403062 } else
2041
- if (event.getSource() == resetreferencesItem)
3063
+ if (source == relinkverticesItem)
3064
+ {
3065
+ boolean random = CameraPane.SWITCH;
3066
+ CameraPane.SWITCH = false; // parse all random nodes
3067
+ group.selection.RelinkToSupport();
3068
+ CameraPane.SWITCH = random;
3069
+
3070
+ refreshContents();
3071
+ } else
3072
+ if (source == resetreferencesItem)
20423073 {
20433074 for (int i=0; i<group.selection.size(); i++)
20443075 {
....@@ -2047,11 +3078,11 @@
20473078
20483079 refreshContents();
20493080 } else
2050
- if (event.getSource() == setMasterItem)
3081
+ if (source == setMasterItem)
20513082 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3083
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20533084 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
3085
+ Object3D content = Grafreed.clipboard.get(0);
20553086
20563087 if (content instanceof cGroup && ((cGroup)content).transientlink )
20573088 content = ((cGroup)content).get(0);
....@@ -2060,13 +3091,13 @@
20603091 refreshContents();
20613092 }
20623093 } else
2063
- if (event.getSource() == poseMeshItem)
3094
+ if (source == poseMeshItem)
20643095 {
20653096 if (group.selection.size() == 1)
20663097 {
2067
- if (GraphreeD.clipboard.size() == 1)
3098
+ if (Grafreed.clipboard.size() == 1)
20683099 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
3100
+ Object3D content = Grafreed.clipboard.get(0);
20703101
20713102 if (content instanceof cGroup && ((cGroup)content).transientlink )
20723103 content = ((cGroup)content).get(0);
....@@ -2079,19 +3110,19 @@
20793110 }
20803111
20813112 } else
2082
- if (event.getSource() == revertMeshItem)
3113
+ if (source == revertMeshItem)
20833114 {
20843115 RevertMeshes();
20853116 } else
2086
- if (event.getSource() == resetMeshItem)
3117
+ if (source == resetAllItem)
20873118 {
20883119 ResetAll();
20893120 } else
2090
- if (event.getSource() == stepAllItem)
3121
+ if (source == stepAllItem)
20913122 {
20923123 StepAll();
20933124 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3125
+ if (source == deleteItem) // || event.getSource() == clearButton)
20953126 {
20963127 //int indices[] = jList.getSelectedIndices();
20973128 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +3130,46 @@
20993130
21003131 ClearSelection(false);
21013132 } else
2102
- if (event.getSource() == clearAllItem)
3133
+ if (source == clearAllItem)
21033134 {
21043135 ClearSelection(true);
21053136 } else
2106
- if (event.getSource() == grabItem)
3137
+ if (source == grabItem || source == groupButton)
21073138 {
2108
- group(new cGroup(), true);
3139
+ group(new cGroup(), false); // true);
21093140 } else
2110
- if (event.getSource() == frontItem)
3141
+ if (source == hideItem)
3142
+ {
3143
+ group(new HiddenObject());
3144
+ } else
3145
+ if (source == frontItem)
21113146 {
21123147 front();
21133148 } else
2114
- if (event.getSource() == backItem)
3149
+ if (source == backItem)
21153150 {
21163151 back();
21173152 } else
2118
- if (event.getSource() == cameraItem)
3153
+ if (source == cameraItem)
21193154 {
21203155 makeSomething(new Camera());
21213156 } else
2122
- if (event.getSource() == compositeItem)
3157
+ if (source == compositeItem || source == compositeButton)
21233158 {
21243159 group(new Composite());
21253160 } else
2126
- if (event.getSource() == randomItem)
3161
+ if (source == switchItem || source == switchButton)
21273162 {
21283163 RandomNode random = new RandomNode();
21293164 group(random);
21303165 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
3166
+ random.name = random.get(0).name + "Switch";
21323167 } else
2133
- if (event.getSource() == physicsItem)
3168
+ if (source == physicsItem)
21343169 {
21353170 group(new PhysicsNode());
21363171 } else
2137
- if (event.getSource() == frameselectorItem)
3172
+ if (source == frameselectorItem)
21383173 {
21393174 for (int i=0; i<group.selection.size(); i++)
21403175 {
....@@ -2146,7 +3181,7 @@
21463181 ResetModel();
21473182 refreshContents();
21483183 } else
2149
- if (event.getSource() == switchGeoItem)
3184
+ if (source == switchGeoItem)
21503185 {
21513186 for (int i=0; i<group.selection.size(); i++)
21523187 {
....@@ -2158,7 +3193,7 @@
21583193 ResetModel();
21593194 refreshContents();
21603195 } else
2161
- if (event.getSource() == switchTransfoItem)
3196
+ if (source == switchTransfoItem)
21623197 {
21633198 for (int i=0; i<group.selection.size(); i++)
21643199 {
....@@ -2170,7 +3205,7 @@
21703205 ResetModel();
21713206 refreshContents();
21723207 } else
2173
- if (event.getSource() == morphItem)
3208
+ if (source == morphItem)
21743209 {
21753210 for (int i=0; i<group.selection.size(); i++)
21763211 {
....@@ -2182,7 +3217,7 @@
21823217 ResetModel();
21833218 refreshContents();
21843219 } else
2185
- if (event.getSource() == scriptNodeItem)
3220
+ if (source == scriptNodeItem)
21863221 {
21873222 boolean atleastone = false;
21883223
....@@ -2221,191 +3256,252 @@
22213256 }
22223257 }
22233258 } else
2224
- if (event.getSource() == linkerItem)
3259
+ if (source == linkerItem)
22253260 {
22263261 group(new cLinker());
22273262 } else
2228
- if (event.getSource() == textureItem)
3263
+ if (source == textureItem || source == textureButton)
22293264 {
22303265 group(new TextureNode());
22313266 } else
2232
- if (event.getSource() == shadowXItem)
3267
+ if (source == billboardItem)
3268
+ {
3269
+ group(new BillboardNode());
3270
+ } else
3271
+ if (source == shadowXItem)
22333272 {
22343273 CastShadow(0);
22353274 } else
2236
- if (event.getSource() == shadowYItem)
3275
+ if (source == shadowYItem)
22373276 {
22383277 CastShadow(1);
22393278 } else
2240
- if (event.getSource() == shadowZItem)
3279
+ if (source == shadowZItem)
22413280 {
22423281 CastShadow(2);
22433282 } else
2244
- if (event.getSource() == ungroupItem)
3283
+ if (source == ungroupItem || source == ungroupButton)
22453284 {
2246
- ungroup();
3285
+ boolean hasRoot = false;
3286
+
3287
+ for (int i=0; i<group.selection.size(); i++)
3288
+ {
3289
+ if (group.selection.get(i) == group)
3290
+ {
3291
+ hasRoot = true;
3292
+ break;
3293
+ }
3294
+ }
3295
+
3296
+ if (!hasRoot)
3297
+ {
3298
+ for (int i=0; i<group.selection.size(); i++)
3299
+ {
3300
+ Ungroup(group.selection.get(i));
3301
+ }
3302
+
3303
+ ClearSelection(false);
3304
+
3305
+ refreshContents();
3306
+ }
22473307 } else
2248
- if (event.getSource() == genUVItem)
3308
+ if (source == genUVItem)
22493309 {
22503310 GenUV();
22513311 } else
2252
- if (event.getSource() == genNormalsCADItem)
3312
+ if (source == genNormalsCADItem)
22533313 {
22543314 GenNormals(true);
22553315 } else
2256
- if (event.getSource() == genNormalsORGANItem)
3316
+ if (source == genNormalsMESHItem)
3317
+ {
3318
+ GenNormalsMESH();
3319
+ } else
3320
+ if (source == genNormalsORGANItem)
22573321 {
22583322 GenNormals(false);
22593323 } else
2260
- if (event.getSource() == stripifyItem)
3324
+ if (source == genNormalsMINEItem)
3325
+ {
3326
+ GenNormalsMINE();
3327
+ } else
3328
+ if (source == stripifyItem)
22613329 {
22623330 Stripify();
22633331 } else
2264
- if (event.getSource() == unstripifyItem)
3332
+ if (source == unstripifyItem)
22653333 {
22663334 Unstripify();
22673335 } else
2268
- if (event.getSource() == trimItem)
3336
+ if (source == trimItem)
22693337 {
22703338 Trim();
22713339 } else
2272
- if (event.getSource() == untrimItem)
3340
+ if (source == untrimItem)
22733341 {
22743342 Untrim();
22753343 } else
2276
- if (event.getSource() == clearColorsItem)
3344
+ if (source == clearColorsItem)
22773345 {
22783346 ClearColors();
22793347 } else
2280
- if (event.getSource() == clearMaterialsItem)
3348
+ if (source == clearMaterialsItem)
22813349 {
22823350 ClearMaterials();
22833351 } else
2284
- if (event.getSource() == liveleavesItem)
3352
+ if (source == liveleavesItem)
22853353 {
22863354 LiveLeaves(true);
22873355 } else
2288
- if (event.getSource() == unliveleavesItem)
3356
+ if (source == unliveleavesItem)
22893357 {
22903358 LiveLeaves(false);
22913359 } else
2292
- if (event.getSource() == supportleavesItem)
3360
+ if (source == supportleavesItem)
22933361 {
22943362 SupportLeaves(true);
22953363 } else
2296
- if (event.getSource() == unsupportleavesItem)
3364
+ if (source == unsupportleavesItem)
22973365 {
22983366 SupportLeaves(false);
22993367 } else
2300
- if (event.getSource() == hideleavesItem)
3368
+ if (source == hideleavesItem)
23013369 {
23023370 HideLeaves(true);
23033371 } else
2304
- if (event.getSource() == showleavesItem)
3372
+ if (source == showleavesItem)
23053373 {
23063374 HideLeaves(false);
23073375 } else
2308
- if (event.getSource() == markleavesItem)
3376
+ if (source == markleavesItem)
23093377 {
23103378 MarkLeaves(true);
23113379 } else
2312
- if (event.getSource() == unmarkleavesItem)
3380
+ if (source == unmarkleavesItem)
23133381 {
23143382 MarkLeaves(false);
23153383 } else
2316
- if (event.getSource() == flipVItem)
3384
+ if (source == rewindleavesItem)
3385
+ {
3386
+ RewindLeaves(true);
3387
+ } else
3388
+ if (source == unrewindleavesItem)
3389
+ {
3390
+ RewindLeaves(false);
3391
+ } else
3392
+ if (source == randomleavesItem)
3393
+ {
3394
+ RandomLeaves(true);
3395
+ } else
3396
+ if (source == unrandomleavesItem)
3397
+ {
3398
+ RandomLeaves(false);
3399
+ } else
3400
+ if (source == flipVItem)
23173401 {
23183402 FlipV(true);
23193403 } else
2320
- if (event.getSource() == unflipVItem)
3404
+ if (source == unflipVItem)
23213405 {
23223406 FlipV(false);
23233407 } else
2324
- if (event.getSource() == lowTexturesItem)
3408
+ if (source == lowTexturesItem)
23253409 {
23263410 SetTexRes(0);
23273411 } else
2328
- if (event.getSource() == normalTexturesItem)
3412
+ if (source == normalTexturesItem)
23293413 {
23303414 SetTexRes(1);
23313415 } else
2332
- if (event.getSource() == highTexturesItem)
3416
+ if (source == highTexturesItem)
23333417 {
23343418 SetTexRes(2);
23353419 } else
2336
- if (event.getSource() == veryhighTexturesItem)
3420
+ if (source == veryhighTexturesItem)
23373421 {
23383422 SetTexRes(3);
23393423 } else
2340
- if (event.getSource() == maxTexturesItem)
3424
+ if (source == maxTexturesItem)
23413425 {
23423426 SetTexRes(4);
23433427 } else
2344
- if (event.getSource() == panoTexturesItem)
3428
+ if (source == panoTexturesItem)
23453429 {
23463430 SetTexRes(5);
23473431 } else
2348
- if (event.getSource() == reverseNormalsItem)
3432
+ if (source == reverseNormalsItem)
23493433 {
23503434 ReverseNormals();
23513435 } else
2352
- if (event.getSource() == parseverticesItem)
3436
+ if (source == parseverticesItem)
23533437 {
23543438 ParseVertices();
23553439 } else
2356
- if (event.getSource() == alignItem)
3440
+ if (source == textureFieldItem)
3441
+ {
3442
+ TextureVertices();
3443
+ } else
3444
+ if (source == alignItem)
23573445 {
23583446 Align();
23593447 } else
2360
- if (event.getSource() == mirrorItem)
3448
+ if (source == mirrorItem)
23613449 {
23623450 MirrorPoses();
23633451 } else
2364
- if (event.getSource() == reduceMorphItem)
3452
+ if (source == reduceMorphItem)
23653453 {
23663454 MeshReduction(false);
23673455 } else
2368
- if (event.getSource() == reduce34MorphItem)
3456
+ if (source == reduce34MorphItem)
23693457 {
23703458 MeshReduction(true);
23713459 } else
2372
- if (event.getSource() == reverseTrianglesItem)
3460
+ if (source == reverseTrianglesItem)
23733461 {
23743462 ReverseTriangles();
23753463 } else
2376
- if (event.getSource() == reduceMeshItem)
3464
+ if (source == reduceMeshItem)
23773465 {
23783466 ReduceMesh(false);
23793467 } else
2380
- if (event.getSource() == reduce34MeshItem)
3468
+ if (source == reduce34MeshItem)
23813469 {
23823470 ReduceMesh(true);
23833471 } else
2384
- if (event.getSource() == increaseMeshItem)
3472
+ if (source == increaseMeshItem)
23853473 {
23863474 IncreaseMesh();
23873475 } else
2388
- if (event.getSource() == clipMeshItem)
3476
+ if (source == clipMeshItem)
23893477 {
23903478 ClipMesh();
23913479 } else
2392
- if (event.getSource() == smoothMeshItem)
3480
+ if (source == smoothMeshItem)
23933481 {
23943482 SmoothMesh();
23953483 } else
2396
- if (event.getSource() == transformgeometryItem)
3484
+ if (source == transformGeometryItem)
23973485 {
23983486 TransformGeometry();
23993487 } else
2400
- if (event.getSource() == resetTransformItem)
3488
+ if (source == transformChildrenItem)
3489
+ {
3490
+ TransformChildren();
3491
+ } else
3492
+ if (source == resetTransformItem)
24013493 {
24023494 ResetTransform();
24033495 } else
2404
- if (event.getSource() == resetCentroidItem)
3496
+ if (source == resetCentroidItem)
24053497 {
2406
- ResetCentroid();
3498
+ ResetCentroid(true);
24073499 } else
2408
- if (event.getSource() == resetParentItem)
3500
+ if (source == resetCentroidXZItem)
3501
+ {
3502
+ ResetCentroid(false);
3503
+ } else
3504
+ if (source == resetParentItem)
24093505 {
24103506 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113507 {
....@@ -2415,7 +3511,7 @@
24153511
24163512 refreshContents();
24173513 } else
2418
- if (event.getSource() == repairParentItem)
3514
+ if (source == repairParentItem)
24193515 {
24203516 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213517 {
....@@ -2429,7 +3525,21 @@
24293525
24303526 refreshContents();
24313527 } else
2432
- if (event.getSource() == sortbysizeItem)
3528
+ if (source == repairShadowItem)
3529
+ {
3530
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3531
+ {
3532
+ Object3D obj = (Object3D)e.nextElement();
3533
+ obj.RepairShadow();
3534
+// for (int i=0; i<obj.size(); i++)
3535
+// {
3536
+// obj.get(i).parent = obj;
3537
+// }
3538
+ }
3539
+
3540
+ refreshContents();
3541
+ } else
3542
+ if (source == sortbysizeItem)
24333543 {
24343544 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353545 {
....@@ -2441,7 +3551,7 @@
24413551 ResetModel();
24423552 refreshContents();
24433553 } else
2444
- if (event.getSource() == sortbynameItem)
3554
+ if (source == sortbynameItem)
24453555 {
24463556 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473557 {
....@@ -2453,7 +3563,7 @@
24533563 ResetModel();
24543564 refreshContents();
24553565 } else
2456
- if (event.getSource() == attachPigmentItem)
3566
+ if (source == attachPigmentItem)
24573567 {
24583568 String texture = GetFile("Attach pigment");
24593569 Object3D obj;
....@@ -2465,7 +3575,7 @@
24653575
24663576 refreshContents();
24673577 } else
2468
- if (event.getSource() == detachPigmentItem)
3578
+ if (source == detachPigmentItem)
24693579 {
24703580 Object3D obj;
24713581 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3586,7 @@
24763586
24773587 refreshContents();
24783588 } else
2479
- if (event.getSource() == attachBumpItem)
3589
+ if (source == attachBumpItem)
24803590 {
24813591 String texture = GetFile("Attach bump");
24823592 Object3D obj;
....@@ -2488,18 +3598,18 @@
24883598
24893599 refreshContents();
24903600 } else
2491
- if (event.getSource() == detachBumpItem)
3601
+ if (source == detachBumpItem)
24923602 {
24933603 Object3D obj;
24943604 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953605 {
24963606 obj = (Object3D)e.nextElement();
2497
- obj.SetBumpTexture(null);
3607
+ obj.ResetBumpTexture();
24983608 }
24993609
25003610 refreshContents();
25013611 } else
2502
- if (event.getSource() == pigmentBumpItem)
3612
+ if (source == pigmentBumpItem)
25033613 {
25043614 Object3D obj;
25053615 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +3620,262 @@
25103620
25113621 refreshContents();
25123622 } else
2513
- if (event.getSource() == flashSelectionButton)
3623
+ if (source == embedTexturesItem)
3624
+ {
3625
+ Object3D obj;
3626
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3627
+ {
3628
+ obj = (Object3D)e.nextElement();
3629
+ obj.EmbedTextures(true);
3630
+ }
3631
+
3632
+ refreshContents();
3633
+ } else
3634
+ if (source == deEmbedTexturesItem)
3635
+ {
3636
+ Object3D obj;
3637
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3638
+ {
3639
+ obj = (Object3D)e.nextElement();
3640
+ obj.EmbedTextures(false);
3641
+ }
3642
+
3643
+ CameraPane.texturepigment.clear();
3644
+ CameraPane.texturebump.clear();
3645
+
3646
+ refreshContents();
3647
+ } else
3648
+ if (source == flashSelectionButton)
25143649 {
25153650 CameraPane.flash = true;
25163651 refreshContents();
25173652 } else
2518
- if (event.getSource() == oneButton)
3653
+ if (source == oneButton)
25193654 {
25203655 } else
2521
- if (event.getSource() == twoButton)
3656
+ if (source == twoButton)
25223657 {
25233658 radio.layout = twoButton;
3659
+
3660
+ if (CameraPane.FULLSCREEN)
3661
+ fullscreenLayout = radio.layout;
3662
+
25243663 // bug
25253664 //gridPanel.setDividerLocation(1.0);
25263665 //bigPanel.setDividerLocation(0.0);
2527
- bigThree.remove(jtp);
2528
- bigThree.remove(cameraPanel);
2529
- bigThree.remove(XYZPanel);
2530
- aWindowConstraints.gridx = 0;
2531
- aWindowConstraints.gridy = 0;
2532
- aWindowConstraints.gridwidth = 1;
2533
- // aConstraints.gridheight = 3;
2534
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2535
- aWindowConstraints.weightx = 0;
2536
- aWindowConstraints.weighty = 1;
2537
- //bigThree.add(jtp, aWindowConstraints);
2538
- aWindowConstraints.weightx = 1;
2539
- aWindowConstraints.gridwidth = 3;
2540
- // aConstraints.gridheight = 3;
2541
- aWindowConstraints.gridx = 1;
2542
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2543
- bigThree.add(cameraPanel, aWindowConstraints);
2544
- aWindowConstraints.weightx = 0;
2545
- aWindowConstraints.gridx = 4;
2546
- aWindowConstraints.gridwidth = 1;
2547
- // aConstraints.gridheight = 3;
2548
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2549
- //bigThree.add(XYZPanel, aWindowConstraints);
2550
- bigThree.revalidate();
3666
+// bigThree.remove(scenePanel);
3667
+// bigThree.remove(centralPanel);
3668
+// bigThree.remove(XYZPanel);
3669
+// aWindowConstraints.gridx = 0;
3670
+// aWindowConstraints.gridy = 0;
3671
+// aWindowConstraints.gridwidth = 1;
3672
+// // aConstraints.gridheight = 3;
3673
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3674
+// aWindowConstraints.weightx = 0;
3675
+// aWindowConstraints.weighty = 1;
3676
+// //bigThree.add(jtp, aWindowConstraints);
3677
+// aWindowConstraints.weightx = 1;
3678
+// aWindowConstraints.gridwidth = 3;
3679
+// // aConstraints.gridheight = 3;
3680
+// aWindowConstraints.gridx = 1;
3681
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3682
+// bigThree.add(centralPanel, aWindowConstraints);
3683
+// aWindowConstraints.weightx = 0;
3684
+// aWindowConstraints.gridx = 4;
3685
+// aWindowConstraints.gridwidth = 1;
3686
+// // aConstraints.gridheight = 3;
3687
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3688
+// //bigThree.add(XYZPanel, aWindowConstraints);
3689
+// scenePanel.setVisible(false);
3690
+// centralPanel.setVisible(true);
3691
+// XYZPanel.setVisible(false);
3692
+ bigThree.ClearUI();
3693
+ bigThree.add(centralPanel);
3694
+ bigThree.FlushUI();
3695
+
3696
+ cameraView.requestFocusInWindow();
3697
+
3698
+// refreshContents(true);
3699
+//
3700
+// try
3701
+// {
3702
+// java.awt.Robot bot = new java.awt.Robot();
3703
+// int mask = InputEvent.BUTTON1_MASK;
3704
+// bot.mouseMove(100, 100);
3705
+// bot.mousePress(mask);
3706
+// bot.mouseRelease(mask);
3707
+// }
3708
+// catch (Exception e)
3709
+// {
3710
+//
3711
+// }
3712
+
25513713 } else
2552
- if (event.getSource() == threeButton)
3714
+ if (source == threeButton)
25533715 {
25543716 radio.layout = threeButton;
2555
- bigThree.remove(jtp);
2556
- bigThree.remove(cameraPanel);
2557
- bigThree.remove(XYZPanel);
2558
- aWindowConstraints.gridx = 0;
2559
- aWindowConstraints.gridy = 0;
2560
- aWindowConstraints.gridwidth = 1;
2561
- // aConstraints.gridheight = 3;
2562
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2563
- aWindowConstraints.weightx = 0;
2564
- aWindowConstraints.weighty = 1;
2565
- //bigThree.add(jtp, aWindowConstraints);
2566
- aWindowConstraints.weightx = 1;
2567
- aWindowConstraints.gridwidth = 3;
2568
- // aConstraints.gridheight = 3;
2569
- aWindowConstraints.gridx = 1;
2570
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2571
- bigThree.add(cameraPanel, aWindowConstraints);
2572
- aWindowConstraints.weightx = 0;
2573
- aWindowConstraints.gridx = 4;
2574
- aWindowConstraints.gridwidth = 1;
2575
- // aConstraints.gridheight = 3;
2576
- aConstraints.fill = GridBagConstraints.VERTICAL;
2577
- bigThree.add(XYZPanel, aWindowConstraints);
2578
- bigThree.revalidate();
3717
+
3718
+ if (CameraPane.FULLSCREEN)
3719
+ fullscreenLayout = radio.layout;
3720
+
3721
+// bigThree.remove(scenePanel);
3722
+// bigThree.remove(centralPanel);
3723
+// bigThree.remove(XYZPanel);
3724
+// aWindowConstraints.gridx = 0;
3725
+// aWindowConstraints.gridy = 0;
3726
+// aWindowConstraints.gridwidth = 1;
3727
+// // aConstraints.gridheight = 3;
3728
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3729
+// aWindowConstraints.weightx = 0;
3730
+// aWindowConstraints.weighty = 1;
3731
+// //bigThree.add(jtp, aWindowConstraints);
3732
+// aWindowConstraints.weightx = 1;
3733
+// aWindowConstraints.gridwidth = 3;
3734
+// // aConstraints.gridheight = 3;
3735
+// aWindowConstraints.gridx = 1;
3736
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3737
+// bigThree.add(centralPanel, aWindowConstraints);
3738
+// aWindowConstraints.weightx = 0;
3739
+// aWindowConstraints.gridx = 4;
3740
+// aWindowConstraints.gridwidth = 1;
3741
+// // aConstraints.gridheight = 3;
3742
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3743
+// bigThree.add(XYZPanel, aWindowConstraints);
3744
+// bigThree.validate();
3745
+// scenePanel.setVisible(false);
3746
+// centralPanel.setVisible(true);
3747
+// XYZPanel.setVisible(true);
3748
+ bigThree.ClearUI();
3749
+ bigThree.add(scenePanel);
3750
+ bigThree.add(centralPanel);
3751
+ bigThree.FlushUI();
3752
+
3753
+ cameraView.requestFocusInWindow();
25793754 } else
2580
- if (event.getSource() == fourButton)
3755
+ if (source == fourButton)
25813756 {
25823757 radio.layout = fourButton;
2583
- bigThree.remove(jtp);
2584
- bigThree.remove(cameraPanel);
2585
- bigThree.remove(XYZPanel);
2586
- aWindowConstraints.gridx = 0;
2587
- aWindowConstraints.gridy = 0;
2588
- aWindowConstraints.gridwidth = 1;
2589
- // aWindowConstraints.gridheight = 3;
2590
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2591
- aWindowConstraints.weightx = 1;
2592
- aWindowConstraints.weighty = 1;
2593
- bigThree.add(jtp, aWindowConstraints);
2594
- aWindowConstraints.weightx = 1;
2595
- aWindowConstraints.gridwidth = 3;
2596
- // aConstraints.gridheight = 3;
2597
- aWindowConstraints.gridx = 1;
2598
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2599
- //bigThree.add(cameraPanel, aWindowConstraints);
2600
- aWindowConstraints.weightx = 0;
2601
- aWindowConstraints.gridx = 4;
2602
- aWindowConstraints.gridwidth = 1;
2603
- // aWindowConstraints.gridheight = 3;
2604
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2605
- //bigThree.add(XYZPanel, aWindowConstraints);
2606
- bigThree.revalidate();
3758
+
3759
+ if (CameraPane.FULLSCREEN)
3760
+ fullscreenLayout = radio.layout;
3761
+
3762
+// bigThree.remove(scenePanel);
3763
+// bigThree.remove(centralPanel);
3764
+// bigThree.remove(XYZPanel);
3765
+// aWindowConstraints.gridx = 0;
3766
+// aWindowConstraints.gridy = 0;
3767
+// aWindowConstraints.gridwidth = 1;
3768
+// // aWindowConstraints.gridheight = 3;
3769
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3770
+// aWindowConstraints.weightx = 1;
3771
+// aWindowConstraints.weighty = 1;
3772
+// bigThree.add(scenePanel, aWindowConstraints);
3773
+// aWindowConstraints.weightx = 1;
3774
+// aWindowConstraints.gridwidth = 3;
3775
+// // aConstraints.gridheight = 3;
3776
+// aWindowConstraints.gridx = 1;
3777
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3778
+// //bigThree.add(cameraPanel, aWindowConstraints);
3779
+// aWindowConstraints.weightx = 0;
3780
+// aWindowConstraints.gridx = 4;
3781
+// aWindowConstraints.gridwidth = 1;
3782
+// // aWindowConstraints.gridheight = 3;
3783
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3784
+// //bigThree.add(XYZPanel, aWindowConstraints);
3785
+// bigThree.validate();
3786
+// scenePanel.setVisible(true);
3787
+// centralPanel.setVisible(false);
3788
+// XYZPanel.setVisible(false);
3789
+ bigThree.ClearUI();
3790
+ bigThree.add(scenePanel);
3791
+ bigThree.FlushUI();
3792
+
3793
+ cameraView.requestFocusInWindow();
26073794 } else
2608
- if (event.getSource() == sixButton)
3795
+ if (source == sixButton)
26093796 {
26103797 radio.layout = sixButton;
2611
- bigThree.remove(jtp);
2612
- bigThree.remove(cameraPanel);
2613
- bigThree.remove(XYZPanel);
2614
- aWindowConstraints.gridx = 0;
2615
- aWindowConstraints.gridy = 0;
2616
- aWindowConstraints.gridwidth = 1;
2617
- // aConstraints.gridheight = 3;
2618
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2619
- aWindowConstraints.weightx = 0;
2620
- aWindowConstraints.weighty = 1;
2621
- bigThree.add(jtp, aWindowConstraints);
2622
- aWindowConstraints.weightx = 1;
2623
- aWindowConstraints.gridwidth = 3;
2624
- // aWindowConstraints.gridheight = 3;
2625
- aWindowConstraints.gridx = 1;
2626
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2627
- bigThree.add(cameraPanel, aWindowConstraints);
2628
- aWindowConstraints.weightx = 0;
2629
- aWindowConstraints.gridx = 4;
2630
- aWindowConstraints.gridwidth = 1;
2631
- // aWindowConstraints.gridheight = 3;
2632
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2633
- //bigThree.add(XYZPanel, aConstraints);
2634
- bigThree.revalidate();
3798
+
3799
+ if (CameraPane.FULLSCREEN)
3800
+ fullscreenLayout = radio.layout;
3801
+
3802
+// bigThree.remove(scenePanel);
3803
+// bigThree.remove(centralPanel);
3804
+// bigThree.remove(XYZPanel);
3805
+// aWindowConstraints.gridx = 0;
3806
+// aWindowConstraints.gridy = 0;
3807
+// aWindowConstraints.gridwidth = 1;
3808
+// // aConstraints.gridheight = 3;
3809
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3810
+// aWindowConstraints.weightx = 0;
3811
+// aWindowConstraints.weighty = 1;
3812
+// bigThree.add(scenePanel, aWindowConstraints);
3813
+// aWindowConstraints.weightx = 1;
3814
+// aWindowConstraints.gridwidth = 3;
3815
+// // aWindowConstraints.gridheight = 3;
3816
+// aWindowConstraints.gridx = 1;
3817
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3818
+// bigThree.add(centralPanel, aWindowConstraints);
3819
+// aWindowConstraints.weightx = 0;
3820
+// aWindowConstraints.gridx = 4;
3821
+// aWindowConstraints.gridwidth = 1;
3822
+// // aWindowConstraints.gridheight = 3;
3823
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3824
+// //bigThree.add(XYZPanel, aConstraints);
3825
+// bigThree.validate();
3826
+// scenePanel.setVisible(true);
3827
+// centralPanel.setVisible(true);
3828
+// XYZPanel.setVisible(false);
3829
+ bigThree.ClearUI();
3830
+ bigThree.add(centralPanel);
3831
+ bigThree.add(scenePanel);
3832
+ bigThree.FlushUI();
3833
+
3834
+ cameraView.requestFocusInWindow();
26353835 } else
2636
- if (event.getSource() == sevenButton)
3836
+ if (source == sevenButton)
26373837 {
26383838 radio.layout = sevenButton;
2639
- bigThree.remove(jtp);
2640
- bigThree.remove(cameraPanel);
2641
- bigThree.remove(XYZPanel);
2642
- aWindowConstraints.gridx = 0;
2643
- aWindowConstraints.gridy = 0;
2644
- aWindowConstraints.gridwidth = 1;
2645
- // aWindowConstraints.gridheight = 3;
2646
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2647
- aWindowConstraints.weightx = 0;
2648
- aWindowConstraints.weighty = 1;
2649
- bigThree.add(jtp, aWindowConstraints);
2650
- aWindowConstraints.weightx = 1;
2651
- aWindowConstraints.gridwidth = 3;
2652
- // aWindowConstraints.gridheight = 3;
2653
- aWindowConstraints.gridx = 1;
2654
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2655
- bigThree.add(cameraPanel, aWindowConstraints);
2656
- aWindowConstraints.weightx = 0;
2657
- aWindowConstraints.gridx = 4;
2658
- aWindowConstraints.gridwidth = 1;
2659
- // aConstraints.gridheight = 3;
2660
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2661
- bigThree.add(XYZPanel, aWindowConstraints);
2662
- bigThree.revalidate();
3839
+
3840
+ if (CameraPane.FULLSCREEN)
3841
+ fullscreenLayout = radio.layout;
3842
+
3843
+// bigThree.remove(scenePanel);
3844
+// bigThree.remove(centralPanel);
3845
+// bigThree.remove(XYZPanel);
3846
+// aWindowConstraints.gridx = 0;
3847
+// aWindowConstraints.gridy = 0;
3848
+// aWindowConstraints.gridwidth = 1;
3849
+// // aWindowConstraints.gridheight = 3;
3850
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3851
+// aWindowConstraints.weightx = 0;
3852
+// aWindowConstraints.weighty = 1;
3853
+// bigThree.add(scenePanel, aWindowConstraints);
3854
+// aWindowConstraints.weightx = 1;
3855
+// aWindowConstraints.gridwidth = 3;
3856
+// // aWindowConstraints.gridheight = 3;
3857
+// aWindowConstraints.gridx = 1;
3858
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3859
+// bigThree.add(centralPanel, aWindowConstraints);
3860
+// aWindowConstraints.weightx = 0;
3861
+// aWindowConstraints.gridx = 4;
3862
+// aWindowConstraints.gridwidth = 1;
3863
+// // aConstraints.gridheight = 3;
3864
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3865
+// bigThree.add(XYZPanel, aWindowConstraints);
3866
+// bigThree.validate();
3867
+// scenePanel.setVisible(true);
3868
+// centralPanel.setVisible(true);
3869
+// XYZPanel.setVisible(true);
3870
+ bigThree.ClearUI();
3871
+ bigThree.add(scenePanel);
3872
+ bigThree.add(centralPanel);
3873
+ bigThree.add(XYZPanel);
3874
+ bigThree.FlushUI();
3875
+
3876
+ cameraView.requestFocusInWindow();
26633877 } else
2664
- if (event.getSource() == rootButton)
3878
+ if (source == rootButton)
26653879 {
26663880 Object3D obj;
26673881 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,66 +3885,85 @@
26713885 EditObject(obj);
26723886 }
26733887
3888
+ cameraView.requestFocusInWindow();
26743889 refreshContents(true);
26753890 } else
2676
- if (event.getSource() == closeButton)
3891
+ if (source == closeButton)
26773892 {
26783893 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793894 cRadio ab;
26803895 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813896 {
26823897 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3898
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843899 {
3900
+ // Patch to avoid bug with transparency.
3901
+ if (!ab.hadMaterial)
3902
+ {
3903
+ ab.object.material = null;
3904
+ }
3905
+
26853906 buttonGroup.remove(ab);
26863907 radioPanel.remove(ab);
26873908
2688
- ab.GetObject().editWindow = null;
3909
+ //ab.GetObject().editWindow = null;
3910
+ ab.GetObject().manipWindow = null;
26893911 // ab.GetObject().objectUI = null; // ?????????
26903912
26913913 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923914 break;
26933915 }
26943916 }
3917
+
3918
+ cameraView.requestFocusInWindow();
26953919 refreshContents(true);
26963920 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3921
+ if (source == editItem || source == editButton)
26983922 {
3923
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3924
+ {
3925
+ Object3D child = (Object3D)e.nextElement();
3926
+ child.pinned = true;
3927
+ }
3928
+
26993929 EditSelection(false);
27003930 } else
2701
- if (event.getSource() == uneditButton)
3931
+ if (source == uneditButton)
27023932 {
27033933 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043934 {
27053935 Object3D child = (Object3D)e.nextElement();
27063936 if(child.editWindow != null)
2707
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3937
+ child.pinned = false;
27083938 child.CloseUI();
27093939 listUI.remove(child);
3940
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27103941
2711
- child.editWindow = null; // ???????????
3942
+ //child.editWindow = null; // ???????????
27123943 }
2713
- objEditor.ctrlPanel.revalidate();
3944
+ objEditor.ctrlPanel.FlushUI();
27143945 //objEditor.jTree.clearSelection();
27153946 //objEditor.ResetSliders();
27163947 refreshContents(true);
27173948 } else
2718
- if (event.getSource() == clearPanelButton)
3949
+ if (source == clearPanelButton)
27193950 {
27203951 assert(copy == group);
27213952 //copy.ClearUI();
27223953 for (Object3D obj : listUI)
27233954 {
3955
+ obj.pinned = false;
27243956 obj.CloseUI();
27253957 }
27263958 listUI.clear();
3959
+ SetPinStates(group.selection.size() > 0);
27273960 refreshContents(true);
27283961 } else
2729
- if (event.getSource() == allParamsButton)
3962
+ if (source == allParamsButton)
27303963 {
27313964 assert(copy == group);
27323965
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3966
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343967
27353968 for (Object3D obj : listUI)
27363969 {
....@@ -2747,19 +3980,19 @@
27473980
27483981 refreshContents(true);
27493982 } else
2750
- if (event.getSource() == unselectButton)
3983
+ if (source == unselectButton)
27513984 {
27523985 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3986
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543987 objEditor.ResetSliders();
27553988 refreshContents(true);
27563989 } else
2757
- if(event.getSource() instanceof cRadio)
3990
+ if(source instanceof cRadio)
27583991 {
27593992 group.parent = keepparent;
27603993 group.attributes = 0;
27613994 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3995
+ /*cRadio*/ radio = (cRadio)source;
27633996 Object3D obj = radio.GetObject();
27643997 System.out.println("Edit " + obj);
27653998 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +4012,10 @@
27794012 }
27804013
27814014 copy = group;
2782
- //CameraPane.theRenderer.object = group;
4015
+
4016
+ SetUndoStates();
4017
+
4018
+ //Globals.theRenderer.object = group;
27834019 if(!useclient)
27844020 {
27854021 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +4024,55 @@
27884024 cameraView.cameras[cameraView.cameracount] = radio.camera;
27894025 cameraView.targetLookAt.set(radio.camera.lookAt);
27904026 cameraView.object = group;
2791
- cameraView.lighttouched = true;
4027
+ //cameraView.lighttouched = true;
4028
+ Globals.lighttouched = true;
27924029 topView.object = group;
27934030 frontView.object = group;
27944031 sideView.object = group;
27954032 }
2796
- group.editWindow = this;
4033
+
4034
+// fix "+" issue
4035
+ //group.editWindow = this;
4036
+ group.manipWindow = this;
4037
+
27974038 /*
27984039 currentLayout = radio.layout;
27994040 if (currentLayout == null)
28004041 currentLayout = sevenButton;
28014042 */
28024043 radio.layout.doClick();
4044
+
4045
+ ClearUnpinned();
4046
+
4047
+ //Grafreed.Assert(group != null);
4048
+ //Grafreed.Assert(group.selection != null);
4049
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4050
+ if (group.selection == null || group.selection.size() == 1)
4051
+ EditSelection(false);
28034052 keepparent = group.parent;
28044053 // PARENT = NULL or not???
28054054 //group.parent = null; // ROOT
28064055 //group.attributes = -1;
28074056 ResetModel();
4057
+
4058
+ cameraView.requestFocusInWindow();
28084059 refreshContents(true);
2809
- }
4060
+ } else if (event.getSource() == editCameraItem)
4061
+ {
4062
+ cameraView.ProtectCamera();
4063
+ cameraView.requestFocusInWindow();
4064
+ cameraView.repaint();
4065
+ return;
4066
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4067
+ {
4068
+ cameraView.RevertCamera();
4069
+ cameraView.requestFocusInWindow();
4070
+ cameraView.repaint();
4071
+ return;
4072
+ // } else if (event.getSource() == textureButton)
4073
+ // {
4074
+ // return; // true;
4075
+ }
28104076 else
28114077 {
28124078 //return super.action(event, arg);
....@@ -2815,7 +4081,6 @@
28154081 }
28164082
28174083 boolean useclient = false;
2818
- cRadio radio;
28194084
28204085 void ToggleRoot()
28214086 {
....@@ -2824,7 +4089,7 @@
28244089 if (useclient)
28254090 {
28264091 cameraView.object = client;
2827
- cameraView.lighttouched = true;
4092
+ Globals.lighttouched = true;
28284093 //topView.object = client;
28294094 //frontView.object = client;
28304095 //sideView.object = client;
....@@ -2832,7 +4097,7 @@
28324097 else
28334098 {
28344099 cameraView.object = group;
2835
- cameraView.lighttouched = true;
4100
+ Globals.lighttouched = true;
28364101 //topView.object = group;
28374102 //frontView.object = group;
28384103 //sideView.object = group;
....@@ -2867,6 +4132,28 @@
28674132 refreshContents();
28684133 }
28694134
4135
+ void TransformChildren()
4136
+ {
4137
+ Object3D obj;
4138
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4139
+ {
4140
+ obj = (Object3D)e.nextElement();
4141
+ obj.KeepTextureMatrices();
4142
+ obj.TransformChildren();
4143
+ obj.RestoreTextureMatrices();
4144
+
4145
+// if (obj.parent == null)
4146
+// {
4147
+// System.out.println("NULL PARENT!");
4148
+// new Exception().printStackTrace();
4149
+// }
4150
+// else
4151
+// TouchTransform(obj);
4152
+// //obj.parent.Touch();
4153
+ }
4154
+
4155
+ refreshContents();
4156
+ }
28704157
28714158 void ResetTransform()
28724159 {
....@@ -2979,7 +4266,7 @@
29794266 refreshContents();
29804267 }
29814268
2982
- void ResetCentroid()
4269
+ void ResetCentroid(boolean full)
29834270 {
29844271 Object3D obj;
29854272 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +4281,16 @@
29944281 LA.matIdentity(Object3D.mat);
29954282 obj.getBounds(minima, maxima, false);
29964283 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4284
+ if (full)
4285
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29984286 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29994287 obj.TransformMesh(Object3D.mat);
4288
+
30004289 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4290
+ if (full)
4291
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30024292 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4293
+
30034294 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30044295 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30054296 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +4319,8 @@
30284319
30294320 int size = obj.MemorySize();
30304321
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
4322
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4323
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30324324 }
30334325 }
30344326 catch (Exception e)
....@@ -3065,9 +4357,9 @@
30654357 obj = (Object3D)e.nextElement();
30664358
30674359 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
4360
+ Grafreed.AnalyzeObject(obj);
30694361 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
4362
+ Grafreed.AnalyzeObject(obj.bRep);
30714363
30724364 // System.err.println((size/1024) + " KB is the size of " + obj);
30734365 }
....@@ -3109,6 +4401,20 @@
31094401 void GenNormals(boolean crease)
31104402 {
31114403 group.GenNormalsS(crease);
4404
+
4405
+ refreshContents();
4406
+ }
4407
+
4408
+ void GenNormalsMESH()
4409
+ {
4410
+ group.GenNormalsMeshS();
4411
+
4412
+ refreshContents();
4413
+ }
4414
+
4415
+ void GenNormalsMINE()
4416
+ {
4417
+ group.selection.GenNormalsMINE();
31124418
31134419 refreshContents();
31144420 }
....@@ -3157,104 +4463,259 @@
31574463
31584464 //Object3D buffer;
31594465 cVector temp = new cVector();
3160
- BoundaryRep temprep;
3161
- Object3D nodes;
3162
- Vector<Vertex> vertices;
3163
-
3164
- public void Vertex(Object3D node, Vertex v)
3165
- {
3166
- vertices.add(v);
3167
- nodes.addElement(node);
3168
-
3169
- if (temprep.GetCache(v) != null)
3170
- {
3171
- temprep.Remove(v);
3172
- }
3173
- else
3174
- {
3175
- temprep.Remember(v);
3176
- }
3177
- }
3178
-
3179
- public void Face(Object3D node, Face f)
3180
- {
3181
-
3182
- }
3183
-
4466
+// BoundaryRep temprep;
4467
+// Object3D nodes;
4468
+// Vector<Vertex> vertices;
4469
+//
4470
+// cGroup buffer;
4471
+//
4472
+// public void Vertex(Object3D node, Vertex v)
4473
+// {
4474
+//// vertices.add(v);
4475
+//// nodes.addElement(node);
4476
+////
4477
+//// if (temprep.GetCache(v) != null)
4478
+//// {
4479
+//// temprep.Remove(v);
4480
+//// } else
4481
+//// {
4482
+//// temprep.Remember(v);
4483
+//// }
4484
+//
4485
+// //Object3D node = nodes.get(index);
4486
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
4487
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4488
+//
4489
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4490
+//
4491
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4492
+//
4493
+// cGroup g = new cGroup();
4494
+//
4495
+// if (g.toParent == null)
4496
+// {
4497
+// g.toParent = LA.newMatrix();
4498
+// g.fromParent = LA.newMatrix();
4499
+// }
4500
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4501
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4502
+//
4503
+// g.add(GrafreeD.clipboard);
4504
+//
4505
+// buffer.add(g);
4506
+// }
4507
+//
4508
+// public void Face(Object3D node, Face f)
4509
+// {
4510
+//
4511
+// }
4512
+//
4513
+// void ParseVerticesOld() // ??
4514
+// {
4515
+// //if (group.selection.size() != 1)
4516
+// // return;
4517
+//
4518
+// temprep = new BoundaryRep();
4519
+// nodes = new Object3D();
4520
+// vertices = new Vector<Vertex>();
4521
+//
4522
+// boolean epsequal = GrafreeD.epsequal;
4523
+// GrafreeD.epsequal = true;
4524
+//
4525
+// for (int i=0; i<group.selection.size(); i++)
4526
+// {
4527
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4528
+//
4529
+// group.selection.get(i).Parse(
4530
+//this );
4531
+//
4532
+// int repsize = temprep.VertexCount();
4533
+// int tablesize = temprep.vertextable.size();
4534
+// int nodesize = nodes.size();
4535
+//
4536
+// assert(vertices.size() == nodes.size());
4537
+//
4538
+// temprep.vertextable.elements();
4539
+//
4540
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4541
+//
4542
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4543
+// {
4544
+// cGroup g = new cGroup();
4545
+//
4546
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4547
+//
4548
+// Object3D node = nodes.get(index);
4549
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4550
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4551
+//
4552
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4553
+//
4554
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4555
+//
4556
+// if (g.toParent == null)
4557
+// {
4558
+// g.toParent = LA.newMatrix();
4559
+// g.fromParent = LA.newMatrix();
4560
+// }
4561
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4562
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4563
+//
4564
+// g.add(GrafreeD.clipboard);
4565
+//
4566
+// buffer.add(g);
4567
+// }
4568
+//
4569
+// makeSomething(buffer, i==group.selection.size()-1);
4570
+// }
4571
+//
4572
+// GrafreeD.epsequal = epsequal;
4573
+//
4574
+// //buffer = null;
4575
+// temprep = null;
4576
+// nodes = null;
4577
+//
4578
+// refreshContents();
4579
+// }
4580
+
31844581 void ParseVertices()
31854582 {
3186
- //if (group.selection.size() != 1)
3187
- // return;
3188
-
3189
- temprep = new BoundaryRep();
3190
- nodes = new Object3D();
3191
- vertices = new Vector<Vertex>();
3192
-
3193
- boolean epsequal = GraphreeD.epsequal;
3194
- GraphreeD.epsequal = true;
4583
+ boolean epsequal = Grafreed.epsequal;
4584
+ Grafreed.epsequal = true;
31954585
31964586 for (int i=0; i<group.selection.size(); i++)
31974587 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4588
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994589
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4590
+ group.selection.get(i).Parse(
4591
+
4592
+ new iParse()
4593
+ {
4594
+ public void Vertex(Object3D node, Vertex v)
4595
+ {
4596
+ temp.set(v);
4597
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054598
3206
- assert(vertices.size() == nodes.size());
3207
-
3208
- temprep.vertextable.elements();
3209
-
3210
- java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4599
+ cGroup g = new cGroup();
32114600
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4601
+ if (g.toParent == null)
4602
+ {
4603
+ g.toParent = LA.newMatrix();
4604
+ g.fromParent = LA.newMatrix();
4605
+ }
4606
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4607
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154608
3216
- int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
3217
- Object3D node = nodes.get(index);
3218
- temp.set(vertices.get(index)); // temprep.GetVertex(k));
3219
- // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4609
+ g.add(Grafreed.clipboard);
32204610
3221
- LA.xformPos(temp, node.GlobalTransformInv(), temp);
3222
-
3223
- // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
3224
-
3225
- if (g.toParent == null)
3226
- {
3227
- g.toParent = LA.newMatrix();
3228
- g.fromParent = LA.newMatrix();
3229
- }
3230
- LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
3231
- LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4611
+ buffer.add(g);
4612
+ }
32324613
3233
- g.add(GraphreeD.clipboard);
4614
+ public void Face(Object3D node, Face f)
4615
+ {
32344616
3235
- buffer.add(g);
3236
- }
4617
+ }
4618
+ }
4619
+ );
32374620
32384621 makeSomething(buffer, i==group.selection.size()-1);
32394622 }
32404623
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4624
+ Grafreed.epsequal = epsequal;
32464625
32474626 refreshContents();
32484627 }
3249
-
4628
+
4629
+ void TextureVertices()
4630
+ {
4631
+ for (int i=0; i<group.selection.size(); i++)
4632
+ {
4633
+ group.selection.get(i).Parse(
4634
+ new iParse()
4635
+ {
4636
+ public void Vertex(Object3D node, Vertex v)
4637
+ {
4638
+ cTexture tex = node.GetTextures();
4639
+ String pigment = Object3D.GetPigment(tex);
4640
+ //String bump = Object3D.GetBump(tex);
4641
+
4642
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4643
+
4644
+ try
4645
+ {
4646
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4647
+ }
4648
+ catch (Exception e)
4649
+ {
4650
+ System.err.println("FAIL: " + node);
4651
+ }
4652
+
4653
+ double s = v.s;
4654
+
4655
+ if (s == 1)
4656
+ s = 0;
4657
+
4658
+ double t = v.t;
4659
+
4660
+ if (t == 1)
4661
+ t = 0;
4662
+
4663
+ int indexs = (int) (texturedata.getWidth() * s);
4664
+ int indext = (int) (texturedata.getHeight() * t);
4665
+
4666
+ int index = indext * texturedata.getWidth() + indexs;
4667
+
4668
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4669
+
4670
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4671
+
4672
+ float scale = bytebuf.get(index*slide) & 0xFF;
4673
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4674
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4675
+ scale /= 3;
4676
+
4677
+ scale /= 0xFF;
4678
+ // c'est quoi ca? scale /= 4;
4679
+
4680
+ //v.AO = scale;
4681
+
4682
+ v.x += v.norm.x * scale;
4683
+ v.y += v.norm.y * scale;
4684
+ v.z += v.norm.z * scale;
4685
+ }
4686
+
4687
+ public void Face(Object3D node, Face f)
4688
+ {
4689
+ }
4690
+ }
4691
+ );
4692
+ }
4693
+
4694
+ refreshContents();
4695
+ }
4696
+
32504697 void Align()
32514698 {
4699
+ if (group.selection.size() == 0)
4700
+ return;
4701
+
4702
+ cVector bbmin = new cVector();
4703
+ cVector bbmax = new cVector();
4704
+
4705
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4706
+
4707
+ double dx = bbmax.x - bbmin.x;
4708
+ double dy = bbmax.y - bbmin.y;
4709
+ double dz = bbmax.z - bbmin.z;
4710
+
4711
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4712
+
32524713 for (int i=0; i<group.selection.size(); i++)
32534714 {
32544715 Object3D obj = group.selection.get(i);
32554716
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4717
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4718
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584719 }
32594720
32604721 refreshContents();
....@@ -3267,7 +4728,7 @@
32674728 // ref.SaveSupports();
32684729 // Object3D par = ref.parent;
32694730 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4731
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714732 // ref.parent = par;
32724733 // ref.RestoreSupports();
32734734
....@@ -3275,11 +4736,11 @@
32754736
32764737 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774738
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4739
+ boolean random = CameraPane.SWITCH;
4740
+ CameraPane.SWITCH = false; // parse all random nodes
32804741 lowres.linkVerticesThis(null);
32814742 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4743
+ CameraPane.SWITCH = random;
32834744
32844745 System.err.flush();
32854746
....@@ -3297,7 +4758,7 @@
32974758 // lowres.SaveSupports();
32984759 // par = lowres.parent;
32994760 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4761
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014762 Object3D newlow = CloneObject(lowres, false);
33024763 newlow.name = sn.switchobject.get(i).name;
33034764 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4780,7 @@
33194780 return;
33204781
33214782 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4783
+ Object3D ref = Grafreed.clipboard.get(0);
33234784
33244785 Object3D newgroup = new Object3D("Po:" + poses.name);
33254786
....@@ -3488,7 +4949,7 @@
34884949 group.selection.RelinkToSupport(); // july 2014
34894950 System.out.println("DONE.");
34904951 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4952
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924953 }
34934954
34944955 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4974,20 @@
35134974
35144975 void ClipMesh()
35154976 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4977
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174978 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4979
+ Object3D content = Grafreed.clipboard.get(0);
35194980
35204981 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214982 content = ((cGroup)content).get(0);
35224983
35234984 // for (int i=0; i<group.selection.size(); i++)
35244985 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4986
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264987 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4988
+ group.selection.ClipMesh(Grafreed.clipboard);
35284989 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4990
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304991 System.out.println("DONE.");
35314992 refreshContents();
35324993 }
....@@ -3571,6 +5032,18 @@
35715032 void MarkLeaves(boolean hide)
35725033 {
35735034 group.selection.MarkLeaves(hide);
5035
+ refreshContents();
5036
+ }
5037
+
5038
+ void RewindLeaves(boolean hide)
5039
+ {
5040
+ group.selection.RewindLeaves(hide);
5041
+ refreshContents();
5042
+ }
5043
+
5044
+ void RandomLeaves(boolean hide)
5045
+ {
5046
+ group.selection.RandomLeaves(hide);
35745047 refreshContents();
35755048 }
35765049
....@@ -3645,28 +5118,25 @@
36455118 // }
36465119 // }
36475120
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36525121 void EditSelection(boolean newWindow)
36535122 {
5123
+ if (group.selection == null)
5124
+ {
5125
+ EditElement(group, newWindow); // ? new
5126
+ return;
5127
+ }
5128
+
36545129 // aConstraints.gridy = 0;
36555130 for (int i=0; i<group.selection.size(); i++)
36565131 {
36575132 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36585133 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5134
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36605135
36615136 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
5137
+ if(elem != group || !newWindow)
36635138 {
3664
- // if (!(elem instanceof Composite))
3665
- // newWindow = false;
3666
- listUI.add(elem);
3667
- elem.openEditWindow(this, newWindow); //, false);
3668
- System.out.println("edit : " + elem);
3669
- elem.editWindow.refreshContents(true); // ? new
5139
+ EditElement(elem, newWindow); // ? new
36705140 }
36715141 }
36725142 }
....@@ -3729,9 +5199,7 @@
37295199
37305200 freezemodel = false;
37315201 }
3732
-
3733
- boolean flashIt = true;
3734
-
5202
+
37355203 public void valueChanged(TreeSelectionEvent e)
37365204 //public boolean handleEvent(Event event)
37375205 {
....@@ -3741,7 +5209,8 @@
37415209 //new Exception().printStackTrace();
37425210
37435211 freezemodel = true;
3744
-
5212
+ ClearUnpinned();
5213
+
37455214 /**/
37465215 //switch (event.id)
37475216 {
....@@ -3749,7 +5218,6 @@
37495218 //case 702: // Event.LIST_DESELECT
37505219 group.deselectAll();
37515220 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37535221 if (tps != null)
37545222 {
37555223 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +5226,39 @@
37585226
37595227 //if (child.parent != null)
37605228 //child.parent.addSelectee(child);
5229
+ objEditor.SetMaterial(child);
37615230 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37655231 }
37665232 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
5233
+// else
5234
+// {
5235
+// objEditor.SetMaterial(group); // .GetMaterial());
5236
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5237
+// System.err.println("info : " + group.GetPath());
5238
+// }
37735239
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5240
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37775241 CameraPane.flash = true;
37785242
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5243
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37805244 // a camera
37815245 {
3782
- CameraPane.camerachangeframe = 0; // don't refuse it
3783
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3784
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3785
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
5246
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5247
+ {
5248
+ CameraPane.camerachangeframe = 0; // don't refuse it
5249
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5250
+ }
5251
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5252
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37865253 }
37875254
5255
+ if (tps != null && tps.length == 1)
5256
+ {
5257
+ EditSelection(false);
5258
+ }
5259
+
5260
+ SetPinStates(tps != null && tps.length > 0);
5261
+
37885262 refreshContents();
37895263 //return true;
37905264 }
....@@ -3793,6 +5267,37 @@
37935267
37945268 freezemodel = false;
37955269 }
5270
+
5271
+ void SetPinStates(boolean enabled)
5272
+ {
5273
+ editButton.setEnabled(enabled);
5274
+ uneditButton.setEnabled(enabled);
5275
+ //unselectButton.setEnabled(enabled);
5276
+ flashSelectionButton.setEnabled(enabled);
5277
+
5278
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5279
+ }
5280
+
5281
+ void refreshContents(boolean cp)
5282
+ {
5283
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5284
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5285
+ {
5286
+ objEditor.ClearInfo(); // .GetMaterial());
5287
+
5288
+ for (int i=0; i < group.selection.Size(); i++)
5289
+ {
5290
+ Object3D child = (Object3D) group.selection.get(i);
5291
+
5292
+ objEditor.AddInfo(child, this, true);
5293
+ System.err.println("info : " + child.GetPath());
5294
+ }
5295
+
5296
+ objEditor.SetText(); // jan 2014
5297
+ }
5298
+
5299
+ super.refreshContents(cp);
5300
+ }
37965301
37975302 void linkSomething(Object3D thing)
37985303 {
....@@ -3864,16 +5369,19 @@
38645369 {
38655370 if (group.selection.isEmpty())
38665371 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
5372
+
5373
+ Grafreed.clipboardIsTempGroup = false;
38685374 Composite tGroup = null;
38695375 if (group.selection.size() > 0) // 1)
38705376 {
38715377 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
5378
+ Grafreed.clipboardIsTempGroup = true;
38735379 }
38745380
38755381 if (cut)
38765382 {
5383
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5384
+// Save();
38775385 //int indices[] = jList.getSelectedIndices();
38785386 //for (int i = indices.length - 1; i >= 0; i--)
38795387 //jList.remove(indices[i]);
....@@ -3909,16 +5417,16 @@
39095417 //System.out.println("cut " + child);
39105418 //System.out.println("parent = " + child.parent);
39115419 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
5420
+ if (Grafreed.clipboardIsTempGroup)
39135421 tGroup.add/*Child*/(tmp);
39145422 else
3915
- GraphreeD.clipboard = tmp;
5423
+ Grafreed.clipboard = tmp;
39165424 }
39175425 else
3918
- if (GraphreeD.clipboardIsTempGroup)
5426
+ if (Grafreed.clipboardIsTempGroup)
39195427 tGroup.add/*Child*/(child);
39205428 else
3921
- GraphreeD.clipboard = child;
5429
+ Grafreed.clipboard = child;
39225430 }
39235431
39245432 //ResetModel();
....@@ -3950,21 +5458,23 @@
39505458 //System.out.println("cut " + elem);
39515459 //System.out.println("parent = " + elem.parent);
39525460 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
5461
+ if (Grafreed.clipboardIsTempGroup)
39545462 tGroup.add/*Child*/(tmp);
39555463 else
3956
- GraphreeD.clipboard = tmp;
5464
+ Grafreed.clipboard = tmp;
39575465 }
39585466 else
3959
- if (GraphreeD.clipboardIsTempGroup)
5467
+ if (Grafreed.clipboardIsTempGroup)
39605468 tGroup.add/*Child*/(child);
39615469 else
3962
- GraphreeD.clipboard = child;
5470
+ Grafreed.clipboard = child;
39635471 }
39645472
39655473 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
5474
+
5475
+ if (Grafreed.clipboardIsTempGroup)
5476
+ Grafreed.clipboard = tGroup;
5477
+
39685478 if (cut)
39695479 {
39705480 ResetModel();
....@@ -3974,11 +5484,15 @@
39745484
39755485 void paste(boolean expand)
39765486 {
3977
- // if (GraphreeD.clipboard == null)
5487
+ if (Globals.REPLACEONMAKE)
5488
+ Save();
5489
+ boolean keep = Globals.REPLACEONMAKE;
5490
+ Globals.REPLACEONMAKE = false;
5491
+ // if (GrafreeD.clipboard == null)
39785492 // return;
39795493 boolean first = true;
39805494
3981
- if (GraphreeD.clipboardIsTempGroup)
5495
+ if (Grafreed.clipboardIsTempGroup)
39825496 {
39835497 Composite temp;
39845498
....@@ -3989,7 +5503,7 @@
39895503 temp = (Composite)Applet3D.clipboard.deepCopy();
39905504 */
39915505 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5506
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39935507 {
39945508 Object3D child = (Object3D)e.nextElement();
39955509
....@@ -4003,7 +5517,7 @@
40035517 else
40045518 elem = child.deepCopy(); // ?
40055519 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5520
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075521 // elem = elem.get(0);
40085522 makeSomething(elem, true); // ?? first);
40095523 //group.addChild(elem);
....@@ -4023,23 +5537,24 @@
40235537 //Object3D cb = Applet3D.clipboard;
40245538 //temp.addChild(cb);
40255539 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4026
- assert(GraphreeD.clipboard.parent == null);
4027
- Object3D /*Composite*/ keepparent = GraphreeD.clipboard.get(0).parent;
4028
- GraphreeD.clipboard.get(0).parent = null; // Avoid copy?
4029
- if (LA.isIdentity(GraphreeD.clipboard.toParent))
4030
- makeSomething(expand?GraphreeD.clipboard.get(0).copyExpand():GraphreeD.clipboard.get(0).deepCopy());
5540
+ assert(Grafreed.clipboard.parent == null);
5541
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5542
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5543
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5544
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315545 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5546
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5547
+ Grafreed.clipboard.get(0).parent = keepparent;
40345548 }
40355549
5550
+ Globals.REPLACEONMAKE = keep;
40365551 ResetModel();
40375552 refreshContents();
40385553 }
40395554
4040
- void pasteInto(boolean copyit)
5555
+ void pasteInto(boolean copyit, boolean clone)
40415556 {
4042
-// if (GraphreeD.clipboard == null)
5557
+// if (GrafreeD.clipboard == null)
40435558 // return;
40445559
40455560 if (group.selection.size() != 1)
....@@ -4066,15 +5581,22 @@
40665581 if (copyit)
40675582 {
40685583 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5584
+ if (clone)
5585
+ {
5586
+ CloneClipboard(false); // sept 2014
5587
+ }
5588
+ else
5589
+ {
5590
+ paste(false);
5591
+ }
40705592 }
40715593 else
40725594 {
40735595 boolean first = true;
40745596
4075
- if (GraphreeD.clipboardIsTempGroup)
5597
+ if (Grafreed.clipboardIsTempGroup)
40765598 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5599
+ Composite temp = (Composite)Grafreed.clipboard;
40785600 Object3D copy;
40795601 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805602 {
....@@ -4084,7 +5606,7 @@
40845606 }
40855607 } else
40865608 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5609
+ linkSomething(Grafreed.clipboard); //.get(0));
40885610 }
40895611 }
40905612 }
....@@ -4161,6 +5683,10 @@
41615683
41625684 void group(Object3D csg, boolean grab)
41635685 {
5686
+ if (Globals.REPLACEONMAKE)
5687
+ Save();
5688
+ boolean keep = Globals.REPLACEONMAKE;
5689
+ Globals.REPLACEONMAKE = false;
41645690 if (//false) // why??
41655691 !group.selection.isEmpty())
41665692 {
....@@ -4274,8 +5800,34 @@
42745800 //node.add(csg);
42755801 //makeSomething(node);
42765802 makeSomething(csg);
5803
+ Globals.REPLACEONMAKE = keep;
42775804 }
42785805
5806
+ void Ungroup(Object3D g)
5807
+ {
5808
+ if (Globals.REPLACEONMAKE)
5809
+ Save();
5810
+ boolean keep = Globals.REPLACEONMAKE;
5811
+ Globals.REPLACEONMAKE = false;
5812
+ if (g instanceof HiddenObject)
5813
+ {
5814
+ HiddenObject h = (HiddenObject) g;
5815
+
5816
+ for (int i=0; i<h.ActualSize(); i++)
5817
+ {
5818
+ objEditor.makeSomething(h.get(i), false);
5819
+ }
5820
+ }
5821
+ else
5822
+ {
5823
+ for (int i=0; i<g.Size(); i++)
5824
+ {
5825
+ objEditor.makeSomething(g.get(i), false);
5826
+ }
5827
+ }
5828
+ Globals.REPLACEONMAKE = keep;
5829
+ }
5830
+
42795831 void ungroup()
42805832 {
42815833 /*
....@@ -4469,21 +6021,6 @@
44696021 }
44706022 */
44716023
4472
- void ImportGFD()
4473
- {
4474
- FileDialog browser = new FileDialog(objEditor.frame, "Import GraphreeD", FileDialog.LOAD);
4475
- browser.show();
4476
- String filename = browser.getFile();
4477
- if (filename != null && filename.length() > 0)
4478
- {
4479
- String fullname = browser.getDirectory() + filename;
4480
-
4481
- //Object3D readobj =
4482
- objEditor.ReadGFD(fullname, objEditor);
4483
- //makeSomething(readobj);
4484
- }
4485
- }
4486
-
44876024 /*
44886025 public void Callback(Object obj)
44896026 {
....@@ -4507,26 +6044,9 @@
45076044 }
45086045 */
45096046
4510
- void ImportVRMLX3D()
4511
- {
4512
- if (GraphreeD.standAlone)
4513
- {
4514
- /**/
4515
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4516
- browser.show();
4517
- String filename = browser.getFile();
4518
- if (filename != null && filename.length() > 0)
4519
- {
4520
- String fullname = browser.getDirectory() + filename;
4521
- LoadVRMLX3D(fullname);
4522
- }
4523
- /**/
4524
- }
4525
- }
4526
-
45276047 String GetFile(String dialogName)
45286048 {
4529
- if (GraphreeD.standAlone)
6049
+ if (Grafreed.standAlone)
45306050 {
45316051 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45326052 browser.show();
....@@ -4590,10 +6110,48 @@
45906110 cButton flashSelectionButton;
45916111 cButton editButton;
45926112 cButton uneditButton;
6113
+ JCheckBox allParamsButton;
45936114 cButton clearpanelButton;
4594
- cButton allParamsButton;
45956115 cButton unselectButton;
45966116
6117
+ cButton restoreCameraButton;
6118
+
6119
+ cButton oneStepButton;
6120
+
6121
+ cButton groupButton;
6122
+ cButton ungroupButton;
6123
+ cButton compositeButton;
6124
+ cButton switchButton;
6125
+ cButton loopButton;
6126
+ cButton textureButton;
6127
+
6128
+ cButton skybox1Button;
6129
+ cButton skybox2Button;
6130
+ cButton skybox3Button;
6131
+ cButton skybox4Button;
6132
+ cButton skybox5Button;
6133
+ cButton skybox6Button;
6134
+ cButton skybox7Button;
6135
+
6136
+ cButton skybox11Button;
6137
+ cButton skybox12Button;
6138
+ cButton skybox13Button;
6139
+ cButton skybox14Button;
6140
+ cButton skybox15Button;
6141
+ cButton skybox16Button;
6142
+ cButton skybox17Button;
6143
+
6144
+ cButton gridButton;
6145
+ cButton boxButton;
6146
+ cButton sphereButton;
6147
+ cButton coneButton;
6148
+ cButton torusButton;
6149
+ cButton superButton;
6150
+ cButton kleinButton;
6151
+ cButton particlesButton;
6152
+ cButton overlayButton;
6153
+ cButton lightButton;
6154
+
45976155 cButton screenfitButton;
45986156 cButton screenfitpointButton;
45996157 cButton snapobjectButton;
....@@ -4605,14 +6163,6 @@
46056163
46066164 cButton setsupportButton;
46076165
4608
- cButton twoButton;
4609
- cButton sixButton;
4610
- cButton threeButton;
4611
- cButton sevenButton;
4612
- cButton fourButton; // full panel
4613
- cButton oneButton; // full XYZ
4614
- //cButton currentLayout;
4615
-
46166166 //
46176167 //Composite
46186168 Object3D // to do !!
....@@ -4622,9 +6172,11 @@
46226172 //JTree jTree;
46236173 private MenuItem lookAtItem;
46246174 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
6175
+ private MenuItem switchViewItem;
46266176 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
6177
+ private MenuItem undoItem;
6178
+ private MenuItem redoItem;
6179
+ private JMenuItem duplicateItem;
46286180 private MenuItem cloneItem;
46296181 private MenuItem cloneSupportItem;
46306182 private MenuItem overwriteGeoItem;
....@@ -4635,8 +6187,9 @@
46356187 private MenuItem resetsupportItem;
46366188 private MenuItem resetreferencesItem;
46376189 private MenuItem linkverticesItem;
6190
+ private MenuItem relinkverticesItem;
46386191 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
6192
+ private MenuItem resetAllItem;
46406193 private MenuItem stepAllItem;
46416194 private MenuItem revertMeshItem;
46426195 private MenuItem poseMeshItem;
....@@ -4647,14 +6200,17 @@
46476200 private MenuItem mergeGeometriesItem;
46486201 private MenuItem copyItem;
46496202 private MenuItem pasteItem;
6203
+ private MenuItem pasteIntoItem;
46506204 private MenuItem pasteLinkItem;
46516205 private MenuItem pasteCloneItem;
46526206 private MenuItem pasteExpandItem;
4653
- private MenuItem clearItem;
6207
+ private MenuItem deleteItem;
46546208 private MenuItem clearAllItem;
46556209 private MenuItem genUVItem;
6210
+ private MenuItem genNormalsMESHItem;
46566211 private MenuItem genNormalsCADItem;
46576212 private MenuItem genNormalsORGANItem;
6213
+ private MenuItem genNormalsMINEItem;
46586214 private MenuItem stripifyItem;
46596215 private MenuItem unstripifyItem;
46606216 private MenuItem trimItem;
....@@ -4683,6 +6239,10 @@
46836239 private MenuItem showleavesItem;
46846240 private MenuItem markleavesItem;
46856241 private MenuItem unmarkleavesItem;
6242
+ private MenuItem rewindleavesItem;
6243
+ private MenuItem unrewindleavesItem;
6244
+ private MenuItem randomleavesItem;
6245
+ private MenuItem unrandomleavesItem;
46866246
46876247 private MenuItem flipVItem;
46886248 private MenuItem unflipVItem;
....@@ -4694,14 +6254,17 @@
46946254 private MenuItem panoTexturesItem;
46956255
46966256 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
6257
+ private MenuItem resetCentroidXZItem;
46986258 private MenuItem resetTransformItem;
6259
+ private MenuItem transformGeometryItem;
6260
+ private MenuItem transformChildrenItem;
6261
+ private MenuItem hideItem;
46996262 private MenuItem grabItem;
47006263 private MenuItem backItem;
47016264 private MenuItem frontItem;
47026265 private MenuItem cameraItem;
47036266 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
6267
+ private MenuItem switchItem;
47056268 private MenuItem physicsItem;
47066269 private MenuItem frameselectorItem;
47076270 private MenuItem scriptNodeItem;
....@@ -4716,6 +6279,7 @@
47166279
47176280 private MenuItem resetParentItem;
47186281 private MenuItem repairParentItem;
6282
+ private MenuItem repairShadowItem;
47196283 private MenuItem sortbysizeItem;
47206284 private MenuItem sortbynameItem;
47216285
....@@ -4724,20 +6288,25 @@
47246288 private MenuItem attachBumpItem;
47256289 private MenuItem detachBumpItem;
47266290 private MenuItem pigmentBumpItem;
6291
+ private MenuItem embedTexturesItem;
6292
+ private MenuItem deEmbedTexturesItem;
47276293
47286294 private MenuItem particleItem;
47296295 private MenuItem ragdollItem;
47306296 private MenuItem ragdoll2Item;
6297
+ private MenuItem heightFieldItem;
6298
+ private MenuItem textureFieldItem;
47316299 private MenuItem gridItem;
47326300 private MenuItem rectoidItem;
47336301 private MenuItem ellipsoidItem;
47346302 private MenuItem coneItem;
47356303 private MenuItem torusItem;
47366304 private MenuItem superItem;
6305
+ private MenuItem kleinItem;
47376306 private MenuItem blobItem;
47386307 private MenuItem latheItem;
47396308 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
6309
+ private MenuItem overlayItem;
47416310 private MenuItem meshItem;
47426311 // private MenuItem meshGroupItem;
47436312 private MenuItem springItem;
....@@ -4746,6 +6315,7 @@
47466315 private MenuItem csgItem;
47476316 private MenuItem templateItem;
47486317 private MenuItem textureItem;
6318
+ private MenuItem billboardItem;
47496319 private MenuItem shadowXItem;
47506320 private MenuItem shadowYItem;
47516321 private MenuItem shadowZItem;
....@@ -4758,11 +6328,6 @@
47586328 private MenuItem doubleItem;
47596329 private MenuItem tripleItem;
47606330
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47666331 private MenuItem computeAOItem;
47676332 private MenuItem recompileItem;
47686333 private MenuItem editScriptItem;
....@@ -4772,4 +6337,8 @@
47726337 private MenuItem analyzeItem;
47736338 private MenuItem dumpItem;
47746339 //boolean freezemodel = false;
6340
+
6341
+ Menu cameraMenu;
6342
+ MenuItem editCameraItem;
6343
+ MenuItem restoreCameraItem;
47756344 }