Normand Briere
2019-08-09 912749d2520afedd9b56458d771400c261fe2b88
GroupEditor.java
....@@ -16,6 +16,7 @@
1616 //import buoy.widget.BFileChooser;
1717
1818 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1920 ObjectUI,
2021 Runnable,
2122 ActionListener,
....@@ -23,6 +24,341 @@
2324 DragGestureListener, DragSourceListener, DropTargetListener,
2425 ItemListener // ListSelectionListener
2526 {
27
+
28
+ public void AddSkyboxButton(String f, String s, cGridBag row)
29
+ {
30
+ cButton skyboxButton;
31
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
33
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
+ skyboxButton.setToolTipText(s);
35
+ skyboxButton.addActionListener(new ActionListener()
36
+ {
37
+ @Override
38
+ public void actionPerformed(ActionEvent e)
39
+ {
40
+ ChangeSkybox(path);
41
+ }
42
+ });
43
+ }
44
+
45
+ public void AddTextureButton(String f, String c, final String t, int count, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(c + count);
51
+ textureButton.addActionListener(new ActionListener()
52
+ {
53
+ @Override
54
+ public void actionPerformed(ActionEvent e)
55
+ {
56
+ ChangeTexture(path + t);
57
+ }
58
+ });
59
+ }
60
+
61
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
62
+ {
63
+ cGridBag tab0 = new cGridBag().setVertical(true);
64
+
65
+ tab0.setName("Urban");
66
+ skyboxpanel.add(tab0);
67
+
68
+ cGridBag row0 = new cGridBag();
69
+ cGridBag row1 = new cGridBag();
70
+ cGridBag row2 = new cGridBag();
71
+ cGridBag row3 = new cGridBag();
72
+ cGridBag row4 = new cGridBag();
73
+ cGridBag row5 = new cGridBag();
74
+ cGridBag row6 = new cGridBag();
75
+
76
+ AddSkyboxButton("default", "rgb", row0);
77
+ //AddSkyboxButton("default", "cornell", row0);
78
+ AddSkyboxButton("penguins", "dust", row0);
79
+ AddSkyboxButton("penguins", "tropic", row0);
80
+ AddSkyboxButton("penguins", "yonder", row0);
81
+
82
+ AddSkyboxButton("default", "uffizi", row1);
83
+ AddSkyboxButton("bridge", "Bridge", row1);
84
+ AddSkyboxButton("bridge", "Bridge2", row1);
85
+ AddSkyboxButton("urban", "GamlaStan2", row1);
86
+
87
+ AddSkyboxButton("urban", "Parliament", row2);
88
+ AddSkyboxButton("urban", "Roundabout", row2);
89
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
90
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
91
+
92
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
93
+ AddSkyboxButton("urban", "UnionSquare", row3);
94
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
95
+ AddSkyboxButton("park", "BerzeliiPark", row3);
96
+
97
+ AddSkyboxButton("park", "Buddha", row4);
98
+ AddSkyboxButton("park", "CNTower2", row4);
99
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
100
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
101
+
102
+ AddSkyboxButton("park", "Park", row5);
103
+ AddSkyboxButton("park", "Pond", row5);
104
+ AddSkyboxButton("park", "Skansen", row5);
105
+ AddSkyboxButton("park", "Skansen2", row5);
106
+
107
+ AddSkyboxButton("park", "Skansen3", row6);
108
+ AddSkyboxButton("park", "Skansen4", row6);
109
+ AddSkyboxButton("park", "Skansen5", row6);
110
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
111
+
112
+ tab0.add(row0);
113
+ tab0.add(row1);
114
+ tab0.add(row2);
115
+ tab0.add(row3);
116
+ tab0.add(row4);
117
+ tab0.add(row5);
118
+ tab0.add(row6);
119
+
120
+ for (int i=5; --i>=0;)
121
+ {
122
+ //oe.toolboxPanel.Return();
123
+ //tab0.add(new cGridBag());
124
+ }
125
+ }
126
+
127
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
128
+ {
129
+ cGridBag tab0 = new cGridBag().setVertical(true);
130
+
131
+ tab0.setName("Nature");
132
+ skyboxpanel.add(tab0);
133
+
134
+ cGridBag row0 = new cGridBag();
135
+ cGridBag row1 = new cGridBag();
136
+ cGridBag row2 = new cGridBag();
137
+ cGridBag row3 = new cGridBag();
138
+ cGridBag row4 = new cGridBag();
139
+ cGridBag row5 = new cGridBag();
140
+ cGridBag row6 = new cGridBag();
141
+
142
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
143
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
144
+ AddSkyboxButton("beach", "PalmTrees", row0);
145
+ AddSkyboxButton("beach", "Tenerife", row0);
146
+
147
+ AddSkyboxButton("beach", "Tenerife2", row1);
148
+ AddSkyboxButton("beach", "Tenerife3", row1);
149
+ AddSkyboxButton("field", "FishPond", row1);
150
+ AddSkyboxButton("field", "Footballfield", row1);
151
+
152
+ AddSkyboxButton("field", "Meadow", row2);
153
+ AddSkyboxButton("field", "Sorsele", row2);
154
+ AddSkyboxButton("field", "Sorsele2", row2);
155
+ AddSkyboxButton("field", "Sorsele3", row2);
156
+
157
+ AddSkyboxButton("forest", "Brudslojan", row3);
158
+ AddSkyboxButton("forest", "Langholmen2", row3);
159
+ AddSkyboxButton("forest", "Plants", row3);
160
+ AddSkyboxButton("mountain", "Maskonaive", row3);
161
+
162
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
163
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
164
+ AddSkyboxButton("mountain", "Teide", row4);
165
+ AddSkyboxButton("park", "Tantolunden4", row4);
166
+
167
+ AddSkyboxButton("park", "Stairs", row5);
168
+ AddSkyboxButton("default", "skycube", row6);
169
+ AddSkyboxButton("rocky", "Langholmen", row5);
170
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
171
+
172
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
173
+ AddSkyboxButton("default", "CloudyHills", row6);
174
+ AddSkyboxButton("daz", "Autumn", row6);
175
+ AddSkyboxButton("daz", "MountainTrail", row6);
176
+ /*
177
+Autumn
178
+Greenlands
179
+MountainTrail
180
+Oasis
181
+TheRock
182
+TopOfTheWorld
183
+Winter
184
+ */
185
+
186
+ tab0.add(row0);
187
+ tab0.add(row1);
188
+ tab0.add(row2);
189
+ tab0.add(row3);
190
+ tab0.add(row4);
191
+ tab0.add(row5);
192
+ tab0.add(row6);
193
+
194
+ for (int i=5; --i>=0;)
195
+ {
196
+ //oe.toolboxPanel.Return();
197
+ //tab0.add(new cGridBag());
198
+ }
199
+ }
200
+
201
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
202
+ {
203
+ cGridBag tab0 = new cGridBag().setVertical(true);
204
+
205
+ tab0.setName("Night");
206
+ skyboxpanel.add(tab0);
207
+
208
+ cGridBag row0 = new cGridBag();
209
+ cGridBag row1 = new cGridBag();
210
+ cGridBag row2 = new cGridBag();
211
+ cGridBag row3 = new cGridBag();
212
+ cGridBag row4 = new cGridBag();
213
+ cGridBag row5 = new cGridBag();
214
+ cGridBag row6 = new cGridBag();
215
+
216
+ AddSkyboxButton("night", "NightPath", row0);
217
+ AddSkyboxButton("night", "PondNight", row0);
218
+ AddSkyboxButton("night", "Powerlines", row0);
219
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
220
+
221
+ AddSkyboxButton("urban", "CNTower", row1);
222
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
223
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
224
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
225
+
226
+ AddSkyboxButton("penguins", "kenon_star", row2);
227
+ AddSkyboxButton("persson", "corona", row2);
228
+ AddSkyboxButton("persson", "spaceskybox", row2);
229
+ AddSkyboxButton("indoors", "Vasa", row2);
230
+
231
+ AddSkyboxButton("winter", "Backyard", row3);
232
+ AddSkyboxButton("winter", "Creek", row3);
233
+ AddSkyboxButton("winter", "FootballField3", row3);
234
+ AddSkyboxButton("winter", "Forest", row3);
235
+
236
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
237
+ AddSkyboxButton("winter", "House", row4);
238
+ AddSkyboxButton("winter", "IceLake", row4);
239
+ AddSkyboxButton("winter", "IceRiver", row4);
240
+
241
+ AddSkyboxButton("winter", "Park3", row5);
242
+ AddSkyboxButton("winter", "PondWinter", row5);
243
+ AddSkyboxButton("winter", "Tantolunden5", row5);
244
+ AddSkyboxButton("winter", "Vindelalven", row5);
245
+
246
+ AddSkyboxButton("daz", "TheRock", row6);
247
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
248
+ AddSkyboxButton("daz", "Winter", row6);
249
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
250
+
251
+ tab0.add(row0);
252
+ tab0.add(row1);
253
+ tab0.add(row2);
254
+ tab0.add(row3);
255
+ tab0.add(row4);
256
+ tab0.add(row5);
257
+ tab0.add(row6);
258
+
259
+ for (int i=5; --i>=0;)
260
+ {
261
+ //oe.toolboxPanel.Return();
262
+ //tab0.add(new cGridBag());
263
+ }
264
+ }
265
+
266
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
267
+ {
268
+ cGridBag tab0 = new cGridBag().setVertical(true);
269
+
270
+ tab0.setName("Others");
271
+ skyboxpanel.add(tab0);
272
+
273
+ cGridBag row0 = new cGridBag();
274
+ cGridBag row1 = new cGridBag();
275
+ cGridBag row2 = new cGridBag();
276
+ cGridBag row3 = new cGridBag();
277
+ cGridBag row4 = new cGridBag();
278
+ cGridBag row5 = new cGridBag();
279
+ cGridBag row6 = new cGridBag();
280
+
281
+ AddSkyboxButton("mayhem", "afterrain", row0);
282
+ AddSkyboxButton("mayhem", "aqua4", row0);
283
+ AddSkyboxButton("mayhem", "aqua9", row0);
284
+ AddSkyboxButton("mayhem", "flame", row0);
285
+
286
+ AddSkyboxButton("mayhem", "h2s", row1);
287
+ AddSkyboxButton("mayhem", "prehistoric", row1);
288
+ AddSkyboxButton("mayhem", "scorched", row1);
289
+ AddSkyboxButton("penguins", "desertdawn", row1);
290
+
291
+ AddSkyboxButton("persson", "Citadella", row2);
292
+ AddSkyboxButton("persson", "Citadella2", row2);
293
+ AddSkyboxButton("persson", "clouds1", row2);
294
+ AddSkyboxButton("penguins", "wrath", row2);
295
+
296
+ AddSkyboxButton("persson", "FishermansBastion", row3);
297
+ AddSkyboxButton("persson", "HeroesSquare", row3);
298
+ AddSkyboxButton("indoors", "DallasW", row3);
299
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
300
+
301
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
302
+ AddSkyboxButton("persson", "PereaBeach1", row4);
303
+ AddSkyboxButton("persson", "PereaBeach2", row4);
304
+ AddSkyboxButton("persson", "redeclipse", row4);
305
+
306
+ AddSkyboxButton("daz", "Greenlands", row5);
307
+ AddSkyboxButton("daz", "Oasis", row5);
308
+ AddSkyboxButton("elyvisions", "arch3", row5);
309
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
310
+
311
+ AddSkyboxButton("elyvisions", "rainbow", row6);
312
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
313
+ AddSkyboxButton("elyvisions", "heaven", row6);
314
+ AddSkyboxButton("elyvisions", "hot", row6);
315
+
316
+ tab0.add(row0);
317
+ tab0.add(row1);
318
+ tab0.add(row2);
319
+ tab0.add(row3);
320
+ tab0.add(row4);
321
+ tab0.add(row5);
322
+ tab0.add(row6);
323
+
324
+ for (int i=5; --i>=0;)
325
+ {
326
+ //oe.toolboxPanel.Return();
327
+ //tab0.add(new cGridBag());
328
+ }
329
+ }
330
+
331
+ public void ChangeSkybox(String skybox)
332
+ {
333
+ //cameraView.envyoff = false;
334
+ group.skyboxname = skybox;
335
+ group.skyboxext = "jpg";
336
+ cameraView.repaint();
337
+ }
338
+
339
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
340
+ {
341
+ JTabbedPane skyboxpane = new JTabbedPane();
342
+
343
+ AddSkyboxTab0(skyboxpane);
344
+ AddSkyboxTab1(skyboxpane);
345
+ AddSkyboxTab2(skyboxpane);
346
+ AddSkyboxTab3(skyboxpane);
347
+
348
+ skyboxPanel.add(skyboxpane);
349
+ }
350
+
351
+ public void ChangeTexture(String texture)
352
+ {
353
+ for (int i=0; i<group.selection.size(); i++)
354
+ {
355
+ Object3D obj = group.selection.get(i);
356
+ obj.SetPigmentTexture("@" + texture);
357
+ }
358
+
359
+ refreshContents();
360
+ }
361
+
26362 //ObjEditor objEditor;
27363 public void closeUI2()
28364 {
....@@ -60,6 +396,12 @@
60396 this.copy = this.group = group;
61397 //selectees = this.group.selectees;
62398
399
+ if (copy.versionlist == null)
400
+ {
401
+ copy.versionlist = new Object3D[100];
402
+ copy.versionindex = -1;
403
+ }
404
+
63405 if(ui)
64406 SetupUI(objEditor);
65407 }
....@@ -74,16 +416,28 @@
74416 this.copy = this.group = copy;
75417 //selectees = this.group.selectees;
76418
77
- SetupMenu2(objEditor);
419
+ SetupMenu2(this); //objEditor);
78420 SetupUI2(objEditor);
79421 objEditor.SetupUI(true);
80422 SetupViews(objEditor);
81423
82424 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
425
+
426
+ if (copy.versionlist == null)
427
+ {
428
+ copy.versionlist = new Object3D[100];
429
+ copy.versionindex = -1;
430
+
431
+ Save(true);
432
+ }
83433 }
84434
85435 void CloneSelection(boolean supports)
86436 {
437
+ if (Globals.REPLACEONMAKE)
438
+ Save();
439
+ boolean keep = Globals.REPLACEONMAKE;
440
+ Globals.REPLACEONMAKE = false;
87441 // Object3D keep = GrafreeD.clipboard;
88442 //Object3D obj;
89443 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +448,19 @@
94448
95449 makeSomething(clone, i==group.selection.size()-1);
96450 }
451
+ Globals.REPLACEONMAKE = keep;
97452 }
98453
99454 void CloneClipboard(boolean supports)
100455 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
456
+ assert(Grafreed.clipboard.parent == null);
457
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
458
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
459
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
460
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106461 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
462
+ makeSomething(CloneObject(Grafreed.clipboard, false));
463
+ Grafreed.clipboard.get(0).parent = keepparent;
109464 }
110465
111466 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +474,7 @@
119474 // obj.support = null;
120475 if (!supports)
121476 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
477
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123478 obj.parent = parent;
124479 // obj.support = support;
125480 // clone.support = support; // aout 2013
....@@ -148,28 +503,21 @@
148503
149504 //JTextField nameField;
150505
151
- void SetupMenu2(ObjEditor oe)
506
+ void SetupMenu2(GroupEditor oe)
152507 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
508
+ oe.jTree = new cTree();
509
+
168510 Menu menu;
169511 oe.menuBar.add(menu = new Menu("Edit"));
170512 //editItem = menu.add(new MenuItem("Edit"));
171513 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
514
+
515
+// undoItem = menu.add(new MenuItem("Undo"));
516
+// undoItem.addActionListener(this);
517
+// redoItem = menu.add(new MenuItem("Redo"));
518
+// redoItem.addActionListener(this);
519
+// menu.add("-");
520
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173521 duplicateItem.addActionListener(this);
174522 cloneItem = menu.add(new MenuItem("Clone"));
175523 cloneItem.addActionListener(this);
....@@ -185,7 +533,6 @@
185533 copyItem.addActionListener(this);
186534 pasteItem = menu.add(new MenuItem("Paste"));
187535 pasteItem.addActionListener(this);
188
- menu.add("-");
189536
190537 menu.add("-");
191538 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,8 +544,8 @@
197544 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
198545 // pasteExpandItem.addActionListener(this);
199546 menu.add("-");
200
- clearItem = menu.add(new MenuItem("Clear"));
201
- clearItem.addActionListener(this);
547
+ deleteItem = menu.add(new MenuItem("Delete"));
548
+ deleteItem.addActionListener(this);
202549
203550 if (Globals.ADVANCED)
204551 {
....@@ -206,14 +553,97 @@
206553 clearAllItem = menu.add(new MenuItem("Clear All"));
207554 clearAllItem.addActionListener(this);
208555 }
556
+
557
+ menuBar.add(cameraMenu = new Menu("View"));
558
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
559
+ //zBufferItem.addActionListener(this);
560
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
561
+ //normalLensItem.addActionListener(this);
562
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
563
+ restoreCameraItem.addActionListener(this);
564
+
565
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
566
+// toggleFullScreenItem.addItemListener(this);
567
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
568
+// cameraMenu.add("-");
569
+//
570
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
571
+// toggleTextureItem.addItemListener(this);
572
+// toggleTextureItem.setState(CameraPane.textureon);
573
+//
574
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
575
+// toggleSwitchItem.addItemListener(this);
576
+// toggleSwitchItem.setState(CameraPane.SWITCH);
577
+
578
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
579
+ toggleHandleItem.addItemListener(this);
580
+ toggleHandleItem.setState(CameraPane.HANDLES);
581
+
582
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
583
+ togglePaintItem.addItemListener(this);
584
+ togglePaintItem.setState(CameraPane.PAINTMODE);
585
+
586
+ if (Globals.ADVANCED)
587
+ {
588
+ cameraMenu.add("-");
589
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
590
+ toggleLiveItem.addItemListener(this);
591
+ toggleLiveItem.setState(Globals.isLIVE());
209592
593
+ cameraMenu.add(stepItem = new MenuItem("Step"));
594
+ stepItem.addActionListener(this);
595
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
596
+ // toggleDLItem.addItemListener(this);
597
+ // toggleDLItem.setState(false);
598
+
599
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
600
+ toggleRenderItem.addItemListener(this);
601
+ toggleRenderItem.setState(!CameraPane.frozen);
602
+
603
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
604
+ toggleDebugItem.addItemListener(this);
605
+ toggleDebugItem.setState(Globals.DEBUG);
606
+
607
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
608
+ toggleFrustumItem.addItemListener(this);
609
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
610
+
611
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
612
+ toggleFootContactItem.addItemListener(this);
613
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
614
+
615
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
616
+ toggleTimelineItem.addItemListener(this);
617
+ }
618
+
619
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
620
+// toggleRootItem.addItemListener(this);
621
+// toggleRootItem.setState(false);
622
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
623
+// animationItem.addItemListener(this);
624
+// animationItem.setState(CameraPane.ANIMATION);
625
+ cameraMenu.add("-");
626
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
627
+ editCameraItem.addActionListener(this);
628
+
629
+ if (Globals.ADVANCED)
630
+ {
631
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
632
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
633
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
634
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
635
+ oe.cameraMenu.add("-");
636
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
637
+ openWindowItem.addActionListener(this);
638
+ editLeafItem.addActionListener(this);
639
+ lookAtItem.addActionListener(this);
640
+ //lookFromItem.addActinoListener(this);
641
+ //switchViewItem.addActionListener(this);
642
+ }
643
+
210644 oe.menuBar.add(menu = new Menu("Setting"));
211645 if (Globals.ADVANCED)
212646 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217647 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218648 revertMeshItem.addActionListener(this);
219649 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +683,29 @@
253683 }
254684
255685 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
686
+// grabItem = menu.add(new MenuItem("Grab"));
687
+// grabItem.addActionListener(this);
258688 backItem = menu.add(new MenuItem("Back"));
259689 backItem.addActionListener(this);
260690 frontItem = menu.add(new MenuItem("Front"));
261691 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
692
+// compositeItem = menu.add(new MenuItem("Composite"));
693
+// compositeItem.addActionListener(this);
694
+
695
+ if (Globals.ADVANCED)
696
+ {
264697 hideItem = menu.add(new MenuItem("Hidden Group"));
265698 hideItem.addActionListener(this);
699
+ }
266700 ungroupItem = menu.add(new MenuItem("Ungroup"));
267701 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- randomItem.addActionListener(this);
702
+
703
+// menu.add("-");
704
+//
705
+// switchItem = menu.add(new MenuItem("Switch node"));
706
+// switchItem.addActionListener(this);
707
+ if (Globals.ADVANCED)
708
+ {
271709 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272710 switchGeoItem.addActionListener(this);
273711 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +713,6 @@
275713 morphItem = menu.add(new MenuItem("Morph Group"));
276714 morphItem.addActionListener(this);
277715
278
- if (Globals.ADVANCED)
279
- {
280716 menu.add("-");
281717 physicsItem = menu.add(new MenuItem("Physics"));
282718 physicsItem.addActionListener(this);
....@@ -284,30 +720,29 @@
284720 frameselectorItem.addActionListener(this);
285721 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286722 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289723 }
290724
291725 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
726
+// textureItem = menu.add(new MenuItem("Texture"));
727
+// textureItem.addActionListener(this);
294728 billboardItem = menu.add(new MenuItem("Billboard"));
295729 billboardItem.addActionListener(this);
296730 csgItem = menu.add(new MenuItem("CSG"));
297731 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
732
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299733 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
734
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301735 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
736
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303737 shadowZItem.addActionListener(this);
738
+ attributeItem = menu.add(new MenuItem("Attribute"));
739
+ attributeItem.addActionListener(this);
740
+
304741 if (Globals.ADVANCED)
305742 {
306743 menu.add("-");
307744 linkerItem = menu.add(new MenuItem("Linker"));
308745 linkerItem.addActionListener(this);
309
- attributeItem = menu.add(new MenuItem("Attribute"));
310
- attributeItem.addActionListener(this);
311746 templateItem = menu.add(new MenuItem("Template"));
312747 templateItem.addActionListener(this);
313748 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -318,8 +753,12 @@
318753 resetTransformItem.addActionListener(this);
319754 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
320755 resetCentroidItem.addActionListener(this);
321
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
- transformgeometryItem.addActionListener(this);
756
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
757
+ resetCentroidXZItem.addActionListener(this);
758
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
759
+ transformGeometryItem.addActionListener(this);
760
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
761
+ transformChildrenItem.addActionListener(this);
323762
324763 oe.menuBar.add(menu = new Menu("Geometry"));
325764 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -332,7 +771,7 @@
332771 genNormalsMESHItem.addActionListener(this);
333772 if (Globals.ADVANCED)
334773 {
335
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
774
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
336775 genNormalsMINEItem.addActionListener(this);
337776 }
338777 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -368,6 +807,10 @@
368807 oe.menuBar.add(menu = new Menu("Attributes"));
369808 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370809 clearMaterialsItem.addActionListener(this);
810
+ resetAllItem = menu.add(new MenuItem("Reset All"));
811
+ resetAllItem.addActionListener(this);
812
+ stepAllItem = menu.add(new MenuItem("Step All"));
813
+ stepAllItem.addActionListener(this);
371814 menu.add("-");
372815 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
373816 liveleavesItem.addActionListener(this);
....@@ -388,6 +831,14 @@
388831 markleavesItem.addActionListener(this);
389832 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
390833 unmarkleavesItem.addActionListener(this);
834
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
835
+ rewindleavesItem.addActionListener(this);
836
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
837
+ unrewindleavesItem.addActionListener(this);
838
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
839
+ randomleavesItem.addActionListener(this);
840
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
841
+ unrandomleavesItem.addActionListener(this);
391842 menu.add("-");
392843 flipVItem = menu.add(new MenuItem("Flip V"));
393844 flipVItem.addActionListener(this);
....@@ -413,50 +864,123 @@
413864 attachBumpItem.addActionListener(this);
414865 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
415866 pigmentBumpItem.addActionListener(this);
867
+ //embedTexturesItem
416868 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
417869 detachPigmentItem.addActionListener(this);
418870 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
419871 detachBumpItem.addActionListener(this);
872
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
873
+ embedTexturesItem.addActionListener(this);
874
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
875
+ deEmbedTexturesItem.addActionListener(this);
420876 menu.add("-");
421877 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
422878 sortbysizeItem.addActionListener(this);
423879 sortbynameItem = menu.add(new MenuItem("Sort by name"));
424880 sortbynameItem.addActionListener(this);
881
+ menu.add("-");
882
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
883
+ shareGeometriesItem.addActionListener(this);
884
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
885
+ mergeGeometriesItem.addActionListener(this);
425886 if (Globals.ADVANCED)
426887 {
427
- menu.add("-");
888
+ // Pretty much the same as duplicate and clone.
428889 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429890 extractGeometriesItem.addActionListener(this);
430891 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431892 cloneGeometriesItem.addActionListener(this);
432
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
433
- shareGeometriesItem.addActionListener(this);
434
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
435
- mergeGeometriesItem.addActionListener(this);
436893 }
437894
438895 oe.menuBar.add(menu = new Menu("Insert"));
439896 buildCreateMenu(menu);
440897
441
- oe.menuBar.add(menu = new Menu("Include"));
442
- importOBJItem = menu.add(new MenuItem("OBJ file..."));
443
- importOBJItem.addActionListener(this);
444
- menu.add("-");
445
- import3DSItem = menu.add(new MenuItem("3DS file..."));
446
- import3DSItem.addActionListener(this);
447
- menu.add("-");
448
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
449
- importVRMLX3DItem.addActionListener(this);
450
- menu.add("-");
451
- importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
452
- importGFDItem.addActionListener(this);
453
-
454898 oe.menuBar.add(menu = new Menu("Tools"));
455899 buildToolsMenu(menu);
456900 }
457901
902
+ JTabbedPane resourcecontainer;
903
+ cGridBag currenttab;
904
+ boolean added; // patch for jar
905
+
906
+ int tabcount = 0;
907
+ int colcount = 0;
908
+ int rowcount = 0;
909
+ int texturecount = 0;
910
+
911
+ int columns = 5;
912
+ int rows = 7;
913
+
914
+ public void ResourceCallBack(String[] path)
915
+ {
916
+// for (int i = 0; i < path.length; i++)
917
+// System.out.print(path[i] + "/");
918
+// System.out.println();
919
+
920
+ if (//rowcount == 0 ||
921
+ path.length == 1)
922
+ {
923
+ currenttab = new cGridBag();
924
+ added = false;
925
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
926
+ currenttab.setName(tabname);
927
+ rowcount = 1;
928
+ colcount = 0;
929
+ texturecount = 0;
930
+ }
931
+
932
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
933
+ {
934
+ if (!added)
935
+ {
936
+ added = true;
937
+ resourcecontainer.add(currenttab);
938
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
940
+ }
941
+
942
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
943
+
944
+ if (++colcount >= columns)
945
+ {
946
+ colcount = 0;
947
+ currenttab.Return();
948
+
949
+ if (rowcount++ >= rows)
950
+ {
951
+ rowcount = 0;
952
+ }
953
+ }
954
+ }
955
+ else
956
+ {
957
+// if (!path[path.length-1].equals("icons"))
958
+// resourcecontainer.Return();
959
+ }
960
+ }
961
+
962
+ void CreateTexturePanel(cGridBag container)
963
+ {
964
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
965
+ container.add(resourcecontainer);
966
+
967
+ Grafreed.ParseResources("textures", this);
968
+ }
969
+
458970 void SetupUI2(ObjEditor oe)
459971 {
972
+ // June 2019
973
+ if (oe == null)
974
+ {
975
+ //super.SetupUI2(this);
976
+ //return;
977
+ }
978
+
979
+ if (copy != group)
980
+ {
981
+ //super.SetupUI2(this);
982
+ }
983
+
460984 //new Exception().printStackTrace();
461985
462986 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -485,97 +1009,238 @@
4851009 oe.radioPanel.add(dummyButton);
4861010 oe.buttonGroup.add(dummyButton);
4871011 */
1012
+ cGridBag copyOptionsPanel = new cGridBag();
1013
+
1014
+ copyOptionsPanel.preferredHeight = 2;
1015
+
4881016 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
4891017
490
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
491
- liveCB.setToolTipText("Enabled animation");
1018
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1019
+ //minButton.setToolTipText("Minimize window");
1020
+ //minButton.addActionListener(this);
1021
+
1022
+ if (Globals.ADVANCED)
1023
+ {
1024
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
+ maxButton.setToolTipText("Maximize window");
1026
+ maxButton.addActionListener(this);
1027
+ }
1028
+
1029
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
+ fullButton.setToolTipText("Full-screen window");
1031
+ fullButton.addActionListener(this);
1032
+
1033
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1034
+ screenfitButton.setToolTipText("Screen fit");
1035
+ screenfitButton.addActionListener(this);
1036
+
1037
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1038
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1039
+ restoreCameraButton.addActionListener(this);
1040
+
1041
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
+ saveVersionButton.setToolTipText("Duplicate current version");
1043
+ saveVersionButton.addActionListener(this);
1044
+
1045
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1046
+ deleteVersionButton.setToolTipText("Delete current version");
1047
+ deleteVersionButton.addActionListener(this);
1048
+
1049
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ previousVersionButton.setToolTipText("Previous version");
1051
+ previousVersionButton.addActionListener(this);
1052
+ previousVersionButton.setEnabled(false);
1053
+
1054
+ cGridBag updown = new cGridBag().setVertical(true);
1055
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ restoreButton.setToolTipText("Undo (restore current version)");
1057
+ restoreButton.addActionListener(this);
1058
+ //restoreButton.setEnabled(false);
1059
+
1060
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+ replaceButton.setToolTipText("Save (replace current version)");
1062
+ replaceButton.addActionListener(this);
1063
+ //replaceButton.setEnabled(false);
1064
+
1065
+ copyOptionsPanel.add(updown);
1066
+
1067
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ nextVersionButton.setToolTipText("Next version");
1069
+ nextVersionButton.addActionListener(this);
1070
+ nextVersionButton.setEnabled(false);
1071
+
1072
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1073
+ liveCB.setToolTipText("Enable animation");
4921074 liveCB.addItemListener(this);
4931075
494
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1076
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
4951077 oneStepButton.setToolTipText("Animate one step forward");
4961078 oneStepButton.addActionListener(this);
4971079
498
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
1080
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
4991081 fastCB.setToolTipText("Fast mode");
5001082 fastCB.addItemListener(this);
5011083
502
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
503
- trackCB.setToolTipText("Enable tracking");
504
- trackCB.addItemListener(this);
505
-
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
507
- screenfitButton.setToolTipText("Screen fit");
508
- screenfitButton.addActionListener(this);
1084
+ //oe.toolboxPanel.Return();
1085
+
1086
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1087
+// trackCB.setToolTipText("Enable tracking");
1088
+// trackCB.addItemListener(this);
5091089
5101090 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
5111091 // screenfitpointButton.addActionListener(this);
5121092
5131093 if (Globals.ADVANCED)
5141094 {
515
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1095
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5161096 snapobjectButton.addActionListener(this);
5171097 snapobjectButton.setToolTipText("Snap Object");
1098
+
1099
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
+ fourButton.addActionListener(this);
1101
+ fourButton.setToolTipText("Show control panel only");
5181102 }
5191103
520
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
521
- flashSelectionButton.setToolTipText("Show selection");
522
- flashSelectionButton.addActionListener(this);
1104
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
5231105
524
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
525
-
526
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
527
- twoButton.setToolTipText("Show center view only");
1106
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1107
+ twoButton.setToolTipText("Show 3D view only");
5281108 twoButton.addActionListener(this);
529
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
530
- fourButton.addActionListener(this);
531
- fourButton.setToolTipText("Show left panel only");
532
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
533
- sixButton.setToolTipText("2-column layout left");
534
- sixButton.addActionListener(this);
535
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
536
- threeButton.setToolTipText("2-column layout right");
1109
+ this.fullscreenLayout = twoButton;
1110
+
1111
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
+ threeButton.setToolTipText("Show controls and 3D view");
5371113 threeButton.addActionListener(this);
538
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
539
- sevenButton.setToolTipText("3-column layout");
540
- sevenButton.addActionListener(this);
1114
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
+ sixButton.setToolTipText("Show 3D view and controls");
1116
+ sixButton.addActionListener(this);
1117
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+// sevenButton.setToolTipText("3-column layout");
1119
+// sevenButton.addActionListener(this);
5411120 //
5421121
543
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
544
- rootButton.setToolTipText("Edit selection in new tab");
1122
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1123
+ rootButton.setToolTipText("Open selection in new tab");
5451124 rootButton.addActionListener(this);
5461125
547
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1126
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5481127 closeButton.setToolTipText("Close tab");
5491128 closeButton.addActionListener(this);
5501129 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5511130 //clearButton.addActionListener(this);
552
-
553
- cGridBag commandsPanel = new cGridBag();
1131
+
1132
+ cGridBag row1 = new cGridBag();
5541133
555
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
556
- editButton.setToolTipText("Edit selection");
1134
+ // INSERT
1135
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ gridButton.setToolTipText("Create grid");
1137
+ gridButton.addActionListener(this);
1138
+
1139
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ boxButton.setToolTipText("Create box");
1141
+ boxButton.addActionListener(this);
1142
+
1143
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1144
+ sphereButton.setToolTipText("Create sphere");
1145
+ sphereButton.addActionListener(this);
1146
+
1147
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1148
+ coneButton.setToolTipText("Create cone");
1149
+ coneButton.addActionListener(this);
1150
+
1151
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ torusButton.setToolTipText("Create torus");
1153
+ torusButton.addActionListener(this);
1154
+
1155
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1156
+ superButton.setToolTipText("Create superellipsoid");
1157
+ superButton.addActionListener(this);
1158
+
1159
+ if (Globals.ADVANCED)
1160
+ {
1161
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1162
+ kleinButton.setToolTipText("Create Klein bottle");
1163
+ kleinButton.addActionListener(this);
1164
+ }
1165
+
1166
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1167
+ particlesButton.setToolTipText("Create particle system");
1168
+ particlesButton.addActionListener(this);
1169
+
1170
+ oe.toolboxPanel.add(row1);
1171
+
1172
+ cGridBag row2 = new cGridBag();
1173
+
1174
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ groupButton.setToolTipText("Create group");
1176
+ groupButton.addActionListener(this);
1177
+
1178
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1179
+ compositeButton.setToolTipText("Create composite");
1180
+ compositeButton.addActionListener(this);
1181
+
1182
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ switchButton.setToolTipText("Create item switcher");
1184
+ switchButton.addActionListener(this);
1185
+
1186
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ loopButton.setToolTipText("Create loop");
1188
+ loopButton.addActionListener(this);
1189
+
1190
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1191
+ textureButton.setToolTipText("Create texture");
1192
+ textureButton.addActionListener(this);
1193
+
1194
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1195
+ overlayButton.setToolTipText("Create overlay");
1196
+ overlayButton.addActionListener(this);
1197
+
1198
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1199
+ lightButton.setToolTipText("Create light");
1200
+ lightButton.addActionListener(this);
1201
+
1202
+ oe.toolboxPanel.add(row2);
1203
+
1204
+ cGridBag textures = new cGridBag();
1205
+
1206
+ CreateTexturePanel(textures);
1207
+
1208
+ oe.toolboxPanel.add(textures);
1209
+
1210
+ textures.preferredHeight = 100;
1211
+
1212
+ CreateSkyboxPanel(oe.skyboxPanel);
1213
+
1214
+ // EDIT panel
1215
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1216
+ editButton.setToolTipText("Pin selection controls");
5571217 editButton.addActionListener(this);
5581218
559
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
560
- uneditButton.setToolTipText("Unedit selection");
1219
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5611221 uneditButton.addActionListener(this);
5621222
563
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
564
- allParamsButton.setToolTipText("Edit all params");
1223
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1224
+ allParamsButton.setToolTipText("Show all controls");
5651225 allParamsButton.addActionListener(this);
5661226
567
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
568
- clearPanelButton.setToolTipText("Clear edit panel");
1227
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1228
+ clearPanelButton.setToolTipText("Clear all controls");
5691229 clearPanelButton.addActionListener(this);
5701230
571
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
572
- unselectButton.setToolTipText("Unselect");
573
- unselectButton.addActionListener(this);
1231
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ //unselectButton.setToolTipText("Unselect");
1233
+ //unselectButton.addActionListener(this);
5741234
575
- commandsPanel.preferredHeight = 1;
1235
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ flashSelectionButton.setToolTipText("Highlight selection");
1237
+ flashSelectionButton.addActionListener(this);
5761238
577
- oe.treePanel.add(commandsPanel);
578
- oe.treePanel.Return();
1239
+ editCommandsPanel.preferredHeight = 1;
1240
+
1241
+ SetPinStates(false);
1242
+// oe.treePanel.add(commandsPanel);
1243
+// oe.treePanel.Return();
5791244
5801245 // oe.aConstraints.gridx += 1;
5811246 // oe.aConstraints.weighty = 0;
....@@ -592,32 +1257,20 @@
5921257
5931258 JScrollPane jSP;
5941259 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
595
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1260
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5961261 ResetModel();
5971262
5981263 oe.treePanel.add(jSPPanel);
5991264 oe.treePanel.Return();
6001265
601
- cGridBag copyOptionsPanel = new cGridBag();
602
-
603
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
604
- colorCB.setToolTipText("Copy color when dropped");
605
- colorCB.addItemListener(this);
606
-
607
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
608
- materialCB.setToolTipText("Copy material when dropped");
609
- materialCB.addItemListener(this);
610
-
611
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
612
- textureCB.setToolTipText("Copy texture when dropped");
613
- textureCB.addItemListener(this);
614
-
615
- copyOptionsPanel.preferredHeight = 1;
6161266 oe.treePanel.add(copyOptionsPanel);
6171267 oe.treePanel.Return();
1268
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1269
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1270
+ sliderPane.preferredHeight = 1;
6181271
619
-// mainPanel.setDividerLocation(0.5); //1.0);
620
-// mainPanel.setResizeWeight(0.5);
1272
+// mainPanel.setDividerLocation(0.1); //1.0);
1273
+ mainPanel.setResizeWeight(0.4);
6211274
6221275 //jList.addListSelectionListener(this);
6231276 oe.jTree.addTreeSelectionListener(this);
....@@ -625,7 +1278,7 @@
6251278 //jTree.setEditable(true);
6261279 oe.jTree.setDragEnabled(true);
6271280 //jTree.setPreferredSize(new Dimension(10,10));
628
- jSP.setPreferredSize(new Dimension(100,200));
1281
+ //jSP.setPreferredSize(new Dimension(100,200));
6291282
6301283 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6311284
....@@ -637,29 +1290,49 @@
6371290 dgr.addDragGestureListener(this);
6381291 }catch(Exception e) {}
6391292 */
640
- radio.layout = sevenButton;
1293
+ radio.layout = threeButton; // sixButton;
6411294 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6421295 }
6431296
6441297 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6451298 {
1299
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1300
+ colorCB.setToolTipText("Copy color when dropped");
1301
+ colorCB.addItemListener(this);
1302
+
1303
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1304
+ materialCB.setToolTipText("Copy material when dropped");
1305
+ materialCB.addItemListener(this);
1306
+
1307
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1308
+ textureCB.setToolTipText("Copy texture when dropped");
1309
+ textureCB.addItemListener(this);
1310
+
1311
+ panel.Return();
1312
+
6461313 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
6471314 boxCB.setToolTipText("Display bounding boxes");
6481315 boxCB.addItemListener(this);
6491316
6501317 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
651
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1318
+ zoomBoxCB.setToolTipText("Display only for wheel");
6521319 zoomBoxCB.addItemListener(this);
6531320
654
- if (Globals.ADVANCED)
1321
+ if (true) // Globals.ADVANCED)
6551322 {
656
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
657
- supportCB.setToolTipText("Enable rigging");
658
- supportCB.addItemListener(this);
1323
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1324
+// supportCB.setToolTipText("Enable rigging");
1325
+// supportCB.addItemListener(this);
1326
+
1327
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1328
+ freezeCB.setToolTipText("Fast moving camera");
1329
+ freezeCB.addItemListener(this);
6591330
6601331 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6611332 // localCB.addItemListener(this);
6621333
1334
+ panel.Return();
1335
+
6631336 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6641337 crowdCB.setToolTipText("Used for crowds");
6651338 crowdCB.addItemListener(this);
....@@ -668,14 +1341,19 @@
6681341 smoothCB.setToolTipText("Snapping delay");
6691342 smoothCB.addItemListener(this);
6701343
671
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
672
- slowCB.setToolTipText("Smooth interpolation");
673
- slowCB.addItemListener(this);
1344
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1345
+// slowCB.setToolTipText("Smooth interpolation");
1346
+// slowCB.addItemListener(this);
1347
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1348
+ minshaderCB.setToolTipText("Minimal fast shader");
1349
+ minshaderCB.addItemListener(this);
6741350
6751351 // constraints.gridy += 1;
6761352 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6771353 // speakerMocapCB.addItemListener(this);
6781354
1355
+ panel.Return();
1356
+
6791357 if (false)
6801358 {
6811359 // handled in scripts
....@@ -690,42 +1368,85 @@
6901368 //constraints.gridy += 1;
6911369 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6921370 smoothfocusCB.addItemListener(this);
1371
+ panel.Return();
6931372 }
6941373
6951374 //constraints.gridx += 1;
6961375 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6971376 // debugCB.addItemListener(this);
6981377
1378
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1379
+ trackCB.setToolTipText("Enable tracking target");
1380
+ trackCB.addItemListener(this);
1381
+
6991382 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1383
+ oeilCB.setToolTipText("Move camera when tracking");
7001384 oeilCB.addItemListener(this);
7011385
1386
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1387
+ shadowCB.setToolTipText("When live compute shadows");
1388
+ shadowCB.addItemListener(this);
1389
+
1390
+ panel.Return();
1391
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1392
+ toggleTextureCB.setToolTipText("Load textures");
1393
+ toggleTextureCB.addItemListener(this);
1394
+
1395
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1396
+ toggleSwitchCB.setToolTipText("Choose a single item");
1397
+ toggleSwitchCB.addItemListener(this);
1398
+
1399
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1400
+ autokeepCB.setToolTipText("On structure change");
1401
+ autokeepCB.addItemListener(this);
1402
+
1403
+ panel.Return();
1404
+ if (Globals.ADVANCED)
1405
+ {
7021406 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7031407 lookAtCB.setToolTipText("Look-at target");
7041408 lookAtCB.addItemListener(this);
1409
+ }
7051410
7061411 }
7071412
7081413 cGridBag fill = new cGridBag();
709
-
7101414 fill.preferredHeight = 200;
1415
+ cGridBag fill2 = new cGridBag();
1416
+ fill2.preferredHeight = 200;
1417
+ cGridBag fill3 = new cGridBag();
1418
+ fill3.preferredHeight = 200;
7111419
7121420 panel.add(fill);
1421
+ panel.add(fill2);
1422
+ panel.add(fill3);
7131423
7141424 }
7151425
7161426 void EditObject(Object3D obj)
7171427 {
7181428 cRadio radioButton = new cRadio(obj.name);
1429
+
1430
+ // June 2019. Patch to avoid bug with transparency.
1431
+ radioButton.hadMaterial = obj.material != null;
1432
+ if (!radioButton.hadMaterial)
1433
+ {
1434
+ obj.material = new cMaterial();
1435
+ }
1436
+
7191437 radioButton.SetObject(obj);
720
- radioButton.layout = sevenButton;
1438
+ radioButton.layout = threeButton; // sixButton;
7211439 radioButton.SetCamera(cameraView.renderCamera, false);
7221440 radioButton.addActionListener(this);
7231441 radioPanel.add(radioButton);
7241442 buttonGroup.add(radioButton);
7251443 radioButton.doClick();
7261444 }
1445
+
7271446 void SetupViews(ObjEditor oe)
7281447 {
1448
+ theFrame = this;
1449
+
7291450 oe.SetupViews();
7301451
7311452 System.out.println("SetupViews");
....@@ -734,23 +1455,30 @@
7341455 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7351456 }
7361457
737
- JCheckBox liveCB;
738
- JCheckBox supportCB;
739
- JCheckBox localCB;
740
- JCheckBox crowdCB;
741
- JCheckBox smoothCB;
742
- JCheckBox fastCB;
743
- JCheckBox slowCB;
744
- JCheckBox boxCB;
745
- JCheckBox zoomBoxCB;
746
- JCheckBox trackCB;
747
- JCheckBox smoothfocusCB;
1458
+ cToggleButton liveCB;
1459
+ cCheckBox supportCB;
1460
+ cCheckBox localCB;
1461
+ cCheckBox crowdCB;
1462
+ cCheckBox smoothCB;
1463
+ cCheckBox minshaderCB;
1464
+
1465
+ cToggleButton fastCB;
1466
+ cCheckBox slowCB;
1467
+ cCheckBox boxCB;
1468
+ cCheckBox zoomBoxCB;
1469
+ cCheckBox freezeCB;
1470
+ //cToggleButton trackCB;
1471
+ cCheckBox trackCB;
1472
+ cCheckBox smoothfocusCB;
7481473 // JCheckBox speakerMocapCB;
749
- JCheckBox speakerCameraCB;
750
- JCheckBox speakerFocusCB;
751
- JCheckBox debugCB;
752
- JCheckBox oeilCB;
753
- JCheckBox lookAtCB;
1474
+ cCheckBox speakerCameraCB;
1475
+ cCheckBox speakerFocusCB;
1476
+ cCheckBox debugCB;
1477
+
1478
+ cCheckBox oeilCB;
1479
+ cCheckBox shadowCB;
1480
+ cCheckBox autokeepCB;
1481
+ cCheckBox lookAtCB;
7541482
7551483 // static int COLOR = 1;
7561484 // static int MATERIAL = 2;
....@@ -758,9 +1486,9 @@
7581486
7591487 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7601488
761
- JCheckBox colorCB;
762
- JCheckBox materialCB;
763
- JCheckBox textureCB;
1489
+ cCheckBox colorCB;
1490
+ cCheckBox materialCB;
1491
+ cCheckBox textureCB;
7641492
7651493 public void itemStateChanged(ItemEvent e)
7661494 {
....@@ -788,6 +1516,7 @@
7881516 } else if(e.getSource() == liveCB)
7891517 {
7901518 cameraView.ToggleLive();
1519
+ refreshContents(false);
7911520 }
7921521 else if(e.getSource() == supportCB)
7931522 {
....@@ -803,6 +1532,12 @@
8031532 {
8041533 cameraView.ToggleInertia();
8051534 cameraView.repaint();
1535
+ }
1536
+ else if(e.getSource() == minshaderCB)
1537
+ {
1538
+ Globals.MINSHADER ^= true;
1539
+ cameraView.programInitialized = false;
1540
+ cameraView.repaint();
8061541 }
8071542 else if(e.getSource() == localCB)
8081543 {
....@@ -852,6 +1587,18 @@
8521587 {
8531588 cameraView.ToggleOeil();
8541589 }
1590
+ else if(e.getSource() == shadowCB)
1591
+ {
1592
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1593
+ }
1594
+ else if(e.getSource() == freezeCB)
1595
+ {
1596
+ Globals.FREEZEONMOVE ^= true;
1597
+ }
1598
+ else if(e.getSource() == autokeepCB)
1599
+ {
1600
+ Globals.REPLACEONMAKE ^= true;
1601
+ }
8551602 else if(e.getSource() == lookAtCB)
8561603 {
8571604 cameraView.ToggleLookAt();
....@@ -868,7 +1615,8 @@
8681615
8691616 /**/
8701617 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
871
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1618
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1619
+ TreePath path = objEditor.jTree.getSelectionPath();
8721620 if ((path == null) || (path.getPathCount() <= 1)) {
8731621 // We can't move the root node or an empty selection
8741622 return;
....@@ -931,8 +1679,6 @@
9311679 }
9321680 }
9331681
934
- String string = (String) object;
935
-
9361682 System.out.println("Transfer = " + object + "; drop : " + target);
9371683 // if( object instanceof java.io.File[])
9381684 // {
....@@ -940,7 +1686,11 @@
9401686 // objEditor.DropFile((java.io.File[]) object, true);
9411687 // return;
9421688 // }
943
- if (string.charAt(0) == '/')
1689
+
1690
+ String string = object.toString();
1691
+
1692
+ // File path for Mac and Windows
1693
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9441694 {
9451695 // file(s)
9461696 String[] names = string.split("\n");
....@@ -967,7 +1717,7 @@
9671717
9681718 flashIt = false;
9691719 CameraPane pane = (CameraPane) target;
970
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1720
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9711721 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9721722
9731723 if (group.selection.size() == 1)
....@@ -983,23 +1733,33 @@
9831733
9841734 assert target == objEditor.jTree;
9851735 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1736
+ Object3D destinationLeaf;
9861737 try {
987
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1738
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9881739 } catch (Exception e) {
9891740 System.out.println("destinationPath : " + destinationPath);
9901741 return;
9911742 }
9921743
993
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1744
+ for (int i=group.selection.size(); --i>=0;)
9941745 {
1746
+ Object3D child = (Object3D)group.selection.elementAt(i);
1747
+
1748
+ // Cannot move into itself
1749
+ if (child == destinationLeaf)
1750
+ return;
1751
+ }
1752
+
1753
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1754
+// {
9951755 loadClipboard(true);
9961756 objEditor.jTree.setSelectionPath(destinationPath);
9971757 pasteInto(false, false);
998
- } else {
999
- loadClipboard(false);
1000
- objEditor.jTree.setSelectionPath(destinationPath);
1001
- pasteInto(false, false); // true); // ???
1002
- }
1758
+// } else {
1759
+// loadClipboard(false);
1760
+// objEditor.jTree.setSelectionPath(destinationPath);
1761
+// pasteInto(false, false); // true); // ???
1762
+// }
10031763 }
10041764 public void dropActionChanged(DropTargetDragEvent dtde)
10051765 // Called if the user has modified the current drop gesture
....@@ -1104,22 +1864,30 @@
11041864 {
11051865 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11061866 //heightFieldItem.addActionListener(this);
1107
- gridItem = menu.add(new MenuItem("Grid"));
1108
- gridItem.addActionListener(this);
1109
- rectoidItem = menu.add(new MenuItem("Box"));
1110
- rectoidItem.addActionListener(this);
1111
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1112
- ellipsoidItem.addActionListener(this);
1113
- coneItem = menu.add(new MenuItem("Cone"));
1114
- coneItem.addActionListener(this);
1115
- torusItem = menu.add(new MenuItem("Torus"));
1116
- torusItem.addActionListener(this);
1117
- superItem = menu.add(new MenuItem("Superellipsoid"));
1118
- superItem.addActionListener(this);
1867
+// gridItem = menu.add(new MenuItem("Grid"));
1868
+// gridItem.addActionListener(this);
1869
+// rectoidItem = menu.add(new MenuItem("Box"));
1870
+// rectoidItem.addActionListener(this);
1871
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1872
+// ellipsoidItem.addActionListener(this);
1873
+// coneItem = menu.add(new MenuItem("Cone"));
1874
+// coneItem.addActionListener(this);
1875
+// torusItem = menu.add(new MenuItem("Torus"));
1876
+// torusItem.addActionListener(this);
1877
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1878
+// superItem.addActionListener(this);
1879
+
1880
+ cameraItem = menu.add(new MenuItem("Camera"));
1881
+ cameraItem.addActionListener(this);
1882
+
1883
+ if (!Globals.ADVANCED)
1884
+ {
11191885 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11201886 kleinItem.addActionListener(this);
1121
- particleItem = menu.add(new MenuItem("Particle system"));
1122
- particleItem.addActionListener(this);
1887
+ }
1888
+
1889
+// particleItem = menu.add(new MenuItem("Particle system"));
1890
+// particleItem.addActionListener(this);
11231891 if (Globals.ADVANCED)
11241892 {
11251893 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1145,15 +1913,15 @@
11451913 }
11461914 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11471915 bezierItem.addActionListener(this);
1148
- overlayItem = menu.add(new MenuItem("Overlay"));
1149
- overlayItem.addActionListener(this);
1150
- lightItem = menu.add(new MenuItem("Light"));
1151
- lightItem.addActionListener(this);
1916
+// overlayItem = menu.add(new MenuItem("Overlay"));
1917
+// overlayItem.addActionListener(this);
1918
+// lightItem = menu.add(new MenuItem("Light"));
1919
+// lightItem.addActionListener(this);
11521920 menu.add("-");
11531921 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11541922 //superLoopItem.addActionListener(this);
1155
- loopItem = menu.add(new MenuItem("Loop"));
1156
- loopItem.addActionListener(this);
1923
+// loopItem = menu.add(new MenuItem("Loop"));
1924
+// loopItem.addActionListener(this);
11571925 doubleItem = menu.add(new MenuItem("Fork"));
11581926 doubleItem.addActionListener(this);
11591927 if (Globals.ADVANCED)
....@@ -1169,6 +1937,9 @@
11691937 animationItem.addItemListener(this);
11701938 animationItem.setState(Globals.ANIMATION);
11711939
1940
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1941
+ archiveItem.addActionListener(this);
1942
+
11721943 menu.add("-");
11731944 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11741945 parseverticesItem.addActionListener(this);
....@@ -1181,6 +1952,8 @@
11811952 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11821953 reduce34MorphItem.addActionListener(this);
11831954 menu.add("-");
1955
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1956
+ memoryItem.addActionListener(this);
11841957 menu.add(computeAOItem = new MenuItem("Compute AO"));
11851958 computeAOItem.addActionListener(this);
11861959
....@@ -1189,11 +1962,9 @@
11891962 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11901963 mirrorItem.addActionListener(this);
11911964 menu.add("-");
1192
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1193
- memoryItem.addActionListener(this);
11941965 menu.add(analyzeItem = new MenuItem("Analyze"));
11951966 analyzeItem.addActionListener(this);
1196
- menu.add(dumpItem = new MenuItem("Dump"));
1967
+ menu.add(dumpItem = new MenuItem("Print"));
11971968 dumpItem.addActionListener(this);
11981969 // menu.add(pathItem = new MenuItem("From-to path"));
11991970 // pathItem.addActionListener(this);
....@@ -1334,9 +2105,34 @@
13342105 shadow.material = new cMaterial(obj.material);
13352106 shadow.material.diffuse = 0.0001f;
13362107 shadow.material.specular = 0.0001f;
2108
+ //shadow.projectedVertices[1].x = 300;
13372109
13382110 makeSomething(shadow);
13392111 }
2112
+
2113
+ private void ClearUnpinned()
2114
+ {
2115
+ //for (Object3D obj : listUI)
2116
+ for (int i=listUI.size(); --i>=0;)
2117
+ {
2118
+ Object3D obj = listUI.elementAt(i);
2119
+ if (!obj.pinned)
2120
+ {
2121
+ obj.CloseUI();
2122
+ listUI.remove(i);
2123
+ }
2124
+ }
2125
+ }
2126
+
2127
+ private void EditElement(Object3D elem, boolean newWindow)
2128
+ {
2129
+ // if (!(elem instanceof Composite))
2130
+ // newWindow = false;
2131
+ listUI.add(elem);
2132
+ elem.openEditWindow(this, newWindow); //, false);
2133
+ System.out.println("edit : " + elem);
2134
+ elem.editWindow.refreshContents(true); // ? new
2135
+ }
13402136
13412137 /**
13422138 * applyExample
....@@ -1540,9 +2336,9 @@
15402336
15412337 void Overwrite(int mask)
15422338 {
1543
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2339
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15442340 {
1545
- Object3D content = GrafreeD.clipboard.get(0);
2341
+ Object3D content = Grafreed.clipboard.get(0);
15462342
15472343 if (content instanceof cGroup && ((cGroup)content).transientlink )
15482344 content = ((cGroup)content).get(0);
....@@ -1581,7 +2377,7 @@
15812377 {
15822378 ScreenFit();
15832379 } else
1584
- if (source == switchItem)
2380
+ if (source == switchViewItem)
15852381 {
15862382 cVector v1 = new cVector();
15872383 cVector v2 = new cVector();
....@@ -1590,11 +2386,11 @@
15902386 objEditor.cameraView.renderCamera.setAim(v2, v1);
15912387 objEditor.cameraView.repaint();
15922388 } else
1593
- if (source == rectoidItem)
2389
+ if (source == rectoidItem || source == boxButton)
15942390 {
15952391 makeSomething(new Box());
15962392 } else
1597
- if (source == particleItem)
2393
+ if (source == particleItem || source == particlesButton)
15982394 {
15992395 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16002396 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1673,27 +2469,27 @@
16732469
16742470 makeSomething(obj);
16752471 } else
1676
- if (source == gridItem)
2472
+ if (source == gridItem || source == gridButton)
16772473 {
16782474 makeSomething(new Grid());
16792475 } else
1680
- if (source == ellipsoidItem)
2476
+ if (source == ellipsoidItem || source == sphereButton)
16812477 {
16822478 makeSomething(new Sphere());
16832479 } else
1684
- if (source == coneItem)
2480
+ if (source == coneItem || source == coneButton)
16852481 {
16862482 makeSomething(new Cone());
16872483 } else
1688
- if (source == torusItem)
2484
+ if (source == torusItem || source == torusButton)
16892485 {
16902486 makeSomething(new Torus());
16912487 } else
1692
- if (source == superItem)
2488
+ if (source == superItem || source == superButton)
16932489 {
16942490 makeSomething(new Superellipsoid());
16952491 } else
1696
- if (source == kleinItem)
2492
+ if (source == kleinItem || source == kleinButton)
16972493 {
16982494 makeSomething(new Klein());
16992495 } else
....@@ -1713,7 +2509,7 @@
17132509 {
17142510 makeSomething(new BezierSurface());
17152511 } else
1716
- if (source == overlayItem)
2512
+ if (source == overlayItem || source == overlayButton)
17172513 {
17182514 /*
17192515 Object3D obj = new BezierSurface(5,8);
....@@ -1761,10 +2557,27 @@
17612557 s.setup();
17622558 makeSomething(s);
17632559 } else
1764
- if (source == lightItem)
2560
+ if (source == lightItem || source == lightButton)
17652561 {
17662562 makeSomething(new Light());
17672563 } else
2564
+// if (source == skybox1Button ||
2565
+// source == skybox2Button ||
2566
+// source == skybox3Button ||
2567
+// source == skybox4Button ||
2568
+// source == skybox5Button ||
2569
+// source == skybox6Button ||
2570
+// source == skybox7Button ||
2571
+// source == skybox11Button ||
2572
+// source == skybox12Button ||
2573
+// source == skybox13Button ||
2574
+// source == skybox14Button ||
2575
+// source == skybox15Button ||
2576
+// source == skybox16Button ||
2577
+// source == skybox17Button)
2578
+// {
2579
+// ChangeSkybox(source);
2580
+// } else
17682581 if (source == csgItem)
17692582 {
17702583 group(new CSG());
....@@ -1811,30 +2624,30 @@
18112624
18122625 group(g);
18132626 } else
1814
- if (source == loopItem)
2627
+ if (source == loopItem || source == loopButton)
18152628 {
18162629 Composite csg = new GroupLeaf();
18172630 csg.count = 5;
18182631 group(csg);
1819
- Composite child = new cGroup();
2632
+ Composite child = new cGroup("Branch");
18202633 csg.addChild(child);
18212634 child.addChild(csg);
18222635 } else
18232636 if (source == doubleItem)
18242637 {
1825
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Fork");
18262639 csg.count = 5;
18272640 group(csg);
1828
- Composite child = new cGroup();
2641
+ Composite child = new cGroup("Branch A");
18292642 csg.addChild(child);
18302643 child.addChild(csg);
1831
- child = new cGroup();
2644
+ child = new cGroup("Branch B");
18322645 csg.addChild(child);
18332646 child.addChild(csg);
18342647 } else
18352648 if (source == tripleItem)
18362649 {
1837
- Composite csg = new GroupLeaf();
2650
+ Composite csg = new GroupLeaf("Trident");
18382651 csg.count = 4;
18392652 group(csg);
18402653 Composite child = new cGroup();
....@@ -1847,35 +2660,10 @@
18472660 csg.addChild(child);
18482661 child.addChild(csg);
18492662 } else
1850
-
1851
- if (source == importGFDItem)
1852
- {
1853
- ImportGFD();
1854
- } else
1855
- if (source == importVRMLX3DItem)
1856
- {
1857
- ImportVRMLX3D();
1858
- } else
1859
- if (source == import3DSItem)
1860
- {
1861
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1862
- } else
1863
- if (source == importOBJItem)
1864
- {
1865
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1866
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1867
- browser.setVisible(true);
1868
- String filename = browser.getFile();
1869
- if (filename != null && filename.length() > 0)
1870
- {
1871
- String fullname = browser.getDirectory() + filename;
1872
- makeSomething(ReadOBJ(fullname), true);
1873
- }
1874
- } else
18752663 if (source == computeAOItem)
18762664 {
18772665 Globals.drawMode = CameraPane.OCCLUSION;
1878
- Globals.theRenderer.repaint();
2666
+ cameraView.repaint();
18792667 } else
18802668 if (source == recompileItem)
18812669 {
....@@ -1890,7 +2678,7 @@
18902678 if (source == invariantsItem)
18912679 {
18922680 System.out.println("Invariants:");
1893
- GrafreeD.grafreeD.universe.invariants();
2681
+ Grafreed.grafreed.universe.invariants();
18942682 } else
18952683 if (source == memoryItem)
18962684 {
....@@ -1909,6 +2697,53 @@
19092697 {
19102698 DumpObject();
19112699 } else
2700
+ if (source == minButton)
2701
+ {
2702
+ Minimize();
2703
+ } else
2704
+ if (source == maxButton)
2705
+ {
2706
+ Maximize();
2707
+ } else
2708
+ if (source == fullButton)
2709
+ {
2710
+ ToggleFullScreen();
2711
+ } else
2712
+ if (source == previousVersionButton)
2713
+ {
2714
+ // Go to previous version
2715
+ //if (!Undo())
2716
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2717
+ PreviousVersion();
2718
+ } else
2719
+ if (source == restoreButton)
2720
+ {
2721
+ // Restore current version
2722
+ Restore();
2723
+ //restoreButton.setEnabled(false);
2724
+ } else
2725
+ if (source == replaceButton)
2726
+ {
2727
+ // Overwrite current version
2728
+ Replace();
2729
+ //replaceButton.setEnabled(false);
2730
+ } else
2731
+ if (source == nextVersionButton)
2732
+ {
2733
+ // Go to next version
2734
+ NextVersion();
2735
+ } else
2736
+ if (source == saveVersionButton)
2737
+ {
2738
+ // Save a new version
2739
+ if (!Save(true))
2740
+ java.awt.Toolkit.getDefaultToolkit().beep();
2741
+ } else
2742
+ if (source == deleteVersionButton)
2743
+ {
2744
+ // Delete a new version
2745
+ DeleteVersion();
2746
+ } else
19122747 if (source == oneStepButton)
19132748 {
19142749 Globals.ONESTEP = true;
....@@ -1916,17 +2751,14 @@
19162751 } else
19172752 if (source == screenfitButton)
19182753 {
1919
- //Reload(lastConverter, lastFilename, true);
19202754 ScreenFit();
19212755 } else
19222756 if (source == screenfitpointButton)
19232757 {
1924
- //Reload(lastConverter, lastFilename, true);
19252758 ScreenFitPoint();
19262759 } else
19272760 if (source == snapobjectButton)
19282761 {
1929
- //Reload(lastConverter, lastFilename, true);
19302762 SnapObject();
19312763 } else
19322764 // if (event.getSource() == recompileButton)
....@@ -1963,12 +2795,20 @@
19632795 {
19642796 loadClipboard(true);
19652797 } else
2798
+ if (source == undoItem)
2799
+ {
2800
+ PreviousVersion();
2801
+ } else
2802
+ if (source == redoItem)
2803
+ {
2804
+ NextVersion();
2805
+ } else
19662806 if (source == duplicateItem)
19672807 {
1968
- Object3D keep = GrafreeD.clipboard;
2808
+ Object3D keep = Grafreed.clipboard;
19692809 loadClipboard(false);
19702810 paste(false);
1971
- GrafreeD.clipboard = keep;
2811
+ Grafreed.clipboard = keep;
19722812 } else
19732813 if (source == cloneItem)
19742814 {
....@@ -2188,9 +3028,9 @@
21883028 // group.selection.get(0).setMasterThis(content); // should be identity
21893029 // refreshContents();
21903030 // }
2191
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3031
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21923032 {
2193
- Object3D content = GrafreeD.clipboard.get(0);
3033
+ Object3D content = Grafreed.clipboard.get(0);
21943034
21953035 if (content instanceof cGroup && ((cGroup)content).transientlink )
21963036 content = ((cGroup)content).get(0);
....@@ -2240,9 +3080,9 @@
22403080 } else
22413081 if (source == setMasterItem)
22423082 {
2243
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
3083
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22443084 {
2245
- Object3D content = GrafreeD.clipboard.get(0);
3085
+ Object3D content = Grafreed.clipboard.get(0);
22463086
22473087 if (content instanceof cGroup && ((cGroup)content).transientlink )
22483088 content = ((cGroup)content).get(0);
....@@ -2255,9 +3095,9 @@
22553095 {
22563096 if (group.selection.size() == 1)
22573097 {
2258
- if (GrafreeD.clipboard.size() == 1)
3098
+ if (Grafreed.clipboard.size() == 1)
22593099 {
2260
- Object3D content = GrafreeD.clipboard.get(0);
3100
+ Object3D content = Grafreed.clipboard.get(0);
22613101
22623102 if (content instanceof cGroup && ((cGroup)content).transientlink )
22633103 content = ((cGroup)content).get(0);
....@@ -2274,7 +3114,7 @@
22743114 {
22753115 RevertMeshes();
22763116 } else
2277
- if (source == resetMeshItem)
3117
+ if (source == resetAllItem)
22783118 {
22793119 ResetAll();
22803120 } else
....@@ -2282,7 +3122,7 @@
22823122 {
22833123 StepAll();
22843124 } else
2285
- if (source == clearItem) // || event.getSource() == clearButton)
3125
+ if (source == deleteItem) // || event.getSource() == clearButton)
22863126 {
22873127 //int indices[] = jList.getSelectedIndices();
22883128 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2294,9 +3134,9 @@
22943134 {
22953135 ClearSelection(true);
22963136 } else
2297
- if (source == grabItem)
3137
+ if (source == grabItem || source == groupButton)
22983138 {
2299
- group(new cGroup(), true);
3139
+ group(new cGroup(), false); // true);
23003140 } else
23013141 if (source == hideItem)
23023142 {
....@@ -2314,11 +3154,11 @@
23143154 {
23153155 makeSomething(new Camera());
23163156 } else
2317
- if (source == compositeItem)
3157
+ if (source == compositeItem || source == compositeButton)
23183158 {
23193159 group(new Composite());
23203160 } else
2321
- if (source == randomItem)
3161
+ if (source == switchItem || source == switchButton)
23223162 {
23233163 RandomNode random = new RandomNode();
23243164 group(random);
....@@ -2420,7 +3260,7 @@
24203260 {
24213261 group(new cLinker());
24223262 } else
2423
- if (source == textureItem)
3263
+ if (source == textureItem || source == textureButton)
24243264 {
24253265 group(new TextureNode());
24263266 } else
....@@ -2440,17 +3280,30 @@
24403280 {
24413281 CastShadow(2);
24423282 } else
2443
- if (source == ungroupItem)
3283
+ if (source == ungroupItem || source == ungroupButton)
24443284 {
2445
- //ungroup();
3285
+ boolean hasRoot = false;
3286
+
24463287 for (int i=0; i<group.selection.size(); i++)
24473288 {
2448
- Ungroup(group.selection.get(i));
3289
+ if (group.selection.get(i) == group)
3290
+ {
3291
+ hasRoot = true;
3292
+ break;
3293
+ }
24493294 }
24503295
2451
- ClearSelection(false);
2452
-
2453
- refreshContents();
3296
+ if (!hasRoot)
3297
+ {
3298
+ for (int i=0; i<group.selection.size(); i++)
3299
+ {
3300
+ Ungroup(group.selection.get(i));
3301
+ }
3302
+
3303
+ ClearSelection(false);
3304
+
3305
+ refreshContents();
3306
+ }
24543307 } else
24553308 if (source == genUVItem)
24563309 {
....@@ -2462,7 +3315,7 @@
24623315 } else
24633316 if (source == genNormalsMESHItem)
24643317 {
2465
- GenNormals(true); // TODO
3318
+ GenNormalsMESH();
24663319 } else
24673320 if (source == genNormalsORGANItem)
24683321 {
....@@ -2527,6 +3380,22 @@
25273380 if (source == unmarkleavesItem)
25283381 {
25293382 MarkLeaves(false);
3383
+ } else
3384
+ if (source == rewindleavesItem)
3385
+ {
3386
+ RewindLeaves(true);
3387
+ } else
3388
+ if (source == unrewindleavesItem)
3389
+ {
3390
+ RewindLeaves(false);
3391
+ } else
3392
+ if (source == randomleavesItem)
3393
+ {
3394
+ RandomLeaves(true);
3395
+ } else
3396
+ if (source == unrandomleavesItem)
3397
+ {
3398
+ RandomLeaves(false);
25303399 } else
25313400 if (source == flipVItem)
25323401 {
....@@ -2612,9 +3481,13 @@
26123481 {
26133482 SmoothMesh();
26143483 } else
2615
- if (source == transformgeometryItem)
3484
+ if (source == transformGeometryItem)
26163485 {
26173486 TransformGeometry();
3487
+ } else
3488
+ if (source == transformChildrenItem)
3489
+ {
3490
+ TransformChildren();
26183491 } else
26193492 if (source == resetTransformItem)
26203493 {
....@@ -2622,7 +3495,11 @@
26223495 } else
26233496 if (source == resetCentroidItem)
26243497 {
2625
- ResetCentroid();
3498
+ ResetCentroid(true);
3499
+ } else
3500
+ if (source == resetCentroidXZItem)
3501
+ {
3502
+ ResetCentroid(false);
26263503 } else
26273504 if (source == resetParentItem)
26283505 {
....@@ -2727,7 +3604,7 @@
27273604 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27283605 {
27293606 obj = (Object3D)e.nextElement();
2730
- obj.SetBumpTexture(null);
3607
+ obj.ResetBumpTexture();
27313608 }
27323609
27333610 refreshContents();
....@@ -2743,6 +3620,31 @@
27433620
27443621 refreshContents();
27453622 } else
3623
+ if (source == embedTexturesItem)
3624
+ {
3625
+ Object3D obj;
3626
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3627
+ {
3628
+ obj = (Object3D)e.nextElement();
3629
+ obj.EmbedTextures(true);
3630
+ }
3631
+
3632
+ refreshContents();
3633
+ } else
3634
+ if (source == deEmbedTexturesItem)
3635
+ {
3636
+ Object3D obj;
3637
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3638
+ {
3639
+ obj = (Object3D)e.nextElement();
3640
+ obj.EmbedTextures(false);
3641
+ }
3642
+
3643
+ CameraPane.texturepigment.clear();
3644
+ CameraPane.texturebump.clear();
3645
+
3646
+ refreshContents();
3647
+ } else
27463648 if (source == flashSelectionButton)
27473649 {
27483650 CameraPane.flash = true;
....@@ -2754,6 +3656,10 @@
27543656 if (source == twoButton)
27553657 {
27563658 radio.layout = twoButton;
3659
+
3660
+ if (CameraPane.FULLSCREEN)
3661
+ fullscreenLayout = radio.layout;
3662
+
27573663 // bug
27583664 //gridPanel.setDividerLocation(1.0);
27593665 //bigPanel.setDividerLocation(0.0);
....@@ -2786,10 +3692,31 @@
27863692 bigThree.ClearUI();
27873693 bigThree.add(centralPanel);
27883694 bigThree.FlushUI();
3695
+
3696
+ cameraView.requestFocusInWindow();
3697
+
3698
+// refreshContents(true);
3699
+//
3700
+// try
3701
+// {
3702
+// java.awt.Robot bot = new java.awt.Robot();
3703
+// int mask = InputEvent.BUTTON1_MASK;
3704
+// bot.mouseMove(100, 100);
3705
+// bot.mousePress(mask);
3706
+// bot.mouseRelease(mask);
3707
+// }
3708
+// catch (Exception e)
3709
+// {
3710
+//
3711
+// }
3712
+
27893713 } else
27903714 if (source == threeButton)
27913715 {
27923716 radio.layout = threeButton;
3717
+
3718
+ if (CameraPane.FULLSCREEN)
3719
+ fullscreenLayout = radio.layout;
27933720
27943721 // bigThree.remove(scenePanel);
27953722 // bigThree.remove(centralPanel);
....@@ -2819,13 +3746,18 @@
28193746 // centralPanel.setVisible(true);
28203747 // XYZPanel.setVisible(true);
28213748 bigThree.ClearUI();
3749
+ bigThree.add(scenePanel);
28223750 bigThree.add(centralPanel);
2823
- bigThree.add(XYZPanel);
28243751 bigThree.FlushUI();
3752
+
3753
+ cameraView.requestFocusInWindow();
28253754 } else
28263755 if (source == fourButton)
28273756 {
28283757 radio.layout = fourButton;
3758
+
3759
+ if (CameraPane.FULLSCREEN)
3760
+ fullscreenLayout = radio.layout;
28293761
28303762 // bigThree.remove(scenePanel);
28313763 // bigThree.remove(centralPanel);
....@@ -2857,10 +3789,15 @@
28573789 bigThree.ClearUI();
28583790 bigThree.add(scenePanel);
28593791 bigThree.FlushUI();
3792
+
3793
+ cameraView.requestFocusInWindow();
28603794 } else
28613795 if (source == sixButton)
28623796 {
28633797 radio.layout = sixButton;
3798
+
3799
+ if (CameraPane.FULLSCREEN)
3800
+ fullscreenLayout = radio.layout;
28643801
28653802 // bigThree.remove(scenePanel);
28663803 // bigThree.remove(centralPanel);
....@@ -2890,13 +3827,18 @@
28903827 // centralPanel.setVisible(true);
28913828 // XYZPanel.setVisible(false);
28923829 bigThree.ClearUI();
2893
- bigThree.add(scenePanel);
28943830 bigThree.add(centralPanel);
3831
+ bigThree.add(scenePanel);
28953832 bigThree.FlushUI();
3833
+
3834
+ cameraView.requestFocusInWindow();
28963835 } else
28973836 if (source == sevenButton)
28983837 {
28993838 radio.layout = sevenButton;
3839
+
3840
+ if (CameraPane.FULLSCREEN)
3841
+ fullscreenLayout = radio.layout;
29003842
29013843 // bigThree.remove(scenePanel);
29023844 // bigThree.remove(centralPanel);
....@@ -2930,6 +3872,8 @@
29303872 bigThree.add(centralPanel);
29313873 bigThree.add(XYZPanel);
29323874 bigThree.FlushUI();
3875
+
3876
+ cameraView.requestFocusInWindow();
29333877 } else
29343878 if (source == rootButton)
29353879 {
....@@ -2941,6 +3885,7 @@
29413885 EditObject(obj);
29423886 }
29433887
3888
+ cameraView.requestFocusInWindow();
29443889 refreshContents(true);
29453890 } else
29463891 if (source == closeButton)
....@@ -2950,22 +3895,37 @@
29503895 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29513896 {
29523897 ab = (cRadio)e.nextElement();
2953
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3898
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29543899 {
3900
+ // Patch to avoid bug with transparency.
3901
+ if (!ab.hadMaterial)
3902
+ {
3903
+ ab.object.material = null;
3904
+ }
3905
+
29553906 buttonGroup.remove(ab);
29563907 radioPanel.remove(ab);
29573908
2958
- ab.GetObject().editWindow = null;
3909
+ //ab.GetObject().editWindow = null;
3910
+ ab.GetObject().manipWindow = null;
29593911 // ab.GetObject().objectUI = null; // ?????????
29603912
29613913 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29623914 break;
29633915 }
29643916 }
3917
+
3918
+ cameraView.requestFocusInWindow();
29653919 refreshContents(true);
29663920 } else
29673921 if (source == editItem || source == editButton)
29683922 {
3923
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3924
+ {
3925
+ Object3D child = (Object3D)e.nextElement();
3926
+ child.pinned = true;
3927
+ }
3928
+
29693929 EditSelection(false);
29703930 } else
29713931 if (source == uneditButton)
....@@ -2974,11 +3934,12 @@
29743934 {
29753935 Object3D child = (Object3D)e.nextElement();
29763936 if(child.editWindow != null)
2977
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3937
+ child.pinned = false;
29783938 child.CloseUI();
29793939 listUI.remove(child);
3940
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29803941
2981
- child.editWindow = null; // ???????????
3942
+ //child.editWindow = null; // ???????????
29823943 }
29833944 objEditor.ctrlPanel.FlushUI();
29843945 //objEditor.jTree.clearSelection();
....@@ -2991,16 +3952,18 @@
29913952 //copy.ClearUI();
29923953 for (Object3D obj : listUI)
29933954 {
3955
+ obj.pinned = false;
29943956 obj.CloseUI();
29953957 }
29963958 listUI.clear();
3959
+ SetPinStates(group.selection.size() > 0);
29973960 refreshContents(true);
29983961 } else
29993962 if (source == allParamsButton)
30003963 {
30013964 assert(copy == group);
30023965
3003
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3966
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30043967
30053968 for (Object3D obj : listUI)
30063969 {
....@@ -3049,6 +4012,9 @@
30494012 }
30504013
30514014 copy = group;
4015
+
4016
+ SetUndoStates();
4017
+
30524018 //Globals.theRenderer.object = group;
30534019 if(!useclient)
30544020 {
....@@ -3064,20 +4030,49 @@
30644030 frontView.object = group;
30654031 sideView.object = group;
30664032 }
3067
- group.editWindow = this;
4033
+
4034
+// fix "+" issue
4035
+ //group.editWindow = this;
4036
+ group.manipWindow = this;
4037
+
30684038 /*
30694039 currentLayout = radio.layout;
30704040 if (currentLayout == null)
30714041 currentLayout = sevenButton;
30724042 */
30734043 radio.layout.doClick();
4044
+
4045
+ ClearUnpinned();
4046
+
4047
+ //Grafreed.Assert(group != null);
4048
+ //Grafreed.Assert(group.selection != null);
4049
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4050
+ if (group.selection == null || group.selection.size() == 1)
4051
+ EditSelection(false);
30744052 keepparent = group.parent;
30754053 // PARENT = NULL or not???
30764054 //group.parent = null; // ROOT
30774055 //group.attributes = -1;
30784056 ResetModel();
4057
+
4058
+ cameraView.requestFocusInWindow();
30794059 refreshContents(true);
3080
- }
4060
+ } else if (event.getSource() == editCameraItem)
4061
+ {
4062
+ cameraView.ProtectCamera();
4063
+ cameraView.requestFocusInWindow();
4064
+ cameraView.repaint();
4065
+ return;
4066
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4067
+ {
4068
+ cameraView.RevertCamera();
4069
+ cameraView.requestFocusInWindow();
4070
+ cameraView.repaint();
4071
+ return;
4072
+ // } else if (event.getSource() == textureButton)
4073
+ // {
4074
+ // return; // true;
4075
+ }
30814076 else
30824077 {
30834078 //return super.action(event, arg);
....@@ -3086,7 +4081,6 @@
30864081 }
30874082
30884083 boolean useclient = false;
3089
- cRadio radio;
30904084
30914085 void ToggleRoot()
30924086 {
....@@ -3138,6 +4132,28 @@
31384132 refreshContents();
31394133 }
31404134
4135
+ void TransformChildren()
4136
+ {
4137
+ Object3D obj;
4138
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4139
+ {
4140
+ obj = (Object3D)e.nextElement();
4141
+ obj.KeepTextureMatrices();
4142
+ obj.TransformChildren();
4143
+ obj.RestoreTextureMatrices();
4144
+
4145
+// if (obj.parent == null)
4146
+// {
4147
+// System.out.println("NULL PARENT!");
4148
+// new Exception().printStackTrace();
4149
+// }
4150
+// else
4151
+// TouchTransform(obj);
4152
+// //obj.parent.Touch();
4153
+ }
4154
+
4155
+ refreshContents();
4156
+ }
31414157
31424158 void ResetTransform()
31434159 {
....@@ -3250,7 +4266,7 @@
32504266 refreshContents();
32514267 }
32524268
3253
- void ResetCentroid()
4269
+ void ResetCentroid(boolean full)
32544270 {
32554271 Object3D obj;
32564272 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3265,12 +4281,16 @@
32654281 LA.matIdentity(Object3D.mat);
32664282 obj.getBounds(minima, maxima, false);
32674283 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3268
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4284
+ if (full)
4285
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32694286 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32704287 obj.TransformMesh(Object3D.mat);
4288
+
32714289 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3272
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4290
+ if (full)
4291
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32734292 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4293
+
32744294 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32754295 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32764296 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3299,7 +4319,8 @@
32994319
33004320 int size = obj.MemorySize();
33014321
3302
- System.err.println((size/1024) + " KB is the size of " + obj);
4322
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4323
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33034324 }
33044325 }
33054326 catch (Exception e)
....@@ -3336,9 +4357,9 @@
33364357 obj = (Object3D)e.nextElement();
33374358
33384359 System.out.println("Object is: " + obj);
3339
- GrafreeD.AnalyzeObject(obj);
4360
+ Grafreed.AnalyzeObject(obj);
33404361 System.out.println("Boundary rep: " + obj.bRep);
3341
- GrafreeD.AnalyzeObject(obj.bRep);
4362
+ Grafreed.AnalyzeObject(obj.bRep);
33424363
33434364 // System.err.println((size/1024) + " KB is the size of " + obj);
33444365 }
....@@ -3380,6 +4401,13 @@
33804401 void GenNormals(boolean crease)
33814402 {
33824403 group.GenNormalsS(crease);
4404
+
4405
+ refreshContents();
4406
+ }
4407
+
4408
+ void GenNormalsMESH()
4409
+ {
4410
+ group.GenNormalsMeshS();
33834411
33844412 refreshContents();
33854413 }
....@@ -3552,8 +4580,8 @@
35524580
35534581 void ParseVertices()
35544582 {
3555
- boolean epsequal = GrafreeD.epsequal;
3556
- GrafreeD.epsequal = true;
4583
+ boolean epsequal = Grafreed.epsequal;
4584
+ Grafreed.epsequal = true;
35574585
35584586 for (int i=0; i<group.selection.size(); i++)
35594587 {
....@@ -3578,7 +4606,7 @@
35784606 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35794607 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35804608
3581
- g.add(GrafreeD.clipboard);
4609
+ g.add(Grafreed.clipboard);
35824610
35834611 buffer.add(g);
35844612 }
....@@ -3593,7 +4621,7 @@
35934621 makeSomething(buffer, i==group.selection.size()-1);
35944622 }
35954623
3596
- GrafreeD.epsequal = epsequal;
4624
+ Grafreed.epsequal = epsequal;
35974625
35984626 refreshContents();
35994627 }
....@@ -3611,7 +4639,16 @@
36114639 String pigment = Object3D.GetPigment(tex);
36124640 //String bump = Object3D.GetBump(tex);
36134641
3614
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4642
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4643
+
4644
+ try
4645
+ {
4646
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4647
+ }
4648
+ catch (Exception e)
4649
+ {
4650
+ System.err.println("FAIL: " + node);
4651
+ }
36154652
36164653 double s = v.s;
36174654
....@@ -3743,7 +4780,7 @@
37434780 return;
37444781
37454782 Object3D poses = group.selection.get(0);
3746
- Object3D ref = GrafreeD.clipboard.get(0);
4783
+ Object3D ref = Grafreed.clipboard.get(0);
37474784
37484785 Object3D newgroup = new Object3D("Po:" + poses.name);
37494786
....@@ -3937,9 +4974,9 @@
39374974
39384975 void ClipMesh()
39394976 {
3940
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4977
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39414978 {
3942
- Object3D content = GrafreeD.clipboard.get(0);
4979
+ Object3D content = Grafreed.clipboard.get(0);
39434980
39444981 if (content instanceof cGroup && ((cGroup)content).transientlink )
39454982 content = ((cGroup)content).get(0);
....@@ -3948,7 +4985,7 @@
39484985 // {
39494986 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39504987 // }
3951
- group.selection.ClipMesh(GrafreeD.clipboard);
4988
+ group.selection.ClipMesh(Grafreed.clipboard);
39524989 }
39534990 // group.selection.ClipMesh(GrafreeD.clipboard);
39544991 System.out.println("DONE.");
....@@ -3995,6 +5032,18 @@
39955032 void MarkLeaves(boolean hide)
39965033 {
39975034 group.selection.MarkLeaves(hide);
5035
+ refreshContents();
5036
+ }
5037
+
5038
+ void RewindLeaves(boolean hide)
5039
+ {
5040
+ group.selection.RewindLeaves(hide);
5041
+ refreshContents();
5042
+ }
5043
+
5044
+ void RandomLeaves(boolean hide)
5045
+ {
5046
+ group.selection.RandomLeaves(hide);
39985047 refreshContents();
39995048 }
40005049
....@@ -4069,28 +5118,25 @@
40695118 // }
40705119 // }
40715120
4072
- static boolean allparams = true;
4073
-
4074
- static Vector<Object3D> listUI = new Vector<Object3D>();
4075
-
40765121 void EditSelection(boolean newWindow)
40775122 {
5123
+ if (group.selection == null)
5124
+ {
5125
+ EditElement(group, newWindow); // ? new
5126
+ return;
5127
+ }
5128
+
40785129 // aConstraints.gridy = 0;
40795130 for (int i=0; i<group.selection.size(); i++)
40805131 {
40815132 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40825133 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4083
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5134
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40845135
40855136 Object3D elem = (Object3D)group.selection.elementAt(i);
4086
- if(elem != group)
5137
+ if(elem != group || !newWindow)
40875138 {
4088
- // if (!(elem instanceof Composite))
4089
- // newWindow = false;
4090
- listUI.add(elem);
4091
- elem.openEditWindow(this, newWindow); //, false);
4092
- System.out.println("edit : " + elem);
4093
- elem.editWindow.refreshContents(true); // ? new
5139
+ EditElement(elem, newWindow); // ? new
40945140 }
40955141 }
40965142 }
....@@ -4153,9 +5199,7 @@
41535199
41545200 freezemodel = false;
41555201 }
4156
-
4157
- boolean flashIt = true;
4158
-
5202
+
41595203 public void valueChanged(TreeSelectionEvent e)
41605204 //public boolean handleEvent(Event event)
41615205 {
....@@ -4165,7 +5209,8 @@
41655209 //new Exception().printStackTrace();
41665210
41675211 freezemodel = true;
4168
-
5212
+ ClearUnpinned();
5213
+
41695214 /**/
41705215 //switch (event.id)
41715216 {
....@@ -4173,7 +5218,6 @@
41735218 //case 702: // Event.LIST_DESELECT
41745219 group.deselectAll();
41755220 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4176
- objEditor.ClearInfo(); // .GetMaterial());
41775221 if (tps != null)
41785222 {
41795223 for (int i=0; i < tps.length; i++)
....@@ -4182,10 +5226,8 @@
41825226
41835227 //if (child.parent != null)
41845228 //child.parent.addSelectee(child);
5229
+ objEditor.SetMaterial(child);
41855230 group.addSelectee(child);
4186
- objEditor.SetMaterial(child); // .GetMaterial());
4187
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4188
- System.err.println("info : " + child.GetPath());
41895231 }
41905232 }
41915233 // else
....@@ -4195,20 +5237,28 @@
41955237 // System.err.println("info : " + group.GetPath());
41965238 // }
41975239
4198
- objEditor.SetText(); // jan 2014
4199
-
4200
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5240
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42015241 CameraPane.flash = true;
42025242
4203
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5243
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42045244 // a camera
42055245 {
4206
- CameraPane.camerachangeframe = 0; // don't refuse it
4207
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5246
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5247
+ {
5248
+ CameraPane.camerachangeframe = 0; // don't refuse it
5249
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5250
+ }
42085251 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42095252 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42105253 }
42115254
5255
+ if (tps != null && tps.length == 1)
5256
+ {
5257
+ EditSelection(false);
5258
+ }
5259
+
5260
+ SetPinStates(tps != null && tps.length > 0);
5261
+
42125262 refreshContents();
42135263 //return true;
42145264 }
....@@ -4217,6 +5267,37 @@
42175267
42185268 freezemodel = false;
42195269 }
5270
+
5271
+ void SetPinStates(boolean enabled)
5272
+ {
5273
+ editButton.setEnabled(enabled);
5274
+ uneditButton.setEnabled(enabled);
5275
+ //unselectButton.setEnabled(enabled);
5276
+ flashSelectionButton.setEnabled(enabled);
5277
+
5278
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5279
+ }
5280
+
5281
+ void refreshContents(boolean cp)
5282
+ {
5283
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5284
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5285
+ {
5286
+ objEditor.ClearInfo(); // .GetMaterial());
5287
+
5288
+ for (int i=0; i < group.selection.Size(); i++)
5289
+ {
5290
+ Object3D child = (Object3D) group.selection.get(i);
5291
+
5292
+ objEditor.AddInfo(child, this, true);
5293
+ System.err.println("info : " + child.GetPath());
5294
+ }
5295
+
5296
+ objEditor.SetText(); // jan 2014
5297
+ }
5298
+
5299
+ super.refreshContents(cp);
5300
+ }
42205301
42215302 void linkSomething(Object3D thing)
42225303 {
....@@ -4288,16 +5369,19 @@
42885369 {
42895370 if (group.selection.isEmpty())
42905371 return;
4291
- GrafreeD.clipboardIsTempGroup = false;
5372
+
5373
+ Grafreed.clipboardIsTempGroup = false;
42925374 Composite tGroup = null;
42935375 if (group.selection.size() > 0) // 1)
42945376 {
42955377 tGroup = new cGroup();
4296
- GrafreeD.clipboardIsTempGroup = true;
5378
+ Grafreed.clipboardIsTempGroup = true;
42975379 }
42985380
42995381 if (cut)
43005382 {
5383
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5384
+// Save();
43015385 //int indices[] = jList.getSelectedIndices();
43025386 //for (int i = indices.length - 1; i >= 0; i--)
43035387 //jList.remove(indices[i]);
....@@ -4333,16 +5417,16 @@
43335417 //System.out.println("cut " + child);
43345418 //System.out.println("parent = " + child.parent);
43355419 // tmp.addChild(child);
4336
- if (GrafreeD.clipboardIsTempGroup)
5420
+ if (Grafreed.clipboardIsTempGroup)
43375421 tGroup.add/*Child*/(tmp);
43385422 else
4339
- GrafreeD.clipboard = tmp;
5423
+ Grafreed.clipboard = tmp;
43405424 }
43415425 else
4342
- if (GrafreeD.clipboardIsTempGroup)
5426
+ if (Grafreed.clipboardIsTempGroup)
43435427 tGroup.add/*Child*/(child);
43445428 else
4345
- GrafreeD.clipboard = child;
5429
+ Grafreed.clipboard = child;
43465430 }
43475431
43485432 //ResetModel();
....@@ -4374,21 +5458,23 @@
43745458 //System.out.println("cut " + elem);
43755459 //System.out.println("parent = " + elem.parent);
43765460 // tmp.addChild(elem);
4377
- if (GrafreeD.clipboardIsTempGroup)
5461
+ if (Grafreed.clipboardIsTempGroup)
43785462 tGroup.add/*Child*/(tmp);
43795463 else
4380
- GrafreeD.clipboard = tmp;
5464
+ Grafreed.clipboard = tmp;
43815465 }
43825466 else
4383
- if (GrafreeD.clipboardIsTempGroup)
5467
+ if (Grafreed.clipboardIsTempGroup)
43845468 tGroup.add/*Child*/(child);
43855469 else
4386
- GrafreeD.clipboard = child;
5470
+ Grafreed.clipboard = child;
43875471 }
43885472
43895473 }
4390
- if (GrafreeD.clipboardIsTempGroup)
4391
- GrafreeD.clipboard = tGroup;
5474
+
5475
+ if (Grafreed.clipboardIsTempGroup)
5476
+ Grafreed.clipboard = tGroup;
5477
+
43925478 if (cut)
43935479 {
43945480 ResetModel();
....@@ -4398,11 +5484,15 @@
43985484
43995485 void paste(boolean expand)
44005486 {
5487
+ if (Globals.REPLACEONMAKE)
5488
+ Save();
5489
+ boolean keep = Globals.REPLACEONMAKE;
5490
+ Globals.REPLACEONMAKE = false;
44015491 // if (GrafreeD.clipboard == null)
44025492 // return;
44035493 boolean first = true;
44045494
4405
- if (GrafreeD.clipboardIsTempGroup)
5495
+ if (Grafreed.clipboardIsTempGroup)
44065496 {
44075497 Composite temp;
44085498
....@@ -4413,7 +5503,7 @@
44135503 temp = (Composite)Applet3D.clipboard.deepCopy();
44145504 */
44155505 Object3D elem;
4416
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5506
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44175507 {
44185508 Object3D child = (Object3D)e.nextElement();
44195509
....@@ -4447,16 +5537,17 @@
44475537 //Object3D cb = Applet3D.clipboard;
44485538 //temp.addChild(cb);
44495539 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4450
- assert(GrafreeD.clipboard.parent == null);
4451
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4452
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4453
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4454
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5540
+ assert(Grafreed.clipboard.parent == null);
5541
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5542
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5543
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5544
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44555545 else
4456
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4457
- GrafreeD.clipboard.get(0).parent = keepparent;
5546
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5547
+ Grafreed.clipboard.get(0).parent = keepparent;
44585548 }
44595549
5550
+ Globals.REPLACEONMAKE = keep;
44605551 ResetModel();
44615552 refreshContents();
44625553 }
....@@ -4503,9 +5594,9 @@
45035594 {
45045595 boolean first = true;
45055596
4506
- if (GrafreeD.clipboardIsTempGroup)
5597
+ if (Grafreed.clipboardIsTempGroup)
45075598 {
4508
- Composite temp = (Composite)GrafreeD.clipboard;
5599
+ Composite temp = (Composite)Grafreed.clipboard;
45095600 Object3D copy;
45105601 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45115602 {
....@@ -4515,7 +5606,7 @@
45155606 }
45165607 } else
45175608 {
4518
- linkSomething(GrafreeD.clipboard); //.get(0));
5609
+ linkSomething(Grafreed.clipboard); //.get(0));
45195610 }
45205611 }
45215612 }
....@@ -4592,6 +5683,10 @@
45925683
45935684 void group(Object3D csg, boolean grab)
45945685 {
5686
+ if (Globals.REPLACEONMAKE)
5687
+ Save();
5688
+ boolean keep = Globals.REPLACEONMAKE;
5689
+ Globals.REPLACEONMAKE = false;
45955690 if (//false) // why??
45965691 !group.selection.isEmpty())
45975692 {
....@@ -4705,10 +5800,15 @@
47055800 //node.add(csg);
47065801 //makeSomething(node);
47075802 makeSomething(csg);
5803
+ Globals.REPLACEONMAKE = keep;
47085804 }
47095805
47105806 void Ungroup(Object3D g)
47115807 {
5808
+ if (Globals.REPLACEONMAKE)
5809
+ Save();
5810
+ boolean keep = Globals.REPLACEONMAKE;
5811
+ Globals.REPLACEONMAKE = false;
47125812 if (g instanceof HiddenObject)
47135813 {
47145814 HiddenObject h = (HiddenObject) g;
....@@ -4725,6 +5825,7 @@
47255825 objEditor.makeSomething(g.get(i), false);
47265826 }
47275827 }
5828
+ Globals.REPLACEONMAKE = keep;
47285829 }
47295830
47305831 void ungroup()
....@@ -4920,21 +6021,6 @@
49206021 }
49216022 */
49226023
4923
- void ImportGFD()
4924
- {
4925
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4926
- browser.show();
4927
- String filename = browser.getFile();
4928
- if (filename != null && filename.length() > 0)
4929
- {
4930
- String fullname = browser.getDirectory() + filename;
4931
-
4932
- //Object3D readobj =
4933
- objEditor.ReadGFD(fullname, objEditor);
4934
- //makeSomething(readobj);
4935
- }
4936
- }
4937
-
49386024 /*
49396025 public void Callback(Object obj)
49406026 {
....@@ -4958,26 +6044,9 @@
49586044 }
49596045 */
49606046
4961
- void ImportVRMLX3D()
4962
- {
4963
- if (GrafreeD.standAlone)
4964
- {
4965
- /**/
4966
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4967
- browser.show();
4968
- String filename = browser.getFile();
4969
- if (filename != null && filename.length() > 0)
4970
- {
4971
- String fullname = browser.getDirectory() + filename;
4972
- LoadVRMLX3D(fullname);
4973
- }
4974
- /**/
4975
- }
4976
- }
4977
-
49786047 String GetFile(String dialogName)
49796048 {
4980
- if (GrafreeD.standAlone)
6049
+ if (Grafreed.standAlone)
49816050 {
49826051 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49836052 browser.show();
....@@ -5045,7 +6114,43 @@
50456114 cButton clearpanelButton;
50466115 cButton unselectButton;
50476116
6117
+ cButton restoreCameraButton;
6118
+
50486119 cButton oneStepButton;
6120
+
6121
+ cButton groupButton;
6122
+ cButton ungroupButton;
6123
+ cButton compositeButton;
6124
+ cButton switchButton;
6125
+ cButton loopButton;
6126
+ cButton textureButton;
6127
+
6128
+ cButton skybox1Button;
6129
+ cButton skybox2Button;
6130
+ cButton skybox3Button;
6131
+ cButton skybox4Button;
6132
+ cButton skybox5Button;
6133
+ cButton skybox6Button;
6134
+ cButton skybox7Button;
6135
+
6136
+ cButton skybox11Button;
6137
+ cButton skybox12Button;
6138
+ cButton skybox13Button;
6139
+ cButton skybox14Button;
6140
+ cButton skybox15Button;
6141
+ cButton skybox16Button;
6142
+ cButton skybox17Button;
6143
+
6144
+ cButton gridButton;
6145
+ cButton boxButton;
6146
+ cButton sphereButton;
6147
+ cButton coneButton;
6148
+ cButton torusButton;
6149
+ cButton superButton;
6150
+ cButton kleinButton;
6151
+ cButton particlesButton;
6152
+ cButton overlayButton;
6153
+ cButton lightButton;
50496154
50506155 cButton screenfitButton;
50516156 cButton screenfitpointButton;
....@@ -5058,14 +6163,6 @@
50586163
50596164 cButton setsupportButton;
50606165
5061
- cButton twoButton;
5062
- cButton sixButton;
5063
- cButton threeButton;
5064
- cButton sevenButton;
5065
- cButton fourButton; // full panel
5066
- cButton oneButton; // full XYZ
5067
- //cButton currentLayout;
5068
-
50696166 //
50706167 //Composite
50716168 Object3D // to do !!
....@@ -5075,9 +6172,11 @@
50756172 //JTree jTree;
50766173 private MenuItem lookAtItem;
50776174 private MenuItem lookFromItem;
5078
- private MenuItem switchItem;
6175
+ private MenuItem switchViewItem;
50796176 private MenuItem cutItem;
5080
- private MenuItem duplicateItem;
6177
+ private MenuItem undoItem;
6178
+ private MenuItem redoItem;
6179
+ private JMenuItem duplicateItem;
50816180 private MenuItem cloneItem;
50826181 private MenuItem cloneSupportItem;
50836182 private MenuItem overwriteGeoItem;
....@@ -5090,7 +6189,7 @@
50906189 private MenuItem linkverticesItem;
50916190 private MenuItem relinkverticesItem;
50926191 private MenuItem setMasterItem;
5093
- private MenuItem resetMeshItem;
6192
+ private MenuItem resetAllItem;
50946193 private MenuItem stepAllItem;
50956194 private MenuItem revertMeshItem;
50966195 private MenuItem poseMeshItem;
....@@ -5105,7 +6204,7 @@
51056204 private MenuItem pasteLinkItem;
51066205 private MenuItem pasteCloneItem;
51076206 private MenuItem pasteExpandItem;
5108
- private MenuItem clearItem;
6207
+ private MenuItem deleteItem;
51096208 private MenuItem clearAllItem;
51106209 private MenuItem genUVItem;
51116210 private MenuItem genNormalsMESHItem;
....@@ -5140,6 +6239,10 @@
51406239 private MenuItem showleavesItem;
51416240 private MenuItem markleavesItem;
51426241 private MenuItem unmarkleavesItem;
6242
+ private MenuItem rewindleavesItem;
6243
+ private MenuItem unrewindleavesItem;
6244
+ private MenuItem randomleavesItem;
6245
+ private MenuItem unrandomleavesItem;
51436246
51446247 private MenuItem flipVItem;
51456248 private MenuItem unflipVItem;
....@@ -5151,15 +6254,17 @@
51516254 private MenuItem panoTexturesItem;
51526255
51536256 private MenuItem resetCentroidItem;
5154
- private MenuItem transformgeometryItem;
6257
+ private MenuItem resetCentroidXZItem;
51556258 private MenuItem resetTransformItem;
6259
+ private MenuItem transformGeometryItem;
6260
+ private MenuItem transformChildrenItem;
51566261 private MenuItem hideItem;
51576262 private MenuItem grabItem;
51586263 private MenuItem backItem;
51596264 private MenuItem frontItem;
51606265 private MenuItem cameraItem;
51616266 private MenuItem compositeItem;
5162
- private MenuItem randomItem;
6267
+ private MenuItem switchItem;
51636268 private MenuItem physicsItem;
51646269 private MenuItem frameselectorItem;
51656270 private MenuItem scriptNodeItem;
....@@ -5183,6 +6288,8 @@
51836288 private MenuItem attachBumpItem;
51846289 private MenuItem detachBumpItem;
51856290 private MenuItem pigmentBumpItem;
6291
+ private MenuItem embedTexturesItem;
6292
+ private MenuItem deEmbedTexturesItem;
51866293
51876294 private MenuItem particleItem;
51886295 private MenuItem ragdollItem;
....@@ -5221,11 +6328,6 @@
52216328 private MenuItem doubleItem;
52226329 private MenuItem tripleItem;
52236330
5224
- private MenuItem importGFDItem;
5225
- private MenuItem importVRMLX3DItem;
5226
- private MenuItem import3DSItem;
5227
- private MenuItem importOBJItem;
5228
-
52296331 private MenuItem computeAOItem;
52306332 private MenuItem recompileItem;
52316333 private MenuItem editScriptItem;
....@@ -5235,4 +6337,8 @@
52356337 private MenuItem analyzeItem;
52366338 private MenuItem dumpItem;
52376339 //boolean freezemodel = false;
6340
+
6341
+ Menu cameraMenu;
6342
+ MenuItem editCameraItem;
6343
+ MenuItem restoreCameraItem;
52386344 }