Normand Briere
2019-08-08 8294241adc5fe698b70e13ebd6780af46ab83f7e
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,335 @@
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, final String t, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(f + "s");
51
+ textureButton.addActionListener(new ActionListener()
52
+ {
53
+ @Override
54
+ public void actionPerformed(ActionEvent e)
55
+ {
56
+ ChangeTexture(path + t);
57
+ }
58
+ });
59
+ }
60
+
61
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
62
+ {
63
+ cGridBag tab0 = new cGridBag().setVertical(true);
64
+
65
+ tab0.setName("Urban");
66
+ skyboxpanel.add(tab0);
67
+
68
+ cGridBag row0 = new cGridBag();
69
+ cGridBag row1 = new cGridBag();
70
+ cGridBag row2 = new cGridBag();
71
+ cGridBag row3 = new cGridBag();
72
+ cGridBag row4 = new cGridBag();
73
+ cGridBag row5 = new cGridBag();
74
+ cGridBag row6 = new cGridBag();
75
+
76
+ AddSkyboxButton("default", "rgb", row0);
77
+ //AddSkyboxButton("default", "cornell", row0);
78
+ AddSkyboxButton("penguins", "dust", row0);
79
+ AddSkyboxButton("penguins", "tropic", row0);
80
+ AddSkyboxButton("penguins", "yonder", row0);
81
+
82
+ AddSkyboxButton("default", "uffizi", row1);
83
+ AddSkyboxButton("bridge", "Bridge", row1);
84
+ AddSkyboxButton("bridge", "Bridge2", row1);
85
+ AddSkyboxButton("urban", "GamlaStan2", row1);
86
+
87
+ AddSkyboxButton("urban", "Parliament", row2);
88
+ AddSkyboxButton("urban", "Roundabout", row2);
89
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
90
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
91
+
92
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
93
+ AddSkyboxButton("urban", "UnionSquare", row3);
94
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
95
+ AddSkyboxButton("park", "BerzeliiPark", row3);
96
+
97
+ AddSkyboxButton("park", "Buddha", row4);
98
+ AddSkyboxButton("park", "CNTower2", row4);
99
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
100
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
101
+
102
+ AddSkyboxButton("park", "Park", row5);
103
+ AddSkyboxButton("park", "Pond", row5);
104
+ AddSkyboxButton("park", "Skansen", row5);
105
+ AddSkyboxButton("park", "Skansen2", row5);
106
+
107
+ AddSkyboxButton("park", "Skansen3", row6);
108
+ AddSkyboxButton("park", "Skansen4", row6);
109
+ AddSkyboxButton("park", "Skansen5", row6);
110
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
111
+
112
+ tab0.add(row0);
113
+ tab0.add(row1);
114
+ tab0.add(row2);
115
+ tab0.add(row3);
116
+ tab0.add(row4);
117
+ tab0.add(row5);
118
+ tab0.add(row6);
119
+
120
+ for (int i=5; --i>=0;)
121
+ {
122
+ //oe.toolboxPanel.Return();
123
+ //tab0.add(new cGridBag());
124
+ }
125
+ }
126
+
127
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
128
+ {
129
+ cGridBag tab0 = new cGridBag().setVertical(true);
130
+
131
+ tab0.setName("Nature");
132
+ skyboxpanel.add(tab0);
133
+
134
+ cGridBag row0 = new cGridBag();
135
+ cGridBag row1 = new cGridBag();
136
+ cGridBag row2 = new cGridBag();
137
+ cGridBag row3 = new cGridBag();
138
+ cGridBag row4 = new cGridBag();
139
+ cGridBag row5 = new cGridBag();
140
+ cGridBag row6 = new cGridBag();
141
+
142
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
143
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
144
+ AddSkyboxButton("beach", "PalmTrees", row0);
145
+ AddSkyboxButton("beach", "Tenerife", row0);
146
+
147
+ AddSkyboxButton("beach", "Tenerife2", row1);
148
+ AddSkyboxButton("beach", "Tenerife3", row1);
149
+ AddSkyboxButton("field", "FishPond", row1);
150
+ AddSkyboxButton("field", "Footballfield", row1);
151
+
152
+ AddSkyboxButton("field", "Meadow", row2);
153
+ AddSkyboxButton("field", "Sorsele", row2);
154
+ AddSkyboxButton("field", "Sorsele2", row2);
155
+ AddSkyboxButton("field", "Sorsele3", row2);
156
+
157
+ AddSkyboxButton("forest", "Brudslojan", row3);
158
+ AddSkyboxButton("forest", "Langholmen2", row3);
159
+ AddSkyboxButton("forest", "Plants", row3);
160
+ AddSkyboxButton("mountain", "Maskonaive", row3);
161
+
162
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
163
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
164
+ AddSkyboxButton("mountain", "Teide", row4);
165
+ AddSkyboxButton("park", "Tantolunden4", row4);
166
+
167
+ AddSkyboxButton("park", "Stairs", row5);
168
+ AddSkyboxButton("default", "skycube", row6);
169
+ AddSkyboxButton("rocky", "Langholmen", row5);
170
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
171
+
172
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
173
+ AddSkyboxButton("default", "CloudyHills", row6);
174
+ AddSkyboxButton("daz", "Autumn", row6);
175
+ AddSkyboxButton("daz", "MountainTrail", row6);
176
+ /*
177
+Autumn
178
+Greenlands
179
+MountainTrail
180
+Oasis
181
+TheRock
182
+TopOfTheWorld
183
+Winter
184
+ */
185
+
186
+ tab0.add(row0);
187
+ tab0.add(row1);
188
+ tab0.add(row2);
189
+ tab0.add(row3);
190
+ tab0.add(row4);
191
+ tab0.add(row5);
192
+ tab0.add(row6);
193
+
194
+ for (int i=5; --i>=0;)
195
+ {
196
+ //oe.toolboxPanel.Return();
197
+ //tab0.add(new cGridBag());
198
+ }
199
+ }
200
+
201
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
202
+ {
203
+ cGridBag tab0 = new cGridBag().setVertical(true);
204
+
205
+ tab0.setName("Night");
206
+ skyboxpanel.add(tab0);
207
+
208
+ cGridBag row0 = new cGridBag();
209
+ cGridBag row1 = new cGridBag();
210
+ cGridBag row2 = new cGridBag();
211
+ cGridBag row3 = new cGridBag();
212
+ cGridBag row4 = new cGridBag();
213
+ cGridBag row5 = new cGridBag();
214
+ cGridBag row6 = new cGridBag();
215
+
216
+ AddSkyboxButton("night", "NightPath", row0);
217
+ AddSkyboxButton("night", "PondNight", row0);
218
+ AddSkyboxButton("night", "Powerlines", row0);
219
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
220
+
221
+ AddSkyboxButton("urban", "CNTower", row1);
222
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
223
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
224
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
225
+
226
+ AddSkyboxButton("penguins", "kenon_star", row2);
227
+ AddSkyboxButton("persson", "corona", row2);
228
+ AddSkyboxButton("persson", "spaceskybox", row2);
229
+ AddSkyboxButton("indoors", "Vasa", row2);
230
+
231
+ AddSkyboxButton("winter", "Backyard", row3);
232
+ AddSkyboxButton("winter", "Creek", row3);
233
+ AddSkyboxButton("winter", "FootballField3", row3);
234
+ AddSkyboxButton("winter", "Forest", row3);
235
+
236
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
237
+ AddSkyboxButton("winter", "House", row4);
238
+ AddSkyboxButton("winter", "IceLake", row4);
239
+ AddSkyboxButton("winter", "IceRiver", row4);
240
+
241
+ AddSkyboxButton("winter", "Park3", row5);
242
+ AddSkyboxButton("winter", "PondWinter", row5);
243
+ AddSkyboxButton("winter", "Tantolunden5", row5);
244
+ AddSkyboxButton("winter", "Vindelalven", row5);
245
+
246
+ AddSkyboxButton("daz", "TheRock", row6);
247
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
248
+ AddSkyboxButton("daz", "Winter", row6);
249
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
250
+
251
+ tab0.add(row0);
252
+ tab0.add(row1);
253
+ tab0.add(row2);
254
+ tab0.add(row3);
255
+ tab0.add(row4);
256
+ tab0.add(row5);
257
+ tab0.add(row6);
258
+
259
+ for (int i=5; --i>=0;)
260
+ {
261
+ //oe.toolboxPanel.Return();
262
+ //tab0.add(new cGridBag());
263
+ }
264
+ }
265
+
266
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
267
+ {
268
+ cGridBag tab0 = new cGridBag().setVertical(true);
269
+
270
+ tab0.setName("Others");
271
+ skyboxpanel.add(tab0);
272
+
273
+ cGridBag row0 = new cGridBag();
274
+ cGridBag row1 = new cGridBag();
275
+ cGridBag row2 = new cGridBag();
276
+ cGridBag row3 = new cGridBag();
277
+ cGridBag row4 = new cGridBag();
278
+ cGridBag row5 = new cGridBag();
279
+ cGridBag row6 = new cGridBag();
280
+
281
+ AddSkyboxButton("mayhem", "afterrain", row0);
282
+ AddSkyboxButton("mayhem", "aqua4", row0);
283
+ AddSkyboxButton("mayhem", "aqua9", row0);
284
+ AddSkyboxButton("mayhem", "flame", row0);
285
+
286
+ AddSkyboxButton("mayhem", "h2s", row1);
287
+ AddSkyboxButton("mayhem", "prehistoric", row1);
288
+ AddSkyboxButton("mayhem", "scorched", row1);
289
+ AddSkyboxButton("penguins", "desertdawn", row1);
290
+
291
+ AddSkyboxButton("persson", "Citadella", row2);
292
+ AddSkyboxButton("persson", "Citadella2", row2);
293
+ AddSkyboxButton("persson", "clouds1", row2);
294
+ AddSkyboxButton("penguins", "wrath", row2);
295
+
296
+ AddSkyboxButton("persson", "FishermansBastion", row3);
297
+ AddSkyboxButton("persson", "HeroesSquare", row3);
298
+ AddSkyboxButton("indoors", "DallasW", row3);
299
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
300
+
301
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
302
+ AddSkyboxButton("persson", "PereaBeach1", row4);
303
+ AddSkyboxButton("persson", "PereaBeach2", row4);
304
+ AddSkyboxButton("persson", "redeclipse", row4);
305
+
306
+ AddSkyboxButton("daz", "Greenlands", row5);
307
+ AddSkyboxButton("daz", "Oasis", row5);
308
+ AddSkyboxButton("elyvisions", "arch3", row5);
309
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
310
+
311
+ AddSkyboxButton("elyvisions", "rainbow", row6);
312
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
313
+ AddSkyboxButton("elyvisions", "heaven", row6);
314
+ AddSkyboxButton("elyvisions", "hot", row6);
315
+
316
+ tab0.add(row0);
317
+ tab0.add(row1);
318
+ tab0.add(row2);
319
+ tab0.add(row3);
320
+ tab0.add(row4);
321
+ tab0.add(row5);
322
+ tab0.add(row6);
323
+
324
+ for (int i=5; --i>=0;)
325
+ {
326
+ //oe.toolboxPanel.Return();
327
+ //tab0.add(new cGridBag());
328
+ }
329
+ }
330
+
331
+ public void ChangeSkybox(String skybox)
332
+ {
333
+ //cameraView.envyoff = false;
334
+ group.skyboxname = skybox;
335
+ group.skyboxext = "jpg";
336
+ cameraView.repaint();
337
+ }
338
+
339
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
340
+ {
341
+ JTabbedPane skyboxpane = new JTabbedPane();
342
+
343
+ AddSkyboxTab0(skyboxpane);
344
+ AddSkyboxTab1(skyboxpane);
345
+ AddSkyboxTab2(skyboxpane);
346
+ AddSkyboxTab3(skyboxpane);
347
+
348
+ skyboxPanel.add(skyboxpane);
349
+ }
350
+
351
+ public void ChangeTexture(String texture)
352
+ {
353
+ cameraView.repaint();
354
+ }
355
+
26356 //ObjEditor objEditor;
27357 public void closeUI2()
28358 {
....@@ -60,6 +390,12 @@
60390 this.copy = this.group = group;
61391 //selectees = this.group.selectees;
62392
393
+ if (copy.versionlist == null)
394
+ {
395
+ copy.versionlist = new Object3D[100];
396
+ copy.versionindex = -1;
397
+ }
398
+
63399 if(ui)
64400 SetupUI(objEditor);
65401 }
....@@ -74,16 +410,28 @@
74410 this.copy = this.group = copy;
75411 //selectees = this.group.selectees;
76412
77
- SetupMenu2(objEditor);
413
+ SetupMenu2(this); //objEditor);
78414 SetupUI2(objEditor);
79415 objEditor.SetupUI(true);
80416 SetupViews(objEditor);
81417
82418 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
419
+
420
+ if (copy.versionlist == null)
421
+ {
422
+ copy.versionlist = new Object3D[100];
423
+ copy.versionindex = -1;
424
+
425
+ Save(true);
426
+ }
83427 }
84428
85429 void CloneSelection(boolean supports)
86430 {
431
+ if (Globals.REPLACEONMAKE)
432
+ Save();
433
+ boolean keep = Globals.REPLACEONMAKE;
434
+ Globals.REPLACEONMAKE = false;
87435 // Object3D keep = GrafreeD.clipboard;
88436 //Object3D obj;
89437 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +442,19 @@
94442
95443 makeSomething(clone, i==group.selection.size()-1);
96444 }
445
+ Globals.REPLACEONMAKE = keep;
97446 }
98447
99448 void CloneClipboard(boolean supports)
100449 {
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));
450
+ assert(Grafreed.clipboard.parent == null);
451
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
452
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
453
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
454
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106455 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
456
+ makeSomething(CloneObject(Grafreed.clipboard, false));
457
+ Grafreed.clipboard.get(0).parent = keepparent;
109458 }
110459
111460 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +468,7 @@
119468 // obj.support = null;
120469 if (!supports)
121470 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
471
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123472 obj.parent = parent;
124473 // obj.support = support;
125474 // clone.support = support; // aout 2013
....@@ -148,40 +497,37 @@
148497
149498 //JTextField nameField;
150499
151
- void SetupMenu2(ObjEditor oe)
500
+ void SetupMenu2(GroupEditor oe)
152501 {
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
-
502
+ oe.jTree = new cTree();
503
+
168504 Menu menu;
169505 oe.menuBar.add(menu = new Menu("Edit"));
170506 //editItem = menu.add(new MenuItem("Edit"));
171507 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
508
+
509
+// undoItem = menu.add(new MenuItem("Undo"));
510
+// undoItem.addActionListener(this);
511
+// redoItem = menu.add(new MenuItem("Redo"));
512
+// redoItem.addActionListener(this);
513
+// menu.add("-");
514
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173515 duplicateItem.addActionListener(this);
516
+ cloneItem = menu.add(new MenuItem("Clone"));
517
+ cloneItem.addActionListener(this);
518
+ if (Globals.ADVANCED)
519
+ {
520
+ cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
521
+ cloneSupportItem.addActionListener(this);
522
+ }
523
+ menu.add("-");
174524 cutItem = menu.add(new MenuItem("Cut"));
175525 cutItem.addActionListener(this);
176526 copyItem = menu.add(new MenuItem("Copy"));
177527 copyItem.addActionListener(this);
178528 pasteItem = menu.add(new MenuItem("Paste"));
179529 pasteItem.addActionListener(this);
180
- menu.add("-");
181
- cloneItem = menu.add(new MenuItem("Clone"));
182
- cloneItem.addActionListener(this);
183
- cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
184
- cloneSupportItem.addActionListener(this);
530
+
185531 menu.add("-");
186532 pasteIntoItem = menu.add(new MenuItem("Paste into"));
187533 pasteIntoItem.addActionListener(this);
....@@ -192,8 +538,8 @@
192538 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
193539 // pasteExpandItem.addActionListener(this);
194540 menu.add("-");
195
- clearItem = menu.add(new MenuItem("Clear"));
196
- clearItem.addActionListener(this);
541
+ deleteItem = menu.add(new MenuItem("Delete"));
542
+ deleteItem.addActionListener(this);
197543
198544 if (Globals.ADVANCED)
199545 {
....@@ -201,14 +547,97 @@
201547 clearAllItem = menu.add(new MenuItem("Clear All"));
202548 clearAllItem.addActionListener(this);
203549 }
550
+
551
+ menuBar.add(cameraMenu = new Menu("View"));
552
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
553
+ //zBufferItem.addActionListener(this);
554
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
555
+ //normalLensItem.addActionListener(this);
556
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
557
+ restoreCameraItem.addActionListener(this);
558
+
559
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
560
+// toggleFullScreenItem.addItemListener(this);
561
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
562
+// cameraMenu.add("-");
563
+//
564
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
565
+// toggleTextureItem.addItemListener(this);
566
+// toggleTextureItem.setState(CameraPane.textureon);
567
+//
568
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
569
+// toggleSwitchItem.addItemListener(this);
570
+// toggleSwitchItem.setState(CameraPane.SWITCH);
571
+
572
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
573
+ toggleHandleItem.addItemListener(this);
574
+ toggleHandleItem.setState(CameraPane.HANDLES);
575
+
576
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
577
+ togglePaintItem.addItemListener(this);
578
+ togglePaintItem.setState(CameraPane.PAINTMODE);
579
+
580
+ if (Globals.ADVANCED)
581
+ {
582
+ cameraMenu.add("-");
583
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
584
+ toggleLiveItem.addItemListener(this);
585
+ toggleLiveItem.setState(Globals.isLIVE());
204586
587
+ cameraMenu.add(stepItem = new MenuItem("Step"));
588
+ stepItem.addActionListener(this);
589
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
590
+ // toggleDLItem.addItemListener(this);
591
+ // toggleDLItem.setState(false);
592
+
593
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
594
+ toggleRenderItem.addItemListener(this);
595
+ toggleRenderItem.setState(!CameraPane.frozen);
596
+
597
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
598
+ toggleDebugItem.addItemListener(this);
599
+ toggleDebugItem.setState(Globals.DEBUG);
600
+
601
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
602
+ toggleFrustumItem.addItemListener(this);
603
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
604
+
605
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
606
+ toggleFootContactItem.addItemListener(this);
607
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
608
+
609
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
610
+ toggleTimelineItem.addItemListener(this);
611
+ }
612
+
613
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
614
+// toggleRootItem.addItemListener(this);
615
+// toggleRootItem.setState(false);
616
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
617
+// animationItem.addItemListener(this);
618
+// animationItem.setState(CameraPane.ANIMATION);
619
+ cameraMenu.add("-");
620
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
621
+ editCameraItem.addActionListener(this);
622
+
623
+ if (Globals.ADVANCED)
624
+ {
625
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
626
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
627
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
628
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
629
+ oe.cameraMenu.add("-");
630
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
631
+ openWindowItem.addActionListener(this);
632
+ editLeafItem.addActionListener(this);
633
+ lookAtItem.addActionListener(this);
634
+ //lookFromItem.addActinoListener(this);
635
+ //switchViewItem.addActionListener(this);
636
+ }
637
+
205638 oe.menuBar.add(menu = new Menu("Setting"));
206639 if (Globals.ADVANCED)
207640 {
208
- resetMeshItem = menu.add(new MenuItem("Reset All"));
209
- resetMeshItem.addActionListener(this);
210
- stepAllItem = menu.add(new MenuItem("Step All"));
211
- stepAllItem.addActionListener(this);
212641 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
213642 revertMeshItem.addActionListener(this);
214643 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -248,21 +677,29 @@
248677 }
249678
250679 oe.menuBar.add(menu = new Menu("Group"));
251
- grabItem = menu.add(new MenuItem("Grab"));
252
- grabItem.addActionListener(this);
680
+// grabItem = menu.add(new MenuItem("Grab"));
681
+// grabItem.addActionListener(this);
253682 backItem = menu.add(new MenuItem("Back"));
254683 backItem.addActionListener(this);
255684 frontItem = menu.add(new MenuItem("Front"));
256685 frontItem.addActionListener(this);
257
- compositeItem = menu.add(new MenuItem("Composite"));
258
- compositeItem.addActionListener(this);
686
+// compositeItem = menu.add(new MenuItem("Composite"));
687
+// compositeItem.addActionListener(this);
688
+
689
+ if (Globals.ADVANCED)
690
+ {
259691 hideItem = menu.add(new MenuItem("Hidden Group"));
260692 hideItem.addActionListener(this);
693
+ }
261694 ungroupItem = menu.add(new MenuItem("Ungroup"));
262695 ungroupItem.addActionListener(this);
263
- menu.add("-");
264
- randomItem = menu.add(new MenuItem("Switch node"));
265
- randomItem.addActionListener(this);
696
+
697
+// menu.add("-");
698
+//
699
+// switchItem = menu.add(new MenuItem("Switch node"));
700
+// switchItem.addActionListener(this);
701
+ if (Globals.ADVANCED)
702
+ {
266703 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
267704 switchGeoItem.addActionListener(this);
268705 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -270,49 +707,52 @@
270707 morphItem = menu.add(new MenuItem("Morph Group"));
271708 morphItem.addActionListener(this);
272709
273
- if (Globals.ADVANCED)
274
- {
710
+ menu.add("-");
275711 physicsItem = menu.add(new MenuItem("Physics"));
276712 physicsItem.addActionListener(this);
277713 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
278714 frameselectorItem.addActionListener(this);
279715 scriptNodeItem = menu.add(new MenuItem("Script Node"));
280716 scriptNodeItem.addActionListener(this);
281
- cameraItem = menu.add(new MenuItem("Camera"));
282
- cameraItem.addActionListener(this);
283717 }
284718
285719 oe.menuBar.add(menu = new Menu("Object"));
286
- textureItem = menu.add(new MenuItem("Texture"));
287
- textureItem.addActionListener(this);
720
+// textureItem = menu.add(new MenuItem("Texture"));
721
+// textureItem.addActionListener(this);
288722 billboardItem = menu.add(new MenuItem("Billboard"));
289723 billboardItem.addActionListener(this);
290724 csgItem = menu.add(new MenuItem("CSG"));
291725 csgItem.addActionListener(this);
292
- shadowXItem = menu.add(new MenuItem("Shadow X"));
726
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
293727 shadowXItem.addActionListener(this);
294
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
728
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
295729 shadowYItem.addActionListener(this);
296
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
730
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
297731 shadowZItem.addActionListener(this);
298
- if (Globals.ADVANCED)
299
- {
300
- linkerItem = menu.add(new MenuItem("Linker"));
301
- linkerItem.addActionListener(this);
302732 attributeItem = menu.add(new MenuItem("Attribute"));
303733 attributeItem.addActionListener(this);
734
+
735
+ if (Globals.ADVANCED)
736
+ {
737
+ menu.add("-");
738
+ linkerItem = menu.add(new MenuItem("Linker"));
739
+ linkerItem.addActionListener(this);
304740 templateItem = menu.add(new MenuItem("Template"));
305741 templateItem.addActionListener(this);
306742 pointflowItem = menu.add(new MenuItem("Point Flow"));
307743 pointflowItem.addActionListener(this);
308
- menu.add("-");
309744 }
745
+ menu.add("-");
310746 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
311747 resetTransformItem.addActionListener(this);
312748 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
313749 resetCentroidItem.addActionListener(this);
314
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
315
- transformgeometryItem.addActionListener(this);
750
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
751
+ resetCentroidXZItem.addActionListener(this);
752
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
753
+ transformGeometryItem.addActionListener(this);
754
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
755
+ transformChildrenItem.addActionListener(this);
316756
317757 oe.menuBar.add(menu = new Menu("Geometry"));
318758 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -325,7 +765,7 @@
325765 genNormalsMESHItem.addActionListener(this);
326766 if (Globals.ADVANCED)
327767 {
328
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
768
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
329769 genNormalsMINEItem.addActionListener(this);
330770 }
331771 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -361,6 +801,10 @@
361801 oe.menuBar.add(menu = new Menu("Attributes"));
362802 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
363803 clearMaterialsItem.addActionListener(this);
804
+ resetAllItem = menu.add(new MenuItem("Reset All"));
805
+ resetAllItem.addActionListener(this);
806
+ stepAllItem = menu.add(new MenuItem("Step All"));
807
+ stepAllItem.addActionListener(this);
364808 menu.add("-");
365809 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
366810 liveleavesItem.addActionListener(this);
....@@ -381,6 +825,14 @@
381825 markleavesItem.addActionListener(this);
382826 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
383827 unmarkleavesItem.addActionListener(this);
828
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
829
+ rewindleavesItem.addActionListener(this);
830
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
831
+ unrewindleavesItem.addActionListener(this);
832
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
833
+ randomleavesItem.addActionListener(this);
834
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
835
+ unrandomleavesItem.addActionListener(this);
384836 menu.add("-");
385837 flipVItem = menu.add(new MenuItem("Flip V"));
386838 flipVItem.addActionListener(this);
....@@ -406,47 +858,117 @@
406858 attachBumpItem.addActionListener(this);
407859 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
408860 pigmentBumpItem.addActionListener(this);
861
+ //embedTexturesItem
409862 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
410863 detachPigmentItem.addActionListener(this);
411864 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
412865 detachBumpItem.addActionListener(this);
866
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
867
+ embedTexturesItem.addActionListener(this);
868
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
869
+ deEmbedTexturesItem.addActionListener(this);
413870 menu.add("-");
414871 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
415872 sortbysizeItem.addActionListener(this);
416873 sortbynameItem = menu.add(new MenuItem("Sort by name"));
417874 sortbynameItem.addActionListener(this);
875
+ menu.add("-");
876
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
877
+ shareGeometriesItem.addActionListener(this);
878
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
879
+ mergeGeometriesItem.addActionListener(this);
418880 if (Globals.ADVANCED)
419881 {
420
- menu.add("-");
882
+ // Pretty much the same as duplicate and clone.
421883 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
422884 extractGeometriesItem.addActionListener(this);
423885 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
424886 cloneGeometriesItem.addActionListener(this);
425
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
426
- shareGeometriesItem.addActionListener(this);
427
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
428
- mergeGeometriesItem.addActionListener(this);
429887 }
430888
431889 oe.menuBar.add(menu = new Menu("Insert"));
432890 buildCreateMenu(menu);
433891
434
- oe.menuBar.add(menu = new Menu("Include"));
435
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
436
- importGFDItem.addActionListener(this);
437
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
438
- importVRMLX3DItem.addActionListener(this);
439
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
440
- importOBJItem.addActionListener(this);
441
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
442
- import3DSItem.addActionListener(this);
443
-
444892 oe.menuBar.add(menu = new Menu("Tools"));
445893 buildToolsMenu(menu);
446894 }
447895
896
+ JTabbedPane resourcecontainer;
897
+ cGridBag currenttab;
898
+ boolean added; // patch for jar
899
+
900
+ int tabcount = 0;
901
+ int colcount = 0;
902
+ int rowcount = 0;
903
+
904
+ int columns = 5;
905
+ int rows = 7;
906
+
907
+ public void ResourceCallBack(String[] path)
908
+ {
909
+ for (int i = 0; i < path.length; i++)
910
+ System.out.print(path[i] + "/");
911
+ System.out.println();
912
+ if (rowcount == 0)
913
+ {
914
+ currenttab = new cGridBag();
915
+ added = false;
916
+ String tabname = String.valueOf((char)('A'+tabcount));
917
+ currenttab.setName(tabname);
918
+ rowcount = 1;
919
+ }
920
+
921
+ if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
922
+ {
923
+ if (!added)
924
+ {
925
+ added = true;
926
+ resourcecontainer.add(currenttab);
927
+ String tabname = String.valueOf((char)('A'+tabcount));
928
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
929
+ }
930
+
931
+ AddTextureButton(path[0], path[1], currenttab);
932
+ if (++colcount >= columns)
933
+ {
934
+ colcount = 0;
935
+ currenttab.Return();
936
+
937
+ if (rowcount++ >= rows)
938
+ {
939
+ rowcount = 0;
940
+ }
941
+ }
942
+ }
943
+ else
944
+ {
945
+// if (!path[path.length-1].equals("icons"))
946
+// resourcecontainer.Return();
947
+ }
948
+ }
949
+
950
+ void CreateTexturePanel(cGridBag container)
951
+ {
952
+ resourcecontainer = new JTabbedPane();
953
+ container.add(resourcecontainer);
954
+
955
+ Grafreed.ParseResources("textures", this);
956
+ }
957
+
448958 void SetupUI2(ObjEditor oe)
449959 {
960
+ // June 2019
961
+ if (oe == null)
962
+ {
963
+ //super.SetupUI2(this);
964
+ //return;
965
+ }
966
+
967
+ if (copy != group)
968
+ {
969
+ //super.SetupUI2(this);
970
+ }
971
+
450972 //new Exception().printStackTrace();
451973
452974 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -475,97 +997,238 @@
475997 oe.radioPanel.add(dummyButton);
476998 oe.buttonGroup.add(dummyButton);
477999 */
1000
+ cGridBag copyOptionsPanel = new cGridBag();
1001
+
1002
+ copyOptionsPanel.preferredHeight = 2;
1003
+
4781004 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
4791005
480
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
481
- liveCB.setToolTipText("Enabled animation");
1006
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
+ //minButton.setToolTipText("Minimize window");
1008
+ //minButton.addActionListener(this);
1009
+
1010
+ if (Globals.ADVANCED)
1011
+ {
1012
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
+ maxButton.setToolTipText("Maximize window");
1014
+ maxButton.addActionListener(this);
1015
+ }
1016
+
1017
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ fullButton.setToolTipText("Full-screen window");
1019
+ fullButton.addActionListener(this);
1020
+
1021
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1022
+ screenfitButton.setToolTipText("Screen fit");
1023
+ screenfitButton.addActionListener(this);
1024
+
1025
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1026
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1027
+ restoreCameraButton.addActionListener(this);
1028
+
1029
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
+ saveVersionButton.setToolTipText("Duplicate current version");
1031
+ saveVersionButton.addActionListener(this);
1032
+
1033
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1034
+ deleteVersionButton.setToolTipText("Delete current version");
1035
+ deleteVersionButton.addActionListener(this);
1036
+
1037
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1038
+ previousVersionButton.setToolTipText("Previous version");
1039
+ previousVersionButton.addActionListener(this);
1040
+ previousVersionButton.setEnabled(false);
1041
+
1042
+ cGridBag updown = new cGridBag().setVertical(true);
1043
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1044
+ restoreButton.setToolTipText("Undo (restore current version)");
1045
+ restoreButton.addActionListener(this);
1046
+ //restoreButton.setEnabled(false);
1047
+
1048
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+ replaceButton.setToolTipText("Save (replace current version)");
1050
+ replaceButton.addActionListener(this);
1051
+ //replaceButton.setEnabled(false);
1052
+
1053
+ copyOptionsPanel.add(updown);
1054
+
1055
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ nextVersionButton.setToolTipText("Next version");
1057
+ nextVersionButton.addActionListener(this);
1058
+ nextVersionButton.setEnabled(false);
1059
+
1060
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1061
+ liveCB.setToolTipText("Enable animation");
4821062 liveCB.addItemListener(this);
4831063
484
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1064
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
4851065 oneStepButton.setToolTipText("Animate one step forward");
4861066 oneStepButton.addActionListener(this);
4871067
488
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
1068
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
4891069 fastCB.setToolTipText("Fast mode");
4901070 fastCB.addItemListener(this);
4911071
492
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
493
- trackCB.setToolTipText("Enable tracking");
494
- trackCB.addItemListener(this);
495
-
496
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
497
- screenfitButton.setToolTipText("Screen fit");
498
- screenfitButton.addActionListener(this);
1072
+ //oe.toolboxPanel.Return();
1073
+
1074
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1075
+// trackCB.setToolTipText("Enable tracking");
1076
+// trackCB.addItemListener(this);
4991077
5001078 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
5011079 // screenfitpointButton.addActionListener(this);
5021080
5031081 if (Globals.ADVANCED)
5041082 {
505
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1083
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5061084 snapobjectButton.addActionListener(this);
5071085 snapobjectButton.setToolTipText("Snap Object");
1086
+
1087
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ fourButton.addActionListener(this);
1089
+ fourButton.setToolTipText("Show control panel only");
5081090 }
5091091
510
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
511
- flashSelectionButton.setToolTipText("Show selection");
512
- flashSelectionButton.addActionListener(this);
1092
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
5131093
514
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
515
-
516
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
517
- twoButton.setToolTipText("Show center view only");
1094
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1095
+ twoButton.setToolTipText("Show 3D view only");
5181096 twoButton.addActionListener(this);
519
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
520
- fourButton.addActionListener(this);
521
- fourButton.setToolTipText("Show left panel only");
522
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
523
- sixButton.setToolTipText("2-column layout left");
524
- sixButton.addActionListener(this);
525
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
526
- threeButton.setToolTipText("2-column layout right");
1097
+ this.fullscreenLayout = twoButton;
1098
+
1099
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
+ threeButton.setToolTipText("Show controls and 3D view");
5271101 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
529
- sevenButton.setToolTipText("3-column layout");
530
- sevenButton.addActionListener(this);
1102
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1103
+ sixButton.setToolTipText("Show 3D view and controls");
1104
+ sixButton.addActionListener(this);
1105
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1106
+// sevenButton.setToolTipText("3-column layout");
1107
+// sevenButton.addActionListener(this);
5311108 //
5321109
533
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
534
- rootButton.setToolTipText("Edit selection in new tab");
1110
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1111
+ rootButton.setToolTipText("Open selection in new tab");
5351112 rootButton.addActionListener(this);
5361113
537
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1114
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5381115 closeButton.setToolTipText("Close tab");
5391116 closeButton.addActionListener(this);
5401117 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5411118 //clearButton.addActionListener(this);
542
-
543
- cGridBag commandsPanel = new cGridBag();
1119
+
1120
+ cGridBag row1 = new cGridBag();
5441121
545
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
546
- editButton.setToolTipText("Edit selection");
1122
+ // INSERT
1123
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ gridButton.setToolTipText("Create grid");
1125
+ gridButton.addActionListener(this);
1126
+
1127
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1128
+ boxButton.setToolTipText("Create box");
1129
+ boxButton.addActionListener(this);
1130
+
1131
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1132
+ sphereButton.setToolTipText("Create sphere");
1133
+ sphereButton.addActionListener(this);
1134
+
1135
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ coneButton.setToolTipText("Create cone");
1137
+ coneButton.addActionListener(this);
1138
+
1139
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ torusButton.setToolTipText("Create torus");
1141
+ torusButton.addActionListener(this);
1142
+
1143
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1144
+ superButton.setToolTipText("Create superellipsoid");
1145
+ superButton.addActionListener(this);
1146
+
1147
+ if (Globals.ADVANCED)
1148
+ {
1149
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1150
+ kleinButton.setToolTipText("Create Klein bottle");
1151
+ kleinButton.addActionListener(this);
1152
+ }
1153
+
1154
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1155
+ particlesButton.setToolTipText("Create particle system");
1156
+ particlesButton.addActionListener(this);
1157
+
1158
+ oe.toolboxPanel.add(row1);
1159
+
1160
+ cGridBag row2 = new cGridBag();
1161
+
1162
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1163
+ groupButton.setToolTipText("Create group");
1164
+ groupButton.addActionListener(this);
1165
+
1166
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1167
+ compositeButton.setToolTipText("Create composite");
1168
+ compositeButton.addActionListener(this);
1169
+
1170
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1171
+ switchButton.setToolTipText("Create item switcher");
1172
+ switchButton.addActionListener(this);
1173
+
1174
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ loopButton.setToolTipText("Create loop");
1176
+ loopButton.addActionListener(this);
1177
+
1178
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1179
+ textureButton.setToolTipText("Create texture");
1180
+ textureButton.addActionListener(this);
1181
+
1182
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ overlayButton.setToolTipText("Create overlay");
1184
+ overlayButton.addActionListener(this);
1185
+
1186
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ lightButton.setToolTipText("Create light");
1188
+ lightButton.addActionListener(this);
1189
+
1190
+ oe.toolboxPanel.add(row2);
1191
+
1192
+ cGridBag textures = new cGridBag();
1193
+
1194
+ CreateTexturePanel(textures);
1195
+
1196
+ oe.toolboxPanel.add(textures);
1197
+
1198
+ textures.preferredHeight = 100;
1199
+
1200
+ CreateSkyboxPanel(oe.skyboxPanel);
1201
+
1202
+ // EDIT panel
1203
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1204
+ editButton.setToolTipText("Pin selection controls");
5471205 editButton.addActionListener(this);
5481206
549
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
550
- uneditButton.setToolTipText("Unedit selection");
1207
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1208
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5511209 uneditButton.addActionListener(this);
5521210
553
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
554
- allParamsButton.setToolTipText("Edit all params");
1211
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1212
+ allParamsButton.setToolTipText("Show all controls");
5551213 allParamsButton.addActionListener(this);
5561214
557
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
558
- clearPanelButton.setToolTipText("Clear edit panel");
1215
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1216
+ clearPanelButton.setToolTipText("Clear all controls");
5591217 clearPanelButton.addActionListener(this);
5601218
561
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
562
- unselectButton.setToolTipText("Unselect");
563
- unselectButton.addActionListener(this);
1219
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ //unselectButton.setToolTipText("Unselect");
1221
+ //unselectButton.addActionListener(this);
5641222
565
- commandsPanel.preferredHeight = 1;
1223
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1224
+ flashSelectionButton.setToolTipText("Highlight selection");
1225
+ flashSelectionButton.addActionListener(this);
5661226
567
- oe.treePanel.add(commandsPanel);
568
- oe.treePanel.Return();
1227
+ editCommandsPanel.preferredHeight = 1;
1228
+
1229
+ SetPinStates(false);
1230
+// oe.treePanel.add(commandsPanel);
1231
+// oe.treePanel.Return();
5691232
5701233 // oe.aConstraints.gridx += 1;
5711234 // oe.aConstraints.weighty = 0;
....@@ -582,32 +1245,20 @@
5821245
5831246 JScrollPane jSP;
5841247 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
585
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1248
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5861249 ResetModel();
5871250
5881251 oe.treePanel.add(jSPPanel);
5891252 oe.treePanel.Return();
5901253
591
- cGridBag copyOptionsPanel = new cGridBag();
592
-
593
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
594
- colorCB.setToolTipText("Copy color when dropped");
595
- colorCB.addItemListener(this);
596
-
597
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
598
- materialCB.setToolTipText("Copy material when dropped");
599
- materialCB.addItemListener(this);
600
-
601
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
602
- textureCB.setToolTipText("Copy texture when dropped");
603
- textureCB.addItemListener(this);
604
-
605
- copyOptionsPanel.preferredHeight = 1;
6061254 oe.treePanel.add(copyOptionsPanel);
6071255 oe.treePanel.Return();
1256
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1257
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1258
+ sliderPane.preferredHeight = 1;
6081259
609
-// mainPanel.setDividerLocation(0.5); //1.0);
610
-// mainPanel.setResizeWeight(0.5);
1260
+// mainPanel.setDividerLocation(0.1); //1.0);
1261
+ mainPanel.setResizeWeight(0.4);
6111262
6121263 //jList.addListSelectionListener(this);
6131264 oe.jTree.addTreeSelectionListener(this);
....@@ -615,7 +1266,7 @@
6151266 //jTree.setEditable(true);
6161267 oe.jTree.setDragEnabled(true);
6171268 //jTree.setPreferredSize(new Dimension(10,10));
618
- jSP.setPreferredSize(new Dimension(100,200));
1269
+ //jSP.setPreferredSize(new Dimension(100,200));
6191270
6201271 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6211272
....@@ -627,29 +1278,49 @@
6271278 dgr.addDragGestureListener(this);
6281279 }catch(Exception e) {}
6291280 */
630
- radio.layout = sevenButton;
1281
+ radio.layout = threeButton; // sixButton;
6311282 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6321283 }
6331284
6341285 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6351286 {
1287
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1288
+ colorCB.setToolTipText("Copy color when dropped");
1289
+ colorCB.addItemListener(this);
1290
+
1291
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1292
+ materialCB.setToolTipText("Copy material when dropped");
1293
+ materialCB.addItemListener(this);
1294
+
1295
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1296
+ textureCB.setToolTipText("Copy texture when dropped");
1297
+ textureCB.addItemListener(this);
1298
+
1299
+ panel.Return();
1300
+
6361301 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
6371302 boxCB.setToolTipText("Display bounding boxes");
6381303 boxCB.addItemListener(this);
6391304
6401305 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
641
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1306
+ zoomBoxCB.setToolTipText("Display only for wheel");
6421307 zoomBoxCB.addItemListener(this);
6431308
644
- if (Globals.ADVANCED)
1309
+ if (true) // Globals.ADVANCED)
6451310 {
646
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
647
- supportCB.setToolTipText("Enable rigging");
648
- supportCB.addItemListener(this);
1311
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1312
+// supportCB.setToolTipText("Enable rigging");
1313
+// supportCB.addItemListener(this);
1314
+
1315
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1316
+ freezeCB.setToolTipText("Fast moving camera");
1317
+ freezeCB.addItemListener(this);
6491318
6501319 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6511320 // localCB.addItemListener(this);
6521321
1322
+ panel.Return();
1323
+
6531324 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6541325 crowdCB.setToolTipText("Used for crowds");
6551326 crowdCB.addItemListener(this);
....@@ -658,14 +1329,19 @@
6581329 smoothCB.setToolTipText("Snapping delay");
6591330 smoothCB.addItemListener(this);
6601331
661
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
662
- slowCB.setToolTipText("Smooth interpolation");
663
- slowCB.addItemListener(this);
1332
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1333
+// slowCB.setToolTipText("Smooth interpolation");
1334
+// slowCB.addItemListener(this);
1335
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1336
+ minshaderCB.setToolTipText("Minimal fast shader");
1337
+ minshaderCB.addItemListener(this);
6641338
6651339 // constraints.gridy += 1;
6661340 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6671341 // speakerMocapCB.addItemListener(this);
6681342
1343
+ panel.Return();
1344
+
6691345 if (false)
6701346 {
6711347 // handled in scripts
....@@ -680,42 +1356,85 @@
6801356 //constraints.gridy += 1;
6811357 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6821358 smoothfocusCB.addItemListener(this);
1359
+ panel.Return();
6831360 }
6841361
6851362 //constraints.gridx += 1;
6861363 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6871364 // debugCB.addItemListener(this);
6881365
1366
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1367
+ trackCB.setToolTipText("Enable tracking target");
1368
+ trackCB.addItemListener(this);
1369
+
6891370 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1371
+ oeilCB.setToolTipText("Move camera when tracking");
6901372 oeilCB.addItemListener(this);
6911373
1374
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1375
+ shadowCB.setToolTipText("When live compute shadows");
1376
+ shadowCB.addItemListener(this);
1377
+
1378
+ panel.Return();
1379
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1380
+ toggleTextureCB.setToolTipText("Load textures");
1381
+ toggleTextureCB.addItemListener(this);
1382
+
1383
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1384
+ toggleSwitchCB.setToolTipText("Choose a single item");
1385
+ toggleSwitchCB.addItemListener(this);
1386
+
1387
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1388
+ autokeepCB.setToolTipText("On structure change");
1389
+ autokeepCB.addItemListener(this);
1390
+
1391
+ panel.Return();
1392
+ if (Globals.ADVANCED)
1393
+ {
6921394 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
6931395 lookAtCB.setToolTipText("Look-at target");
6941396 lookAtCB.addItemListener(this);
1397
+ }
6951398
6961399 }
6971400
6981401 cGridBag fill = new cGridBag();
699
-
7001402 fill.preferredHeight = 200;
1403
+ cGridBag fill2 = new cGridBag();
1404
+ fill2.preferredHeight = 200;
1405
+ cGridBag fill3 = new cGridBag();
1406
+ fill3.preferredHeight = 200;
7011407
7021408 panel.add(fill);
1409
+ panel.add(fill2);
1410
+ panel.add(fill3);
7031411
7041412 }
7051413
7061414 void EditObject(Object3D obj)
7071415 {
7081416 cRadio radioButton = new cRadio(obj.name);
1417
+
1418
+ // June 2019. Patch to avoid bug with transparency.
1419
+ radioButton.hadMaterial = obj.material != null;
1420
+ if (!radioButton.hadMaterial)
1421
+ {
1422
+ obj.material = new cMaterial();
1423
+ }
1424
+
7091425 radioButton.SetObject(obj);
710
- radioButton.layout = sevenButton;
1426
+ radioButton.layout = threeButton; // sixButton;
7111427 radioButton.SetCamera(cameraView.renderCamera, false);
7121428 radioButton.addActionListener(this);
7131429 radioPanel.add(radioButton);
7141430 buttonGroup.add(radioButton);
7151431 radioButton.doClick();
7161432 }
1433
+
7171434 void SetupViews(ObjEditor oe)
7181435 {
1436
+ theFrame = this;
1437
+
7191438 oe.SetupViews();
7201439
7211440 System.out.println("SetupViews");
....@@ -724,23 +1443,30 @@
7241443 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7251444 }
7261445
727
- JCheckBox liveCB;
728
- JCheckBox supportCB;
729
- JCheckBox localCB;
730
- JCheckBox crowdCB;
731
- JCheckBox smoothCB;
732
- JCheckBox fastCB;
733
- JCheckBox slowCB;
734
- JCheckBox boxCB;
735
- JCheckBox zoomBoxCB;
736
- JCheckBox trackCB;
737
- JCheckBox smoothfocusCB;
1446
+ cToggleButton liveCB;
1447
+ cCheckBox supportCB;
1448
+ cCheckBox localCB;
1449
+ cCheckBox crowdCB;
1450
+ cCheckBox smoothCB;
1451
+ cCheckBox minshaderCB;
1452
+
1453
+ cToggleButton fastCB;
1454
+ cCheckBox slowCB;
1455
+ cCheckBox boxCB;
1456
+ cCheckBox zoomBoxCB;
1457
+ cCheckBox freezeCB;
1458
+ //cToggleButton trackCB;
1459
+ cCheckBox trackCB;
1460
+ cCheckBox smoothfocusCB;
7381461 // JCheckBox speakerMocapCB;
739
- JCheckBox speakerCameraCB;
740
- JCheckBox speakerFocusCB;
741
- JCheckBox debugCB;
742
- JCheckBox oeilCB;
743
- JCheckBox lookAtCB;
1462
+ cCheckBox speakerCameraCB;
1463
+ cCheckBox speakerFocusCB;
1464
+ cCheckBox debugCB;
1465
+
1466
+ cCheckBox oeilCB;
1467
+ cCheckBox shadowCB;
1468
+ cCheckBox autokeepCB;
1469
+ cCheckBox lookAtCB;
7441470
7451471 // static int COLOR = 1;
7461472 // static int MATERIAL = 2;
....@@ -748,9 +1474,9 @@
7481474
7491475 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7501476
751
- JCheckBox colorCB;
752
- JCheckBox materialCB;
753
- JCheckBox textureCB;
1477
+ cCheckBox colorCB;
1478
+ cCheckBox materialCB;
1479
+ cCheckBox textureCB;
7541480
7551481 public void itemStateChanged(ItemEvent e)
7561482 {
....@@ -778,6 +1504,7 @@
7781504 } else if(e.getSource() == liveCB)
7791505 {
7801506 cameraView.ToggleLive();
1507
+ refreshContents(false);
7811508 }
7821509 else if(e.getSource() == supportCB)
7831510 {
....@@ -793,6 +1520,12 @@
7931520 {
7941521 cameraView.ToggleInertia();
7951522 cameraView.repaint();
1523
+ }
1524
+ else if(e.getSource() == minshaderCB)
1525
+ {
1526
+ Globals.MINSHADER ^= true;
1527
+ cameraView.programInitialized = false;
1528
+ cameraView.repaint();
7961529 }
7971530 else if(e.getSource() == localCB)
7981531 {
....@@ -842,6 +1575,18 @@
8421575 {
8431576 cameraView.ToggleOeil();
8441577 }
1578
+ else if(e.getSource() == shadowCB)
1579
+ {
1580
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1581
+ }
1582
+ else if(e.getSource() == freezeCB)
1583
+ {
1584
+ Globals.FREEZEONMOVE ^= true;
1585
+ }
1586
+ else if(e.getSource() == autokeepCB)
1587
+ {
1588
+ Globals.REPLACEONMAKE ^= true;
1589
+ }
8451590 else if(e.getSource() == lookAtCB)
8461591 {
8471592 cameraView.ToggleLookAt();
....@@ -858,7 +1603,8 @@
8581603
8591604 /**/
8601605 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
861
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1606
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1607
+ TreePath path = objEditor.jTree.getSelectionPath();
8621608 if ((path == null) || (path.getPathCount() <= 1)) {
8631609 // We can't move the root node or an empty selection
8641610 return;
....@@ -921,8 +1667,6 @@
9211667 }
9221668 }
9231669
924
- String string = (String) object;
925
-
9261670 System.out.println("Transfer = " + object + "; drop : " + target);
9271671 // if( object instanceof java.io.File[])
9281672 // {
....@@ -930,7 +1674,11 @@
9301674 // objEditor.DropFile((java.io.File[]) object, true);
9311675 // return;
9321676 // }
933
- if (string.charAt(0) == '/')
1677
+
1678
+ String string = object.toString();
1679
+
1680
+ // File path for Mac and Windows
1681
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9341682 {
9351683 // file(s)
9361684 String[] names = string.split("\n");
....@@ -957,7 +1705,7 @@
9571705
9581706 flashIt = false;
9591707 CameraPane pane = (CameraPane) target;
960
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1708
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9611709 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9621710
9631711 if (group.selection.size() == 1)
....@@ -973,23 +1721,33 @@
9731721
9741722 assert target == objEditor.jTree;
9751723 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1724
+ Object3D destinationLeaf;
9761725 try {
977
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1726
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9781727 } catch (Exception e) {
9791728 System.out.println("destinationPath : " + destinationPath);
9801729 return;
9811730 }
9821731
983
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1732
+ for (int i=group.selection.size(); --i>=0;)
9841733 {
1734
+ Object3D child = (Object3D)group.selection.elementAt(i);
1735
+
1736
+ // Cannot move into itself
1737
+ if (child == destinationLeaf)
1738
+ return;
1739
+ }
1740
+
1741
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1742
+// {
9851743 loadClipboard(true);
9861744 objEditor.jTree.setSelectionPath(destinationPath);
9871745 pasteInto(false, false);
988
- } else {
989
- loadClipboard(false);
990
- objEditor.jTree.setSelectionPath(destinationPath);
991
- pasteInto(false, false); // true); // ???
992
- }
1746
+// } else {
1747
+// loadClipboard(false);
1748
+// objEditor.jTree.setSelectionPath(destinationPath);
1749
+// pasteInto(false, false); // true); // ???
1750
+// }
9931751 }
9941752 public void dropActionChanged(DropTargetDragEvent dtde)
9951753 // Called if the user has modified the current drop gesture
....@@ -1094,22 +1852,30 @@
10941852 {
10951853 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10961854 //heightFieldItem.addActionListener(this);
1097
- gridItem = menu.add(new MenuItem("Grid"));
1098
- gridItem.addActionListener(this);
1099
- rectoidItem = menu.add(new MenuItem("Box"));
1100
- rectoidItem.addActionListener(this);
1101
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1102
- ellipsoidItem.addActionListener(this);
1103
- coneItem = menu.add(new MenuItem("Cone"));
1104
- coneItem.addActionListener(this);
1105
- torusItem = menu.add(new MenuItem("Torus"));
1106
- torusItem.addActionListener(this);
1107
- superItem = menu.add(new MenuItem("Superellipsoid"));
1108
- superItem.addActionListener(this);
1855
+// gridItem = menu.add(new MenuItem("Grid"));
1856
+// gridItem.addActionListener(this);
1857
+// rectoidItem = menu.add(new MenuItem("Box"));
1858
+// rectoidItem.addActionListener(this);
1859
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1860
+// ellipsoidItem.addActionListener(this);
1861
+// coneItem = menu.add(new MenuItem("Cone"));
1862
+// coneItem.addActionListener(this);
1863
+// torusItem = menu.add(new MenuItem("Torus"));
1864
+// torusItem.addActionListener(this);
1865
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1866
+// superItem.addActionListener(this);
1867
+
1868
+ cameraItem = menu.add(new MenuItem("Camera"));
1869
+ cameraItem.addActionListener(this);
1870
+
1871
+ if (!Globals.ADVANCED)
1872
+ {
11091873 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11101874 kleinItem.addActionListener(this);
1111
- particleItem = menu.add(new MenuItem("Particle system"));
1112
- particleItem.addActionListener(this);
1875
+ }
1876
+
1877
+// particleItem = menu.add(new MenuItem("Particle system"));
1878
+// particleItem.addActionListener(this);
11131879 if (Globals.ADVANCED)
11141880 {
11151881 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1135,15 +1901,15 @@
11351901 }
11361902 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11371903 bezierItem.addActionListener(this);
1138
- overlayItem = menu.add(new MenuItem("Overlay"));
1139
- overlayItem.addActionListener(this);
1140
- lightItem = menu.add(new MenuItem("Light"));
1141
- lightItem.addActionListener(this);
1904
+// overlayItem = menu.add(new MenuItem("Overlay"));
1905
+// overlayItem.addActionListener(this);
1906
+// lightItem = menu.add(new MenuItem("Light"));
1907
+// lightItem.addActionListener(this);
11421908 menu.add("-");
11431909 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11441910 //superLoopItem.addActionListener(this);
1145
- loopItem = menu.add(new MenuItem("Loop"));
1146
- loopItem.addActionListener(this);
1911
+// loopItem = menu.add(new MenuItem("Loop"));
1912
+// loopItem.addActionListener(this);
11471913 doubleItem = menu.add(new MenuItem("Fork"));
11481914 doubleItem.addActionListener(this);
11491915 if (Globals.ADVANCED)
....@@ -1159,18 +1925,23 @@
11591925 animationItem.addItemListener(this);
11601926 animationItem.setState(Globals.ANIMATION);
11611927
1928
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1929
+ archiveItem.addActionListener(this);
1930
+
11621931 menu.add("-");
11631932 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11641933 parseverticesItem.addActionListener(this);
11651934 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11661935 textureFieldItem.addActionListener(this);
1167
- alignItem = menu.add(new MenuItem("Align Object"));
1936
+ alignItem = menu.add(new MenuItem("Align Objects"));
11681937 alignItem.addActionListener(this);
11691938 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11701939 reduceMorphItem.addActionListener(this);
11711940 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11721941 reduce34MorphItem.addActionListener(this);
1173
-
1942
+ menu.add("-");
1943
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1944
+ memoryItem.addActionListener(this);
11741945 menu.add(computeAOItem = new MenuItem("Compute AO"));
11751946 computeAOItem.addActionListener(this);
11761947
....@@ -1179,11 +1950,9 @@
11791950 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11801951 mirrorItem.addActionListener(this);
11811952 menu.add("-");
1182
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1183
- memoryItem.addActionListener(this);
11841953 menu.add(analyzeItem = new MenuItem("Analyze"));
11851954 analyzeItem.addActionListener(this);
1186
- menu.add(dumpItem = new MenuItem("Dump"));
1955
+ menu.add(dumpItem = new MenuItem("Print"));
11871956 dumpItem.addActionListener(this);
11881957 // menu.add(pathItem = new MenuItem("From-to path"));
11891958 // pathItem.addActionListener(this);
....@@ -1324,9 +2093,34 @@
13242093 shadow.material = new cMaterial(obj.material);
13252094 shadow.material.diffuse = 0.0001f;
13262095 shadow.material.specular = 0.0001f;
2096
+ //shadow.projectedVertices[1].x = 300;
13272097
13282098 makeSomething(shadow);
13292099 }
2100
+
2101
+ private void ClearUnpinned()
2102
+ {
2103
+ //for (Object3D obj : listUI)
2104
+ for (int i=listUI.size(); --i>=0;)
2105
+ {
2106
+ Object3D obj = listUI.elementAt(i);
2107
+ if (!obj.pinned)
2108
+ {
2109
+ obj.CloseUI();
2110
+ listUI.remove(i);
2111
+ }
2112
+ }
2113
+ }
2114
+
2115
+ private void EditElement(Object3D elem, boolean newWindow)
2116
+ {
2117
+ // if (!(elem instanceof Composite))
2118
+ // newWindow = false;
2119
+ listUI.add(elem);
2120
+ elem.openEditWindow(this, newWindow); //, false);
2121
+ System.out.println("edit : " + elem);
2122
+ elem.editWindow.refreshContents(true); // ? new
2123
+ }
13302124
13312125 /**
13322126 * applyExample
....@@ -1530,9 +2324,9 @@
15302324
15312325 void Overwrite(int mask)
15322326 {
1533
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2327
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15342328 {
1535
- Object3D content = GrafreeD.clipboard.get(0);
2329
+ Object3D content = Grafreed.clipboard.get(0);
15362330
15372331 if (content instanceof cGroup && ((cGroup)content).transientlink )
15382332 content = ((cGroup)content).get(0);
....@@ -1571,7 +2365,7 @@
15712365 {
15722366 ScreenFit();
15732367 } else
1574
- if (source == switchItem)
2368
+ if (source == switchViewItem)
15752369 {
15762370 cVector v1 = new cVector();
15772371 cVector v2 = new cVector();
....@@ -1580,11 +2374,11 @@
15802374 objEditor.cameraView.renderCamera.setAim(v2, v1);
15812375 objEditor.cameraView.repaint();
15822376 } else
1583
- if (source == rectoidItem)
2377
+ if (source == rectoidItem || source == boxButton)
15842378 {
15852379 makeSomething(new Box());
15862380 } else
1587
- if (source == particleItem)
2381
+ if (source == particleItem || source == particlesButton)
15882382 {
15892383 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15902384 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1663,27 +2457,27 @@
16632457
16642458 makeSomething(obj);
16652459 } else
1666
- if (source == gridItem)
2460
+ if (source == gridItem || source == gridButton)
16672461 {
16682462 makeSomething(new Grid());
16692463 } else
1670
- if (source == ellipsoidItem)
2464
+ if (source == ellipsoidItem || source == sphereButton)
16712465 {
16722466 makeSomething(new Sphere());
16732467 } else
1674
- if (source == coneItem)
2468
+ if (source == coneItem || source == coneButton)
16752469 {
16762470 makeSomething(new Cone());
16772471 } else
1678
- if (source == torusItem)
2472
+ if (source == torusItem || source == torusButton)
16792473 {
16802474 makeSomething(new Torus());
16812475 } else
1682
- if (source == superItem)
2476
+ if (source == superItem || source == superButton)
16832477 {
16842478 makeSomething(new Superellipsoid());
16852479 } else
1686
- if (source == kleinItem)
2480
+ if (source == kleinItem || source == kleinButton)
16872481 {
16882482 makeSomething(new Klein());
16892483 } else
....@@ -1703,7 +2497,7 @@
17032497 {
17042498 makeSomething(new BezierSurface());
17052499 } else
1706
- if (source == overlayItem)
2500
+ if (source == overlayItem || source == overlayButton)
17072501 {
17082502 /*
17092503 Object3D obj = new BezierSurface(5,8);
....@@ -1751,10 +2545,27 @@
17512545 s.setup();
17522546 makeSomething(s);
17532547 } else
1754
- if (source == lightItem)
2548
+ if (source == lightItem || source == lightButton)
17552549 {
17562550 makeSomething(new Light());
17572551 } else
2552
+// if (source == skybox1Button ||
2553
+// source == skybox2Button ||
2554
+// source == skybox3Button ||
2555
+// source == skybox4Button ||
2556
+// source == skybox5Button ||
2557
+// source == skybox6Button ||
2558
+// source == skybox7Button ||
2559
+// source == skybox11Button ||
2560
+// source == skybox12Button ||
2561
+// source == skybox13Button ||
2562
+// source == skybox14Button ||
2563
+// source == skybox15Button ||
2564
+// source == skybox16Button ||
2565
+// source == skybox17Button)
2566
+// {
2567
+// ChangeSkybox(source);
2568
+// } else
17582569 if (source == csgItem)
17592570 {
17602571 group(new CSG());
....@@ -1801,30 +2612,30 @@
18012612
18022613 group(g);
18032614 } else
1804
- if (source == loopItem)
2615
+ if (source == loopItem || source == loopButton)
18052616 {
18062617 Composite csg = new GroupLeaf();
18072618 csg.count = 5;
18082619 group(csg);
1809
- Composite child = new cGroup();
2620
+ Composite child = new cGroup("Branch");
18102621 csg.addChild(child);
18112622 child.addChild(csg);
18122623 } else
18132624 if (source == doubleItem)
18142625 {
1815
- Composite csg = new GroupLeaf();
2626
+ Composite csg = new GroupLeaf("Fork");
18162627 csg.count = 5;
18172628 group(csg);
1818
- Composite child = new cGroup();
2629
+ Composite child = new cGroup("Branch A");
18192630 csg.addChild(child);
18202631 child.addChild(csg);
1821
- child = new cGroup();
2632
+ child = new cGroup("Branch B");
18222633 csg.addChild(child);
18232634 child.addChild(csg);
18242635 } else
18252636 if (source == tripleItem)
18262637 {
1827
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Trident");
18282639 csg.count = 4;
18292640 group(csg);
18302641 Composite child = new cGroup();
....@@ -1837,27 +2648,10 @@
18372648 csg.addChild(child);
18382649 child.addChild(csg);
18392650 } else
1840
-
1841
- if (source == importGFDItem)
1842
- {
1843
- ImportGFD();
1844
- } else
1845
- if (source == importVRMLX3DItem)
1846
- {
1847
- ImportVRMLX3D();
1848
- } else
1849
- if (source == import3DSItem)
1850
- {
1851
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1852
- } else
1853
- if (source == importOBJItem)
1854
- {
1855
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1856
- } else
18572651 if (source == computeAOItem)
18582652 {
18592653 Globals.drawMode = CameraPane.OCCLUSION;
1860
- Globals.theRenderer.repaint();
2654
+ cameraView.repaint();
18612655 } else
18622656 if (source == recompileItem)
18632657 {
....@@ -1872,7 +2666,7 @@
18722666 if (source == invariantsItem)
18732667 {
18742668 System.out.println("Invariants:");
1875
- GrafreeD.grafreeD.universe.invariants();
2669
+ Grafreed.grafreed.universe.invariants();
18762670 } else
18772671 if (source == memoryItem)
18782672 {
....@@ -1891,6 +2685,53 @@
18912685 {
18922686 DumpObject();
18932687 } else
2688
+ if (source == minButton)
2689
+ {
2690
+ Minimize();
2691
+ } else
2692
+ if (source == maxButton)
2693
+ {
2694
+ Maximize();
2695
+ } else
2696
+ if (source == fullButton)
2697
+ {
2698
+ ToggleFullScreen();
2699
+ } else
2700
+ if (source == previousVersionButton)
2701
+ {
2702
+ // Go to previous version
2703
+ //if (!Undo())
2704
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2705
+ PreviousVersion();
2706
+ } else
2707
+ if (source == restoreButton)
2708
+ {
2709
+ // Restore current version
2710
+ Restore();
2711
+ //restoreButton.setEnabled(false);
2712
+ } else
2713
+ if (source == replaceButton)
2714
+ {
2715
+ // Overwrite current version
2716
+ Replace();
2717
+ //replaceButton.setEnabled(false);
2718
+ } else
2719
+ if (source == nextVersionButton)
2720
+ {
2721
+ // Go to next version
2722
+ NextVersion();
2723
+ } else
2724
+ if (source == saveVersionButton)
2725
+ {
2726
+ // Save a new version
2727
+ if (!Save(true))
2728
+ java.awt.Toolkit.getDefaultToolkit().beep();
2729
+ } else
2730
+ if (source == deleteVersionButton)
2731
+ {
2732
+ // Delete a new version
2733
+ DeleteVersion();
2734
+ } else
18942735 if (source == oneStepButton)
18952736 {
18962737 Globals.ONESTEP = true;
....@@ -1898,17 +2739,14 @@
18982739 } else
18992740 if (source == screenfitButton)
19002741 {
1901
- //Reload(lastConverter, lastFilename, true);
19022742 ScreenFit();
19032743 } else
19042744 if (source == screenfitpointButton)
19052745 {
1906
- //Reload(lastConverter, lastFilename, true);
19072746 ScreenFitPoint();
19082747 } else
19092748 if (source == snapobjectButton)
19102749 {
1911
- //Reload(lastConverter, lastFilename, true);
19122750 SnapObject();
19132751 } else
19142752 // if (event.getSource() == recompileButton)
....@@ -1945,12 +2783,20 @@
19452783 {
19462784 loadClipboard(true);
19472785 } else
2786
+ if (source == undoItem)
2787
+ {
2788
+ PreviousVersion();
2789
+ } else
2790
+ if (source == redoItem)
2791
+ {
2792
+ NextVersion();
2793
+ } else
19482794 if (source == duplicateItem)
19492795 {
1950
- Object3D keep = GrafreeD.clipboard;
2796
+ Object3D keep = Grafreed.clipboard;
19512797 loadClipboard(false);
19522798 paste(false);
1953
- GrafreeD.clipboard = keep;
2799
+ Grafreed.clipboard = keep;
19542800 } else
19552801 if (source == cloneItem)
19562802 {
....@@ -2170,9 +3016,9 @@
21703016 // group.selection.get(0).setMasterThis(content); // should be identity
21713017 // refreshContents();
21723018 // }
2173
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
3019
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21743020 {
2175
- Object3D content = GrafreeD.clipboard.get(0);
3021
+ Object3D content = Grafreed.clipboard.get(0);
21763022
21773023 if (content instanceof cGroup && ((cGroup)content).transientlink )
21783024 content = ((cGroup)content).get(0);
....@@ -2222,9 +3068,9 @@
22223068 } else
22233069 if (source == setMasterItem)
22243070 {
2225
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
3071
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22263072 {
2227
- Object3D content = GrafreeD.clipboard.get(0);
3073
+ Object3D content = Grafreed.clipboard.get(0);
22283074
22293075 if (content instanceof cGroup && ((cGroup)content).transientlink )
22303076 content = ((cGroup)content).get(0);
....@@ -2237,9 +3083,9 @@
22373083 {
22383084 if (group.selection.size() == 1)
22393085 {
2240
- if (GrafreeD.clipboard.size() == 1)
3086
+ if (Grafreed.clipboard.size() == 1)
22413087 {
2242
- Object3D content = GrafreeD.clipboard.get(0);
3088
+ Object3D content = Grafreed.clipboard.get(0);
22433089
22443090 if (content instanceof cGroup && ((cGroup)content).transientlink )
22453091 content = ((cGroup)content).get(0);
....@@ -2256,7 +3102,7 @@
22563102 {
22573103 RevertMeshes();
22583104 } else
2259
- if (source == resetMeshItem)
3105
+ if (source == resetAllItem)
22603106 {
22613107 ResetAll();
22623108 } else
....@@ -2264,7 +3110,7 @@
22643110 {
22653111 StepAll();
22663112 } else
2267
- if (source == clearItem) // || event.getSource() == clearButton)
3113
+ if (source == deleteItem) // || event.getSource() == clearButton)
22683114 {
22693115 //int indices[] = jList.getSelectedIndices();
22703116 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2276,9 +3122,9 @@
22763122 {
22773123 ClearSelection(true);
22783124 } else
2279
- if (source == grabItem)
3125
+ if (source == grabItem || source == groupButton)
22803126 {
2281
- group(new cGroup(), true);
3127
+ group(new cGroup(), false); // true);
22823128 } else
22833129 if (source == hideItem)
22843130 {
....@@ -2296,11 +3142,11 @@
22963142 {
22973143 makeSomething(new Camera());
22983144 } else
2299
- if (source == compositeItem)
3145
+ if (source == compositeItem || source == compositeButton)
23003146 {
23013147 group(new Composite());
23023148 } else
2303
- if (source == randomItem)
3149
+ if (source == switchItem || source == switchButton)
23043150 {
23053151 RandomNode random = new RandomNode();
23063152 group(random);
....@@ -2402,7 +3248,7 @@
24023248 {
24033249 group(new cLinker());
24043250 } else
2405
- if (source == textureItem)
3251
+ if (source == textureItem || source == textureButton)
24063252 {
24073253 group(new TextureNode());
24083254 } else
....@@ -2422,17 +3268,30 @@
24223268 {
24233269 CastShadow(2);
24243270 } else
2425
- if (source == ungroupItem)
3271
+ if (source == ungroupItem || source == ungroupButton)
24263272 {
2427
- //ungroup();
3273
+ boolean hasRoot = false;
3274
+
24283275 for (int i=0; i<group.selection.size(); i++)
24293276 {
2430
- Ungroup(group.selection.get(i));
3277
+ if (group.selection.get(i) == group)
3278
+ {
3279
+ hasRoot = true;
3280
+ break;
3281
+ }
24313282 }
24323283
2433
- ClearSelection(false);
2434
-
2435
- refreshContents();
3284
+ if (!hasRoot)
3285
+ {
3286
+ for (int i=0; i<group.selection.size(); i++)
3287
+ {
3288
+ Ungroup(group.selection.get(i));
3289
+ }
3290
+
3291
+ ClearSelection(false);
3292
+
3293
+ refreshContents();
3294
+ }
24363295 } else
24373296 if (source == genUVItem)
24383297 {
....@@ -2444,7 +3303,7 @@
24443303 } else
24453304 if (source == genNormalsMESHItem)
24463305 {
2447
- GenNormals(true); // TODO
3306
+ GenNormalsMESH();
24483307 } else
24493308 if (source == genNormalsORGANItem)
24503309 {
....@@ -2509,6 +3368,22 @@
25093368 if (source == unmarkleavesItem)
25103369 {
25113370 MarkLeaves(false);
3371
+ } else
3372
+ if (source == rewindleavesItem)
3373
+ {
3374
+ RewindLeaves(true);
3375
+ } else
3376
+ if (source == unrewindleavesItem)
3377
+ {
3378
+ RewindLeaves(false);
3379
+ } else
3380
+ if (source == randomleavesItem)
3381
+ {
3382
+ RandomLeaves(true);
3383
+ } else
3384
+ if (source == unrandomleavesItem)
3385
+ {
3386
+ RandomLeaves(false);
25123387 } else
25133388 if (source == flipVItem)
25143389 {
....@@ -2594,9 +3469,13 @@
25943469 {
25953470 SmoothMesh();
25963471 } else
2597
- if (source == transformgeometryItem)
3472
+ if (source == transformGeometryItem)
25983473 {
25993474 TransformGeometry();
3475
+ } else
3476
+ if (source == transformChildrenItem)
3477
+ {
3478
+ TransformChildren();
26003479 } else
26013480 if (source == resetTransformItem)
26023481 {
....@@ -2604,7 +3483,11 @@
26043483 } else
26053484 if (source == resetCentroidItem)
26063485 {
2607
- ResetCentroid();
3486
+ ResetCentroid(true);
3487
+ } else
3488
+ if (source == resetCentroidXZItem)
3489
+ {
3490
+ ResetCentroid(false);
26083491 } else
26093492 if (source == resetParentItem)
26103493 {
....@@ -2709,7 +3592,7 @@
27093592 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27103593 {
27113594 obj = (Object3D)e.nextElement();
2712
- obj.SetBumpTexture(null);
3595
+ obj.ResetBumpTexture();
27133596 }
27143597
27153598 refreshContents();
....@@ -2725,6 +3608,31 @@
27253608
27263609 refreshContents();
27273610 } else
3611
+ if (source == embedTexturesItem)
3612
+ {
3613
+ Object3D obj;
3614
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3615
+ {
3616
+ obj = (Object3D)e.nextElement();
3617
+ obj.EmbedTextures(true);
3618
+ }
3619
+
3620
+ refreshContents();
3621
+ } else
3622
+ if (source == deEmbedTexturesItem)
3623
+ {
3624
+ Object3D obj;
3625
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3626
+ {
3627
+ obj = (Object3D)e.nextElement();
3628
+ obj.EmbedTextures(false);
3629
+ }
3630
+
3631
+ CameraPane.texturepigment.clear();
3632
+ CameraPane.texturebump.clear();
3633
+
3634
+ refreshContents();
3635
+ } else
27283636 if (source == flashSelectionButton)
27293637 {
27303638 CameraPane.flash = true;
....@@ -2736,6 +3644,10 @@
27363644 if (source == twoButton)
27373645 {
27383646 radio.layout = twoButton;
3647
+
3648
+ if (CameraPane.FULLSCREEN)
3649
+ fullscreenLayout = radio.layout;
3650
+
27393651 // bug
27403652 //gridPanel.setDividerLocation(1.0);
27413653 //bigPanel.setDividerLocation(0.0);
....@@ -2768,10 +3680,31 @@
27683680 bigThree.ClearUI();
27693681 bigThree.add(centralPanel);
27703682 bigThree.FlushUI();
3683
+
3684
+ cameraView.requestFocusInWindow();
3685
+
3686
+// refreshContents(true);
3687
+//
3688
+// try
3689
+// {
3690
+// java.awt.Robot bot = new java.awt.Robot();
3691
+// int mask = InputEvent.BUTTON1_MASK;
3692
+// bot.mouseMove(100, 100);
3693
+// bot.mousePress(mask);
3694
+// bot.mouseRelease(mask);
3695
+// }
3696
+// catch (Exception e)
3697
+// {
3698
+//
3699
+// }
3700
+
27713701 } else
27723702 if (source == threeButton)
27733703 {
27743704 radio.layout = threeButton;
3705
+
3706
+ if (CameraPane.FULLSCREEN)
3707
+ fullscreenLayout = radio.layout;
27753708
27763709 // bigThree.remove(scenePanel);
27773710 // bigThree.remove(centralPanel);
....@@ -2801,13 +3734,18 @@
28013734 // centralPanel.setVisible(true);
28023735 // XYZPanel.setVisible(true);
28033736 bigThree.ClearUI();
3737
+ bigThree.add(scenePanel);
28043738 bigThree.add(centralPanel);
2805
- bigThree.add(XYZPanel);
28063739 bigThree.FlushUI();
3740
+
3741
+ cameraView.requestFocusInWindow();
28073742 } else
28083743 if (source == fourButton)
28093744 {
28103745 radio.layout = fourButton;
3746
+
3747
+ if (CameraPane.FULLSCREEN)
3748
+ fullscreenLayout = radio.layout;
28113749
28123750 // bigThree.remove(scenePanel);
28133751 // bigThree.remove(centralPanel);
....@@ -2839,10 +3777,15 @@
28393777 bigThree.ClearUI();
28403778 bigThree.add(scenePanel);
28413779 bigThree.FlushUI();
3780
+
3781
+ cameraView.requestFocusInWindow();
28423782 } else
28433783 if (source == sixButton)
28443784 {
28453785 radio.layout = sixButton;
3786
+
3787
+ if (CameraPane.FULLSCREEN)
3788
+ fullscreenLayout = radio.layout;
28463789
28473790 // bigThree.remove(scenePanel);
28483791 // bigThree.remove(centralPanel);
....@@ -2872,13 +3815,18 @@
28723815 // centralPanel.setVisible(true);
28733816 // XYZPanel.setVisible(false);
28743817 bigThree.ClearUI();
2875
- bigThree.add(scenePanel);
28763818 bigThree.add(centralPanel);
3819
+ bigThree.add(scenePanel);
28773820 bigThree.FlushUI();
3821
+
3822
+ cameraView.requestFocusInWindow();
28783823 } else
28793824 if (source == sevenButton)
28803825 {
28813826 radio.layout = sevenButton;
3827
+
3828
+ if (CameraPane.FULLSCREEN)
3829
+ fullscreenLayout = radio.layout;
28823830
28833831 // bigThree.remove(scenePanel);
28843832 // bigThree.remove(centralPanel);
....@@ -2912,6 +3860,8 @@
29123860 bigThree.add(centralPanel);
29133861 bigThree.add(XYZPanel);
29143862 bigThree.FlushUI();
3863
+
3864
+ cameraView.requestFocusInWindow();
29153865 } else
29163866 if (source == rootButton)
29173867 {
....@@ -2923,6 +3873,7 @@
29233873 EditObject(obj);
29243874 }
29253875
3876
+ cameraView.requestFocusInWindow();
29263877 refreshContents(true);
29273878 } else
29283879 if (source == closeButton)
....@@ -2932,22 +3883,37 @@
29323883 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29333884 {
29343885 ab = (cRadio)e.nextElement();
2935
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3886
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29363887 {
3888
+ // Patch to avoid bug with transparency.
3889
+ if (!ab.hadMaterial)
3890
+ {
3891
+ ab.object.material = null;
3892
+ }
3893
+
29373894 buttonGroup.remove(ab);
29383895 radioPanel.remove(ab);
29393896
2940
- ab.GetObject().editWindow = null;
3897
+ //ab.GetObject().editWindow = null;
3898
+ ab.GetObject().manipWindow = null;
29413899 // ab.GetObject().objectUI = null; // ?????????
29423900
29433901 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29443902 break;
29453903 }
29463904 }
3905
+
3906
+ cameraView.requestFocusInWindow();
29473907 refreshContents(true);
29483908 } else
29493909 if (source == editItem || source == editButton)
29503910 {
3911
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3912
+ {
3913
+ Object3D child = (Object3D)e.nextElement();
3914
+ child.pinned = true;
3915
+ }
3916
+
29513917 EditSelection(false);
29523918 } else
29533919 if (source == uneditButton)
....@@ -2956,11 +3922,12 @@
29563922 {
29573923 Object3D child = (Object3D)e.nextElement();
29583924 if(child.editWindow != null)
2959
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3925
+ child.pinned = false;
29603926 child.CloseUI();
29613927 listUI.remove(child);
3928
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29623929
2963
- child.editWindow = null; // ???????????
3930
+ //child.editWindow = null; // ???????????
29643931 }
29653932 objEditor.ctrlPanel.FlushUI();
29663933 //objEditor.jTree.clearSelection();
....@@ -2973,16 +3940,18 @@
29733940 //copy.ClearUI();
29743941 for (Object3D obj : listUI)
29753942 {
3943
+ obj.pinned = false;
29763944 obj.CloseUI();
29773945 }
29783946 listUI.clear();
3947
+ SetPinStates(group.selection.size() > 0);
29793948 refreshContents(true);
29803949 } else
29813950 if (source == allParamsButton)
29823951 {
29833952 assert(copy == group);
29843953
2985
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3954
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29863955
29873956 for (Object3D obj : listUI)
29883957 {
....@@ -3031,6 +4000,9 @@
30314000 }
30324001
30334002 copy = group;
4003
+
4004
+ SetUndoStates();
4005
+
30344006 //Globals.theRenderer.object = group;
30354007 if(!useclient)
30364008 {
....@@ -3046,20 +4018,49 @@
30464018 frontView.object = group;
30474019 sideView.object = group;
30484020 }
3049
- group.editWindow = this;
4021
+
4022
+// fix "+" issue
4023
+ //group.editWindow = this;
4024
+ group.manipWindow = this;
4025
+
30504026 /*
30514027 currentLayout = radio.layout;
30524028 if (currentLayout == null)
30534029 currentLayout = sevenButton;
30544030 */
30554031 radio.layout.doClick();
4032
+
4033
+ ClearUnpinned();
4034
+
4035
+ //Grafreed.Assert(group != null);
4036
+ //Grafreed.Assert(group.selection != null);
4037
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4038
+ if (group.selection == null || group.selection.size() == 1)
4039
+ EditSelection(false);
30564040 keepparent = group.parent;
30574041 // PARENT = NULL or not???
30584042 //group.parent = null; // ROOT
30594043 //group.attributes = -1;
30604044 ResetModel();
4045
+
4046
+ cameraView.requestFocusInWindow();
30614047 refreshContents(true);
3062
- }
4048
+ } else if (event.getSource() == editCameraItem)
4049
+ {
4050
+ cameraView.ProtectCamera();
4051
+ cameraView.requestFocusInWindow();
4052
+ cameraView.repaint();
4053
+ return;
4054
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4055
+ {
4056
+ cameraView.RevertCamera();
4057
+ cameraView.requestFocusInWindow();
4058
+ cameraView.repaint();
4059
+ return;
4060
+ // } else if (event.getSource() == textureButton)
4061
+ // {
4062
+ // return; // true;
4063
+ }
30634064 else
30644065 {
30654066 //return super.action(event, arg);
....@@ -3068,7 +4069,6 @@
30684069 }
30694070
30704071 boolean useclient = false;
3071
- cRadio radio;
30724072
30734073 void ToggleRoot()
30744074 {
....@@ -3120,6 +4120,28 @@
31204120 refreshContents();
31214121 }
31224122
4123
+ void TransformChildren()
4124
+ {
4125
+ Object3D obj;
4126
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4127
+ {
4128
+ obj = (Object3D)e.nextElement();
4129
+ obj.KeepTextureMatrices();
4130
+ obj.TransformChildren();
4131
+ obj.RestoreTextureMatrices();
4132
+
4133
+// if (obj.parent == null)
4134
+// {
4135
+// System.out.println("NULL PARENT!");
4136
+// new Exception().printStackTrace();
4137
+// }
4138
+// else
4139
+// TouchTransform(obj);
4140
+// //obj.parent.Touch();
4141
+ }
4142
+
4143
+ refreshContents();
4144
+ }
31234145
31244146 void ResetTransform()
31254147 {
....@@ -3232,7 +4254,7 @@
32324254 refreshContents();
32334255 }
32344256
3235
- void ResetCentroid()
4257
+ void ResetCentroid(boolean full)
32364258 {
32374259 Object3D obj;
32384260 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3247,12 +4269,16 @@
32474269 LA.matIdentity(Object3D.mat);
32484270 obj.getBounds(minima, maxima, false);
32494271 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3250
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4272
+ if (full)
4273
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32514274 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32524275 obj.TransformMesh(Object3D.mat);
4276
+
32534277 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3254
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4278
+ if (full)
4279
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32554280 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4281
+
32564282 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32574283 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32584284 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3281,7 +4307,8 @@
32814307
32824308 int size = obj.MemorySize();
32834309
3284
- System.err.println((size/1024) + " KB is the size of " + obj);
4310
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4311
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32854312 }
32864313 }
32874314 catch (Exception e)
....@@ -3318,9 +4345,9 @@
33184345 obj = (Object3D)e.nextElement();
33194346
33204347 System.out.println("Object is: " + obj);
3321
- GrafreeD.AnalyzeObject(obj);
4348
+ Grafreed.AnalyzeObject(obj);
33224349 System.out.println("Boundary rep: " + obj.bRep);
3323
- GrafreeD.AnalyzeObject(obj.bRep);
4350
+ Grafreed.AnalyzeObject(obj.bRep);
33244351
33254352 // System.err.println((size/1024) + " KB is the size of " + obj);
33264353 }
....@@ -3362,6 +4389,13 @@
33624389 void GenNormals(boolean crease)
33634390 {
33644391 group.GenNormalsS(crease);
4392
+
4393
+ refreshContents();
4394
+ }
4395
+
4396
+ void GenNormalsMESH()
4397
+ {
4398
+ group.GenNormalsMeshS();
33654399
33664400 refreshContents();
33674401 }
....@@ -3534,8 +4568,8 @@
35344568
35354569 void ParseVertices()
35364570 {
3537
- boolean epsequal = GrafreeD.epsequal;
3538
- GrafreeD.epsequal = true;
4571
+ boolean epsequal = Grafreed.epsequal;
4572
+ Grafreed.epsequal = true;
35394573
35404574 for (int i=0; i<group.selection.size(); i++)
35414575 {
....@@ -3560,7 +4594,7 @@
35604594 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35614595 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35624596
3563
- g.add(GrafreeD.clipboard);
4597
+ g.add(Grafreed.clipboard);
35644598
35654599 buffer.add(g);
35664600 }
....@@ -3575,7 +4609,7 @@
35754609 makeSomething(buffer, i==group.selection.size()-1);
35764610 }
35774611
3578
- GrafreeD.epsequal = epsequal;
4612
+ Grafreed.epsequal = epsequal;
35794613
35804614 refreshContents();
35814615 }
....@@ -3593,7 +4627,16 @@
35934627 String pigment = Object3D.GetPigment(tex);
35944628 //String bump = Object3D.GetBump(tex);
35954629
3596
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4630
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4631
+
4632
+ try
4633
+ {
4634
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4635
+ }
4636
+ catch (Exception e)
4637
+ {
4638
+ System.err.println("FAIL: " + node);
4639
+ }
35974640
35984641 double s = v.s;
35994642
....@@ -3725,7 +4768,7 @@
37254768 return;
37264769
37274770 Object3D poses = group.selection.get(0);
3728
- Object3D ref = GrafreeD.clipboard.get(0);
4771
+ Object3D ref = Grafreed.clipboard.get(0);
37294772
37304773 Object3D newgroup = new Object3D("Po:" + poses.name);
37314774
....@@ -3919,9 +4962,9 @@
39194962
39204963 void ClipMesh()
39214964 {
3922
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4965
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39234966 {
3924
- Object3D content = GrafreeD.clipboard.get(0);
4967
+ Object3D content = Grafreed.clipboard.get(0);
39254968
39264969 if (content instanceof cGroup && ((cGroup)content).transientlink )
39274970 content = ((cGroup)content).get(0);
....@@ -3930,7 +4973,7 @@
39304973 // {
39314974 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39324975 // }
3933
- group.selection.ClipMesh(GrafreeD.clipboard);
4976
+ group.selection.ClipMesh(Grafreed.clipboard);
39344977 }
39354978 // group.selection.ClipMesh(GrafreeD.clipboard);
39364979 System.out.println("DONE.");
....@@ -3977,6 +5020,18 @@
39775020 void MarkLeaves(boolean hide)
39785021 {
39795022 group.selection.MarkLeaves(hide);
5023
+ refreshContents();
5024
+ }
5025
+
5026
+ void RewindLeaves(boolean hide)
5027
+ {
5028
+ group.selection.RewindLeaves(hide);
5029
+ refreshContents();
5030
+ }
5031
+
5032
+ void RandomLeaves(boolean hide)
5033
+ {
5034
+ group.selection.RandomLeaves(hide);
39805035 refreshContents();
39815036 }
39825037
....@@ -4051,28 +5106,25 @@
40515106 // }
40525107 // }
40535108
4054
- static boolean allparams = true;
4055
-
4056
- static Vector<Object3D> listUI = new Vector<Object3D>();
4057
-
40585109 void EditSelection(boolean newWindow)
40595110 {
5111
+ if (group.selection == null)
5112
+ {
5113
+ EditElement(group, newWindow); // ? new
5114
+ return;
5115
+ }
5116
+
40605117 // aConstraints.gridy = 0;
40615118 for (int i=0; i<group.selection.size(); i++)
40625119 {
40635120 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
40645121 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4065
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5122
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40665123
40675124 Object3D elem = (Object3D)group.selection.elementAt(i);
4068
- if(elem != group)
5125
+ if(elem != group || !newWindow)
40695126 {
4070
- // if (!(elem instanceof Composite))
4071
- // newWindow = false;
4072
- listUI.add(elem);
4073
- elem.openEditWindow(this, newWindow); //, false);
4074
- System.out.println("edit : " + elem);
4075
- elem.editWindow.refreshContents(true); // ? new
5127
+ EditElement(elem, newWindow); // ? new
40765128 }
40775129 }
40785130 }
....@@ -4135,9 +5187,7 @@
41355187
41365188 freezemodel = false;
41375189 }
4138
-
4139
- boolean flashIt = true;
4140
-
5190
+
41415191 public void valueChanged(TreeSelectionEvent e)
41425192 //public boolean handleEvent(Event event)
41435193 {
....@@ -4147,7 +5197,8 @@
41475197 //new Exception().printStackTrace();
41485198
41495199 freezemodel = true;
4150
-
5200
+ ClearUnpinned();
5201
+
41515202 /**/
41525203 //switch (event.id)
41535204 {
....@@ -4155,7 +5206,6 @@
41555206 //case 702: // Event.LIST_DESELECT
41565207 group.deselectAll();
41575208 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4158
- objEditor.ClearInfo(); // .GetMaterial());
41595209 if (tps != null)
41605210 {
41615211 for (int i=0; i < tps.length; i++)
....@@ -4164,10 +5214,8 @@
41645214
41655215 //if (child.parent != null)
41665216 //child.parent.addSelectee(child);
5217
+ objEditor.SetMaterial(child);
41675218 group.addSelectee(child);
4168
- objEditor.SetMaterial(child); // .GetMaterial());
4169
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4170
- System.err.println("info : " + child.GetPath());
41715219 }
41725220 }
41735221 // else
....@@ -4177,20 +5225,28 @@
41775225 // System.err.println("info : " + group.GetPath());
41785226 // }
41795227
4180
- objEditor.SetText(); // jan 2014
4181
-
4182
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5228
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41835229 CameraPane.flash = true;
41845230
4185
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5231
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41865232 // a camera
41875233 {
4188
- CameraPane.camerachangeframe = 0; // don't refuse it
4189
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5234
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5235
+ {
5236
+ CameraPane.camerachangeframe = 0; // don't refuse it
5237
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5238
+ }
41905239 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41915240 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41925241 }
41935242
5243
+ if (tps != null && tps.length == 1)
5244
+ {
5245
+ EditSelection(false);
5246
+ }
5247
+
5248
+ SetPinStates(tps != null && tps.length > 0);
5249
+
41945250 refreshContents();
41955251 //return true;
41965252 }
....@@ -4199,6 +5255,37 @@
41995255
42005256 freezemodel = false;
42015257 }
5258
+
5259
+ void SetPinStates(boolean enabled)
5260
+ {
5261
+ editButton.setEnabled(enabled);
5262
+ uneditButton.setEnabled(enabled);
5263
+ //unselectButton.setEnabled(enabled);
5264
+ flashSelectionButton.setEnabled(enabled);
5265
+
5266
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5267
+ }
5268
+
5269
+ void refreshContents(boolean cp)
5270
+ {
5271
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5272
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5273
+ {
5274
+ objEditor.ClearInfo(); // .GetMaterial());
5275
+
5276
+ for (int i=0; i < group.selection.Size(); i++)
5277
+ {
5278
+ Object3D child = (Object3D) group.selection.get(i);
5279
+
5280
+ objEditor.AddInfo(child, this, true);
5281
+ System.err.println("info : " + child.GetPath());
5282
+ }
5283
+
5284
+ objEditor.SetText(); // jan 2014
5285
+ }
5286
+
5287
+ super.refreshContents(cp);
5288
+ }
42025289
42035290 void linkSomething(Object3D thing)
42045291 {
....@@ -4270,16 +5357,19 @@
42705357 {
42715358 if (group.selection.isEmpty())
42725359 return;
4273
- GrafreeD.clipboardIsTempGroup = false;
5360
+
5361
+ Grafreed.clipboardIsTempGroup = false;
42745362 Composite tGroup = null;
42755363 if (group.selection.size() > 0) // 1)
42765364 {
42775365 tGroup = new cGroup();
4278
- GrafreeD.clipboardIsTempGroup = true;
5366
+ Grafreed.clipboardIsTempGroup = true;
42795367 }
42805368
42815369 if (cut)
42825370 {
5371
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5372
+// Save();
42835373 //int indices[] = jList.getSelectedIndices();
42845374 //for (int i = indices.length - 1; i >= 0; i--)
42855375 //jList.remove(indices[i]);
....@@ -4315,16 +5405,16 @@
43155405 //System.out.println("cut " + child);
43165406 //System.out.println("parent = " + child.parent);
43175407 // tmp.addChild(child);
4318
- if (GrafreeD.clipboardIsTempGroup)
5408
+ if (Grafreed.clipboardIsTempGroup)
43195409 tGroup.add/*Child*/(tmp);
43205410 else
4321
- GrafreeD.clipboard = tmp;
5411
+ Grafreed.clipboard = tmp;
43225412 }
43235413 else
4324
- if (GrafreeD.clipboardIsTempGroup)
5414
+ if (Grafreed.clipboardIsTempGroup)
43255415 tGroup.add/*Child*/(child);
43265416 else
4327
- GrafreeD.clipboard = child;
5417
+ Grafreed.clipboard = child;
43285418 }
43295419
43305420 //ResetModel();
....@@ -4356,21 +5446,23 @@
43565446 //System.out.println("cut " + elem);
43575447 //System.out.println("parent = " + elem.parent);
43585448 // tmp.addChild(elem);
4359
- if (GrafreeD.clipboardIsTempGroup)
5449
+ if (Grafreed.clipboardIsTempGroup)
43605450 tGroup.add/*Child*/(tmp);
43615451 else
4362
- GrafreeD.clipboard = tmp;
5452
+ Grafreed.clipboard = tmp;
43635453 }
43645454 else
4365
- if (GrafreeD.clipboardIsTempGroup)
5455
+ if (Grafreed.clipboardIsTempGroup)
43665456 tGroup.add/*Child*/(child);
43675457 else
4368
- GrafreeD.clipboard = child;
5458
+ Grafreed.clipboard = child;
43695459 }
43705460
43715461 }
4372
- if (GrafreeD.clipboardIsTempGroup)
4373
- GrafreeD.clipboard = tGroup;
5462
+
5463
+ if (Grafreed.clipboardIsTempGroup)
5464
+ Grafreed.clipboard = tGroup;
5465
+
43745466 if (cut)
43755467 {
43765468 ResetModel();
....@@ -4380,11 +5472,15 @@
43805472
43815473 void paste(boolean expand)
43825474 {
5475
+ if (Globals.REPLACEONMAKE)
5476
+ Save();
5477
+ boolean keep = Globals.REPLACEONMAKE;
5478
+ Globals.REPLACEONMAKE = false;
43835479 // if (GrafreeD.clipboard == null)
43845480 // return;
43855481 boolean first = true;
43865482
4387
- if (GrafreeD.clipboardIsTempGroup)
5483
+ if (Grafreed.clipboardIsTempGroup)
43885484 {
43895485 Composite temp;
43905486
....@@ -4395,7 +5491,7 @@
43955491 temp = (Composite)Applet3D.clipboard.deepCopy();
43965492 */
43975493 Object3D elem;
4398
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5494
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43995495 {
44005496 Object3D child = (Object3D)e.nextElement();
44015497
....@@ -4429,16 +5525,17 @@
44295525 //Object3D cb = Applet3D.clipboard;
44305526 //temp.addChild(cb);
44315527 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4432
- assert(GrafreeD.clipboard.parent == null);
4433
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4434
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4435
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4436
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5528
+ assert(Grafreed.clipboard.parent == null);
5529
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5530
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5531
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5532
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44375533 else
4438
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4439
- GrafreeD.clipboard.get(0).parent = keepparent;
5534
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5535
+ Grafreed.clipboard.get(0).parent = keepparent;
44405536 }
44415537
5538
+ Globals.REPLACEONMAKE = keep;
44425539 ResetModel();
44435540 refreshContents();
44445541 }
....@@ -4485,9 +5582,9 @@
44855582 {
44865583 boolean first = true;
44875584
4488
- if (GrafreeD.clipboardIsTempGroup)
5585
+ if (Grafreed.clipboardIsTempGroup)
44895586 {
4490
- Composite temp = (Composite)GrafreeD.clipboard;
5587
+ Composite temp = (Composite)Grafreed.clipboard;
44915588 Object3D copy;
44925589 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44935590 {
....@@ -4497,7 +5594,7 @@
44975594 }
44985595 } else
44995596 {
4500
- linkSomething(GrafreeD.clipboard); //.get(0));
5597
+ linkSomething(Grafreed.clipboard); //.get(0));
45015598 }
45025599 }
45035600 }
....@@ -4574,6 +5671,10 @@
45745671
45755672 void group(Object3D csg, boolean grab)
45765673 {
5674
+ if (Globals.REPLACEONMAKE)
5675
+ Save();
5676
+ boolean keep = Globals.REPLACEONMAKE;
5677
+ Globals.REPLACEONMAKE = false;
45775678 if (//false) // why??
45785679 !group.selection.isEmpty())
45795680 {
....@@ -4687,10 +5788,15 @@
46875788 //node.add(csg);
46885789 //makeSomething(node);
46895790 makeSomething(csg);
5791
+ Globals.REPLACEONMAKE = keep;
46905792 }
46915793
46925794 void Ungroup(Object3D g)
46935795 {
5796
+ if (Globals.REPLACEONMAKE)
5797
+ Save();
5798
+ boolean keep = Globals.REPLACEONMAKE;
5799
+ Globals.REPLACEONMAKE = false;
46945800 if (g instanceof HiddenObject)
46955801 {
46965802 HiddenObject h = (HiddenObject) g;
....@@ -4707,6 +5813,7 @@
47075813 objEditor.makeSomething(g.get(i), false);
47085814 }
47095815 }
5816
+ Globals.REPLACEONMAKE = keep;
47105817 }
47115818
47125819 void ungroup()
....@@ -4902,21 +6009,6 @@
49026009 }
49036010 */
49046011
4905
- void ImportGFD()
4906
- {
4907
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4908
- browser.show();
4909
- String filename = browser.getFile();
4910
- if (filename != null && filename.length() > 0)
4911
- {
4912
- String fullname = browser.getDirectory() + filename;
4913
-
4914
- //Object3D readobj =
4915
- objEditor.ReadGFD(fullname, objEditor);
4916
- //makeSomething(readobj);
4917
- }
4918
- }
4919
-
49206012 /*
49216013 public void Callback(Object obj)
49226014 {
....@@ -4940,26 +6032,9 @@
49406032 }
49416033 */
49426034
4943
- void ImportVRMLX3D()
4944
- {
4945
- if (GrafreeD.standAlone)
4946
- {
4947
- /**/
4948
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4949
- browser.show();
4950
- String filename = browser.getFile();
4951
- if (filename != null && filename.length() > 0)
4952
- {
4953
- String fullname = browser.getDirectory() + filename;
4954
- LoadVRMLX3D(fullname);
4955
- }
4956
- /**/
4957
- }
4958
- }
4959
-
49606035 String GetFile(String dialogName)
49616036 {
4962
- if (GrafreeD.standAlone)
6037
+ if (Grafreed.standAlone)
49636038 {
49646039 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49656040 browser.show();
....@@ -5027,7 +6102,43 @@
50276102 cButton clearpanelButton;
50286103 cButton unselectButton;
50296104
6105
+ cButton restoreCameraButton;
6106
+
50306107 cButton oneStepButton;
6108
+
6109
+ cButton groupButton;
6110
+ cButton ungroupButton;
6111
+ cButton compositeButton;
6112
+ cButton switchButton;
6113
+ cButton loopButton;
6114
+ cButton textureButton;
6115
+
6116
+ cButton skybox1Button;
6117
+ cButton skybox2Button;
6118
+ cButton skybox3Button;
6119
+ cButton skybox4Button;
6120
+ cButton skybox5Button;
6121
+ cButton skybox6Button;
6122
+ cButton skybox7Button;
6123
+
6124
+ cButton skybox11Button;
6125
+ cButton skybox12Button;
6126
+ cButton skybox13Button;
6127
+ cButton skybox14Button;
6128
+ cButton skybox15Button;
6129
+ cButton skybox16Button;
6130
+ cButton skybox17Button;
6131
+
6132
+ cButton gridButton;
6133
+ cButton boxButton;
6134
+ cButton sphereButton;
6135
+ cButton coneButton;
6136
+ cButton torusButton;
6137
+ cButton superButton;
6138
+ cButton kleinButton;
6139
+ cButton particlesButton;
6140
+ cButton overlayButton;
6141
+ cButton lightButton;
50316142
50326143 cButton screenfitButton;
50336144 cButton screenfitpointButton;
....@@ -5040,14 +6151,6 @@
50406151
50416152 cButton setsupportButton;
50426153
5043
- cButton twoButton;
5044
- cButton sixButton;
5045
- cButton threeButton;
5046
- cButton sevenButton;
5047
- cButton fourButton; // full panel
5048
- cButton oneButton; // full XYZ
5049
- //cButton currentLayout;
5050
-
50516154 //
50526155 //Composite
50536156 Object3D // to do !!
....@@ -5057,9 +6160,11 @@
50576160 //JTree jTree;
50586161 private MenuItem lookAtItem;
50596162 private MenuItem lookFromItem;
5060
- private MenuItem switchItem;
6163
+ private MenuItem switchViewItem;
50616164 private MenuItem cutItem;
5062
- private MenuItem duplicateItem;
6165
+ private MenuItem undoItem;
6166
+ private MenuItem redoItem;
6167
+ private JMenuItem duplicateItem;
50636168 private MenuItem cloneItem;
50646169 private MenuItem cloneSupportItem;
50656170 private MenuItem overwriteGeoItem;
....@@ -5072,7 +6177,7 @@
50726177 private MenuItem linkverticesItem;
50736178 private MenuItem relinkverticesItem;
50746179 private MenuItem setMasterItem;
5075
- private MenuItem resetMeshItem;
6180
+ private MenuItem resetAllItem;
50766181 private MenuItem stepAllItem;
50776182 private MenuItem revertMeshItem;
50786183 private MenuItem poseMeshItem;
....@@ -5087,7 +6192,7 @@
50876192 private MenuItem pasteLinkItem;
50886193 private MenuItem pasteCloneItem;
50896194 private MenuItem pasteExpandItem;
5090
- private MenuItem clearItem;
6195
+ private MenuItem deleteItem;
50916196 private MenuItem clearAllItem;
50926197 private MenuItem genUVItem;
50936198 private MenuItem genNormalsMESHItem;
....@@ -5122,6 +6227,10 @@
51226227 private MenuItem showleavesItem;
51236228 private MenuItem markleavesItem;
51246229 private MenuItem unmarkleavesItem;
6230
+ private MenuItem rewindleavesItem;
6231
+ private MenuItem unrewindleavesItem;
6232
+ private MenuItem randomleavesItem;
6233
+ private MenuItem unrandomleavesItem;
51256234
51266235 private MenuItem flipVItem;
51276236 private MenuItem unflipVItem;
....@@ -5133,15 +6242,17 @@
51336242 private MenuItem panoTexturesItem;
51346243
51356244 private MenuItem resetCentroidItem;
5136
- private MenuItem transformgeometryItem;
6245
+ private MenuItem resetCentroidXZItem;
51376246 private MenuItem resetTransformItem;
6247
+ private MenuItem transformGeometryItem;
6248
+ private MenuItem transformChildrenItem;
51386249 private MenuItem hideItem;
51396250 private MenuItem grabItem;
51406251 private MenuItem backItem;
51416252 private MenuItem frontItem;
51426253 private MenuItem cameraItem;
51436254 private MenuItem compositeItem;
5144
- private MenuItem randomItem;
6255
+ private MenuItem switchItem;
51456256 private MenuItem physicsItem;
51466257 private MenuItem frameselectorItem;
51476258 private MenuItem scriptNodeItem;
....@@ -5165,6 +6276,8 @@
51656276 private MenuItem attachBumpItem;
51666277 private MenuItem detachBumpItem;
51676278 private MenuItem pigmentBumpItem;
6279
+ private MenuItem embedTexturesItem;
6280
+ private MenuItem deEmbedTexturesItem;
51686281
51696282 private MenuItem particleItem;
51706283 private MenuItem ragdollItem;
....@@ -5203,11 +6316,6 @@
52036316 private MenuItem doubleItem;
52046317 private MenuItem tripleItem;
52056318
5206
- private MenuItem importGFDItem;
5207
- private MenuItem importVRMLX3DItem;
5208
- private MenuItem import3DSItem;
5209
- private MenuItem importOBJItem;
5210
-
52116319 private MenuItem computeAOItem;
52126320 private MenuItem recompileItem;
52136321 private MenuItem editScriptItem;
....@@ -5217,4 +6325,8 @@
52176325 private MenuItem analyzeItem;
52186326 private MenuItem dumpItem;
52196327 //boolean freezemodel = false;
6328
+
6329
+ Menu cameraMenu;
6330
+ MenuItem editCameraItem;
6331
+ MenuItem restoreCameraItem;
52206332 }