Normand Briere
2019-08-08 8294241adc5fe698b70e13ebd6780af46ab83f7e
GroupEditor.java
....@@ -12,9 +12,11 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
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,335 @@
2224 DragGestureListener, DragSourceListener, DropTargetListener,
2325 ItemListener // ListSelectionListener
2426 {
27
+
28
+ public void AddSkyboxButton(String f, String s, cGridBag row)
29
+ {
30
+ cButton skyboxButton;
31
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
33
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
+ skyboxButton.setToolTipText(s);
35
+ skyboxButton.addActionListener(new ActionListener()
36
+ {
37
+ @Override
38
+ public void actionPerformed(ActionEvent e)
39
+ {
40
+ ChangeSkybox(path);
41
+ }
42
+ });
43
+ }
44
+
45
+ public void AddTextureButton(String f, final String t, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(f + "s");
51
+ textureButton.addActionListener(new ActionListener()
52
+ {
53
+ @Override
54
+ public void actionPerformed(ActionEvent e)
55
+ {
56
+ ChangeTexture(path + t);
57
+ }
58
+ });
59
+ }
60
+
61
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
62
+ {
63
+ cGridBag tab0 = new cGridBag().setVertical(true);
64
+
65
+ tab0.setName("Urban");
66
+ skyboxpanel.add(tab0);
67
+
68
+ cGridBag row0 = new cGridBag();
69
+ cGridBag row1 = new cGridBag();
70
+ cGridBag row2 = new cGridBag();
71
+ cGridBag row3 = new cGridBag();
72
+ cGridBag row4 = new cGridBag();
73
+ cGridBag row5 = new cGridBag();
74
+ cGridBag row6 = new cGridBag();
75
+
76
+ AddSkyboxButton("default", "rgb", row0);
77
+ //AddSkyboxButton("default", "cornell", row0);
78
+ AddSkyboxButton("penguins", "dust", row0);
79
+ AddSkyboxButton("penguins", "tropic", row0);
80
+ AddSkyboxButton("penguins", "yonder", row0);
81
+
82
+ AddSkyboxButton("default", "uffizi", row1);
83
+ AddSkyboxButton("bridge", "Bridge", row1);
84
+ AddSkyboxButton("bridge", "Bridge2", row1);
85
+ AddSkyboxButton("urban", "GamlaStan2", row1);
86
+
87
+ AddSkyboxButton("urban", "Parliament", row2);
88
+ AddSkyboxButton("urban", "Roundabout", row2);
89
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
90
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
91
+
92
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
93
+ AddSkyboxButton("urban", "UnionSquare", row3);
94
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
95
+ AddSkyboxButton("park", "BerzeliiPark", row3);
96
+
97
+ AddSkyboxButton("park", "Buddha", row4);
98
+ AddSkyboxButton("park", "CNTower2", row4);
99
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
100
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
101
+
102
+ AddSkyboxButton("park", "Park", row5);
103
+ AddSkyboxButton("park", "Pond", row5);
104
+ AddSkyboxButton("park", "Skansen", row5);
105
+ AddSkyboxButton("park", "Skansen2", row5);
106
+
107
+ AddSkyboxButton("park", "Skansen3", row6);
108
+ AddSkyboxButton("park", "Skansen4", row6);
109
+ AddSkyboxButton("park", "Skansen5", row6);
110
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
111
+
112
+ tab0.add(row0);
113
+ tab0.add(row1);
114
+ tab0.add(row2);
115
+ tab0.add(row3);
116
+ tab0.add(row4);
117
+ tab0.add(row5);
118
+ tab0.add(row6);
119
+
120
+ for (int i=5; --i>=0;)
121
+ {
122
+ //oe.toolboxPanel.Return();
123
+ //tab0.add(new cGridBag());
124
+ }
125
+ }
126
+
127
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
128
+ {
129
+ cGridBag tab0 = new cGridBag().setVertical(true);
130
+
131
+ tab0.setName("Nature");
132
+ skyboxpanel.add(tab0);
133
+
134
+ cGridBag row0 = new cGridBag();
135
+ cGridBag row1 = new cGridBag();
136
+ cGridBag row2 = new cGridBag();
137
+ cGridBag row3 = new cGridBag();
138
+ cGridBag row4 = new cGridBag();
139
+ cGridBag row5 = new cGridBag();
140
+ cGridBag row6 = new cGridBag();
141
+
142
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
143
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
144
+ AddSkyboxButton("beach", "PalmTrees", row0);
145
+ AddSkyboxButton("beach", "Tenerife", row0);
146
+
147
+ AddSkyboxButton("beach", "Tenerife2", row1);
148
+ AddSkyboxButton("beach", "Tenerife3", row1);
149
+ AddSkyboxButton("field", "FishPond", row1);
150
+ AddSkyboxButton("field", "Footballfield", row1);
151
+
152
+ AddSkyboxButton("field", "Meadow", row2);
153
+ AddSkyboxButton("field", "Sorsele", row2);
154
+ AddSkyboxButton("field", "Sorsele2", row2);
155
+ AddSkyboxButton("field", "Sorsele3", row2);
156
+
157
+ AddSkyboxButton("forest", "Brudslojan", row3);
158
+ AddSkyboxButton("forest", "Langholmen2", row3);
159
+ AddSkyboxButton("forest", "Plants", row3);
160
+ AddSkyboxButton("mountain", "Maskonaive", row3);
161
+
162
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
163
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
164
+ AddSkyboxButton("mountain", "Teide", row4);
165
+ AddSkyboxButton("park", "Tantolunden4", row4);
166
+
167
+ AddSkyboxButton("park", "Stairs", row5);
168
+ AddSkyboxButton("default", "skycube", row6);
169
+ AddSkyboxButton("rocky", "Langholmen", row5);
170
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
171
+
172
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
173
+ AddSkyboxButton("default", "CloudyHills", row6);
174
+ AddSkyboxButton("daz", "Autumn", row6);
175
+ AddSkyboxButton("daz", "MountainTrail", row6);
176
+ /*
177
+Autumn
178
+Greenlands
179
+MountainTrail
180
+Oasis
181
+TheRock
182
+TopOfTheWorld
183
+Winter
184
+ */
185
+
186
+ tab0.add(row0);
187
+ tab0.add(row1);
188
+ tab0.add(row2);
189
+ tab0.add(row3);
190
+ tab0.add(row4);
191
+ tab0.add(row5);
192
+ tab0.add(row6);
193
+
194
+ for (int i=5; --i>=0;)
195
+ {
196
+ //oe.toolboxPanel.Return();
197
+ //tab0.add(new cGridBag());
198
+ }
199
+ }
200
+
201
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
202
+ {
203
+ cGridBag tab0 = new cGridBag().setVertical(true);
204
+
205
+ tab0.setName("Night");
206
+ skyboxpanel.add(tab0);
207
+
208
+ cGridBag row0 = new cGridBag();
209
+ cGridBag row1 = new cGridBag();
210
+ cGridBag row2 = new cGridBag();
211
+ cGridBag row3 = new cGridBag();
212
+ cGridBag row4 = new cGridBag();
213
+ cGridBag row5 = new cGridBag();
214
+ cGridBag row6 = new cGridBag();
215
+
216
+ AddSkyboxButton("night", "NightPath", row0);
217
+ AddSkyboxButton("night", "PondNight", row0);
218
+ AddSkyboxButton("night", "Powerlines", row0);
219
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
220
+
221
+ AddSkyboxButton("urban", "CNTower", row1);
222
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
223
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
224
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
225
+
226
+ AddSkyboxButton("penguins", "kenon_star", row2);
227
+ AddSkyboxButton("persson", "corona", row2);
228
+ AddSkyboxButton("persson", "spaceskybox", row2);
229
+ AddSkyboxButton("indoors", "Vasa", row2);
230
+
231
+ AddSkyboxButton("winter", "Backyard", row3);
232
+ AddSkyboxButton("winter", "Creek", row3);
233
+ AddSkyboxButton("winter", "FootballField3", row3);
234
+ AddSkyboxButton("winter", "Forest", row3);
235
+
236
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
237
+ AddSkyboxButton("winter", "House", row4);
238
+ AddSkyboxButton("winter", "IceLake", row4);
239
+ AddSkyboxButton("winter", "IceRiver", row4);
240
+
241
+ AddSkyboxButton("winter", "Park3", row5);
242
+ AddSkyboxButton("winter", "PondWinter", row5);
243
+ AddSkyboxButton("winter", "Tantolunden5", row5);
244
+ AddSkyboxButton("winter", "Vindelalven", row5);
245
+
246
+ AddSkyboxButton("daz", "TheRock", row6);
247
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
248
+ AddSkyboxButton("daz", "Winter", row6);
249
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
250
+
251
+ tab0.add(row0);
252
+ tab0.add(row1);
253
+ tab0.add(row2);
254
+ tab0.add(row3);
255
+ tab0.add(row4);
256
+ tab0.add(row5);
257
+ tab0.add(row6);
258
+
259
+ for (int i=5; --i>=0;)
260
+ {
261
+ //oe.toolboxPanel.Return();
262
+ //tab0.add(new cGridBag());
263
+ }
264
+ }
265
+
266
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
267
+ {
268
+ cGridBag tab0 = new cGridBag().setVertical(true);
269
+
270
+ tab0.setName("Others");
271
+ skyboxpanel.add(tab0);
272
+
273
+ cGridBag row0 = new cGridBag();
274
+ cGridBag row1 = new cGridBag();
275
+ cGridBag row2 = new cGridBag();
276
+ cGridBag row3 = new cGridBag();
277
+ cGridBag row4 = new cGridBag();
278
+ cGridBag row5 = new cGridBag();
279
+ cGridBag row6 = new cGridBag();
280
+
281
+ AddSkyboxButton("mayhem", "afterrain", row0);
282
+ AddSkyboxButton("mayhem", "aqua4", row0);
283
+ AddSkyboxButton("mayhem", "aqua9", row0);
284
+ AddSkyboxButton("mayhem", "flame", row0);
285
+
286
+ AddSkyboxButton("mayhem", "h2s", row1);
287
+ AddSkyboxButton("mayhem", "prehistoric", row1);
288
+ AddSkyboxButton("mayhem", "scorched", row1);
289
+ AddSkyboxButton("penguins", "desertdawn", row1);
290
+
291
+ AddSkyboxButton("persson", "Citadella", row2);
292
+ AddSkyboxButton("persson", "Citadella2", row2);
293
+ AddSkyboxButton("persson", "clouds1", row2);
294
+ AddSkyboxButton("penguins", "wrath", row2);
295
+
296
+ AddSkyboxButton("persson", "FishermansBastion", row3);
297
+ AddSkyboxButton("persson", "HeroesSquare", row3);
298
+ AddSkyboxButton("indoors", "DallasW", row3);
299
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
300
+
301
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
302
+ AddSkyboxButton("persson", "PereaBeach1", row4);
303
+ AddSkyboxButton("persson", "PereaBeach2", row4);
304
+ AddSkyboxButton("persson", "redeclipse", row4);
305
+
306
+ AddSkyboxButton("daz", "Greenlands", row5);
307
+ AddSkyboxButton("daz", "Oasis", row5);
308
+ AddSkyboxButton("elyvisions", "arch3", row5);
309
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
310
+
311
+ AddSkyboxButton("elyvisions", "rainbow", row6);
312
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
313
+ AddSkyboxButton("elyvisions", "heaven", row6);
314
+ AddSkyboxButton("elyvisions", "hot", row6);
315
+
316
+ tab0.add(row0);
317
+ tab0.add(row1);
318
+ tab0.add(row2);
319
+ tab0.add(row3);
320
+ tab0.add(row4);
321
+ tab0.add(row5);
322
+ tab0.add(row6);
323
+
324
+ for (int i=5; --i>=0;)
325
+ {
326
+ //oe.toolboxPanel.Return();
327
+ //tab0.add(new cGridBag());
328
+ }
329
+ }
330
+
331
+ public void ChangeSkybox(String skybox)
332
+ {
333
+ //cameraView.envyoff = false;
334
+ group.skyboxname = skybox;
335
+ group.skyboxext = "jpg";
336
+ cameraView.repaint();
337
+ }
338
+
339
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
340
+ {
341
+ JTabbedPane skyboxpane = new JTabbedPane();
342
+
343
+ AddSkyboxTab0(skyboxpane);
344
+ AddSkyboxTab1(skyboxpane);
345
+ AddSkyboxTab2(skyboxpane);
346
+ AddSkyboxTab3(skyboxpane);
347
+
348
+ skyboxPanel.add(skyboxpane);
349
+ }
350
+
351
+ public void ChangeTexture(String texture)
352
+ {
353
+ cameraView.repaint();
354
+ }
355
+
25356 //ObjEditor objEditor;
26357 public void closeUI2()
27358 {
....@@ -59,6 +390,12 @@
59390 this.copy = this.group = group;
60391 //selectees = this.group.selectees;
61392
393
+ if (copy.versionlist == null)
394
+ {
395
+ copy.versionlist = new Object3D[100];
396
+ copy.versionindex = -1;
397
+ }
398
+
62399 if(ui)
63400 SetupUI(objEditor);
64401 }
....@@ -73,17 +410,29 @@
73410 this.copy = this.group = copy;
74411 //selectees = this.group.selectees;
75412
76
- SetupMenu2(objEditor);
413
+ SetupMenu2(this); //objEditor);
77414 SetupUI2(objEditor);
78415 objEditor.SetupUI(true);
79416 SetupViews(objEditor);
80417
81418 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
419
+
420
+ if (copy.versionlist == null)
421
+ {
422
+ copy.versionlist = new Object3D[100];
423
+ copy.versionindex = -1;
424
+
425
+ Save(true);
426
+ }
82427 }
83428
84429 void CloneSelection(boolean supports)
85430 {
86
- // Object3D keep = GraphreeD.clipboard;
431
+ if (Globals.REPLACEONMAKE)
432
+ Save();
433
+ boolean keep = Globals.REPLACEONMAKE;
434
+ Globals.REPLACEONMAKE = false;
435
+ // Object3D keep = GrafreeD.clipboard;
87436 //Object3D obj;
88437 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
89438 {
....@@ -93,18 +442,19 @@
93442
94443 makeSomething(clone, i==group.selection.size()-1);
95444 }
445
+ Globals.REPLACEONMAKE = keep;
96446 }
97447
98448 void CloneClipboard(boolean supports)
99449 {
100
- assert(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));
450
+ assert(Grafreed.clipboard.parent == null);
451
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
452
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
453
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
454
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105455 else
106
- makeSomething(CloneObject(GraphreeD.clipboard, false));
107
- GraphreeD.clipboard.get(0).parent = keepparent;
456
+ makeSomething(CloneObject(Grafreed.clipboard, false));
457
+ Grafreed.clipboard.get(0).parent = keepparent;
108458 }
109459
110460 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +468,7 @@
118468 // obj.support = null;
119469 if (!supports)
120470 obj.SaveSupports();
121
- Object3D clone = (Object3D)GraphreeD.clone(obj);
471
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122472 obj.parent = parent;
123473 // obj.support = support;
124474 // clone.support = support; // aout 2013
....@@ -147,30 +497,29 @@
147497
148498 //JTextField nameField;
149499
150
- void SetupMenu2(ObjEditor oe)
500
+ void SetupMenu2(GroupEditor oe)
151501 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
502
+ oe.jTree = new cTree();
503
+
163504 Menu menu;
164505 oe.menuBar.add(menu = new Menu("Edit"));
165506 //editItem = menu.add(new MenuItem("Edit"));
166507 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
508
+
509
+// undoItem = menu.add(new MenuItem("Undo"));
510
+// undoItem.addActionListener(this);
511
+// redoItem = menu.add(new MenuItem("Redo"));
512
+// redoItem.addActionListener(this);
513
+// menu.add("-");
514
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168515 duplicateItem.addActionListener(this);
169
- menu.add("-");
170516 cloneItem = menu.add(new MenuItem("Clone"));
171517 cloneItem.addActionListener(this);
518
+ if (Globals.ADVANCED)
519
+ {
172520 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173521 cloneSupportItem.addActionListener(this);
522
+ }
174523 menu.add("-");
175524 cutItem = menu.add(new MenuItem("Cut"));
176525 cutItem.addActionListener(this);
....@@ -178,26 +527,123 @@
178527 copyItem.addActionListener(this);
179528 pasteItem = menu.add(new MenuItem("Paste"));
180529 pasteItem.addActionListener(this);
530
+
531
+ menu.add("-");
532
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
533
+ pasteIntoItem.addActionListener(this);
181534 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182535 pasteLinkItem.addActionListener(this);
183536 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184537 pasteCloneItem.addActionListener(this);
185538 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186539 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
540
+ menu.add("-");
541
+ deleteItem = menu.add(new MenuItem("Delete"));
542
+ deleteItem.addActionListener(this);
543
+
544
+ if (Globals.ADVANCED)
545
+ {
546
+ // Deletes the cameras...
189547 clearAllItem = menu.add(new MenuItem("Clear All"));
190548 clearAllItem.addActionListener(this);
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);
549
+ }
550
+
551
+ menuBar.add(cameraMenu = new Menu("View"));
552
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
553
+ //zBufferItem.addActionListener(this);
554
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
555
+ //normalLensItem.addActionListener(this);
556
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
557
+ restoreCameraItem.addActionListener(this);
558
+
559
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
560
+// toggleFullScreenItem.addItemListener(this);
561
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
562
+// cameraMenu.add("-");
563
+//
564
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
565
+// toggleTextureItem.addItemListener(this);
566
+// toggleTextureItem.setState(CameraPane.textureon);
567
+//
568
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
569
+// toggleSwitchItem.addItemListener(this);
570
+// toggleSwitchItem.setState(CameraPane.SWITCH);
571
+
572
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
573
+ toggleHandleItem.addItemListener(this);
574
+ toggleHandleItem.setState(CameraPane.HANDLES);
575
+
576
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
577
+ togglePaintItem.addItemListener(this);
578
+ togglePaintItem.setState(CameraPane.PAINTMODE);
579
+
580
+ if (Globals.ADVANCED)
581
+ {
582
+ cameraMenu.add("-");
583
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
584
+ toggleLiveItem.addItemListener(this);
585
+ toggleLiveItem.setState(Globals.isLIVE());
586
+
587
+ cameraMenu.add(stepItem = new MenuItem("Step"));
588
+ stepItem.addActionListener(this);
589
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
590
+ // toggleDLItem.addItemListener(this);
591
+ // toggleDLItem.setState(false);
592
+
593
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
594
+ toggleRenderItem.addItemListener(this);
595
+ toggleRenderItem.setState(!CameraPane.frozen);
596
+
597
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
598
+ toggleDebugItem.addItemListener(this);
599
+ toggleDebugItem.setState(Globals.DEBUG);
600
+
601
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
602
+ toggleFrustumItem.addItemListener(this);
603
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
604
+
605
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
606
+ toggleFootContactItem.addItemListener(this);
607
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
608
+
609
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
610
+ toggleTimelineItem.addItemListener(this);
611
+ }
612
+
613
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
614
+// toggleRootItem.addItemListener(this);
615
+// toggleRootItem.setState(false);
616
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
617
+// animationItem.addItemListener(this);
618
+// animationItem.setState(CameraPane.ANIMATION);
619
+ cameraMenu.add("-");
620
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
621
+ editCameraItem.addActionListener(this);
622
+
623
+ if (Globals.ADVANCED)
624
+ {
625
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
626
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
627
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
628
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
629
+ oe.cameraMenu.add("-");
630
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
631
+ openWindowItem.addActionListener(this);
632
+ editLeafItem.addActionListener(this);
633
+ lookAtItem.addActionListener(this);
634
+ //lookFromItem.addActinoListener(this);
635
+ //switchViewItem.addActionListener(this);
636
+ }
637
+
638
+ oe.menuBar.add(menu = new Menu("Setting"));
639
+ if (Globals.ADVANCED)
640
+ {
196641 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
197642 revertMeshItem.addActionListener(this);
198643 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
199644 resetreferencesItem.addActionListener(this);
200645 menu.add("-");
646
+ }
201647 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
202648 overwriteGeoItem.addActionListener(this);
203649 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -209,72 +655,104 @@
209655 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
210656 overwriteUVItem.addActionListener(this);
211657 menu.add("-");
658
+ if (Globals.ADVANCED)
659
+ {
212660 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
213661 generateMeshItem.addActionListener(this);
214662 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
215663 poseMeshItem.addActionListener(this);
216664 menu.add("-");
665
+ }
217666 resetsupportItem = menu.add(new MenuItem("Reset support"));
218667 resetsupportItem.addActionListener(this);
219668 linkverticesItem = menu.add(new MenuItem("Link to Support"));
220669 linkverticesItem.addActionListener(this);
670
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
671
+ relinkverticesItem.addActionListener(this);
672
+
673
+ if (Globals.ADVANCED)
674
+ {
221675 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
222676 setMasterItem.addActionListener(this);
677
+ }
223678
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);
679
+ oe.menuBar.add(menu = new Menu("Group"));
680
+// grabItem = menu.add(new MenuItem("Grab"));
681
+// grabItem.addActionListener(this);
229682 backItem = menu.add(new MenuItem("Back"));
230683 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);
684
+ frontItem = menu.add(new MenuItem("Front"));
685
+ frontItem.addActionListener(this);
686
+// compositeItem = menu.add(new MenuItem("Composite"));
687
+// compositeItem.addActionListener(this);
688
+
689
+ if (Globals.ADVANCED)
690
+ {
691
+ hideItem = menu.add(new MenuItem("Hidden Group"));
692
+ hideItem.addActionListener(this);
693
+ }
694
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
695
+ ungroupItem.addActionListener(this);
696
+
697
+// menu.add("-");
698
+//
699
+// switchItem = menu.add(new MenuItem("Switch node"));
700
+// switchItem.addActionListener(this);
701
+ if (Globals.ADVANCED)
702
+ {
240703 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
241704 switchGeoItem.addActionListener(this);
242705 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
243706 switchTransfoItem.addActionListener(this);
244
- morphItem = menu.add(new MenuItem("Morph"));
707
+ morphItem = menu.add(new MenuItem("Morph Group"));
245708 morphItem.addActionListener(this);
709
+
710
+ menu.add("-");
711
+ physicsItem = menu.add(new MenuItem("Physics"));
712
+ physicsItem.addActionListener(this);
713
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
714
+ frameselectorItem.addActionListener(this);
246715 scriptNodeItem = menu.add(new MenuItem("Script Node"));
247716 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);
717
+ }
718
+
719
+ oe.menuBar.add(menu = new Menu("Object"));
720
+// textureItem = menu.add(new MenuItem("Texture"));
721
+// textureItem.addActionListener(this);
722
+ billboardItem = menu.add(new MenuItem("Billboard"));
723
+ billboardItem.addActionListener(this);
253724 csgItem = menu.add(new MenuItem("CSG"));
254725 csgItem.addActionListener(this);
255
- shadowXItem = menu.add(new MenuItem("Shadow X"));
726
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
256727 shadowXItem.addActionListener(this);
257
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
728
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
258729 shadowYItem.addActionListener(this);
259
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
730
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
260731 shadowZItem.addActionListener(this);
732
+ attributeItem = menu.add(new MenuItem("Attribute"));
733
+ attributeItem.addActionListener(this);
734
+
735
+ if (Globals.ADVANCED)
736
+ {
737
+ menu.add("-");
261738 linkerItem = menu.add(new MenuItem("Linker"));
262739 linkerItem.addActionListener(this);
263740 templateItem = menu.add(new MenuItem("Template"));
264741 templateItem.addActionListener(this);
265
- attributeItem = menu.add(new MenuItem("Attribute"));
266
- attributeItem.addActionListener(this);
267742 pointflowItem = menu.add(new MenuItem("Point Flow"));
268743 pointflowItem.addActionListener(this);
744
+ }
269745 menu.add("-");
270
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
271
- transformgeometryItem.addActionListener(this);
272746 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
273747 resetTransformItem.addActionListener(this);
274748 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
275749 resetCentroidItem.addActionListener(this);
276
- ungroupItem = menu.add(new MenuItem("Ungroup"));
277
- ungroupItem.addActionListener(this);
750
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
751
+ resetCentroidXZItem.addActionListener(this);
752
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
753
+ transformGeometryItem.addActionListener(this);
754
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
755
+ transformChildrenItem.addActionListener(this);
278756
279757 oe.menuBar.add(menu = new Menu("Geometry"));
280758 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -283,6 +761,13 @@
283761 genNormalsORGANItem.addActionListener(this);
284762 genNormalsCADItem = menu.add(new MenuItem("CAD Normals"));
285763 genNormalsCADItem.addActionListener(this);
764
+ genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
765
+ genNormalsMESHItem.addActionListener(this);
766
+ if (Globals.ADVANCED)
767
+ {
768
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
769
+ genNormalsMINEItem.addActionListener(this);
770
+ }
286771 stripifyItem = menu.add(new MenuItem("Stripify"));
287772 stripifyItem.addActionListener(this);
288773 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -292,8 +777,6 @@
292777 untrimItem = menu.add(new MenuItem("Untrim"));
293778 untrimItem.addActionListener(this);
294779 menu.add("-");
295
- clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
296
- clearMaterialsItem.addActionListener(this);
297780 clearColorsItem = menu.add(new MenuItem("Clear AO"));
298781 clearColorsItem.addActionListener(this);
299782 reverseNormalsItem = menu.add(new MenuItem("Reverse Normals"));
....@@ -306,19 +789,34 @@
306789 reduce34MeshItem.addActionListener(this);
307790 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
308791 increaseMeshItem.addActionListener(this);
309
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
310
- smoothMeshItem.addActionListener(this);
311792 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
312793 clipMeshItem.addActionListener(this);
794
+
795
+ if (Globals.ADVANCED)
796
+ {
797
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
798
+ smoothMeshItem.addActionListener(this);
799
+ }
800
+
801
+ oe.menuBar.add(menu = new Menu("Attributes"));
802
+ clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
803
+ clearMaterialsItem.addActionListener(this);
804
+ resetAllItem = menu.add(new MenuItem("Reset All"));
805
+ resetAllItem.addActionListener(this);
806
+ stepAllItem = menu.add(new MenuItem("Step All"));
807
+ stepAllItem.addActionListener(this);
313808 menu.add("-");
314809 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
315810 liveleavesItem.addActionListener(this);
316811 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
317812 unliveleavesItem.addActionListener(this);
813
+ if (Globals.ADVANCED)
814
+ {
318815 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
319816 supportleavesItem.addActionListener(this);
320817 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
321818 unsupportleavesItem.addActionListener(this);
819
+ }
322820 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
323821 hideleavesItem.addActionListener(this);
324822 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -327,32 +825,31 @@
327825 markleavesItem.addActionListener(this);
328826 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
329827 unmarkleavesItem.addActionListener(this);
828
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
829
+ rewindleavesItem.addActionListener(this);
830
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
831
+ unrewindleavesItem.addActionListener(this);
832
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
833
+ randomleavesItem.addActionListener(this);
834
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
835
+ unrandomleavesItem.addActionListener(this);
330836 menu.add("-");
331837 flipVItem = menu.add(new MenuItem("Flip V"));
332838 flipVItem.addActionListener(this);
333839 unflipVItem = menu.add(new MenuItem("Unflip V"));
334840 unflipVItem.addActionListener(this);
335
- lowTexturesItem = menu.add(new MenuItem("Low Texture"));
841
+ lowTexturesItem = menu.add(new MenuItem("Low Texture (256)"));
336842 lowTexturesItem.addActionListener(this);
337
- normalTexturesItem = menu.add(new MenuItem("Normal Texture"));
843
+ normalTexturesItem = menu.add(new MenuItem("Normal Texture (512)"));
338844 normalTexturesItem.addActionListener(this);
339
- highTexturesItem = menu.add(new MenuItem("High Texture"));
845
+ highTexturesItem = menu.add(new MenuItem("High Texture (1024)"));
340846 highTexturesItem.addActionListener(this);
341
- veryhighTexturesItem = menu.add(new MenuItem("Very high Texture"));
847
+ veryhighTexturesItem = menu.add(new MenuItem("Very high Texture (2048)"));
342848 veryhighTexturesItem.addActionListener(this);
343
- maxTexturesItem = menu.add(new MenuItem("Max Texture"));
849
+ maxTexturesItem = menu.add(new MenuItem("Max Texture (4096)"));
344850 maxTexturesItem.addActionListener(this);
345
- panoTexturesItem = menu.add(new MenuItem("Panoramic Texture"));
851
+ panoTexturesItem = menu.add(new MenuItem("Panoramic Texture (8192)"));
346852 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);
356853
357854 oe.menuBar.add(menu = new Menu("Selection"));
358855 attachPigmentItem = menu.add(new MenuItem("Attach Pigment..."));
....@@ -361,23 +858,117 @@
361858 attachBumpItem.addActionListener(this);
362859 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
363860 pigmentBumpItem.addActionListener(this);
861
+ //embedTexturesItem
364862 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
365863 detachPigmentItem.addActionListener(this);
366864 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
367865 detachBumpItem.addActionListener(this);
866
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
867
+ embedTexturesItem.addActionListener(this);
868
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
869
+ deEmbedTexturesItem.addActionListener(this);
368870 menu.add("-");
369871 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
370872 sortbysizeItem.addActionListener(this);
371873 sortbynameItem = menu.add(new MenuItem("Sort by name"));
372874 sortbynameItem.addActionListener(this);
875
+ menu.add("-");
876
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
877
+ shareGeometriesItem.addActionListener(this);
878
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
879
+ mergeGeometriesItem.addActionListener(this);
880
+ if (Globals.ADVANCED)
881
+ {
882
+ // Pretty much the same as duplicate and clone.
883
+ extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
884
+ extractGeometriesItem.addActionListener(this);
885
+ cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
886
+ cloneGeometriesItem.addActionListener(this);
887
+ }
888
+
373889 oe.menuBar.add(menu = new Menu("Insert"));
374890 buildCreateMenu(menu);
375
- oe.menuBar.add(menu = new Menu("Tools"));
891
+
892
+ oe.menuBar.add(menu = new Menu("Tools"));
376893 buildToolsMenu(menu);
377894 }
378895
896
+ JTabbedPane resourcecontainer;
897
+ cGridBag currenttab;
898
+ boolean added; // patch for jar
899
+
900
+ int tabcount = 0;
901
+ int colcount = 0;
902
+ int rowcount = 0;
903
+
904
+ int columns = 5;
905
+ int rows = 7;
906
+
907
+ public void ResourceCallBack(String[] path)
908
+ {
909
+ for (int i = 0; i < path.length; i++)
910
+ System.out.print(path[i] + "/");
911
+ System.out.println();
912
+ if (rowcount == 0)
913
+ {
914
+ currenttab = new cGridBag();
915
+ added = false;
916
+ String tabname = String.valueOf((char)('A'+tabcount));
917
+ currenttab.setName(tabname);
918
+ rowcount = 1;
919
+ }
920
+
921
+ if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
922
+ {
923
+ if (!added)
924
+ {
925
+ added = true;
926
+ resourcecontainer.add(currenttab);
927
+ String tabname = String.valueOf((char)('A'+tabcount));
928
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
929
+ }
930
+
931
+ AddTextureButton(path[0], path[1], currenttab);
932
+ if (++colcount >= columns)
933
+ {
934
+ colcount = 0;
935
+ currenttab.Return();
936
+
937
+ if (rowcount++ >= rows)
938
+ {
939
+ rowcount = 0;
940
+ }
941
+ }
942
+ }
943
+ else
944
+ {
945
+// if (!path[path.length-1].equals("icons"))
946
+// resourcecontainer.Return();
947
+ }
948
+ }
949
+
950
+ void CreateTexturePanel(cGridBag container)
951
+ {
952
+ resourcecontainer = new JTabbedPane();
953
+ container.add(resourcecontainer);
954
+
955
+ Grafreed.ParseResources("textures", this);
956
+ }
957
+
379958 void SetupUI2(ObjEditor oe)
380959 {
960
+ // June 2019
961
+ if (oe == null)
962
+ {
963
+ //super.SetupUI2(this);
964
+ //return;
965
+ }
966
+
967
+ if (copy != group)
968
+ {
969
+ //super.SetupUI2(this);
970
+ }
971
+
381972 //new Exception().printStackTrace();
382973
383974 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -406,150 +997,239 @@
406997 oe.radioPanel.add(dummyButton);
407998 oe.buttonGroup.add(dummyButton);
408999 */
409
- aConstraints.gridy += 1;
410
- oe.aConstraints.gridwidth = 1;
411
- oe.aConstraints.gridx = 0;
1000
+ cGridBag copyOptionsPanel = new cGridBag();
1001
+
1002
+ copyOptionsPanel.preferredHeight = 2;
4121003
413
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
1004
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
1005
+
1006
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
+ //minButton.setToolTipText("Minimize window");
1008
+ //minButton.addActionListener(this);
1009
+
1010
+ if (Globals.ADVANCED)
1011
+ {
1012
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
+ maxButton.setToolTipText("Maximize window");
1014
+ maxButton.addActionListener(this);
1015
+ }
1016
+
1017
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ fullButton.setToolTipText("Full-screen window");
1019
+ fullButton.addActionListener(this);
1020
+
1021
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1022
+ screenfitButton.setToolTipText("Screen fit");
1023
+ screenfitButton.addActionListener(this);
1024
+
1025
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1026
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1027
+ restoreCameraButton.addActionListener(this);
1028
+
1029
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
+ saveVersionButton.setToolTipText("Duplicate current version");
1031
+ saveVersionButton.addActionListener(this);
1032
+
1033
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1034
+ deleteVersionButton.setToolTipText("Delete current version");
1035
+ deleteVersionButton.addActionListener(this);
1036
+
1037
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1038
+ previousVersionButton.setToolTipText("Previous version");
1039
+ previousVersionButton.addActionListener(this);
1040
+ previousVersionButton.setEnabled(false);
1041
+
1042
+ cGridBag updown = new cGridBag().setVertical(true);
1043
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1044
+ restoreButton.setToolTipText("Undo (restore current version)");
1045
+ restoreButton.addActionListener(this);
1046
+ //restoreButton.setEnabled(false);
1047
+
1048
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+ replaceButton.setToolTipText("Save (replace current version)");
1050
+ replaceButton.addActionListener(this);
1051
+ //replaceButton.setEnabled(false);
1052
+
1053
+ copyOptionsPanel.add(updown);
1054
+
1055
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ nextVersionButton.setToolTipText("Next version");
1057
+ nextVersionButton.addActionListener(this);
1058
+ nextVersionButton.setEnabled(false);
1059
+
1060
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1061
+ liveCB.setToolTipText("Enable animation");
4141062 liveCB.addItemListener(this);
4151063
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);
1064
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1065
+ oneStepButton.setToolTipText("Animate one step forward");
1066
+ oneStepButton.addActionListener(this);
1067
+
1068
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
1069
+ fastCB.setToolTipText("Fast mode");
4341070 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);
1071
+
1072
+ //oe.toolboxPanel.Return();
1073
+
1074
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1075
+// trackCB.setToolTipText("Enable tracking");
1076
+// trackCB.addItemListener(this);
4411077
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;
4821078 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
4831079 // 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;
4881080
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);
1081
+ if (Globals.ADVANCED)
1082
+ {
1083
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ snapobjectButton.addActionListener(this);
1085
+ snapobjectButton.setToolTipText("Snap Object");
1086
+
1087
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5041088 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);
1089
+ fourButton.setToolTipText("Show control panel only");
1090
+ }
1091
+
1092
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
1093
+
1094
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1095
+ twoButton.setToolTipText("Show 3D view only");
1096
+ twoButton.addActionListener(this);
1097
+ this.fullscreenLayout = twoButton;
1098
+
1099
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
+ threeButton.setToolTipText("Show controls and 3D view");
5081101 threeButton.addActionListener(this);
509
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
510
- sevenButton.addActionListener(this);
1102
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1103
+ sixButton.setToolTipText("Show 3D view and controls");
1104
+ sixButton.addActionListener(this);
1105
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
+// sevenButton.setToolTipText("3-column layout");
1107
+// sevenButton.addActionListener(this);
5111108 //
5121109
513
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
1110
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1111
+ rootButton.setToolTipText("Open selection in new tab");
5141112 rootButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
1113
+
1114
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
+ closeButton.setToolTipText("Close tab");
5171116 closeButton.addActionListener(this);
5181117 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5191118 //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;
5281119
529
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
1120
+ cGridBag row1 = new cGridBag();
1121
+
1122
+ // INSERT
1123
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ gridButton.setToolTipText("Create grid");
1125
+ gridButton.addActionListener(this);
1126
+
1127
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1128
+ boxButton.setToolTipText("Create box");
1129
+ boxButton.addActionListener(this);
1130
+
1131
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1132
+ sphereButton.setToolTipText("Create sphere");
1133
+ sphereButton.addActionListener(this);
1134
+
1135
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ coneButton.setToolTipText("Create cone");
1137
+ coneButton.addActionListener(this);
1138
+
1139
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ torusButton.setToolTipText("Create torus");
1141
+ torusButton.addActionListener(this);
1142
+
1143
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1144
+ superButton.setToolTipText("Create superellipsoid");
1145
+ superButton.addActionListener(this);
1146
+
1147
+ if (Globals.ADVANCED)
1148
+ {
1149
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1150
+ kleinButton.setToolTipText("Create Klein bottle");
1151
+ kleinButton.addActionListener(this);
1152
+ }
1153
+
1154
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1155
+ particlesButton.setToolTipText("Create particle system");
1156
+ particlesButton.addActionListener(this);
1157
+
1158
+ oe.toolboxPanel.add(row1);
1159
+
1160
+ cGridBag row2 = new cGridBag();
1161
+
1162
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1163
+ groupButton.setToolTipText("Create group");
1164
+ groupButton.addActionListener(this);
1165
+
1166
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1167
+ compositeButton.setToolTipText("Create composite");
1168
+ compositeButton.addActionListener(this);
1169
+
1170
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1171
+ switchButton.setToolTipText("Create item switcher");
1172
+ switchButton.addActionListener(this);
1173
+
1174
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ loopButton.setToolTipText("Create loop");
1176
+ loopButton.addActionListener(this);
1177
+
1178
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1179
+ textureButton.setToolTipText("Create texture");
1180
+ textureButton.addActionListener(this);
1181
+
1182
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ overlayButton.setToolTipText("Create overlay");
1184
+ overlayButton.addActionListener(this);
1185
+
1186
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ lightButton.setToolTipText("Create light");
1188
+ lightButton.addActionListener(this);
1189
+
1190
+ oe.toolboxPanel.add(row2);
1191
+
1192
+ cGridBag textures = new cGridBag();
1193
+
1194
+ CreateTexturePanel(textures);
1195
+
1196
+ oe.toolboxPanel.add(textures);
1197
+
1198
+ textures.preferredHeight = 100;
1199
+
1200
+ CreateSkyboxPanel(oe.skyboxPanel);
1201
+
1202
+ // EDIT panel
1203
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1204
+ editButton.setToolTipText("Pin selection controls");
1205
+ editButton.addActionListener(this);
1206
+
1207
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1208
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5301209 uneditButton.addActionListener(this);
5311210
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);
1211
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1212
+ allParamsButton.setToolTipText("Show all controls");
5441213 allParamsButton.addActionListener(this);
5451214
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);
1215
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1216
+ clearPanelButton.setToolTipText("Clear all controls");
1217
+ clearPanelButton.addActionListener(this);
5521218
1219
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ //unselectButton.setToolTipText("Unselect");
1221
+ //unselectButton.addActionListener(this);
1222
+
1223
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ flashSelectionButton.setToolTipText("Highlight selection");
1225
+ flashSelectionButton.addActionListener(this);
1226
+
1227
+ editCommandsPanel.preferredHeight = 1;
1228
+
1229
+ SetPinStates(false);
1230
+// oe.treePanel.add(commandsPanel);
1231
+// oe.treePanel.Return();
1232
+
5531233 // oe.aConstraints.gridx += 1;
5541234 // oe.aConstraints.weighty = 0;
5551235 // oe.aConstraints.gridwidth = 1;
....@@ -561,47 +1241,32 @@
5611241 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
5621242 // gcButton.addActionListener(this);
5631243
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;
1244
+ cGridBag jSPPanel = new cGridBag();
1245
+
1246
+ JScrollPane jSP;
5751247 //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);
1248
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5771249 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;
5971250
1251
+ oe.treePanel.add(jSPPanel);
1252
+ oe.treePanel.Return();
1253
+
1254
+ oe.treePanel.add(copyOptionsPanel);
1255
+ oe.treePanel.Return();
1256
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1257
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1258
+ sliderPane.preferredHeight = 1;
1259
+
1260
+// mainPanel.setDividerLocation(0.1); //1.0);
1261
+ mainPanel.setResizeWeight(0.4);
1262
+
5981263 //jList.addListSelectionListener(this);
5991264 oe.jTree.addTreeSelectionListener(this);
6001265 //jTree.setRootVisible(false);
6011266 //jTree.setEditable(true);
6021267 oe.jTree.setDragEnabled(true);
6031268 //jTree.setPreferredSize(new Dimension(10,10));
604
- jSP.setPreferredSize(new Dimension(100,200));
1269
+ //jSP.setPreferredSize(new Dimension(100,200));
6051270
6061271 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6071272
....@@ -613,23 +1278,163 @@
6131278 dgr.addDragGestureListener(this);
6141279 }catch(Exception e) {}
6151280 */
616
- radio.layout = sevenButton;
1281
+ radio.layout = threeButton; // sixButton;
6171282 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6181283 }
1284
+
1285
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
1286
+ {
1287
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1288
+ colorCB.setToolTipText("Copy color when dropped");
1289
+ colorCB.addItemListener(this);
1290
+
1291
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1292
+ materialCB.setToolTipText("Copy material when dropped");
1293
+ materialCB.addItemListener(this);
1294
+
1295
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1296
+ textureCB.setToolTipText("Copy texture when dropped");
1297
+ textureCB.addItemListener(this);
1298
+
1299
+ panel.Return();
1300
+
1301
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1302
+ boxCB.setToolTipText("Display bounding boxes");
1303
+ boxCB.addItemListener(this);
1304
+
1305
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1306
+ zoomBoxCB.setToolTipText("Display only for wheel");
1307
+ zoomBoxCB.addItemListener(this);
1308
+
1309
+ if (true) // Globals.ADVANCED)
1310
+ {
1311
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1312
+// supportCB.setToolTipText("Enable rigging");
1313
+// supportCB.addItemListener(this);
1314
+
1315
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1316
+ freezeCB.setToolTipText("Fast moving camera");
1317
+ freezeCB.addItemListener(this);
1318
+
1319
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
1320
+ // localCB.addItemListener(this);
1321
+
1322
+ panel.Return();
1323
+
1324
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
1325
+ crowdCB.setToolTipText("Used for crowds");
1326
+ crowdCB.addItemListener(this);
1327
+
1328
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
1329
+ smoothCB.setToolTipText("Snapping delay");
1330
+ smoothCB.addItemListener(this);
1331
+
1332
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1333
+// slowCB.setToolTipText("Smooth interpolation");
1334
+// slowCB.addItemListener(this);
1335
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1336
+ minshaderCB.setToolTipText("Minimal fast shader");
1337
+ minshaderCB.addItemListener(this);
1338
+
1339
+// constraints.gridy += 1;
1340
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
1341
+// speakerMocapCB.addItemListener(this);
1342
+
1343
+ panel.Return();
1344
+
1345
+ if (false)
1346
+ {
1347
+ // handled in scripts
1348
+ //constraints.gridy += 1;
1349
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
1350
+ speakerCameraCB.addItemListener(this);
1351
+
1352
+ //constraints.gridy += 1;
1353
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
1354
+ speakerFocusCB.addItemListener(this);
1355
+
1356
+ //constraints.gridy += 1;
1357
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
1358
+ smoothfocusCB.addItemListener(this);
1359
+ panel.Return();
1360
+ }
1361
+
1362
+//constraints.gridx += 1;
1363
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
1364
+// debugCB.addItemListener(this);
1365
+
1366
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1367
+ trackCB.setToolTipText("Enable tracking target");
1368
+ trackCB.addItemListener(this);
1369
+
1370
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1371
+ oeilCB.setToolTipText("Move camera when tracking");
1372
+ oeilCB.addItemListener(this);
1373
+
1374
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1375
+ shadowCB.setToolTipText("When live compute shadows");
1376
+ shadowCB.addItemListener(this);
1377
+
1378
+ panel.Return();
1379
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1380
+ toggleTextureCB.setToolTipText("Load textures");
1381
+ toggleTextureCB.addItemListener(this);
1382
+
1383
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1384
+ toggleSwitchCB.setToolTipText("Choose a single item");
1385
+ toggleSwitchCB.addItemListener(this);
1386
+
1387
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1388
+ autokeepCB.setToolTipText("On structure change");
1389
+ autokeepCB.addItemListener(this);
1390
+
1391
+ panel.Return();
1392
+ if (Globals.ADVANCED)
1393
+ {
1394
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
1395
+ lookAtCB.setToolTipText("Look-at target");
1396
+ lookAtCB.addItemListener(this);
1397
+ }
1398
+
1399
+ }
1400
+
1401
+ cGridBag fill = new cGridBag();
1402
+ fill.preferredHeight = 200;
1403
+ cGridBag fill2 = new cGridBag();
1404
+ fill2.preferredHeight = 200;
1405
+ cGridBag fill3 = new cGridBag();
1406
+ fill3.preferredHeight = 200;
1407
+
1408
+ panel.add(fill);
1409
+ panel.add(fill2);
1410
+ panel.add(fill3);
1411
+
1412
+ }
6191413
6201414 void EditObject(Object3D obj)
6211415 {
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();
1416
+ cRadio radioButton = new cRadio(obj.name);
1417
+
1418
+ // June 2019. Patch to avoid bug with transparency.
1419
+ radioButton.hadMaterial = obj.material != null;
1420
+ if (!radioButton.hadMaterial)
1421
+ {
1422
+ obj.material = new cMaterial();
1423
+ }
1424
+
1425
+ radioButton.SetObject(obj);
1426
+ radioButton.layout = threeButton; // sixButton;
1427
+ radioButton.SetCamera(cameraView.renderCamera, false);
1428
+ radioButton.addActionListener(this);
1429
+ radioPanel.add(radioButton);
1430
+ buttonGroup.add(radioButton);
1431
+ radioButton.doClick();
6301432 }
1433
+
6311434 void SetupViews(ObjEditor oe)
6321435 {
1436
+ theFrame = this;
1437
+
6331438 oe.SetupViews();
6341439
6351440 System.out.println("SetupViews");
....@@ -638,22 +1443,30 @@
6381443 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6391444 }
6401445
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;
1446
+ cToggleButton liveCB;
1447
+ cCheckBox supportCB;
1448
+ cCheckBox localCB;
1449
+ cCheckBox crowdCB;
1450
+ cCheckBox smoothCB;
1451
+ cCheckBox minshaderCB;
1452
+
1453
+ cToggleButton fastCB;
1454
+ cCheckBox slowCB;
1455
+ cCheckBox boxCB;
1456
+ cCheckBox zoomBoxCB;
1457
+ cCheckBox freezeCB;
1458
+ //cToggleButton trackCB;
1459
+ cCheckBox trackCB;
1460
+ cCheckBox smoothfocusCB;
6511461 // JCheckBox speakerMocapCB;
652
- JCheckBox speakerCameraCB;
653
- JCheckBox speakerFocusCB;
654
- JCheckBox debugCB;
655
- JCheckBox oeilCB;
656
- JCheckBox lookAtCB;
1462
+ cCheckBox speakerCameraCB;
1463
+ cCheckBox speakerFocusCB;
1464
+ cCheckBox debugCB;
1465
+
1466
+ cCheckBox oeilCB;
1467
+ cCheckBox shadowCB;
1468
+ cCheckBox autokeepCB;
1469
+ cCheckBox lookAtCB;
6571470
6581471 // static int COLOR = 1;
6591472 // static int MATERIAL = 2;
....@@ -661,9 +1474,9 @@
6611474
6621475 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6631476
664
- JCheckBox colorCB;
665
- JCheckBox materialCB;
666
- JCheckBox textureCB;
1477
+ cCheckBox colorCB;
1478
+ cCheckBox materialCB;
1479
+ cCheckBox textureCB;
6671480
6681481 public void itemStateChanged(ItemEvent e)
6691482 {
....@@ -688,10 +1501,10 @@
6881501 dropAttributes |= Object3D.TEXTURE;
6891502 else
6901503 dropAttributes &= ~Object3D.TEXTURE;
691
- }
692
- else if(e.getSource() == liveCB)
1504
+ } else if(e.getSource() == liveCB)
6931505 {
6941506 cameraView.ToggleLive();
1507
+ refreshContents(false);
6951508 }
6961509 else if(e.getSource() == supportCB)
6971510 {
....@@ -707,6 +1520,12 @@
7071520 {
7081521 cameraView.ToggleInertia();
7091522 cameraView.repaint();
1523
+ }
1524
+ else if(e.getSource() == minshaderCB)
1525
+ {
1526
+ Globals.MINSHADER ^= true;
1527
+ cameraView.programInitialized = false;
1528
+ cameraView.repaint();
7101529 }
7111530 else if(e.getSource() == localCB)
7121531 {
....@@ -726,6 +1545,10 @@
7261545 Recompile();
7271546 cameraView.repaint();
7281547 // refreshContents();
1548
+ }
1549
+ else if(e.getSource() == zoomBoxCB)
1550
+ {
1551
+ cameraView.ToggleZoomBoxMode();
7291552 }
7301553 else if(e.getSource() == smoothfocusCB)
7311554 {
....@@ -752,6 +1575,18 @@
7521575 {
7531576 cameraView.ToggleOeil();
7541577 }
1578
+ else if(e.getSource() == shadowCB)
1579
+ {
1580
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1581
+ }
1582
+ else if(e.getSource() == freezeCB)
1583
+ {
1584
+ Globals.FREEZEONMOVE ^= true;
1585
+ }
1586
+ else if(e.getSource() == autokeepCB)
1587
+ {
1588
+ Globals.REPLACEONMAKE ^= true;
1589
+ }
7551590 else if(e.getSource() == lookAtCB)
7561591 {
7571592 cameraView.ToggleLookAt();
....@@ -768,7 +1603,8 @@
7681603
7691604 /**/
7701605 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
771
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1606
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1607
+ TreePath path = objEditor.jTree.getSelectionPath();
7721608 if ((path == null) || (path.getPathCount() <= 1)) {
7731609 // We can't move the root node or an empty selection
7741610 return;
....@@ -831,8 +1667,6 @@
8311667 }
8321668 }
8331669
834
- String string = (String) object;
835
-
8361670 System.out.println("Transfer = " + object + "; drop : " + target);
8371671 // if( object instanceof java.io.File[])
8381672 // {
....@@ -840,7 +1674,11 @@
8401674 // objEditor.DropFile((java.io.File[]) object, true);
8411675 // return;
8421676 // }
843
- if (string.charAt(0) == '/')
1677
+
1678
+ String string = object.toString();
1679
+
1680
+ // File path for Mac and Windows
1681
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8441682 {
8451683 // file(s)
8461684 String[] names = string.split("\n");
....@@ -867,7 +1705,7 @@
8671705
8681706 flashIt = false;
8691707 CameraPane pane = (CameraPane) target;
870
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1708
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8711709 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8721710
8731711 if (group.selection.size() == 1)
....@@ -883,23 +1721,33 @@
8831721
8841722 assert target == objEditor.jTree;
8851723 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1724
+ Object3D destinationLeaf;
8861725 try {
887
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1726
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
8881727 } catch (Exception e) {
8891728 System.out.println("destinationPath : " + destinationPath);
8901729 return;
8911730 }
8921731
893
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1732
+ for (int i=group.selection.size(); --i>=0;)
8941733 {
1734
+ Object3D child = (Object3D)group.selection.elementAt(i);
1735
+
1736
+ // Cannot move into itself
1737
+ if (child == destinationLeaf)
1738
+ return;
1739
+ }
1740
+
1741
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1742
+// {
8951743 loadClipboard(true);
8961744 objEditor.jTree.setSelectionPath(destinationPath);
897
- pasteInto(false);
898
- } else {
899
- loadClipboard(false);
900
- objEditor.jTree.setSelectionPath(destinationPath);
901
- pasteInto(false); // true); // ???
902
- }
1745
+ pasteInto(false, false);
1746
+// } else {
1747
+// loadClipboard(false);
1748
+// objEditor.jTree.setSelectionPath(destinationPath);
1749
+// pasteInto(false, false); // true); // ???
1750
+// }
9031751 }
9041752 public void dropActionChanged(DropTargetDragEvent dtde)
9051753 // Called if the user has modified the current drop gesture
....@@ -1002,90 +1850,109 @@
10021850
10031851 void buildCreateMenu(Menu menu)
10041852 {
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);
1853
+ //heightFieldItem = menu.add(new MenuItem("Height Field"));
1854
+ //heightFieldItem.addActionListener(this);
1855
+// gridItem = menu.add(new MenuItem("Grid"));
1856
+// gridItem.addActionListener(this);
1857
+// rectoidItem = menu.add(new MenuItem("Box"));
1858
+// rectoidItem.addActionListener(this);
1859
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1860
+// ellipsoidItem.addActionListener(this);
1861
+// coneItem = menu.add(new MenuItem("Cone"));
1862
+// coneItem.addActionListener(this);
1863
+// torusItem = menu.add(new MenuItem("Torus"));
1864
+// torusItem.addActionListener(this);
1865
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1866
+// superItem.addActionListener(this);
1867
+
1868
+ cameraItem = menu.add(new MenuItem("Camera"));
1869
+ cameraItem.addActionListener(this);
1870
+
1871
+ if (!Globals.ADVANCED)
1872
+ {
1873
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1874
+ kleinItem.addActionListener(this);
1875
+ }
1876
+
1877
+// particleItem = menu.add(new MenuItem("Particle system"));
1878
+// particleItem.addActionListener(this);
1879
+ if (Globals.ADVANCED)
1880
+ {
10191881 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10201882 ragdollItem.addActionListener(this);
10211883 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10221884 ragdoll2Item.addActionListener(this);
1885
+ }
10231886 menu.add("-");
1024
- meshItem = menu.add(new MenuItem("Mesh"));
1887
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10251888 meshItem.addActionListener(this);
10261889 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10271890 // meshGroupItem.addActionListener(this);
1891
+ if (Globals.ADVANCED)
1892
+ {
10281893 springItem = menu.add(new MenuItem("Spring"));
10291894 springItem.addActionListener(this);
10301895 flagItem = menu.add(new MenuItem("Flag"));
10311896 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);
10361897 blobItem = menu.add(new MenuItem("Blob"));
10371898 blobItem.addActionListener(this);
10381899 latheItem = menu.add(new MenuItem("Lathe"));
10391900 latheItem.addActionListener(this);
1040
- lightItem = menu.add(new MenuItem("Light"));
1041
- lightItem.addActionListener(this);
1901
+ }
1902
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1903
+ bezierItem.addActionListener(this);
1904
+// overlayItem = menu.add(new MenuItem("Overlay"));
1905
+// overlayItem.addActionListener(this);
1906
+// lightItem = menu.add(new MenuItem("Light"));
1907
+// lightItem.addActionListener(this);
10421908 menu.add("-");
10431909 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10441910 //superLoopItem.addActionListener(this);
1045
- loopItem = menu.add(new MenuItem("Loop"));
1046
- loopItem.addActionListener(this);
1911
+// loopItem = menu.add(new MenuItem("Loop"));
1912
+// loopItem.addActionListener(this);
10471913 doubleItem = menu.add(new MenuItem("Fork"));
10481914 doubleItem.addActionListener(this);
1915
+ if (Globals.ADVANCED)
1916
+ {
10491917 tripleItem = menu.add(new MenuItem("Trident"));
10501918 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);
1919
+ }
10601920 }
10611921
10621922 void buildToolsMenu(Menu menu)
10631923 {
10641924 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10651925 animationItem.addItemListener(this);
1066
- animationItem.setState(CameraPane.ANIMATION);
1926
+ animationItem.setState(Globals.ANIMATION);
1927
+
1928
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1929
+ archiveItem.addActionListener(this);
10671930
10681931 menu.add("-");
10691932 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10701933 parseverticesItem.addActionListener(this);
1071
- alignItem = menu.add(new MenuItem("Align"));
1934
+ textureFieldItem = menu.add(new MenuItem("Texture Field"));
1935
+ textureFieldItem.addActionListener(this);
1936
+ alignItem = menu.add(new MenuItem("Align Objects"));
10721937 alignItem.addActionListener(this);
1073
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1074
- mirrorItem.addActionListener(this);
10751938 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10761939 reduceMorphItem.addActionListener(this);
10771940 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10781941 reduce34MorphItem.addActionListener(this);
1079
-
1080
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1081
- computeAOItem.addActionListener(this);
10821942 menu.add("-");
1083
-
10841943 menu.add(memoryItem = new MenuItem("Memory Usage"));
10851944 memoryItem.addActionListener(this);
1945
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1946
+ computeAOItem.addActionListener(this);
1947
+
1948
+ if (Globals.ADVANCED)
1949
+ {
1950
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1951
+ mirrorItem.addActionListener(this);
1952
+ menu.add("-");
10861953 menu.add(analyzeItem = new MenuItem("Analyze"));
10871954 analyzeItem.addActionListener(this);
1088
- menu.add(dumpItem = new MenuItem("Dump"));
1955
+ menu.add(dumpItem = new MenuItem("Print"));
10891956 dumpItem.addActionListener(this);
10901957 // menu.add(pathItem = new MenuItem("From-to path"));
10911958 // pathItem.addActionListener(this);
....@@ -1094,6 +1961,8 @@
10941961 resetParentItem.addActionListener(this);
10951962 repairParentItem = menu.add(new MenuItem("Repair Parent"));
10961963 repairParentItem.addActionListener(this);
1964
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1965
+ repairShadowItem.addActionListener(this);
10971966 menu.add(invariantsItem = new MenuItem("Invariants"));
10981967 invariantsItem.addActionListener(this);
10991968 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1101,6 +1970,7 @@
11011970 menu.add("-");
11021971 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11031972 editScriptItem.addActionListener(this);
1973
+ }
11041974 }
11051975
11061976 void ScreenFit()
....@@ -1223,9 +2093,34 @@
12232093 shadow.material = new cMaterial(obj.material);
12242094 shadow.material.diffuse = 0.0001f;
12252095 shadow.material.specular = 0.0001f;
2096
+ //shadow.projectedVertices[1].x = 300;
12262097
12272098 makeSomething(shadow);
12282099 }
2100
+
2101
+ private void ClearUnpinned()
2102
+ {
2103
+ //for (Object3D obj : listUI)
2104
+ for (int i=listUI.size(); --i>=0;)
2105
+ {
2106
+ Object3D obj = listUI.elementAt(i);
2107
+ if (!obj.pinned)
2108
+ {
2109
+ obj.CloseUI();
2110
+ listUI.remove(i);
2111
+ }
2112
+ }
2113
+ }
2114
+
2115
+ private void EditElement(Object3D elem, boolean newWindow)
2116
+ {
2117
+ // if (!(elem instanceof Composite))
2118
+ // newWindow = false;
2119
+ listUI.add(elem);
2120
+ elem.openEditWindow(this, newWindow); //, false);
2121
+ System.out.println("edit : " + elem);
2122
+ elem.editWindow.refreshContents(true); // ? new
2123
+ }
12292124
12302125 /**
12312126 * applyExample
....@@ -1429,9 +2324,9 @@
14292324
14302325 void Overwrite(int mask)
14312326 {
1432
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2327
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14332328 {
1434
- Object3D content = GraphreeD.clipboard.get(0);
2329
+ Object3D content = Grafreed.clipboard.get(0);
14352330
14362331 if (content instanceof cGroup && ((cGroup)content).transientlink )
14372332 content = ((cGroup)content).get(0);
....@@ -1454,6 +2349,7 @@
14542349 //
14552350 public void actionPerformed(ActionEvent event) // , Object arg)
14562351 {
2352
+ Object source = event.getSource();
14572353 /*
14582354 if (event.getSource() == nameField)
14592355 {
....@@ -1465,11 +2361,11 @@
14652361 }
14662362 else
14672363 */
1468
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
2364
+ if (source == lookAtItem || source == lookFromItem)
14692365 {
14702366 ScreenFit();
14712367 } else
1472
- if (event.getSource() == switchItem)
2368
+ if (source == switchViewItem)
14732369 {
14742370 cVector v1 = new cVector();
14752371 cVector v2 = new cVector();
....@@ -1478,11 +2374,11 @@
14782374 objEditor.cameraView.renderCamera.setAim(v2, v1);
14792375 objEditor.cameraView.repaint();
14802376 } else
1481
- if (event.getSource() == rectoidItem)
2377
+ if (source == rectoidItem || source == boxButton)
14822378 {
14832379 makeSomething(new Box());
14842380 } else
1485
- if (event.getSource() == particleItem)
2381
+ if (source == particleItem || source == particlesButton)
14862382 {
14872383 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
14882384 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1503,9 +2399,9 @@
15032399 applyExample(particleGeom, "SMOKE");
15042400 makeSomething(particleGeom);
15052401 } else
1506
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
2402
+ if (source == ragdollItem || source == ragdoll2Item)
15072403 {
1508
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
2404
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15092405
15102406 ragdoll.toParent = LA.newMatrix();
15112407 ragdoll.fromParent = LA.newMatrix();
....@@ -1521,27 +2417,71 @@
15212417 makeSomething(ragdoll);
15222418 //makeSomething(new VehicleDemo());
15232419 } else
1524
- if (event.getSource() == gridItem)
2420
+ /*
2421
+ */
2422
+ if (source == heightFieldItem)
2423
+ {
2424
+ Object3D obj = new Object3D();
2425
+
2426
+ obj.CreateMaterial();
2427
+ obj.bRep = new BoundaryRep();
2428
+
2429
+ obj.bRep.CreateMesh(new iHeightField()
2430
+ {
2431
+ public double f(double x, double y)
2432
+ {
2433
+ // The Mandelbrot set is represented by coloring
2434
+ // each point (x,y) according to the number of
2435
+ // iterations it takes before the while loop in
2436
+ // this method ends. For points that are actually
2437
+ // in the Mandelbrot set, or very close to it, the
2438
+ // count will reach the maximum value, 80. These
2439
+ // points will be colored purple. All other colors
2440
+ // represent points that are definitely NOT in the set.
2441
+ x -= 600;
2442
+ y -= 500;
2443
+ x /= 200;
2444
+ y /= 200;
2445
+ int count = 0;
2446
+ double zx = x;
2447
+ double zy = y;
2448
+ while (count < 80 && Math.abs(x) < 100 && Math.abs(zy) < 100) {
2449
+ double new_zx = zx*zx - zy*zy + x;
2450
+ zy = 2*zx*zy + y;
2451
+ zx = new_zx;
2452
+ count++;
2453
+ }
2454
+ return count; // Math.sqrt(count);
2455
+ }
2456
+ }, 1000,1000);
2457
+
2458
+ makeSomething(obj);
2459
+ } else
2460
+ if (source == gridItem || source == gridButton)
15252461 {
15262462 makeSomething(new Grid());
15272463 } else
1528
- if (event.getSource() == ellipsoidItem)
2464
+ if (source == ellipsoidItem || source == sphereButton)
15292465 {
15302466 makeSomething(new Sphere());
15312467 } else
1532
- if (event.getSource() == coneItem)
2468
+ if (source == coneItem || source == coneButton)
15332469 {
15342470 makeSomething(new Cone());
15352471 } else
1536
- if (event.getSource() == torusItem)
2472
+ if (source == torusItem || source == torusButton)
15372473 {
15382474 makeSomething(new Torus());
15392475 } else
1540
- if (event.getSource() == superItem)
2476
+ if (source == superItem || source == superButton)
15412477 {
15422478 makeSomething(new Superellipsoid());
15432479 } else
1544
- if (event.getSource() == blobItem)
2480
+ if (source == kleinItem || source == kleinButton)
2481
+ {
2482
+ makeSomething(new Klein());
2483
+ } else
2484
+ if (source == blobItem)
15452485 {
15462486 Blob blob = new Blob();
15472487 BlobComponent comp = new BlobComponent();
....@@ -1549,15 +2489,15 @@
15492489 //blob.retile();
15502490 makeSomething(blob);
15512491 } else
1552
- if (event.getSource() == latheItem)
2492
+ if (source == latheItem)
15532493 {
15542494 makeSomething(new Lathe());
15552495 } else
1556
- if (event.getSource() == bezierItem)
2496
+ if (source == bezierItem)
15572497 {
15582498 makeSomething(new BezierSurface());
15592499 } else
1560
- if (event.getSource() == checkerItem)
2500
+ if (source == overlayItem || source == overlayButton)
15612501 {
15622502 /*
15632503 Object3D obj = new BezierSurface(5,8);
....@@ -1570,9 +2510,9 @@
15702510 LA.matConcat(obj.toParent, cameraView.renderCamera.fromParent, obj.toParent);
15712511 LA.matInvert(obj.toParent, obj.fromParent);
15722512 */
1573
- makeSomething(new CheckerIG());
2513
+ makeSomething(new Checker());
15742514 } else
1575
- if (event.getSource() == meshItem)
2515
+ if (source == meshItem)
15762516 {
15772517 Object3D itemtomake = new Object3D();
15782518 Object3D child;
....@@ -1593,35 +2533,52 @@
15932533 makeSomething(child);
15942534 }
15952535 } else
1596
- if (event.getSource() == springItem)
2536
+ if (source == springItem)
15972537 {
15982538 cSpring s = new cSpring();
15992539 s.setup();
16002540 makeSomething(s);
16012541 } else
1602
- if (event.getSource() == flagItem)
2542
+ if (source == flagItem)
16032543 {
16042544 cSpring s = new cFlag();
16052545 s.setup();
16062546 makeSomething(s);
16072547 } else
1608
- if (event.getSource() == lightItem)
2548
+ if (source == lightItem || source == lightButton)
16092549 {
16102550 makeSomething(new Light());
16112551 } else
1612
- if (event.getSource() == csgItem)
2552
+// if (source == skybox1Button ||
2553
+// source == skybox2Button ||
2554
+// source == skybox3Button ||
2555
+// source == skybox4Button ||
2556
+// source == skybox5Button ||
2557
+// source == skybox6Button ||
2558
+// source == skybox7Button ||
2559
+// source == skybox11Button ||
2560
+// source == skybox12Button ||
2561
+// source == skybox13Button ||
2562
+// source == skybox14Button ||
2563
+// source == skybox15Button ||
2564
+// source == skybox16Button ||
2565
+// source == skybox17Button)
2566
+// {
2567
+// ChangeSkybox(source);
2568
+// } else
2569
+ if (source == csgItem)
16132570 {
16142571 group(new CSG());
16152572 } else
1616
- if (event.getSource() == templateItem)
2573
+ if (source == templateItem)
16172574 {
16182575 group(new cTemplate());
16192576 } else
1620
- if (event.getSource() == attributeItem)
2577
+ if (source == attributeItem)
16212578 {
16222579 makeSomething(new Attribute());
16232580 } else
1624
- if (event.getSource() == pointflowItem)
2581
+ if (source == pointflowItem)
16252582 {
16262583 makeSomething(new PointFlow());
16272584 } else
....@@ -1633,7 +2590,7 @@
16332590 } else
16342591 */
16352592
1636
- if (event.getSource() == superLoopItem)
2593
+ if (source == superLoopItem)
16372594 {
16382595 Composite g = new cGroup();
16392596 for (int i=0; i<15; i++)
....@@ -1655,30 +2612,30 @@
16552612
16562613 group(g);
16572614 } else
1658
- if (event.getSource() == loopItem)
2615
+ if (source == loopItem || source == loopButton)
16592616 {
16602617 Composite csg = new GroupLeaf();
16612618 csg.count = 5;
16622619 group(csg);
1663
- Composite child = new cGroup();
2620
+ Composite child = new cGroup("Branch");
16642621 csg.addChild(child);
16652622 child.addChild(csg);
16662623 } else
1667
- if (event.getSource() == doubleItem)
2624
+ if (source == doubleItem)
16682625 {
1669
- Composite csg = new GroupLeaf();
2626
+ Composite csg = new GroupLeaf("Fork");
16702627 csg.count = 5;
16712628 group(csg);
1672
- Composite child = new cGroup();
2629
+ Composite child = new cGroup("Branch A");
16732630 csg.addChild(child);
16742631 child.addChild(csg);
1675
- child = new cGroup();
2632
+ child = new cGroup("Branch B");
16762633 csg.addChild(child);
16772634 child.addChild(csg);
16782635 } else
1679
- if (event.getSource() == tripleItem)
2636
+ if (source == tripleItem)
16802637 {
1681
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Trident");
16822639 csg.count = 4;
16832640 group(csg);
16842641 Composite child = new cGroup();
....@@ -1691,73 +2648,105 @@
16912648 csg.addChild(child);
16922649 child.addChild(csg);
16932650 } else
1694
-
1695
- if (event.getSource() == importGFDItem)
2651
+ if (source == computeAOItem)
16962652 {
1697
- ImportGFD();
2653
+ Globals.drawMode = CameraPane.OCCLUSION;
2654
+ cameraView.repaint();
16982655 } 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)
2656
+ if (source == recompileItem)
17172657 {
17182658 Recompile();
17192659 refreshContents();
17202660 } else
1721
- if (event.getSource() == editScriptItem)
2661
+ if (source == editScriptItem)
17222662 {
17232663 OpenDialog();
17242664 refreshContents();
17252665 } else
1726
- if (event.getSource() == invariantsItem)
2666
+ if (source == invariantsItem)
17272667 {
17282668 System.out.println("Invariants:");
1729
- GraphreeD.theApplet3D.universe.invariants();
2669
+ Grafreed.grafreed.universe.invariants();
17302670 } else
1731
- if (event.getSource() == memoryItem)
2671
+ if (source == memoryItem)
17322672 {
17332673 //System.out.println("Invariants:");
17342674 PrintMemory();
17352675 } else
1736
- if (event.getSource() == pathItem)
2676
+ if (source == pathItem)
17372677 {
17382678 PrintPath();
17392679 } else
1740
- if (event.getSource() == analyzeItem)
2680
+ if (source == analyzeItem)
17412681 {
17422682 AnalyzeObject();
17432683 } else
1744
- if (event.getSource() == dumpItem)
2684
+ if (source == dumpItem)
17452685 {
17462686 DumpObject();
17472687 } else
1748
- if (event.getSource() == screenfitButton)
2688
+ if (source == minButton)
17492689 {
1750
- //Reload(lastConverter, lastFilename, true);
2690
+ Minimize();
2691
+ } else
2692
+ if (source == maxButton)
2693
+ {
2694
+ Maximize();
2695
+ } else
2696
+ if (source == fullButton)
2697
+ {
2698
+ ToggleFullScreen();
2699
+ } else
2700
+ if (source == previousVersionButton)
2701
+ {
2702
+ // Go to previous version
2703
+ //if (!Undo())
2704
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2705
+ PreviousVersion();
2706
+ } else
2707
+ if (source == restoreButton)
2708
+ {
2709
+ // Restore current version
2710
+ Restore();
2711
+ //restoreButton.setEnabled(false);
2712
+ } else
2713
+ if (source == replaceButton)
2714
+ {
2715
+ // Overwrite current version
2716
+ Replace();
2717
+ //replaceButton.setEnabled(false);
2718
+ } else
2719
+ if (source == nextVersionButton)
2720
+ {
2721
+ // Go to next version
2722
+ NextVersion();
2723
+ } else
2724
+ if (source == saveVersionButton)
2725
+ {
2726
+ // Save a new version
2727
+ if (!Save(true))
2728
+ java.awt.Toolkit.getDefaultToolkit().beep();
2729
+ } else
2730
+ if (source == deleteVersionButton)
2731
+ {
2732
+ // Delete a new version
2733
+ DeleteVersion();
2734
+ } else
2735
+ if (source == oneStepButton)
2736
+ {
2737
+ Globals.ONESTEP = true;
2738
+ cameraView.repaint();
2739
+ } else
2740
+ if (source == screenfitButton)
2741
+ {
17512742 ScreenFit();
17522743 } else
1753
- if (event.getSource() == screenfitpointButton)
2744
+ if (source == screenfitpointButton)
17542745 {
1755
- //Reload(lastConverter, lastFilename, true);
17562746 ScreenFitPoint();
17572747 } else
1758
- if (event.getSource() == snapobjectButton)
2748
+ if (source == snapobjectButton)
17592749 {
1760
- //Reload(lastConverter, lastFilename, true);
17612750 SnapObject();
17622751 } else
17632752 // if (event.getSource() == recompileButton)
....@@ -1766,13 +2755,13 @@
17662755 // Recompile();
17672756 // refreshContents();
17682757 // } else
1769
- if (event.getSource() == gcButton)
2758
+ if (source == gcButton)
17702759 {
17712760 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17722761 System.gc();
17732762 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
17742763 } else
1775
- if (event.getSource() == editLeafItem)
2764
+ if (source == editLeafItem)
17762765 {
17772766 Object3D obj;
17782767 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1786,65 +2775,78 @@
17862775 }
17872776 refreshContents(true);
17882777 } else
1789
- if (event.getSource() == openWindowItem)
2778
+ if (source == openWindowItem)
17902779 {
17912780 EditSelection(true);
17922781 } else
1793
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2782
+ if (source == cutItem || source == clearButton)
17942783 {
17952784 loadClipboard(true);
17962785 } else
1797
- if (event.getSource() == duplicateItem)
2786
+ if (source == undoItem)
17982787 {
1799
- Object3D keep = GraphreeD.clipboard;
2788
+ PreviousVersion();
2789
+ } else
2790
+ if (source == redoItem)
2791
+ {
2792
+ NextVersion();
2793
+ } else
2794
+ if (source == duplicateItem)
2795
+ {
2796
+ Object3D keep = Grafreed.clipboard;
18002797 loadClipboard(false);
18012798 paste(false);
1802
- GraphreeD.clipboard = keep;
2799
+ Grafreed.clipboard = keep;
18032800 } else
1804
- if (event.getSource() == cloneItem)
2801
+ if (source == cloneItem)
18052802 {
18062803 CloneSelection(false);
18072804 } else
1808
- if (event.getSource() == cloneSupportItem)
2805
+ if (source == cloneSupportItem)
18092806 {
18102807 CloneSelection(true);
18112808 } else
1812
- if (event.getSource() == copyItem)
2809
+ if (source == copyItem)
18132810 {
18142811 loadClipboard(false);
18152812 } else
1816
- if (event.getSource() == pasteItem)
2813
+ if (source == pasteItem)
18172814 {
18182815 paste(false);
18192816 } else
1820
- if (event.getSource() == pasteLinkItem)
2817
+ if (source == pasteIntoItem)
18212818 {
1822
- pasteInto(false);
2819
+ pasteInto(true, false);
18232820 } else
1824
- if (event.getSource() == pasteCloneItem)
2821
+ if (source == pasteLinkItem)
18252822 {
1826
- pasteInto(true);
2823
+ pasteInto(false, false);
18272824 } else
1828
- if (event.getSource() == pasteExpandItem)
2825
+ if (source == pasteCloneItem)
2826
+ {
2827
+ pasteInto(true, true);
2828
+ } else
2829
+ if (source == pasteExpandItem)
18292830 {
18302831 paste(true);
18312832 } else
1832
- if (event.getSource() == synchronizeItem)
2833
+ if (source == synchronizeItem)
18332834 {
18342835 Overwrite(Object3D.TRANSFORM);
18352836 } else
1836
- if (event.getSource() == overwriteNameItem)
2837
+ if (source == overwriteNameItem)
18372838 {
18382839 Overwrite(Object3D.NAME);
18392840 } else
1840
- if (event.getSource() == overwriteUVItem)
2841
+ if (source == overwriteUVItem)
18412842 {
18422843 Overwrite(Object3D.UV);
18432844 } else
1844
- if (event.getSource() == overwriteMatItem)
2845
+ if (source == overwriteMatItem)
18452846 {
2847
+ /* july 2015
18462848 if ((dropAttributes & Object3D.TEXTURE) == 0)
1847
- Overwrite(Object3D.MATERIAL);
2849
+ Overwrite(Object3D.MATERIAL | Object3D.COLOR);
18482850 else
18492851 {
18502852 if ((dropAttributes & Object3D.COLOR) == 0 && (dropAttributes & Object3D.MATERIAL) == 0)
....@@ -1856,13 +2858,16 @@
18562858 Overwrite(Object3D.MATERIAL | Object3D.TEXTURE);
18572859 }
18582860 }
2861
+ */
2862
+
2863
+ Overwrite(dropAttributes);
18592864 }
1860
- if (event.getSource() == overwriteGeoItem)
2865
+ if (source == overwriteGeoItem)
18612866 {
18622867 Overwrite(Object3D.GEOMETRY);
1863
-// if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
2868
+// if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
18642869 // {
1865
-// Object3D content = GraphreeD.clipboard.get(0);
2870
+// Object3D content = GrafreeD.clipboard.get(0);
18662871 //
18672872 // if (content instanceof cGroup && ((cGroup)content).transientlink )
18682873 // content = ((cGroup)content).get(0);
....@@ -1874,7 +2879,7 @@
18742879 // refreshContents();
18752880 // }
18762881 } else
1877
- if (event.getSource() == generateMeshItem)
2882
+ if (source == generateMeshItem)
18782883 {
18792884 //if (group.selection.size() == 1)
18802885 // for (int i=0; i<group.selection.size(); i++)
....@@ -1885,7 +2890,7 @@
18852890 ResetModel();
18862891 refreshContents();
18872892 } else
1888
- if (event.getSource() == extractGeometriesItem)
2893
+ if (source == extractGeometriesItem)
18892894 {
18902895 boolean one = false;
18912896
....@@ -1912,7 +2917,7 @@
19122917 ResetModel();
19132918 refreshContents();
19142919 } else
1915
- if (event.getSource() == cloneGeometriesItem)
2920
+ if (source == cloneGeometriesItem)
19162921 {
19172922 boolean one = false;
19182923
....@@ -1938,32 +2943,37 @@
19382943 ResetModel();
19392944 refreshContents();
19402945 } else
1941
- if (event.getSource() == shareGeometriesItem)
2946
+ if (source == shareGeometriesItem)
19422947 {
19432948 boolean one = false;
19442949
19452950 if (group.selection.size() == 1)
19462951 one = true;
19472952
2953
+ Object3D merge = null;
2954
+
19482955 Object3D content = new cGroup();
19492956
19502957 for (int i=0; i<group.selection.size(); i++)
19512958 {
1952
- Object3D sel = new Merge(group.selection.get(i));
2959
+ merge = new Merge(group.selection.get(i));
19532960
19542961 if (one)
1955
- makeSomething(sel, false);
2962
+ makeSomething(merge, false);
19562963 else
1957
- content.addChild(sel);
2964
+ content.addChild(merge);
19582965 }
19592966
19602967 if (!one)
1961
- makeSomething(content, false);
1962
-
1963
- ResetModel();
1964
- refreshContents();
2968
+ makeSomething(content, true);
2969
+ else
2970
+ {
2971
+ ResetModel();
2972
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2973
+ refreshContents();
2974
+ }
19652975 } else
1966
- if (event.getSource() == mergeGeometriesItem)
2976
+ if (source == mergeGeometriesItem)
19672977 {
19682978 boolean one = false;
19692979
....@@ -1993,11 +3003,11 @@
19933003 ResetModel();
19943004 refreshContents();
19953005 } else
1996
- if (event.getSource() == linkverticesItem)
3006
+ if (source == linkverticesItem)
19973007 {
1998
-// if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3008
+// if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
19993009 // {
2000
-// Object3D content = GraphreeD.clipboard.get(0);
3010
+// Object3D content = GrafreeD.clipboard.get(0);
20013011 //
20023012 // if (content instanceof cGroup && ((cGroup)content).transientlink )
20033013 // content = ((cGroup)content).get(0);
....@@ -2006,39 +3016,48 @@
20063016 // group.selection.get(0).setMasterThis(content); // should be identity
20073017 // refreshContents();
20083018 // }
2009
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
3019
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20103020 {
2011
- Object3D content = GraphreeD.clipboard.get(0);
3021
+ Object3D content = Grafreed.clipboard.get(0);
20123022
20133023 if (content instanceof cGroup && ((cGroup)content).transientlink )
20143024 content = ((cGroup)content).get(0);
20153025
2016
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
3026
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20173027 for (int i=0; i<group.selection.size(); i++)
20183028 {
2019
- boolean random = CameraPane.RANDOM;
2020
- CameraPane.RANDOM = false; // parse all random nodes
3029
+ boolean random = CameraPane.SWITCH;
3030
+ CameraPane.SWITCH = false; // parse all random nodes
20213031 group.selection.get(i).linkVerticesThis(content);
20223032 // group.selection.get(i).setMasterThis(content); // should be identity
2023
- CameraPane.RANDOM = random;
3033
+ CameraPane.SWITCH = random;
20243034 }
2025
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
3035
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20263036 refreshContents();
20273037 }
20283038 } else
2029
- if (event.getSource() == resetsupportItem)
3039
+ if (source == resetsupportItem)
20303040 {
20313041 for (int i=0; i<group.selection.size(); i++)
20323042 {
2033
- boolean random = CameraPane.RANDOM;
2034
- CameraPane.RANDOM = false; // parse all random nodes
3043
+ boolean random = CameraPane.SWITCH;
3044
+ CameraPane.SWITCH = false; // parse all random nodes
20353045 group.selection.get(i).linkVerticesThis(null);
2036
- CameraPane.RANDOM = random;
3046
+ CameraPane.SWITCH = random;
20373047 }
20383048
20393049 refreshContents();
20403050 } else
2041
- if (event.getSource() == resetreferencesItem)
3051
+ if (source == relinkverticesItem)
3052
+ {
3053
+ boolean random = CameraPane.SWITCH;
3054
+ CameraPane.SWITCH = false; // parse all random nodes
3055
+ group.selection.RelinkToSupport();
3056
+ CameraPane.SWITCH = random;
3057
+
3058
+ refreshContents();
3059
+ } else
3060
+ if (source == resetreferencesItem)
20423061 {
20433062 for (int i=0; i<group.selection.size(); i++)
20443063 {
....@@ -2047,11 +3066,11 @@
20473066
20483067 refreshContents();
20493068 } else
2050
- if (event.getSource() == setMasterItem)
3069
+ if (source == setMasterItem)
20513070 {
2052
- if (group.selection.size() == 1 && GraphreeD.clipboard.size() == 1)
3071
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
20533072 {
2054
- Object3D content = GraphreeD.clipboard.get(0);
3073
+ Object3D content = Grafreed.clipboard.get(0);
20553074
20563075 if (content instanceof cGroup && ((cGroup)content).transientlink )
20573076 content = ((cGroup)content).get(0);
....@@ -2060,13 +3079,13 @@
20603079 refreshContents();
20613080 }
20623081 } else
2063
- if (event.getSource() == poseMeshItem)
3082
+ if (source == poseMeshItem)
20643083 {
20653084 if (group.selection.size() == 1)
20663085 {
2067
- if (GraphreeD.clipboard.size() == 1)
3086
+ if (Grafreed.clipboard.size() == 1)
20683087 {
2069
- Object3D content = GraphreeD.clipboard.get(0);
3088
+ Object3D content = Grafreed.clipboard.get(0);
20703089
20713090 if (content instanceof cGroup && ((cGroup)content).transientlink )
20723091 content = ((cGroup)content).get(0);
....@@ -2079,19 +3098,19 @@
20793098 }
20803099
20813100 } else
2082
- if (event.getSource() == revertMeshItem)
3101
+ if (source == revertMeshItem)
20833102 {
20843103 RevertMeshes();
20853104 } else
2086
- if (event.getSource() == resetMeshItem)
3105
+ if (source == resetAllItem)
20873106 {
20883107 ResetAll();
20893108 } else
2090
- if (event.getSource() == stepAllItem)
3109
+ if (source == stepAllItem)
20913110 {
20923111 StepAll();
20933112 } else
2094
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
3113
+ if (source == deleteItem) // || event.getSource() == clearButton)
20953114 {
20963115 //int indices[] = jList.getSelectedIndices();
20973116 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2099,42 +3118,46 @@
20993118
21003119 ClearSelection(false);
21013120 } else
2102
- if (event.getSource() == clearAllItem)
3121
+ if (source == clearAllItem)
21033122 {
21043123 ClearSelection(true);
21053124 } else
2106
- if (event.getSource() == grabItem)
3125
+ if (source == grabItem || source == groupButton)
21073126 {
2108
- group(new cGroup(), true);
3127
+ group(new cGroup(), false); // true);
21093128 } else
2110
- if (event.getSource() == frontItem)
3129
+ if (source == hideItem)
3130
+ {
3131
+ group(new HiddenObject());
3132
+ } else
3133
+ if (source == frontItem)
21113134 {
21123135 front();
21133136 } else
2114
- if (event.getSource() == backItem)
3137
+ if (source == backItem)
21153138 {
21163139 back();
21173140 } else
2118
- if (event.getSource() == cameraItem)
3141
+ if (source == cameraItem)
21193142 {
21203143 makeSomething(new Camera());
21213144 } else
2122
- if (event.getSource() == compositeItem)
3145
+ if (source == compositeItem || source == compositeButton)
21233146 {
21243147 group(new Composite());
21253148 } else
2126
- if (event.getSource() == randomItem)
3149
+ if (source == switchItem || source == switchButton)
21273150 {
21283151 RandomNode random = new RandomNode();
21293152 group(random);
21303153 if (random.size() > 0)
2131
- random.name = random.get(0).name + "Rnd";
3154
+ random.name = random.get(0).name + "Switch";
21323155 } else
2133
- if (event.getSource() == physicsItem)
3156
+ if (source == physicsItem)
21343157 {
21353158 group(new PhysicsNode());
21363159 } else
2137
- if (event.getSource() == frameselectorItem)
3160
+ if (source == frameselectorItem)
21383161 {
21393162 for (int i=0; i<group.selection.size(); i++)
21403163 {
....@@ -2146,7 +3169,7 @@
21463169 ResetModel();
21473170 refreshContents();
21483171 } else
2149
- if (event.getSource() == switchGeoItem)
3172
+ if (source == switchGeoItem)
21503173 {
21513174 for (int i=0; i<group.selection.size(); i++)
21523175 {
....@@ -2158,7 +3181,7 @@
21583181 ResetModel();
21593182 refreshContents();
21603183 } else
2161
- if (event.getSource() == switchTransfoItem)
3184
+ if (source == switchTransfoItem)
21623185 {
21633186 for (int i=0; i<group.selection.size(); i++)
21643187 {
....@@ -2170,7 +3193,7 @@
21703193 ResetModel();
21713194 refreshContents();
21723195 } else
2173
- if (event.getSource() == morphItem)
3196
+ if (source == morphItem)
21743197 {
21753198 for (int i=0; i<group.selection.size(); i++)
21763199 {
....@@ -2182,7 +3205,7 @@
21823205 ResetModel();
21833206 refreshContents();
21843207 } else
2185
- if (event.getSource() == scriptNodeItem)
3208
+ if (source == scriptNodeItem)
21863209 {
21873210 boolean atleastone = false;
21883211
....@@ -2221,191 +3244,252 @@
22213244 }
22223245 }
22233246 } else
2224
- if (event.getSource() == linkerItem)
3247
+ if (source == linkerItem)
22253248 {
22263249 group(new cLinker());
22273250 } else
2228
- if (event.getSource() == textureItem)
3251
+ if (source == textureItem || source == textureButton)
22293252 {
22303253 group(new TextureNode());
22313254 } else
2232
- if (event.getSource() == shadowXItem)
3255
+ if (source == billboardItem)
3256
+ {
3257
+ group(new BillboardNode());
3258
+ } else
3259
+ if (source == shadowXItem)
22333260 {
22343261 CastShadow(0);
22353262 } else
2236
- if (event.getSource() == shadowYItem)
3263
+ if (source == shadowYItem)
22373264 {
22383265 CastShadow(1);
22393266 } else
2240
- if (event.getSource() == shadowZItem)
3267
+ if (source == shadowZItem)
22413268 {
22423269 CastShadow(2);
22433270 } else
2244
- if (event.getSource() == ungroupItem)
3271
+ if (source == ungroupItem || source == ungroupButton)
22453272 {
2246
- ungroup();
3273
+ boolean hasRoot = false;
3274
+
3275
+ for (int i=0; i<group.selection.size(); i++)
3276
+ {
3277
+ if (group.selection.get(i) == group)
3278
+ {
3279
+ hasRoot = true;
3280
+ break;
3281
+ }
3282
+ }
3283
+
3284
+ if (!hasRoot)
3285
+ {
3286
+ for (int i=0; i<group.selection.size(); i++)
3287
+ {
3288
+ Ungroup(group.selection.get(i));
3289
+ }
3290
+
3291
+ ClearSelection(false);
3292
+
3293
+ refreshContents();
3294
+ }
22473295 } else
2248
- if (event.getSource() == genUVItem)
3296
+ if (source == genUVItem)
22493297 {
22503298 GenUV();
22513299 } else
2252
- if (event.getSource() == genNormalsCADItem)
3300
+ if (source == genNormalsCADItem)
22533301 {
22543302 GenNormals(true);
22553303 } else
2256
- if (event.getSource() == genNormalsORGANItem)
3304
+ if (source == genNormalsMESHItem)
3305
+ {
3306
+ GenNormalsMESH();
3307
+ } else
3308
+ if (source == genNormalsORGANItem)
22573309 {
22583310 GenNormals(false);
22593311 } else
2260
- if (event.getSource() == stripifyItem)
3312
+ if (source == genNormalsMINEItem)
3313
+ {
3314
+ GenNormalsMINE();
3315
+ } else
3316
+ if (source == stripifyItem)
22613317 {
22623318 Stripify();
22633319 } else
2264
- if (event.getSource() == unstripifyItem)
3320
+ if (source == unstripifyItem)
22653321 {
22663322 Unstripify();
22673323 } else
2268
- if (event.getSource() == trimItem)
3324
+ if (source == trimItem)
22693325 {
22703326 Trim();
22713327 } else
2272
- if (event.getSource() == untrimItem)
3328
+ if (source == untrimItem)
22733329 {
22743330 Untrim();
22753331 } else
2276
- if (event.getSource() == clearColorsItem)
3332
+ if (source == clearColorsItem)
22773333 {
22783334 ClearColors();
22793335 } else
2280
- if (event.getSource() == clearMaterialsItem)
3336
+ if (source == clearMaterialsItem)
22813337 {
22823338 ClearMaterials();
22833339 } else
2284
- if (event.getSource() == liveleavesItem)
3340
+ if (source == liveleavesItem)
22853341 {
22863342 LiveLeaves(true);
22873343 } else
2288
- if (event.getSource() == unliveleavesItem)
3344
+ if (source == unliveleavesItem)
22893345 {
22903346 LiveLeaves(false);
22913347 } else
2292
- if (event.getSource() == supportleavesItem)
3348
+ if (source == supportleavesItem)
22933349 {
22943350 SupportLeaves(true);
22953351 } else
2296
- if (event.getSource() == unsupportleavesItem)
3352
+ if (source == unsupportleavesItem)
22973353 {
22983354 SupportLeaves(false);
22993355 } else
2300
- if (event.getSource() == hideleavesItem)
3356
+ if (source == hideleavesItem)
23013357 {
23023358 HideLeaves(true);
23033359 } else
2304
- if (event.getSource() == showleavesItem)
3360
+ if (source == showleavesItem)
23053361 {
23063362 HideLeaves(false);
23073363 } else
2308
- if (event.getSource() == markleavesItem)
3364
+ if (source == markleavesItem)
23093365 {
23103366 MarkLeaves(true);
23113367 } else
2312
- if (event.getSource() == unmarkleavesItem)
3368
+ if (source == unmarkleavesItem)
23133369 {
23143370 MarkLeaves(false);
23153371 } else
2316
- if (event.getSource() == flipVItem)
3372
+ if (source == rewindleavesItem)
3373
+ {
3374
+ RewindLeaves(true);
3375
+ } else
3376
+ if (source == unrewindleavesItem)
3377
+ {
3378
+ RewindLeaves(false);
3379
+ } else
3380
+ if (source == randomleavesItem)
3381
+ {
3382
+ RandomLeaves(true);
3383
+ } else
3384
+ if (source == unrandomleavesItem)
3385
+ {
3386
+ RandomLeaves(false);
3387
+ } else
3388
+ if (source == flipVItem)
23173389 {
23183390 FlipV(true);
23193391 } else
2320
- if (event.getSource() == unflipVItem)
3392
+ if (source == unflipVItem)
23213393 {
23223394 FlipV(false);
23233395 } else
2324
- if (event.getSource() == lowTexturesItem)
3396
+ if (source == lowTexturesItem)
23253397 {
23263398 SetTexRes(0);
23273399 } else
2328
- if (event.getSource() == normalTexturesItem)
3400
+ if (source == normalTexturesItem)
23293401 {
23303402 SetTexRes(1);
23313403 } else
2332
- if (event.getSource() == highTexturesItem)
3404
+ if (source == highTexturesItem)
23333405 {
23343406 SetTexRes(2);
23353407 } else
2336
- if (event.getSource() == veryhighTexturesItem)
3408
+ if (source == veryhighTexturesItem)
23373409 {
23383410 SetTexRes(3);
23393411 } else
2340
- if (event.getSource() == maxTexturesItem)
3412
+ if (source == maxTexturesItem)
23413413 {
23423414 SetTexRes(4);
23433415 } else
2344
- if (event.getSource() == panoTexturesItem)
3416
+ if (source == panoTexturesItem)
23453417 {
23463418 SetTexRes(5);
23473419 } else
2348
- if (event.getSource() == reverseNormalsItem)
3420
+ if (source == reverseNormalsItem)
23493421 {
23503422 ReverseNormals();
23513423 } else
2352
- if (event.getSource() == parseverticesItem)
3424
+ if (source == parseverticesItem)
23533425 {
23543426 ParseVertices();
23553427 } else
2356
- if (event.getSource() == alignItem)
3428
+ if (source == textureFieldItem)
3429
+ {
3430
+ TextureVertices();
3431
+ } else
3432
+ if (source == alignItem)
23573433 {
23583434 Align();
23593435 } else
2360
- if (event.getSource() == mirrorItem)
3436
+ if (source == mirrorItem)
23613437 {
23623438 MirrorPoses();
23633439 } else
2364
- if (event.getSource() == reduceMorphItem)
3440
+ if (source == reduceMorphItem)
23653441 {
23663442 MeshReduction(false);
23673443 } else
2368
- if (event.getSource() == reduce34MorphItem)
3444
+ if (source == reduce34MorphItem)
23693445 {
23703446 MeshReduction(true);
23713447 } else
2372
- if (event.getSource() == reverseTrianglesItem)
3448
+ if (source == reverseTrianglesItem)
23733449 {
23743450 ReverseTriangles();
23753451 } else
2376
- if (event.getSource() == reduceMeshItem)
3452
+ if (source == reduceMeshItem)
23773453 {
23783454 ReduceMesh(false);
23793455 } else
2380
- if (event.getSource() == reduce34MeshItem)
3456
+ if (source == reduce34MeshItem)
23813457 {
23823458 ReduceMesh(true);
23833459 } else
2384
- if (event.getSource() == increaseMeshItem)
3460
+ if (source == increaseMeshItem)
23853461 {
23863462 IncreaseMesh();
23873463 } else
2388
- if (event.getSource() == clipMeshItem)
3464
+ if (source == clipMeshItem)
23893465 {
23903466 ClipMesh();
23913467 } else
2392
- if (event.getSource() == smoothMeshItem)
3468
+ if (source == smoothMeshItem)
23933469 {
23943470 SmoothMesh();
23953471 } else
2396
- if (event.getSource() == transformgeometryItem)
3472
+ if (source == transformGeometryItem)
23973473 {
23983474 TransformGeometry();
23993475 } else
2400
- if (event.getSource() == resetTransformItem)
3476
+ if (source == transformChildrenItem)
3477
+ {
3478
+ TransformChildren();
3479
+ } else
3480
+ if (source == resetTransformItem)
24013481 {
24023482 ResetTransform();
24033483 } else
2404
- if (event.getSource() == resetCentroidItem)
3484
+ if (source == resetCentroidItem)
24053485 {
2406
- ResetCentroid();
3486
+ ResetCentroid(true);
24073487 } else
2408
- if (event.getSource() == resetParentItem)
3488
+ if (source == resetCentroidXZItem)
3489
+ {
3490
+ ResetCentroid(false);
3491
+ } else
3492
+ if (source == resetParentItem)
24093493 {
24103494 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24113495 {
....@@ -2415,7 +3499,7 @@
24153499
24163500 refreshContents();
24173501 } else
2418
- if (event.getSource() == repairParentItem)
3502
+ if (source == repairParentItem)
24193503 {
24203504 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24213505 {
....@@ -2429,7 +3513,21 @@
24293513
24303514 refreshContents();
24313515 } else
2432
- if (event.getSource() == sortbysizeItem)
3516
+ if (source == repairShadowItem)
3517
+ {
3518
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3519
+ {
3520
+ Object3D obj = (Object3D)e.nextElement();
3521
+ obj.RepairShadow();
3522
+// for (int i=0; i<obj.size(); i++)
3523
+// {
3524
+// obj.get(i).parent = obj;
3525
+// }
3526
+ }
3527
+
3528
+ refreshContents();
3529
+ } else
3530
+ if (source == sortbysizeItem)
24333531 {
24343532 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24353533 {
....@@ -2441,7 +3539,7 @@
24413539 ResetModel();
24423540 refreshContents();
24433541 } else
2444
- if (event.getSource() == sortbynameItem)
3542
+ if (source == sortbynameItem)
24453543 {
24463544 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24473545 {
....@@ -2453,7 +3551,7 @@
24533551 ResetModel();
24543552 refreshContents();
24553553 } else
2456
- if (event.getSource() == attachPigmentItem)
3554
+ if (source == attachPigmentItem)
24573555 {
24583556 String texture = GetFile("Attach pigment");
24593557 Object3D obj;
....@@ -2465,7 +3563,7 @@
24653563
24663564 refreshContents();
24673565 } else
2468
- if (event.getSource() == detachPigmentItem)
3566
+ if (source == detachPigmentItem)
24693567 {
24703568 Object3D obj;
24713569 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2476,7 +3574,7 @@
24763574
24773575 refreshContents();
24783576 } else
2479
- if (event.getSource() == attachBumpItem)
3577
+ if (source == attachBumpItem)
24803578 {
24813579 String texture = GetFile("Attach bump");
24823580 Object3D obj;
....@@ -2488,18 +3586,18 @@
24883586
24893587 refreshContents();
24903588 } else
2491
- if (event.getSource() == detachBumpItem)
3589
+ if (source == detachBumpItem)
24923590 {
24933591 Object3D obj;
24943592 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24953593 {
24963594 obj = (Object3D)e.nextElement();
2497
- obj.SetBumpTexture(null);
3595
+ obj.ResetBumpTexture();
24983596 }
24993597
25003598 refreshContents();
25013599 } else
2502
- if (event.getSource() == pigmentBumpItem)
3600
+ if (source == pigmentBumpItem)
25033601 {
25043602 Object3D obj;
25053603 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2510,158 +3608,262 @@
25103608
25113609 refreshContents();
25123610 } else
2513
- if (event.getSource() == flashSelectionButton)
3611
+ if (source == embedTexturesItem)
3612
+ {
3613
+ Object3D obj;
3614
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3615
+ {
3616
+ obj = (Object3D)e.nextElement();
3617
+ obj.EmbedTextures(true);
3618
+ }
3619
+
3620
+ refreshContents();
3621
+ } else
3622
+ if (source == deEmbedTexturesItem)
3623
+ {
3624
+ Object3D obj;
3625
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3626
+ {
3627
+ obj = (Object3D)e.nextElement();
3628
+ obj.EmbedTextures(false);
3629
+ }
3630
+
3631
+ CameraPane.texturepigment.clear();
3632
+ CameraPane.texturebump.clear();
3633
+
3634
+ refreshContents();
3635
+ } else
3636
+ if (source == flashSelectionButton)
25143637 {
25153638 CameraPane.flash = true;
25163639 refreshContents();
25173640 } else
2518
- if (event.getSource() == oneButton)
3641
+ if (source == oneButton)
25193642 {
25203643 } else
2521
- if (event.getSource() == twoButton)
3644
+ if (source == twoButton)
25223645 {
25233646 radio.layout = twoButton;
3647
+
3648
+ if (CameraPane.FULLSCREEN)
3649
+ fullscreenLayout = radio.layout;
3650
+
25243651 // bug
25253652 //gridPanel.setDividerLocation(1.0);
25263653 //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();
3654
+// bigThree.remove(scenePanel);
3655
+// bigThree.remove(centralPanel);
3656
+// bigThree.remove(XYZPanel);
3657
+// aWindowConstraints.gridx = 0;
3658
+// aWindowConstraints.gridy = 0;
3659
+// aWindowConstraints.gridwidth = 1;
3660
+// // aConstraints.gridheight = 3;
3661
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3662
+// aWindowConstraints.weightx = 0;
3663
+// aWindowConstraints.weighty = 1;
3664
+// //bigThree.add(jtp, aWindowConstraints);
3665
+// aWindowConstraints.weightx = 1;
3666
+// aWindowConstraints.gridwidth = 3;
3667
+// // aConstraints.gridheight = 3;
3668
+// aWindowConstraints.gridx = 1;
3669
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3670
+// bigThree.add(centralPanel, aWindowConstraints);
3671
+// aWindowConstraints.weightx = 0;
3672
+// aWindowConstraints.gridx = 4;
3673
+// aWindowConstraints.gridwidth = 1;
3674
+// // aConstraints.gridheight = 3;
3675
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3676
+// //bigThree.add(XYZPanel, aWindowConstraints);
3677
+// scenePanel.setVisible(false);
3678
+// centralPanel.setVisible(true);
3679
+// XYZPanel.setVisible(false);
3680
+ bigThree.ClearUI();
3681
+ bigThree.add(centralPanel);
3682
+ bigThree.FlushUI();
3683
+
3684
+ cameraView.requestFocusInWindow();
3685
+
3686
+// refreshContents(true);
3687
+//
3688
+// try
3689
+// {
3690
+// java.awt.Robot bot = new java.awt.Robot();
3691
+// int mask = InputEvent.BUTTON1_MASK;
3692
+// bot.mouseMove(100, 100);
3693
+// bot.mousePress(mask);
3694
+// bot.mouseRelease(mask);
3695
+// }
3696
+// catch (Exception e)
3697
+// {
3698
+//
3699
+// }
3700
+
25513701 } else
2552
- if (event.getSource() == threeButton)
3702
+ if (source == threeButton)
25533703 {
25543704 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();
3705
+
3706
+ if (CameraPane.FULLSCREEN)
3707
+ fullscreenLayout = radio.layout;
3708
+
3709
+// bigThree.remove(scenePanel);
3710
+// bigThree.remove(centralPanel);
3711
+// bigThree.remove(XYZPanel);
3712
+// aWindowConstraints.gridx = 0;
3713
+// aWindowConstraints.gridy = 0;
3714
+// aWindowConstraints.gridwidth = 1;
3715
+// // aConstraints.gridheight = 3;
3716
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3717
+// aWindowConstraints.weightx = 0;
3718
+// aWindowConstraints.weighty = 1;
3719
+// //bigThree.add(jtp, aWindowConstraints);
3720
+// aWindowConstraints.weightx = 1;
3721
+// aWindowConstraints.gridwidth = 3;
3722
+// // aConstraints.gridheight = 3;
3723
+// aWindowConstraints.gridx = 1;
3724
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3725
+// bigThree.add(centralPanel, aWindowConstraints);
3726
+// aWindowConstraints.weightx = 0;
3727
+// aWindowConstraints.gridx = 4;
3728
+// aWindowConstraints.gridwidth = 1;
3729
+// // aConstraints.gridheight = 3;
3730
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3731
+// bigThree.add(XYZPanel, aWindowConstraints);
3732
+// bigThree.validate();
3733
+// scenePanel.setVisible(false);
3734
+// centralPanel.setVisible(true);
3735
+// XYZPanel.setVisible(true);
3736
+ bigThree.ClearUI();
3737
+ bigThree.add(scenePanel);
3738
+ bigThree.add(centralPanel);
3739
+ bigThree.FlushUI();
3740
+
3741
+ cameraView.requestFocusInWindow();
25793742 } else
2580
- if (event.getSource() == fourButton)
3743
+ if (source == fourButton)
25813744 {
25823745 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();
3746
+
3747
+ if (CameraPane.FULLSCREEN)
3748
+ fullscreenLayout = radio.layout;
3749
+
3750
+// bigThree.remove(scenePanel);
3751
+// bigThree.remove(centralPanel);
3752
+// bigThree.remove(XYZPanel);
3753
+// aWindowConstraints.gridx = 0;
3754
+// aWindowConstraints.gridy = 0;
3755
+// aWindowConstraints.gridwidth = 1;
3756
+// // aWindowConstraints.gridheight = 3;
3757
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3758
+// aWindowConstraints.weightx = 1;
3759
+// aWindowConstraints.weighty = 1;
3760
+// bigThree.add(scenePanel, aWindowConstraints);
3761
+// aWindowConstraints.weightx = 1;
3762
+// aWindowConstraints.gridwidth = 3;
3763
+// // aConstraints.gridheight = 3;
3764
+// aWindowConstraints.gridx = 1;
3765
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3766
+// //bigThree.add(cameraPanel, aWindowConstraints);
3767
+// aWindowConstraints.weightx = 0;
3768
+// aWindowConstraints.gridx = 4;
3769
+// aWindowConstraints.gridwidth = 1;
3770
+// // aWindowConstraints.gridheight = 3;
3771
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3772
+// //bigThree.add(XYZPanel, aWindowConstraints);
3773
+// bigThree.validate();
3774
+// scenePanel.setVisible(true);
3775
+// centralPanel.setVisible(false);
3776
+// XYZPanel.setVisible(false);
3777
+ bigThree.ClearUI();
3778
+ bigThree.add(scenePanel);
3779
+ bigThree.FlushUI();
3780
+
3781
+ cameraView.requestFocusInWindow();
26073782 } else
2608
- if (event.getSource() == sixButton)
3783
+ if (source == sixButton)
26093784 {
26103785 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();
3786
+
3787
+ if (CameraPane.FULLSCREEN)
3788
+ fullscreenLayout = radio.layout;
3789
+
3790
+// bigThree.remove(scenePanel);
3791
+// bigThree.remove(centralPanel);
3792
+// bigThree.remove(XYZPanel);
3793
+// aWindowConstraints.gridx = 0;
3794
+// aWindowConstraints.gridy = 0;
3795
+// aWindowConstraints.gridwidth = 1;
3796
+// // aConstraints.gridheight = 3;
3797
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3798
+// aWindowConstraints.weightx = 0;
3799
+// aWindowConstraints.weighty = 1;
3800
+// bigThree.add(scenePanel, aWindowConstraints);
3801
+// aWindowConstraints.weightx = 1;
3802
+// aWindowConstraints.gridwidth = 3;
3803
+// // aWindowConstraints.gridheight = 3;
3804
+// aWindowConstraints.gridx = 1;
3805
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3806
+// bigThree.add(centralPanel, aWindowConstraints);
3807
+// aWindowConstraints.weightx = 0;
3808
+// aWindowConstraints.gridx = 4;
3809
+// aWindowConstraints.gridwidth = 1;
3810
+// // aWindowConstraints.gridheight = 3;
3811
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3812
+// //bigThree.add(XYZPanel, aConstraints);
3813
+// bigThree.validate();
3814
+// scenePanel.setVisible(true);
3815
+// centralPanel.setVisible(true);
3816
+// XYZPanel.setVisible(false);
3817
+ bigThree.ClearUI();
3818
+ bigThree.add(centralPanel);
3819
+ bigThree.add(scenePanel);
3820
+ bigThree.FlushUI();
3821
+
3822
+ cameraView.requestFocusInWindow();
26353823 } else
2636
- if (event.getSource() == sevenButton)
3824
+ if (source == sevenButton)
26373825 {
26383826 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();
3827
+
3828
+ if (CameraPane.FULLSCREEN)
3829
+ fullscreenLayout = radio.layout;
3830
+
3831
+// bigThree.remove(scenePanel);
3832
+// bigThree.remove(centralPanel);
3833
+// bigThree.remove(XYZPanel);
3834
+// aWindowConstraints.gridx = 0;
3835
+// aWindowConstraints.gridy = 0;
3836
+// aWindowConstraints.gridwidth = 1;
3837
+// // aWindowConstraints.gridheight = 3;
3838
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3839
+// aWindowConstraints.weightx = 0;
3840
+// aWindowConstraints.weighty = 1;
3841
+// bigThree.add(scenePanel, aWindowConstraints);
3842
+// aWindowConstraints.weightx = 1;
3843
+// aWindowConstraints.gridwidth = 3;
3844
+// // aWindowConstraints.gridheight = 3;
3845
+// aWindowConstraints.gridx = 1;
3846
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3847
+// bigThree.add(centralPanel, aWindowConstraints);
3848
+// aWindowConstraints.weightx = 0;
3849
+// aWindowConstraints.gridx = 4;
3850
+// aWindowConstraints.gridwidth = 1;
3851
+// // aConstraints.gridheight = 3;
3852
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3853
+// bigThree.add(XYZPanel, aWindowConstraints);
3854
+// bigThree.validate();
3855
+// scenePanel.setVisible(true);
3856
+// centralPanel.setVisible(true);
3857
+// XYZPanel.setVisible(true);
3858
+ bigThree.ClearUI();
3859
+ bigThree.add(scenePanel);
3860
+ bigThree.add(centralPanel);
3861
+ bigThree.add(XYZPanel);
3862
+ bigThree.FlushUI();
3863
+
3864
+ cameraView.requestFocusInWindow();
26633865 } else
2664
- if (event.getSource() == rootButton)
3866
+ if (source == rootButton)
26653867 {
26663868 Object3D obj;
26673869 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2671,66 +3873,85 @@
26713873 EditObject(obj);
26723874 }
26733875
3876
+ cameraView.requestFocusInWindow();
26743877 refreshContents(true);
26753878 } else
2676
- if (event.getSource() == closeButton)
3879
+ if (source == closeButton)
26773880 {
26783881 //System.out.println("CLOSE: " + buttonGroup.getSelection());
26793882 cRadio ab;
26803883 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
26813884 {
26823885 ab = (cRadio)e.nextElement();
2683
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3886
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
26843887 {
3888
+ // Patch to avoid bug with transparency.
3889
+ if (!ab.hadMaterial)
3890
+ {
3891
+ ab.object.material = null;
3892
+ }
3893
+
26853894 buttonGroup.remove(ab);
26863895 radioPanel.remove(ab);
26873896
2688
- ab.GetObject().editWindow = null;
3897
+ //ab.GetObject().editWindow = null;
3898
+ ab.GetObject().manipWindow = null;
26893899 // ab.GetObject().objectUI = null; // ?????????
26903900
26913901 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
26923902 break;
26933903 }
26943904 }
3905
+
3906
+ cameraView.requestFocusInWindow();
26953907 refreshContents(true);
26963908 } else
2697
- if (event.getSource() == editItem || event.getSource() == editButton)
3909
+ if (source == editItem || source == editButton)
26983910 {
3911
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3912
+ {
3913
+ Object3D child = (Object3D)e.nextElement();
3914
+ child.pinned = true;
3915
+ }
3916
+
26993917 EditSelection(false);
27003918 } else
2701
- if (event.getSource() == uneditButton)
3919
+ if (source == uneditButton)
27023920 {
27033921 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27043922 {
27053923 Object3D child = (Object3D)e.nextElement();
27063924 if(child.editWindow != null)
2707
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3925
+ child.pinned = false;
27083926 child.CloseUI();
27093927 listUI.remove(child);
3928
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27103929
2711
- child.editWindow = null; // ???????????
3930
+ //child.editWindow = null; // ???????????
27123931 }
2713
- objEditor.ctrlPanel.revalidate();
3932
+ objEditor.ctrlPanel.FlushUI();
27143933 //objEditor.jTree.clearSelection();
27153934 //objEditor.ResetSliders();
27163935 refreshContents(true);
27173936 } else
2718
- if (event.getSource() == clearPanelButton)
3937
+ if (source == clearPanelButton)
27193938 {
27203939 assert(copy == group);
27213940 //copy.ClearUI();
27223941 for (Object3D obj : listUI)
27233942 {
3943
+ obj.pinned = false;
27243944 obj.CloseUI();
27253945 }
27263946 listUI.clear();
3947
+ SetPinStates(group.selection.size() > 0);
27273948 refreshContents(true);
27283949 } else
2729
- if (event.getSource() == allParamsButton)
3950
+ if (source == allParamsButton)
27303951 {
27313952 assert(copy == group);
27323953
2733
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3954
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
27343955
27353956 for (Object3D obj : listUI)
27363957 {
....@@ -2747,19 +3968,19 @@
27473968
27483969 refreshContents(true);
27493970 } else
2750
- if (event.getSource() == unselectButton)
3971
+ if (source == unselectButton)
27513972 {
27523973 objEditor.jTree.clearSelection();
2753
- // ?? oct 2012 GraphreeD.clipboard.clear();
3974
+ // ?? oct 2012 GrafreeD.clipboard.clear();
27543975 objEditor.ResetSliders();
27553976 refreshContents(true);
27563977 } else
2757
- if(event.getSource() instanceof cRadio)
3978
+ if(source instanceof cRadio)
27583979 {
27593980 group.parent = keepparent;
27603981 group.attributes = 0;
27613982 //group.editWindow = null;
2762
- /*cRadio*/ radio = (cRadio)event.getSource();
3983
+ /*cRadio*/ radio = (cRadio)source;
27633984 Object3D obj = radio.GetObject();
27643985 System.out.println("Edit " + obj);
27653986 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2779,7 +4000,10 @@
27794000 }
27804001
27814002 copy = group;
2782
- //CameraPane.theRenderer.object = group;
4003
+
4004
+ SetUndoStates();
4005
+
4006
+ //Globals.theRenderer.object = group;
27834007 if(!useclient)
27844008 {
27854009 cameraView.renderCamera = radio.camera;
....@@ -2788,25 +4012,55 @@
27884012 cameraView.cameras[cameraView.cameracount] = radio.camera;
27894013 cameraView.targetLookAt.set(radio.camera.lookAt);
27904014 cameraView.object = group;
2791
- cameraView.lighttouched = true;
4015
+ //cameraView.lighttouched = true;
4016
+ Globals.lighttouched = true;
27924017 topView.object = group;
27934018 frontView.object = group;
27944019 sideView.object = group;
27954020 }
2796
- group.editWindow = this;
4021
+
4022
+// fix "+" issue
4023
+ //group.editWindow = this;
4024
+ group.manipWindow = this;
4025
+
27974026 /*
27984027 currentLayout = radio.layout;
27994028 if (currentLayout == null)
28004029 currentLayout = sevenButton;
28014030 */
28024031 radio.layout.doClick();
4032
+
4033
+ ClearUnpinned();
4034
+
4035
+ //Grafreed.Assert(group != null);
4036
+ //Grafreed.Assert(group.selection != null);
4037
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4038
+ if (group.selection == null || group.selection.size() == 1)
4039
+ EditSelection(false);
28034040 keepparent = group.parent;
28044041 // PARENT = NULL or not???
28054042 //group.parent = null; // ROOT
28064043 //group.attributes = -1;
28074044 ResetModel();
4045
+
4046
+ cameraView.requestFocusInWindow();
28084047 refreshContents(true);
2809
- }
4048
+ } else if (event.getSource() == editCameraItem)
4049
+ {
4050
+ cameraView.ProtectCamera();
4051
+ cameraView.requestFocusInWindow();
4052
+ cameraView.repaint();
4053
+ return;
4054
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4055
+ {
4056
+ cameraView.RevertCamera();
4057
+ cameraView.requestFocusInWindow();
4058
+ cameraView.repaint();
4059
+ return;
4060
+ // } else if (event.getSource() == textureButton)
4061
+ // {
4062
+ // return; // true;
4063
+ }
28104064 else
28114065 {
28124066 //return super.action(event, arg);
....@@ -2815,7 +4069,6 @@
28154069 }
28164070
28174071 boolean useclient = false;
2818
- cRadio radio;
28194072
28204073 void ToggleRoot()
28214074 {
....@@ -2824,7 +4077,7 @@
28244077 if (useclient)
28254078 {
28264079 cameraView.object = client;
2827
- cameraView.lighttouched = true;
4080
+ Globals.lighttouched = true;
28284081 //topView.object = client;
28294082 //frontView.object = client;
28304083 //sideView.object = client;
....@@ -2832,7 +4085,7 @@
28324085 else
28334086 {
28344087 cameraView.object = group;
2835
- cameraView.lighttouched = true;
4088
+ Globals.lighttouched = true;
28364089 //topView.object = group;
28374090 //frontView.object = group;
28384091 //sideView.object = group;
....@@ -2867,6 +4120,28 @@
28674120 refreshContents();
28684121 }
28694122
4123
+ void TransformChildren()
4124
+ {
4125
+ Object3D obj;
4126
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4127
+ {
4128
+ obj = (Object3D)e.nextElement();
4129
+ obj.KeepTextureMatrices();
4130
+ obj.TransformChildren();
4131
+ obj.RestoreTextureMatrices();
4132
+
4133
+// if (obj.parent == null)
4134
+// {
4135
+// System.out.println("NULL PARENT!");
4136
+// new Exception().printStackTrace();
4137
+// }
4138
+// else
4139
+// TouchTransform(obj);
4140
+// //obj.parent.Touch();
4141
+ }
4142
+
4143
+ refreshContents();
4144
+ }
28704145
28714146 void ResetTransform()
28724147 {
....@@ -2979,7 +4254,7 @@
29794254 refreshContents();
29804255 }
29814256
2982
- void ResetCentroid()
4257
+ void ResetCentroid(boolean full)
29834258 {
29844259 Object3D obj;
29854260 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2994,12 +4269,16 @@
29944269 LA.matIdentity(Object3D.mat);
29954270 obj.getBounds(minima, maxima, false);
29964271 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
2997
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4272
+ if (full)
4273
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
29984274 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
29994275 obj.TransformMesh(Object3D.mat);
4276
+
30004277 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3001
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4278
+ if (full)
4279
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30024280 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4281
+
30034282 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30044283 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30054284 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3028,7 +4307,8 @@
30284307
30294308 int size = obj.MemorySize();
30304309
3031
- System.err.println((size/1024) + " KB is the size of " + obj);
4310
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4311
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30324312 }
30334313 }
30344314 catch (Exception e)
....@@ -3065,9 +4345,9 @@
30654345 obj = (Object3D)e.nextElement();
30664346
30674347 System.out.println("Object is: " + obj);
3068
- GraphreeD.AnalyzeObject(obj);
4348
+ Grafreed.AnalyzeObject(obj);
30694349 System.out.println("Boundary rep: " + obj.bRep);
3070
- GraphreeD.AnalyzeObject(obj.bRep);
4350
+ Grafreed.AnalyzeObject(obj.bRep);
30714351
30724352 // System.err.println((size/1024) + " KB is the size of " + obj);
30734353 }
....@@ -3109,6 +4389,20 @@
31094389 void GenNormals(boolean crease)
31104390 {
31114391 group.GenNormalsS(crease);
4392
+
4393
+ refreshContents();
4394
+ }
4395
+
4396
+ void GenNormalsMESH()
4397
+ {
4398
+ group.GenNormalsMeshS();
4399
+
4400
+ refreshContents();
4401
+ }
4402
+
4403
+ void GenNormalsMINE()
4404
+ {
4405
+ group.selection.GenNormalsMINE();
31124406
31134407 refreshContents();
31144408 }
....@@ -3157,104 +4451,259 @@
31574451
31584452 //Object3D buffer;
31594453 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
-
4454
+// BoundaryRep temprep;
4455
+// Object3D nodes;
4456
+// Vector<Vertex> vertices;
4457
+//
4458
+// cGroup buffer;
4459
+//
4460
+// public void Vertex(Object3D node, Vertex v)
4461
+// {
4462
+//// vertices.add(v);
4463
+//// nodes.addElement(node);
4464
+////
4465
+//// if (temprep.GetCache(v) != null)
4466
+//// {
4467
+//// temprep.Remove(v);
4468
+//// } else
4469
+//// {
4470
+//// temprep.Remember(v);
4471
+//// }
4472
+//
4473
+// //Object3D node = nodes.get(index);
4474
+// temp.set(v); // vertices.get(index)); // temprep.GetVertex(k));
4475
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4476
+//
4477
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4478
+//
4479
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4480
+//
4481
+// cGroup g = new cGroup();
4482
+//
4483
+// if (g.toParent == null)
4484
+// {
4485
+// g.toParent = LA.newMatrix();
4486
+// g.fromParent = LA.newMatrix();
4487
+// }
4488
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4489
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4490
+//
4491
+// g.add(GrafreeD.clipboard);
4492
+//
4493
+// buffer.add(g);
4494
+// }
4495
+//
4496
+// public void Face(Object3D node, Face f)
4497
+// {
4498
+//
4499
+// }
4500
+//
4501
+// void ParseVerticesOld() // ??
4502
+// {
4503
+// //if (group.selection.size() != 1)
4504
+// // return;
4505
+//
4506
+// temprep = new BoundaryRep();
4507
+// nodes = new Object3D();
4508
+// vertices = new Vector<Vertex>();
4509
+//
4510
+// boolean epsequal = GrafreeD.epsequal;
4511
+// GrafreeD.epsequal = true;
4512
+//
4513
+// for (int i=0; i<group.selection.size(); i++)
4514
+// {
4515
+// Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4516
+//
4517
+// group.selection.get(i).Parse(
4518
+//this );
4519
+//
4520
+// int repsize = temprep.VertexCount();
4521
+// int tablesize = temprep.vertextable.size();
4522
+// int nodesize = nodes.size();
4523
+//
4524
+// assert(vertices.size() == nodes.size());
4525
+//
4526
+// temprep.vertextable.elements();
4527
+//
4528
+// java.util.Set<java.util.Map.Entry<Vertex,Vertex>> set = temprep.vertextable.entrySet();
4529
+//
4530
+// for (java.util.Map.Entry<Vertex,Vertex> entry : set)
4531
+// {
4532
+// cGroup g = new cGroup();
4533
+//
4534
+// int index = vertices.indexOf(entry.getValue()); // temprep.vertextable.(k));
4535
+//
4536
+// Object3D node = nodes.get(index);
4537
+// temp.set(vertices.get(index)); // temprep.GetVertex(k));
4538
+// // System.out.println("temp = " + temp.x + ", " + temp.y + ", " + temp.z);
4539
+//
4540
+// LA.xformPos(temp, node.GlobalTransformInv(), temp);
4541
+//
4542
+// // System.out.println("tem+ = " + temp.x + ", " + temp.y + ", " + temp.z);
4543
+//
4544
+// if (g.toParent == null)
4545
+// {
4546
+// g.toParent = LA.newMatrix();
4547
+// g.fromParent = LA.newMatrix();
4548
+// }
4549
+// LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4550
+// LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
4551
+//
4552
+// g.add(GrafreeD.clipboard);
4553
+//
4554
+// buffer.add(g);
4555
+// }
4556
+//
4557
+// makeSomething(buffer, i==group.selection.size()-1);
4558
+// }
4559
+//
4560
+// GrafreeD.epsequal = epsequal;
4561
+//
4562
+// //buffer = null;
4563
+// temprep = null;
4564
+// nodes = null;
4565
+//
4566
+// refreshContents();
4567
+// }
4568
+
31844569 void ParseVertices()
31854570 {
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;
4571
+ boolean epsequal = Grafreed.epsequal;
4572
+ Grafreed.epsequal = true;
31954573
31964574 for (int i=0; i<group.selection.size(); i++)
31974575 {
3198
- Object3D buffer = new cGroup(group.selection.get(i).name + "+");
4576
+ final cGroup buffer = new cGroup(group.selection.get(i).name + "+");
31994577
3200
- group.selection.get(i).Parse(this);
3201
-
3202
- int repsize = temprep.VertexCount();
3203
- int tablesize = temprep.vertextable.size();
3204
- int nodesize = nodes.size();
4578
+ group.selection.get(i).Parse(
4579
+
4580
+ new iParse()
4581
+ {
4582
+ public void Vertex(Object3D node, Vertex v)
4583
+ {
4584
+ temp.set(v);
4585
+ LA.xformPos(temp, node.GlobalTransformInv(), temp);
32054586
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();
4587
+ cGroup g = new cGroup();
32114588
3212
- for (java.util.Map.Entry<Vertex,Vertex> entry : set)
3213
- {
3214
- cGroup g = new cGroup();
4589
+ if (g.toParent == null)
4590
+ {
4591
+ g.toParent = LA.newMatrix();
4592
+ g.fromParent = LA.newMatrix();
4593
+ }
4594
+ LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
4595
+ LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
32154596
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);
4597
+ g.add(Grafreed.clipboard);
32204598
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);
4599
+ buffer.add(g);
4600
+ }
32324601
3233
- g.add(GraphreeD.clipboard);
4602
+ public void Face(Object3D node, Face f)
4603
+ {
32344604
3235
- buffer.add(g);
3236
- }
4605
+ }
4606
+ }
4607
+ );
32374608
32384609 makeSomething(buffer, i==group.selection.size()-1);
32394610 }
32404611
3241
- GraphreeD.epsequal = epsequal;
3242
-
3243
- //buffer = null;
3244
- temprep = null;
3245
- nodes = null;
4612
+ Grafreed.epsequal = epsequal;
32464613
32474614 refreshContents();
32484615 }
3249
-
4616
+
4617
+ void TextureVertices()
4618
+ {
4619
+ for (int i=0; i<group.selection.size(); i++)
4620
+ {
4621
+ group.selection.get(i).Parse(
4622
+ new iParse()
4623
+ {
4624
+ public void Vertex(Object3D node, Vertex v)
4625
+ {
4626
+ cTexture tex = node.GetTextures();
4627
+ String pigment = Object3D.GetPigment(tex);
4628
+ //String bump = Object3D.GetBump(tex);
4629
+
4630
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4631
+
4632
+ try
4633
+ {
4634
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4635
+ }
4636
+ catch (Exception e)
4637
+ {
4638
+ System.err.println("FAIL: " + node);
4639
+ }
4640
+
4641
+ double s = v.s;
4642
+
4643
+ if (s == 1)
4644
+ s = 0;
4645
+
4646
+ double t = v.t;
4647
+
4648
+ if (t == 1)
4649
+ t = 0;
4650
+
4651
+ int indexs = (int) (texturedata.getWidth() * s);
4652
+ int indext = (int) (texturedata.getHeight() * t);
4653
+
4654
+ int index = indext * texturedata.getWidth() + indexs;
4655
+
4656
+ java.nio.ByteBuffer bytebuf = (java.nio.ByteBuffer)texturedata.getBuffer();
4657
+
4658
+ int slide = bytebuf.capacity() / texturedata.getWidth() / texturedata.getHeight();
4659
+
4660
+ float scale = bytebuf.get(index*slide) & 0xFF;
4661
+ scale += bytebuf.get(index*slide+1) & 0xFF;
4662
+ scale += bytebuf.get(index*slide+2) & 0xFF;
4663
+ scale /= 3;
4664
+
4665
+ scale /= 0xFF;
4666
+ // c'est quoi ca? scale /= 4;
4667
+
4668
+ //v.AO = scale;
4669
+
4670
+ v.x += v.norm.x * scale;
4671
+ v.y += v.norm.y * scale;
4672
+ v.z += v.norm.z * scale;
4673
+ }
4674
+
4675
+ public void Face(Object3D node, Face f)
4676
+ {
4677
+ }
4678
+ }
4679
+ );
4680
+ }
4681
+
4682
+ refreshContents();
4683
+ }
4684
+
32504685 void Align()
32514686 {
4687
+ if (group.selection.size() == 0)
4688
+ return;
4689
+
4690
+ cVector bbmin = new cVector();
4691
+ cVector bbmax = new cVector();
4692
+
4693
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4694
+
4695
+ double dx = bbmax.x - bbmin.x;
4696
+ double dy = bbmax.y - bbmin.y;
4697
+ double dz = bbmax.z - bbmin.z;
4698
+
4699
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4700
+
32524701 for (int i=0; i<group.selection.size(); i++)
32534702 {
32544703 Object3D obj = group.selection.get(i);
32554704
3256
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3257
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4705
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4706
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
32584707 }
32594708
32604709 refreshContents();
....@@ -3267,7 +4716,7 @@
32674716 // ref.SaveSupports();
32684717 // Object3D par = ref.parent;
32694718 // ref.parent = null;
3270
-// Object3D lowres = (Object3D) GraphreeD.clone(ref);
4719
+// Object3D lowres = (Object3D) GrafreeD.clone(ref);
32714720 // ref.parent = par;
32724721 // ref.RestoreSupports();
32734722
....@@ -3275,11 +4724,11 @@
32754724
32764725 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
32774726
3278
- boolean random = CameraPane.RANDOM;
3279
- CameraPane.RANDOM = false; // parse all random nodes
4727
+ boolean random = CameraPane.SWITCH;
4728
+ CameraPane.SWITCH = false; // parse all random nodes
32804729 lowres.linkVerticesThis(null);
32814730 lowres.linkVerticesThis(sn);
3282
- CameraPane.RANDOM = random;
4731
+ CameraPane.SWITCH = random;
32834732
32844733 System.err.flush();
32854734
....@@ -3297,7 +4746,7 @@
32974746 // lowres.SaveSupports();
32984747 // par = lowres.parent;
32994748 // lowres.parent = null;
3300
-// Object3D newlow = (Object3D) GraphreeD.clone(lowres);
4749
+// Object3D newlow = (Object3D) GrafreeD.clone(lowres);
33014750 Object3D newlow = CloneObject(lowres, false);
33024751 newlow.name = sn.switchobject.get(i).name;
33034752 System.out.println(" pose#" + i + " = " + newlow);
....@@ -3319,7 +4768,7 @@
33194768 return;
33204769
33214770 Object3D poses = group.selection.get(0);
3322
- Object3D ref = GraphreeD.clipboard.get(0);
4771
+ Object3D ref = Grafreed.clipboard.get(0);
33234772
33244773 Object3D newgroup = new Object3D("Po:" + poses.name);
33254774
....@@ -3488,7 +4937,7 @@
34884937 group.selection.RelinkToSupport(); // july 2014
34894938 System.out.println("DONE.");
34904939 refreshContents();
3491
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4940
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
34924941 }
34934942
34944943 void ReduceMesh(boolean reduction34)
....@@ -3513,20 +4962,20 @@
35134962
35144963 void ClipMesh()
35154964 {
3516
- if (/*group.selection.size() == 1 &&*/ GraphreeD.clipboard.size() == 1)
4965
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
35174966 {
3518
- Object3D content = GraphreeD.clipboard.get(0);
4967
+ Object3D content = Grafreed.clipboard.get(0);
35194968
35204969 if (content instanceof cGroup && ((cGroup)content).transientlink )
35214970 content = ((cGroup)content).get(0);
35224971
35234972 // for (int i=0; i<group.selection.size(); i++)
35244973 // {
3525
-// group.selection.get(i).ClipMesh(GraphreeD.clipboard);
4974
+// group.selection.get(i).ClipMesh(GrafreeD.clipboard);
35264975 // }
3527
- group.selection.ClipMesh(GraphreeD.clipboard);
4976
+ group.selection.ClipMesh(Grafreed.clipboard);
35284977 }
3529
-// group.selection.ClipMesh(GraphreeD.clipboard);
4978
+// group.selection.ClipMesh(GrafreeD.clipboard);
35304979 System.out.println("DONE.");
35314980 refreshContents();
35324981 }
....@@ -3571,6 +5020,18 @@
35715020 void MarkLeaves(boolean hide)
35725021 {
35735022 group.selection.MarkLeaves(hide);
5023
+ refreshContents();
5024
+ }
5025
+
5026
+ void RewindLeaves(boolean hide)
5027
+ {
5028
+ group.selection.RewindLeaves(hide);
5029
+ refreshContents();
5030
+ }
5031
+
5032
+ void RandomLeaves(boolean hide)
5033
+ {
5034
+ group.selection.RandomLeaves(hide);
35745035 refreshContents();
35755036 }
35765037
....@@ -3645,28 +5106,25 @@
36455106 // }
36465107 // }
36475108
3648
- static boolean allparams = true;
3649
-
3650
- static Vector<Object3D> listUI = new Vector<Object3D>();
3651
-
36525109 void EditSelection(boolean newWindow)
36535110 {
5111
+ if (group.selection == null)
5112
+ {
5113
+ EditElement(group, newWindow); // ? new
5114
+ return;
5115
+ }
5116
+
36545117 // aConstraints.gridy = 0;
36555118 for (int i=0; i<group.selection.size(); i++)
36565119 {
36575120 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
36585121 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3659
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5122
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
36605123
36615124 Object3D elem = (Object3D)group.selection.elementAt(i);
3662
- if(elem != group)
5125
+ if(elem != group || !newWindow)
36635126 {
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
5127
+ EditElement(elem, newWindow); // ? new
36705128 }
36715129 }
36725130 }
....@@ -3729,9 +5187,7 @@
37295187
37305188 freezemodel = false;
37315189 }
3732
-
3733
- boolean flashIt = true;
3734
-
5190
+
37355191 public void valueChanged(TreeSelectionEvent e)
37365192 //public boolean handleEvent(Event event)
37375193 {
....@@ -3741,7 +5197,8 @@
37415197 //new Exception().printStackTrace();
37425198
37435199 freezemodel = true;
3744
-
5200
+ ClearUnpinned();
5201
+
37455202 /**/
37465203 //switch (event.id)
37475204 {
....@@ -3749,7 +5206,6 @@
37495206 //case 702: // Event.LIST_DESELECT
37505207 group.deselectAll();
37515208 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3752
- objEditor.ClearInfo(); // .GetMaterial());
37535209 if (tps != null)
37545210 {
37555211 for (int i=0; i < tps.length; i++)
....@@ -3758,33 +5214,39 @@
37585214
37595215 //if (child.parent != null)
37605216 //child.parent.addSelectee(child);
5217
+ objEditor.SetMaterial(child);
37615218 group.addSelectee(child);
3762
- objEditor.SetMaterial(child); // .GetMaterial());
3763
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3764
- System.err.println("info : " + child.GetPath());
37655219 }
37665220 }
3767
- else
3768
- {
3769
- objEditor.SetMaterial(group); // .GetMaterial());
3770
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3771
- System.err.println("info : " + group.GetPath());
3772
- }
5221
+// else
5222
+// {
5223
+// objEditor.SetMaterial(group); // .GetMaterial());
5224
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
5225
+// System.err.println("info : " + group.GetPath());
5226
+// }
37735227
3774
- objEditor.SetText(); // jan 2014
3775
-
3776
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5228
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
37775229 CameraPane.flash = true;
37785230
3779
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5231
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
37805232 // a camera
37815233 {
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;
5234
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5235
+ {
5236
+ CameraPane.camerachangeframe = 0; // don't refuse it
5237
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5238
+ }
5239
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
5240
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
37865241 }
37875242
5243
+ if (tps != null && tps.length == 1)
5244
+ {
5245
+ EditSelection(false);
5246
+ }
5247
+
5248
+ SetPinStates(tps != null && tps.length > 0);
5249
+
37885250 refreshContents();
37895251 //return true;
37905252 }
....@@ -3793,6 +5255,37 @@
37935255
37945256 freezemodel = false;
37955257 }
5258
+
5259
+ void SetPinStates(boolean enabled)
5260
+ {
5261
+ editButton.setEnabled(enabled);
5262
+ uneditButton.setEnabled(enabled);
5263
+ //unselectButton.setEnabled(enabled);
5264
+ flashSelectionButton.setEnabled(enabled);
5265
+
5266
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5267
+ }
5268
+
5269
+ void refreshContents(boolean cp)
5270
+ {
5271
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5272
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5273
+ {
5274
+ objEditor.ClearInfo(); // .GetMaterial());
5275
+
5276
+ for (int i=0; i < group.selection.Size(); i++)
5277
+ {
5278
+ Object3D child = (Object3D) group.selection.get(i);
5279
+
5280
+ objEditor.AddInfo(child, this, true);
5281
+ System.err.println("info : " + child.GetPath());
5282
+ }
5283
+
5284
+ objEditor.SetText(); // jan 2014
5285
+ }
5286
+
5287
+ super.refreshContents(cp);
5288
+ }
37965289
37975290 void linkSomething(Object3D thing)
37985291 {
....@@ -3864,16 +5357,19 @@
38645357 {
38655358 if (group.selection.isEmpty())
38665359 return;
3867
- GraphreeD.clipboardIsTempGroup = false;
5360
+
5361
+ Grafreed.clipboardIsTempGroup = false;
38685362 Composite tGroup = null;
38695363 if (group.selection.size() > 0) // 1)
38705364 {
38715365 tGroup = new cGroup();
3872
- GraphreeD.clipboardIsTempGroup = true;
5366
+ Grafreed.clipboardIsTempGroup = true;
38735367 }
38745368
38755369 if (cut)
38765370 {
5371
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5372
+// Save();
38775373 //int indices[] = jList.getSelectedIndices();
38785374 //for (int i = indices.length - 1; i >= 0; i--)
38795375 //jList.remove(indices[i]);
....@@ -3909,16 +5405,16 @@
39095405 //System.out.println("cut " + child);
39105406 //System.out.println("parent = " + child.parent);
39115407 // tmp.addChild(child);
3912
- if (GraphreeD.clipboardIsTempGroup)
5408
+ if (Grafreed.clipboardIsTempGroup)
39135409 tGroup.add/*Child*/(tmp);
39145410 else
3915
- GraphreeD.clipboard = tmp;
5411
+ Grafreed.clipboard = tmp;
39165412 }
39175413 else
3918
- if (GraphreeD.clipboardIsTempGroup)
5414
+ if (Grafreed.clipboardIsTempGroup)
39195415 tGroup.add/*Child*/(child);
39205416 else
3921
- GraphreeD.clipboard = child;
5417
+ Grafreed.clipboard = child;
39225418 }
39235419
39245420 //ResetModel();
....@@ -3950,21 +5446,23 @@
39505446 //System.out.println("cut " + elem);
39515447 //System.out.println("parent = " + elem.parent);
39525448 // tmp.addChild(elem);
3953
- if (GraphreeD.clipboardIsTempGroup)
5449
+ if (Grafreed.clipboardIsTempGroup)
39545450 tGroup.add/*Child*/(tmp);
39555451 else
3956
- GraphreeD.clipboard = tmp;
5452
+ Grafreed.clipboard = tmp;
39575453 }
39585454 else
3959
- if (GraphreeD.clipboardIsTempGroup)
5455
+ if (Grafreed.clipboardIsTempGroup)
39605456 tGroup.add/*Child*/(child);
39615457 else
3962
- GraphreeD.clipboard = child;
5458
+ Grafreed.clipboard = child;
39635459 }
39645460
39655461 }
3966
- if (GraphreeD.clipboardIsTempGroup)
3967
- GraphreeD.clipboard = tGroup;
5462
+
5463
+ if (Grafreed.clipboardIsTempGroup)
5464
+ Grafreed.clipboard = tGroup;
5465
+
39685466 if (cut)
39695467 {
39705468 ResetModel();
....@@ -3974,11 +5472,15 @@
39745472
39755473 void paste(boolean expand)
39765474 {
3977
- // if (GraphreeD.clipboard == null)
5475
+ if (Globals.REPLACEONMAKE)
5476
+ Save();
5477
+ boolean keep = Globals.REPLACEONMAKE;
5478
+ Globals.REPLACEONMAKE = false;
5479
+ // if (GrafreeD.clipboard == null)
39785480 // return;
39795481 boolean first = true;
39805482
3981
- if (GraphreeD.clipboardIsTempGroup)
5483
+ if (Grafreed.clipboardIsTempGroup)
39825484 {
39835485 Composite temp;
39845486
....@@ -3989,7 +5491,7 @@
39895491 temp = (Composite)Applet3D.clipboard.deepCopy();
39905492 */
39915493 Object3D elem;
3992
- for (Enumeration e = /*temp.children*/GraphreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5494
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
39935495 {
39945496 Object3D child = (Object3D)e.nextElement();
39955497
....@@ -4003,7 +5505,7 @@
40035505 else
40045506 elem = child.deepCopy(); // ?
40055507 child.parent = keepparent;
4006
- //if (GraphreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
5508
+ //if (GrafreeD.clipboardIsTempGroup && LA.isIdentity(elem.fromParent))
40075509 // elem = elem.get(0);
40085510 makeSomething(elem, true); // ?? first);
40095511 //group.addChild(elem);
....@@ -4023,23 +5525,24 @@
40235525 //Object3D cb = Applet3D.clipboard;
40245526 //temp.addChild(cb);
40255527 //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());
5528
+ assert(Grafreed.clipboard.parent == null);
5529
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5530
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5531
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5532
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
40315533 else
4032
- makeSomething(expand?GraphreeD.clipboard.copyExpand():GraphreeD.clipboard.deepCopy());
4033
- GraphreeD.clipboard.get(0).parent = keepparent;
5534
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5535
+ Grafreed.clipboard.get(0).parent = keepparent;
40345536 }
40355537
5538
+ Globals.REPLACEONMAKE = keep;
40365539 ResetModel();
40375540 refreshContents();
40385541 }
40395542
4040
- void pasteInto(boolean copyit)
5543
+ void pasteInto(boolean copyit, boolean clone)
40415544 {
4042
-// if (GraphreeD.clipboard == null)
5545
+// if (GrafreeD.clipboard == null)
40435546 // return;
40445547
40455548 if (group.selection.size() != 1)
....@@ -4066,15 +5569,22 @@
40665569 if (copyit)
40675570 {
40685571 // paste(false);
4069
- CloneClipboard(false); // sept 2014
5572
+ if (clone)
5573
+ {
5574
+ CloneClipboard(false); // sept 2014
5575
+ }
5576
+ else
5577
+ {
5578
+ paste(false);
5579
+ }
40705580 }
40715581 else
40725582 {
40735583 boolean first = true;
40745584
4075
- if (GraphreeD.clipboardIsTempGroup)
5585
+ if (Grafreed.clipboardIsTempGroup)
40765586 {
4077
- Composite temp = (Composite)GraphreeD.clipboard;
5587
+ Composite temp = (Composite)Grafreed.clipboard;
40785588 Object3D copy;
40795589 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
40805590 {
....@@ -4084,7 +5594,7 @@
40845594 }
40855595 } else
40865596 {
4087
- linkSomething(GraphreeD.clipboard); //.get(0));
5597
+ linkSomething(Grafreed.clipboard); //.get(0));
40885598 }
40895599 }
40905600 }
....@@ -4161,6 +5671,10 @@
41615671
41625672 void group(Object3D csg, boolean grab)
41635673 {
5674
+ if (Globals.REPLACEONMAKE)
5675
+ Save();
5676
+ boolean keep = Globals.REPLACEONMAKE;
5677
+ Globals.REPLACEONMAKE = false;
41645678 if (//false) // why??
41655679 !group.selection.isEmpty())
41665680 {
....@@ -4274,8 +5788,34 @@
42745788 //node.add(csg);
42755789 //makeSomething(node);
42765790 makeSomething(csg);
5791
+ Globals.REPLACEONMAKE = keep;
42775792 }
42785793
5794
+ void Ungroup(Object3D g)
5795
+ {
5796
+ if (Globals.REPLACEONMAKE)
5797
+ Save();
5798
+ boolean keep = Globals.REPLACEONMAKE;
5799
+ Globals.REPLACEONMAKE = false;
5800
+ if (g instanceof HiddenObject)
5801
+ {
5802
+ HiddenObject h = (HiddenObject) g;
5803
+
5804
+ for (int i=0; i<h.ActualSize(); i++)
5805
+ {
5806
+ objEditor.makeSomething(h.get(i), false);
5807
+ }
5808
+ }
5809
+ else
5810
+ {
5811
+ for (int i=0; i<g.Size(); i++)
5812
+ {
5813
+ objEditor.makeSomething(g.get(i), false);
5814
+ }
5815
+ }
5816
+ Globals.REPLACEONMAKE = keep;
5817
+ }
5818
+
42795819 void ungroup()
42805820 {
42815821 /*
....@@ -4469,21 +6009,6 @@
44696009 }
44706010 */
44716011
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
-
44876012 /*
44886013 public void Callback(Object obj)
44896014 {
....@@ -4507,26 +6032,9 @@
45076032 }
45086033 */
45096034
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
-
45276035 String GetFile(String dialogName)
45286036 {
4529
- if (GraphreeD.standAlone)
6037
+ if (Grafreed.standAlone)
45306038 {
45316039 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
45326040 browser.show();
....@@ -4590,10 +6098,48 @@
45906098 cButton flashSelectionButton;
45916099 cButton editButton;
45926100 cButton uneditButton;
6101
+ JCheckBox allParamsButton;
45936102 cButton clearpanelButton;
4594
- cButton allParamsButton;
45956103 cButton unselectButton;
45966104
6105
+ cButton restoreCameraButton;
6106
+
6107
+ cButton oneStepButton;
6108
+
6109
+ cButton groupButton;
6110
+ cButton ungroupButton;
6111
+ cButton compositeButton;
6112
+ cButton switchButton;
6113
+ cButton loopButton;
6114
+ cButton textureButton;
6115
+
6116
+ cButton skybox1Button;
6117
+ cButton skybox2Button;
6118
+ cButton skybox3Button;
6119
+ cButton skybox4Button;
6120
+ cButton skybox5Button;
6121
+ cButton skybox6Button;
6122
+ cButton skybox7Button;
6123
+
6124
+ cButton skybox11Button;
6125
+ cButton skybox12Button;
6126
+ cButton skybox13Button;
6127
+ cButton skybox14Button;
6128
+ cButton skybox15Button;
6129
+ cButton skybox16Button;
6130
+ cButton skybox17Button;
6131
+
6132
+ cButton gridButton;
6133
+ cButton boxButton;
6134
+ cButton sphereButton;
6135
+ cButton coneButton;
6136
+ cButton torusButton;
6137
+ cButton superButton;
6138
+ cButton kleinButton;
6139
+ cButton particlesButton;
6140
+ cButton overlayButton;
6141
+ cButton lightButton;
6142
+
45976143 cButton screenfitButton;
45986144 cButton screenfitpointButton;
45996145 cButton snapobjectButton;
....@@ -4605,14 +6151,6 @@
46056151
46066152 cButton setsupportButton;
46076153
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
-
46166154 //
46176155 //Composite
46186156 Object3D // to do !!
....@@ -4622,9 +6160,11 @@
46226160 //JTree jTree;
46236161 private MenuItem lookAtItem;
46246162 private MenuItem lookFromItem;
4625
- private MenuItem switchItem;
6163
+ private MenuItem switchViewItem;
46266164 private MenuItem cutItem;
4627
- private MenuItem duplicateItem;
6165
+ private MenuItem undoItem;
6166
+ private MenuItem redoItem;
6167
+ private JMenuItem duplicateItem;
46286168 private MenuItem cloneItem;
46296169 private MenuItem cloneSupportItem;
46306170 private MenuItem overwriteGeoItem;
....@@ -4635,8 +6175,9 @@
46356175 private MenuItem resetsupportItem;
46366176 private MenuItem resetreferencesItem;
46376177 private MenuItem linkverticesItem;
6178
+ private MenuItem relinkverticesItem;
46386179 private MenuItem setMasterItem;
4639
- private MenuItem resetMeshItem;
6180
+ private MenuItem resetAllItem;
46406181 private MenuItem stepAllItem;
46416182 private MenuItem revertMeshItem;
46426183 private MenuItem poseMeshItem;
....@@ -4647,14 +6188,17 @@
46476188 private MenuItem mergeGeometriesItem;
46486189 private MenuItem copyItem;
46496190 private MenuItem pasteItem;
6191
+ private MenuItem pasteIntoItem;
46506192 private MenuItem pasteLinkItem;
46516193 private MenuItem pasteCloneItem;
46526194 private MenuItem pasteExpandItem;
4653
- private MenuItem clearItem;
6195
+ private MenuItem deleteItem;
46546196 private MenuItem clearAllItem;
46556197 private MenuItem genUVItem;
6198
+ private MenuItem genNormalsMESHItem;
46566199 private MenuItem genNormalsCADItem;
46576200 private MenuItem genNormalsORGANItem;
6201
+ private MenuItem genNormalsMINEItem;
46586202 private MenuItem stripifyItem;
46596203 private MenuItem unstripifyItem;
46606204 private MenuItem trimItem;
....@@ -4683,6 +6227,10 @@
46836227 private MenuItem showleavesItem;
46846228 private MenuItem markleavesItem;
46856229 private MenuItem unmarkleavesItem;
6230
+ private MenuItem rewindleavesItem;
6231
+ private MenuItem unrewindleavesItem;
6232
+ private MenuItem randomleavesItem;
6233
+ private MenuItem unrandomleavesItem;
46866234
46876235 private MenuItem flipVItem;
46886236 private MenuItem unflipVItem;
....@@ -4694,14 +6242,17 @@
46946242 private MenuItem panoTexturesItem;
46956243
46966244 private MenuItem resetCentroidItem;
4697
- private MenuItem transformgeometryItem;
6245
+ private MenuItem resetCentroidXZItem;
46986246 private MenuItem resetTransformItem;
6247
+ private MenuItem transformGeometryItem;
6248
+ private MenuItem transformChildrenItem;
6249
+ private MenuItem hideItem;
46996250 private MenuItem grabItem;
47006251 private MenuItem backItem;
47016252 private MenuItem frontItem;
47026253 private MenuItem cameraItem;
47036254 private MenuItem compositeItem;
4704
- private MenuItem randomItem;
6255
+ private MenuItem switchItem;
47056256 private MenuItem physicsItem;
47066257 private MenuItem frameselectorItem;
47076258 private MenuItem scriptNodeItem;
....@@ -4716,6 +6267,7 @@
47166267
47176268 private MenuItem resetParentItem;
47186269 private MenuItem repairParentItem;
6270
+ private MenuItem repairShadowItem;
47196271 private MenuItem sortbysizeItem;
47206272 private MenuItem sortbynameItem;
47216273
....@@ -4724,20 +6276,25 @@
47246276 private MenuItem attachBumpItem;
47256277 private MenuItem detachBumpItem;
47266278 private MenuItem pigmentBumpItem;
6279
+ private MenuItem embedTexturesItem;
6280
+ private MenuItem deEmbedTexturesItem;
47276281
47286282 private MenuItem particleItem;
47296283 private MenuItem ragdollItem;
47306284 private MenuItem ragdoll2Item;
6285
+ private MenuItem heightFieldItem;
6286
+ private MenuItem textureFieldItem;
47316287 private MenuItem gridItem;
47326288 private MenuItem rectoidItem;
47336289 private MenuItem ellipsoidItem;
47346290 private MenuItem coneItem;
47356291 private MenuItem torusItem;
47366292 private MenuItem superItem;
6293
+ private MenuItem kleinItem;
47376294 private MenuItem blobItem;
47386295 private MenuItem latheItem;
47396296 private MenuItem bezierItem;
4740
- private MenuItem checkerItem;
6297
+ private MenuItem overlayItem;
47416298 private MenuItem meshItem;
47426299 // private MenuItem meshGroupItem;
47436300 private MenuItem springItem;
....@@ -4746,6 +6303,7 @@
47466303 private MenuItem csgItem;
47476304 private MenuItem templateItem;
47486305 private MenuItem textureItem;
6306
+ private MenuItem billboardItem;
47496307 private MenuItem shadowXItem;
47506308 private MenuItem shadowYItem;
47516309 private MenuItem shadowZItem;
....@@ -4758,11 +6316,6 @@
47586316 private MenuItem doubleItem;
47596317 private MenuItem tripleItem;
47606318
4761
- private MenuItem importGFDItem;
4762
- private MenuItem importVRMLX3DItem;
4763
- private MenuItem import3DSItem;
4764
- private MenuItem importOBJItem;
4765
-
47666319 private MenuItem computeAOItem;
47676320 private MenuItem recompileItem;
47686321 private MenuItem editScriptItem;
....@@ -4772,4 +6325,8 @@
47726325 private MenuItem analyzeItem;
47736326 private MenuItem dumpItem;
47746327 //boolean freezemodel = false;
6328
+
6329
+ Menu cameraMenu;
6330
+ MenuItem editCameraItem;
6331
+ MenuItem restoreCameraItem;
47756332 }