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,6 +442,7 @@
94442
95443 makeSomething(clone, i==group.selection.size()-1);
96444 }
445
+ Globals.REPLACEONMAKE = keep;
97446 }
98447
99448 void CloneClipboard(boolean supports)
....@@ -148,28 +497,21 @@
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);
174516 cloneItem = menu.add(new MenuItem("Clone"));
175517 cloneItem.addActionListener(this);
....@@ -185,7 +527,6 @@
185527 copyItem.addActionListener(this);
186528 pasteItem = menu.add(new MenuItem("Paste"));
187529 pasteItem.addActionListener(this);
188
- menu.add("-");
189530
190531 menu.add("-");
191532 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,8 +538,8 @@
197538 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
198539 // pasteExpandItem.addActionListener(this);
199540 menu.add("-");
200
- clearItem = menu.add(new MenuItem("Clear"));
201
- clearItem.addActionListener(this);
541
+ deleteItem = menu.add(new MenuItem("Delete"));
542
+ deleteItem.addActionListener(this);
202543
203544 if (Globals.ADVANCED)
204545 {
....@@ -206,14 +547,97 @@
206547 clearAllItem = menu.add(new MenuItem("Clear All"));
207548 clearAllItem.addActionListener(this);
208549 }
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());
209586
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
+
210638 oe.menuBar.add(menu = new Menu("Setting"));
211639 if (Globals.ADVANCED)
212640 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217641 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218642 revertMeshItem.addActionListener(this);
219643 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +677,29 @@
253677 }
254678
255679 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
680
+// grabItem = menu.add(new MenuItem("Grab"));
681
+// grabItem.addActionListener(this);
258682 backItem = menu.add(new MenuItem("Back"));
259683 backItem.addActionListener(this);
260684 frontItem = menu.add(new MenuItem("Front"));
261685 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
686
+// compositeItem = menu.add(new MenuItem("Composite"));
687
+// compositeItem.addActionListener(this);
688
+
689
+ if (Globals.ADVANCED)
690
+ {
264691 hideItem = menu.add(new MenuItem("Hidden Group"));
265692 hideItem.addActionListener(this);
693
+ }
266694 ungroupItem = menu.add(new MenuItem("Ungroup"));
267695 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- 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
+ {
271703 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272704 switchGeoItem.addActionListener(this);
273705 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +707,6 @@
275707 morphItem = menu.add(new MenuItem("Morph Group"));
276708 morphItem.addActionListener(this);
277709
278
- if (Globals.ADVANCED)
279
- {
280710 menu.add("-");
281711 physicsItem = menu.add(new MenuItem("Physics"));
282712 physicsItem.addActionListener(this);
....@@ -284,30 +714,29 @@
284714 frameselectorItem.addActionListener(this);
285715 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286716 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289717 }
290718
291719 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
720
+// textureItem = menu.add(new MenuItem("Texture"));
721
+// textureItem.addActionListener(this);
294722 billboardItem = menu.add(new MenuItem("Billboard"));
295723 billboardItem.addActionListener(this);
296724 csgItem = menu.add(new MenuItem("CSG"));
297725 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
726
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299727 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
728
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301729 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
730
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303731 shadowZItem.addActionListener(this);
732
+ attributeItem = menu.add(new MenuItem("Attribute"));
733
+ attributeItem.addActionListener(this);
734
+
304735 if (Globals.ADVANCED)
305736 {
306737 menu.add("-");
307738 linkerItem = menu.add(new MenuItem("Linker"));
308739 linkerItem.addActionListener(this);
309
- attributeItem = menu.add(new MenuItem("Attribute"));
310
- attributeItem.addActionListener(this);
311740 templateItem = menu.add(new MenuItem("Template"));
312741 templateItem.addActionListener(this);
313742 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -336,7 +765,7 @@
336765 genNormalsMESHItem.addActionListener(this);
337766 if (Globals.ADVANCED)
338767 {
339
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
768
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
340769 genNormalsMINEItem.addActionListener(this);
341770 }
342771 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -372,6 +801,10 @@
372801 oe.menuBar.add(menu = new Menu("Attributes"));
373802 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
374803 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);
375808 menu.add("-");
376809 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
377810 liveleavesItem.addActionListener(this);
....@@ -392,6 +825,14 @@
392825 markleavesItem.addActionListener(this);
393826 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394827 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);
395836 menu.add("-");
396837 flipVItem = menu.add(new MenuItem("Flip V"));
397838 flipVItem.addActionListener(this);
....@@ -417,10 +858,15 @@
417858 attachBumpItem.addActionListener(this);
418859 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
419860 pigmentBumpItem.addActionListener(this);
861
+ //embedTexturesItem
420862 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
421863 detachPigmentItem.addActionListener(this);
422864 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
423865 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);
424870 menu.add("-");
425871 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
426872 sortbysizeItem.addActionListener(this);
....@@ -443,25 +889,86 @@
443889 oe.menuBar.add(menu = new Menu("Insert"));
444890 buildCreateMenu(menu);
445891
446
- oe.menuBar.add(menu = new Menu("Include"));
447
- importOBJItem = menu.add(new MenuItem("OBJ file..."));
448
- importOBJItem.addActionListener(this);
449
- menu.add("-");
450
- import3DSItem = menu.add(new MenuItem("3DS file..."));
451
- import3DSItem.addActionListener(this);
452
- menu.add("-");
453
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
454
- importVRMLX3DItem.addActionListener(this);
455
- menu.add("-");
456
- importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
457
- importGFDItem.addActionListener(this);
458
-
459892 oe.menuBar.add(menu = new Menu("Tools"));
460893 buildToolsMenu(menu);
461894 }
462895
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
+
463958 void SetupUI2(ObjEditor oe)
464959 {
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
+
465972 //new Exception().printStackTrace();
466973
467974 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +997,83 @@
490997 oe.radioPanel.add(dummyButton);
491998 oe.buttonGroup.add(dummyButton);
492999 */
1000
+ cGridBag copyOptionsPanel = new cGridBag();
1001
+
1002
+ copyOptionsPanel.preferredHeight = 2;
1003
+
4931004 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
4941005
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
496
- 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");
4971062 liveCB.addItemListener(this);
4981063
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1064
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5001065 oneStepButton.setToolTipText("Animate one step forward");
5011066 oneStepButton.addActionListener(this);
5021067
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
1068
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
5041069 fastCB.setToolTipText("Fast mode");
5051070 fastCB.addItemListener(this);
5061071
507
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
508
- trackCB.setToolTipText("Enable tracking");
509
- trackCB.addItemListener(this);
510
-
511
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512
- screenfitButton.setToolTipText("Screen fit");
513
- 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);
5141077
5151078 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
5161079 // screenfitpointButton.addActionListener(this);
....@@ -520,67 +1083,152 @@
5201083 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5211084 snapobjectButton.addActionListener(this);
5221085 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");
5231090 }
5241091
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
1092
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
5281093
529
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
-
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532
- 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");
5331096 twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535
- fourButton.addActionListener(this);
536
- fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538
- sixButton.setToolTipText("2-column layout left");
539
- sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541
- 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");
5421101 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544
- sevenButton.setToolTipText("3-column layout");
545
- 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);
5461108 //
5471109
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549
- 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");
5501112 rootButton.addActionListener(this);
5511113
552
- 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);
5531115 closeButton.setToolTipText("Close tab");
5541116 closeButton.addActionListener(this);
5551117 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5561118 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
1119
+
1120
+ cGridBag row1 = new cGridBag();
5591121
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- 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");
5621205 editButton.addActionListener(this);
5631206
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
1207
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1208
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5661209 uneditButton.addActionListener(this);
5671210
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
1211
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1212
+ allParamsButton.setToolTipText("Show all controls");
5701213 allParamsButton.addActionListener(this);
5711214
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573
- clearPanelButton.setToolTipText("Clear edit panel");
1215
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1216
+ clearPanelButton.setToolTipText("Clear all controls");
5741217 clearPanelButton.addActionListener(this);
5751218
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577
- unselectButton.setToolTipText("Unselect");
578
- unselectButton.addActionListener(this);
1219
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ //unselectButton.setToolTipText("Unselect");
1221
+ //unselectButton.addActionListener(this);
5791222
580
- 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);
5811226
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
1227
+ editCommandsPanel.preferredHeight = 1;
1228
+
1229
+ SetPinStates(false);
1230
+// oe.treePanel.add(commandsPanel);
1231
+// oe.treePanel.Return();
5841232
5851233 // oe.aConstraints.gridx += 1;
5861234 // oe.aConstraints.weighty = 0;
....@@ -597,32 +1245,20 @@
5971245
5981246 JScrollPane jSP;
5991247 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1248
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6011249 ResetModel();
6021250
6031251 oe.treePanel.add(jSPPanel);
6041252 oe.treePanel.Return();
6051253
606
- cGridBag copyOptionsPanel = new cGridBag();
607
-
608
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
609
- colorCB.setToolTipText("Copy color when dropped");
610
- colorCB.addItemListener(this);
611
-
612
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
613
- materialCB.setToolTipText("Copy material when dropped");
614
- materialCB.addItemListener(this);
615
-
616
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
617
- textureCB.setToolTipText("Copy texture when dropped");
618
- textureCB.addItemListener(this);
619
-
620
- copyOptionsPanel.preferredHeight = 1;
6211254 oe.treePanel.add(copyOptionsPanel);
6221255 oe.treePanel.Return();
1256
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1257
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1258
+ sliderPane.preferredHeight = 1;
6231259
624
-// mainPanel.setDividerLocation(0.5); //1.0);
625
-// mainPanel.setResizeWeight(0.5);
1260
+// mainPanel.setDividerLocation(0.1); //1.0);
1261
+ mainPanel.setResizeWeight(0.4);
6261262
6271263 //jList.addListSelectionListener(this);
6281264 oe.jTree.addTreeSelectionListener(this);
....@@ -630,7 +1266,7 @@
6301266 //jTree.setEditable(true);
6311267 oe.jTree.setDragEnabled(true);
6321268 //jTree.setPreferredSize(new Dimension(10,10));
633
- jSP.setPreferredSize(new Dimension(100,200));
1269
+ //jSP.setPreferredSize(new Dimension(100,200));
6341270
6351271 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6361272
....@@ -642,29 +1278,49 @@
6421278 dgr.addDragGestureListener(this);
6431279 }catch(Exception e) {}
6441280 */
645
- radio.layout = sevenButton;
1281
+ radio.layout = threeButton; // sixButton;
6461282 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6471283 }
6481284
6491285 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6501286 {
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
+
6511301 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
6521302 boxCB.setToolTipText("Display bounding boxes");
6531303 boxCB.addItemListener(this);
6541304
6551305 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1306
+ zoomBoxCB.setToolTipText("Display only for wheel");
6571307 zoomBoxCB.addItemListener(this);
6581308
6591309 if (true) // Globals.ADVANCED)
6601310 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- 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);
6641318
6651319 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6661320 // localCB.addItemListener(this);
6671321
1322
+ panel.Return();
1323
+
6681324 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6691325 crowdCB.setToolTipText("Used for crowds");
6701326 crowdCB.addItemListener(this);
....@@ -673,14 +1329,19 @@
6731329 smoothCB.setToolTipText("Snapping delay");
6741330 smoothCB.addItemListener(this);
6751331
676
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
677
- slowCB.setToolTipText("Smooth interpolation");
678
- 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);
6791338
6801339 // constraints.gridy += 1;
6811340 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6821341 // speakerMocapCB.addItemListener(this);
6831342
1343
+ panel.Return();
1344
+
6841345 if (false)
6851346 {
6861347 // handled in scripts
....@@ -695,42 +1356,85 @@
6951356 //constraints.gridy += 1;
6961357 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6971358 smoothfocusCB.addItemListener(this);
1359
+ panel.Return();
6981360 }
6991361
7001362 //constraints.gridx += 1;
7011363 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7021364 // debugCB.addItemListener(this);
7031365
1366
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1367
+ trackCB.setToolTipText("Enable tracking target");
1368
+ trackCB.addItemListener(this);
1369
+
7041370 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1371
+ oeilCB.setToolTipText("Move camera when tracking");
7051372 oeilCB.addItemListener(this);
7061373
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
+ {
7071394 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7081395 lookAtCB.setToolTipText("Look-at target");
7091396 lookAtCB.addItemListener(this);
1397
+ }
7101398
7111399 }
7121400
7131401 cGridBag fill = new cGridBag();
714
-
7151402 fill.preferredHeight = 200;
1403
+ cGridBag fill2 = new cGridBag();
1404
+ fill2.preferredHeight = 200;
1405
+ cGridBag fill3 = new cGridBag();
1406
+ fill3.preferredHeight = 200;
7161407
7171408 panel.add(fill);
1409
+ panel.add(fill2);
1410
+ panel.add(fill3);
7181411
7191412 }
7201413
7211414 void EditObject(Object3D obj)
7221415 {
7231416 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
+
7241425 radioButton.SetObject(obj);
725
- radioButton.layout = sevenButton;
1426
+ radioButton.layout = threeButton; // sixButton;
7261427 radioButton.SetCamera(cameraView.renderCamera, false);
7271428 radioButton.addActionListener(this);
7281429 radioPanel.add(radioButton);
7291430 buttonGroup.add(radioButton);
7301431 radioButton.doClick();
7311432 }
1433
+
7321434 void SetupViews(ObjEditor oe)
7331435 {
1436
+ theFrame = this;
1437
+
7341438 oe.SetupViews();
7351439
7361440 System.out.println("SetupViews");
....@@ -739,23 +1443,30 @@
7391443 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7401444 }
7411445
742
- JCheckBox liveCB;
743
- JCheckBox supportCB;
744
- JCheckBox localCB;
745
- JCheckBox crowdCB;
746
- JCheckBox smoothCB;
747
- JCheckBox fastCB;
748
- JCheckBox slowCB;
749
- JCheckBox boxCB;
750
- JCheckBox zoomBoxCB;
751
- JCheckBox trackCB;
752
- 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;
7531461 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
1462
+ cCheckBox speakerCameraCB;
1463
+ cCheckBox speakerFocusCB;
1464
+ cCheckBox debugCB;
1465
+
1466
+ cCheckBox oeilCB;
1467
+ cCheckBox shadowCB;
1468
+ cCheckBox autokeepCB;
1469
+ cCheckBox lookAtCB;
7591470
7601471 // static int COLOR = 1;
7611472 // static int MATERIAL = 2;
....@@ -763,9 +1474,9 @@
7631474
7641475 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7651476
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
1477
+ cCheckBox colorCB;
1478
+ cCheckBox materialCB;
1479
+ cCheckBox textureCB;
7691480
7701481 public void itemStateChanged(ItemEvent e)
7711482 {
....@@ -793,6 +1504,7 @@
7931504 } else if(e.getSource() == liveCB)
7941505 {
7951506 cameraView.ToggleLive();
1507
+ refreshContents(false);
7961508 }
7971509 else if(e.getSource() == supportCB)
7981510 {
....@@ -808,6 +1520,12 @@
8081520 {
8091521 cameraView.ToggleInertia();
8101522 cameraView.repaint();
1523
+ }
1524
+ else if(e.getSource() == minshaderCB)
1525
+ {
1526
+ Globals.MINSHADER ^= true;
1527
+ cameraView.programInitialized = false;
1528
+ cameraView.repaint();
8111529 }
8121530 else if(e.getSource() == localCB)
8131531 {
....@@ -857,6 +1575,18 @@
8571575 {
8581576 cameraView.ToggleOeil();
8591577 }
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
+ }
8601590 else if(e.getSource() == lookAtCB)
8611591 {
8621592 cameraView.ToggleLookAt();
....@@ -873,7 +1603,8 @@
8731603
8741604 /**/
8751605 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
876
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1606
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1607
+ TreePath path = objEditor.jTree.getSelectionPath();
8771608 if ((path == null) || (path.getPathCount() <= 1)) {
8781609 // We can't move the root node or an empty selection
8791610 return;
....@@ -936,8 +1667,6 @@
9361667 }
9371668 }
9381669
939
- String string = (String) object;
940
-
9411670 System.out.println("Transfer = " + object + "; drop : " + target);
9421671 // if( object instanceof java.io.File[])
9431672 // {
....@@ -945,6 +1674,8 @@
9451674 // objEditor.DropFile((java.io.File[]) object, true);
9461675 // return;
9471676 // }
1677
+
1678
+ String string = object.toString();
9481679
9491680 // File path for Mac and Windows
9501681 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -990,23 +1721,33 @@
9901721
9911722 assert target == objEditor.jTree;
9921723 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1724
+ Object3D destinationLeaf;
9931725 try {
994
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1726
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9951727 } catch (Exception e) {
9961728 System.out.println("destinationPath : " + destinationPath);
9971729 return;
9981730 }
9991731
1000
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1732
+ for (int i=group.selection.size(); --i>=0;)
10011733 {
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
+// {
10021743 loadClipboard(true);
10031744 objEditor.jTree.setSelectionPath(destinationPath);
10041745 pasteInto(false, false);
1005
- } else {
1006
- loadClipboard(false);
1007
- objEditor.jTree.setSelectionPath(destinationPath);
1008
- pasteInto(false, false); // true); // ???
1009
- }
1746
+// } else {
1747
+// loadClipboard(false);
1748
+// objEditor.jTree.setSelectionPath(destinationPath);
1749
+// pasteInto(false, false); // true); // ???
1750
+// }
10101751 }
10111752 public void dropActionChanged(DropTargetDragEvent dtde)
10121753 // Called if the user has modified the current drop gesture
....@@ -1111,22 +1852,30 @@
11111852 {
11121853 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11131854 //heightFieldItem.addActionListener(this);
1114
- gridItem = menu.add(new MenuItem("Grid"));
1115
- gridItem.addActionListener(this);
1116
- rectoidItem = menu.add(new MenuItem("Box"));
1117
- rectoidItem.addActionListener(this);
1118
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1119
- ellipsoidItem.addActionListener(this);
1120
- coneItem = menu.add(new MenuItem("Cone"));
1121
- coneItem.addActionListener(this);
1122
- torusItem = menu.add(new MenuItem("Torus"));
1123
- torusItem.addActionListener(this);
1124
- superItem = menu.add(new MenuItem("Superellipsoid"));
1125
- 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
+ {
11261873 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11271874 kleinItem.addActionListener(this);
1128
- particleItem = menu.add(new MenuItem("Particle system"));
1129
- particleItem.addActionListener(this);
1875
+ }
1876
+
1877
+// particleItem = menu.add(new MenuItem("Particle system"));
1878
+// particleItem.addActionListener(this);
11301879 if (Globals.ADVANCED)
11311880 {
11321881 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1152,15 +1901,15 @@
11521901 }
11531902 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11541903 bezierItem.addActionListener(this);
1155
- overlayItem = menu.add(new MenuItem("Overlay"));
1156
- overlayItem.addActionListener(this);
1157
- lightItem = menu.add(new MenuItem("Light"));
1158
- 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);
11591908 menu.add("-");
11601909 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11611910 //superLoopItem.addActionListener(this);
1162
- loopItem = menu.add(new MenuItem("Loop"));
1163
- loopItem.addActionListener(this);
1911
+// loopItem = menu.add(new MenuItem("Loop"));
1912
+// loopItem.addActionListener(this);
11641913 doubleItem = menu.add(new MenuItem("Fork"));
11651914 doubleItem.addActionListener(this);
11661915 if (Globals.ADVANCED)
....@@ -1176,6 +1925,9 @@
11761925 animationItem.addItemListener(this);
11771926 animationItem.setState(Globals.ANIMATION);
11781927
1928
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1929
+ archiveItem.addActionListener(this);
1930
+
11791931 menu.add("-");
11801932 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11811933 parseverticesItem.addActionListener(this);
....@@ -1188,6 +1940,8 @@
11881940 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11891941 reduce34MorphItem.addActionListener(this);
11901942 menu.add("-");
1943
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1944
+ memoryItem.addActionListener(this);
11911945 menu.add(computeAOItem = new MenuItem("Compute AO"));
11921946 computeAOItem.addActionListener(this);
11931947
....@@ -1196,11 +1950,9 @@
11961950 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11971951 mirrorItem.addActionListener(this);
11981952 menu.add("-");
1199
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1200
- memoryItem.addActionListener(this);
12011953 menu.add(analyzeItem = new MenuItem("Analyze"));
12021954 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1955
+ menu.add(dumpItem = new MenuItem("Print"));
12041956 dumpItem.addActionListener(this);
12051957 // menu.add(pathItem = new MenuItem("From-to path"));
12061958 // pathItem.addActionListener(this);
....@@ -1341,9 +2093,34 @@
13412093 shadow.material = new cMaterial(obj.material);
13422094 shadow.material.diffuse = 0.0001f;
13432095 shadow.material.specular = 0.0001f;
2096
+ //shadow.projectedVertices[1].x = 300;
13442097
13452098 makeSomething(shadow);
13462099 }
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
+ }
13472124
13482125 /**
13492126 * applyExample
....@@ -1588,7 +2365,7 @@
15882365 {
15892366 ScreenFit();
15902367 } else
1591
- if (source == switchItem)
2368
+ if (source == switchViewItem)
15922369 {
15932370 cVector v1 = new cVector();
15942371 cVector v2 = new cVector();
....@@ -1597,11 +2374,11 @@
15972374 objEditor.cameraView.renderCamera.setAim(v2, v1);
15982375 objEditor.cameraView.repaint();
15992376 } else
1600
- if (source == rectoidItem)
2377
+ if (source == rectoidItem || source == boxButton)
16012378 {
16022379 makeSomething(new Box());
16032380 } else
1604
- if (source == particleItem)
2381
+ if (source == particleItem || source == particlesButton)
16052382 {
16062383 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16072384 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1680,27 +2457,27 @@
16802457
16812458 makeSomething(obj);
16822459 } else
1683
- if (source == gridItem)
2460
+ if (source == gridItem || source == gridButton)
16842461 {
16852462 makeSomething(new Grid());
16862463 } else
1687
- if (source == ellipsoidItem)
2464
+ if (source == ellipsoidItem || source == sphereButton)
16882465 {
16892466 makeSomething(new Sphere());
16902467 } else
1691
- if (source == coneItem)
2468
+ if (source == coneItem || source == coneButton)
16922469 {
16932470 makeSomething(new Cone());
16942471 } else
1695
- if (source == torusItem)
2472
+ if (source == torusItem || source == torusButton)
16962473 {
16972474 makeSomething(new Torus());
16982475 } else
1699
- if (source == superItem)
2476
+ if (source == superItem || source == superButton)
17002477 {
17012478 makeSomething(new Superellipsoid());
17022479 } else
1703
- if (source == kleinItem)
2480
+ if (source == kleinItem || source == kleinButton)
17042481 {
17052482 makeSomething(new Klein());
17062483 } else
....@@ -1720,7 +2497,7 @@
17202497 {
17212498 makeSomething(new BezierSurface());
17222499 } else
1723
- if (source == overlayItem)
2500
+ if (source == overlayItem || source == overlayButton)
17242501 {
17252502 /*
17262503 Object3D obj = new BezierSurface(5,8);
....@@ -1768,10 +2545,27 @@
17682545 s.setup();
17692546 makeSomething(s);
17702547 } else
1771
- if (source == lightItem)
2548
+ if (source == lightItem || source == lightButton)
17722549 {
17732550 makeSomething(new Light());
17742551 } 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
17752569 if (source == csgItem)
17762570 {
17772571 group(new CSG());
....@@ -1818,30 +2612,30 @@
18182612
18192613 group(g);
18202614 } else
1821
- if (source == loopItem)
2615
+ if (source == loopItem || source == loopButton)
18222616 {
18232617 Composite csg = new GroupLeaf();
18242618 csg.count = 5;
18252619 group(csg);
1826
- Composite child = new cGroup();
2620
+ Composite child = new cGroup("Branch");
18272621 csg.addChild(child);
18282622 child.addChild(csg);
18292623 } else
18302624 if (source == doubleItem)
18312625 {
1832
- Composite csg = new GroupLeaf();
2626
+ Composite csg = new GroupLeaf("Fork");
18332627 csg.count = 5;
18342628 group(csg);
1835
- Composite child = new cGroup();
2629
+ Composite child = new cGroup("Branch A");
18362630 csg.addChild(child);
18372631 child.addChild(csg);
1838
- child = new cGroup();
2632
+ child = new cGroup("Branch B");
18392633 csg.addChild(child);
18402634 child.addChild(csg);
18412635 } else
18422636 if (source == tripleItem)
18432637 {
1844
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Trident");
18452639 csg.count = 4;
18462640 group(csg);
18472641 Composite child = new cGroup();
....@@ -1854,35 +2648,10 @@
18542648 csg.addChild(child);
18552649 child.addChild(csg);
18562650 } else
1857
-
1858
- if (source == importGFDItem)
1859
- {
1860
- ImportGFD();
1861
- } else
1862
- if (source == importVRMLX3DItem)
1863
- {
1864
- ImportVRMLX3D();
1865
- } else
1866
- if (source == import3DSItem)
1867
- {
1868
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1869
- } else
1870
- if (source == importOBJItem)
1871
- {
1872
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1874
- browser.setVisible(true);
1875
- String filename = browser.getFile();
1876
- if (filename != null && filename.length() > 0)
1877
- {
1878
- String fullname = browser.getDirectory() + filename;
1879
- makeSomething(ReadOBJ(fullname), true);
1880
- }
1881
- } else
18822651 if (source == computeAOItem)
18832652 {
18842653 Globals.drawMode = CameraPane.OCCLUSION;
1885
- Globals.theRenderer.repaint();
2654
+ cameraView.repaint();
18862655 } else
18872656 if (source == recompileItem)
18882657 {
....@@ -1897,7 +2666,7 @@
18972666 if (source == invariantsItem)
18982667 {
18992668 System.out.println("Invariants:");
1900
- Grafreed.grafreeD.universe.invariants();
2669
+ Grafreed.grafreed.universe.invariants();
19012670 } else
19022671 if (source == memoryItem)
19032672 {
....@@ -1916,6 +2685,53 @@
19162685 {
19172686 DumpObject();
19182687 } 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
19192735 if (source == oneStepButton)
19202736 {
19212737 Globals.ONESTEP = true;
....@@ -1923,17 +2739,14 @@
19232739 } else
19242740 if (source == screenfitButton)
19252741 {
1926
- //Reload(lastConverter, lastFilename, true);
19272742 ScreenFit();
19282743 } else
19292744 if (source == screenfitpointButton)
19302745 {
1931
- //Reload(lastConverter, lastFilename, true);
19322746 ScreenFitPoint();
19332747 } else
19342748 if (source == snapobjectButton)
19352749 {
1936
- //Reload(lastConverter, lastFilename, true);
19372750 SnapObject();
19382751 } else
19392752 // if (event.getSource() == recompileButton)
....@@ -1969,6 +2782,14 @@
19692782 if (source == cutItem || source == clearButton)
19702783 {
19712784 loadClipboard(true);
2785
+ } else
2786
+ if (source == undoItem)
2787
+ {
2788
+ PreviousVersion();
2789
+ } else
2790
+ if (source == redoItem)
2791
+ {
2792
+ NextVersion();
19722793 } else
19732794 if (source == duplicateItem)
19742795 {
....@@ -2281,7 +3102,7 @@
22813102 {
22823103 RevertMeshes();
22833104 } else
2284
- if (source == resetMeshItem)
3105
+ if (source == resetAllItem)
22853106 {
22863107 ResetAll();
22873108 } else
....@@ -2289,7 +3110,7 @@
22893110 {
22903111 StepAll();
22913112 } else
2292
- if (source == clearItem) // || event.getSource() == clearButton)
3113
+ if (source == deleteItem) // || event.getSource() == clearButton)
22933114 {
22943115 //int indices[] = jList.getSelectedIndices();
22953116 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2301,9 +3122,9 @@
23013122 {
23023123 ClearSelection(true);
23033124 } else
2304
- if (source == grabItem)
3125
+ if (source == grabItem || source == groupButton)
23053126 {
2306
- group(new cGroup(), true);
3127
+ group(new cGroup(), false); // true);
23073128 } else
23083129 if (source == hideItem)
23093130 {
....@@ -2321,11 +3142,11 @@
23213142 {
23223143 makeSomething(new Camera());
23233144 } else
2324
- if (source == compositeItem)
3145
+ if (source == compositeItem || source == compositeButton)
23253146 {
23263147 group(new Composite());
23273148 } else
2328
- if (source == randomItem)
3149
+ if (source == switchItem || source == switchButton)
23293150 {
23303151 RandomNode random = new RandomNode();
23313152 group(random);
....@@ -2427,7 +3248,7 @@
24273248 {
24283249 group(new cLinker());
24293250 } else
2430
- if (source == textureItem)
3251
+ if (source == textureItem || source == textureButton)
24313252 {
24323253 group(new TextureNode());
24333254 } else
....@@ -2447,17 +3268,30 @@
24473268 {
24483269 CastShadow(2);
24493270 } else
2450
- if (source == ungroupItem)
3271
+ if (source == ungroupItem || source == ungroupButton)
24513272 {
2452
- //ungroup();
3273
+ boolean hasRoot = false;
3274
+
24533275 for (int i=0; i<group.selection.size(); i++)
24543276 {
2455
- Ungroup(group.selection.get(i));
3277
+ if (group.selection.get(i) == group)
3278
+ {
3279
+ hasRoot = true;
3280
+ break;
3281
+ }
24563282 }
24573283
2458
- ClearSelection(false);
2459
-
2460
- 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
+ }
24613295 } else
24623296 if (source == genUVItem)
24633297 {
....@@ -2469,7 +3303,7 @@
24693303 } else
24703304 if (source == genNormalsMESHItem)
24713305 {
2472
- GenNormals(true); // TODO
3306
+ GenNormalsMESH();
24733307 } else
24743308 if (source == genNormalsORGANItem)
24753309 {
....@@ -2534,6 +3368,22 @@
25343368 if (source == unmarkleavesItem)
25353369 {
25363370 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);
25373387 } else
25383388 if (source == flipVItem)
25393389 {
....@@ -2742,7 +3592,7 @@
27423592 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27433593 {
27443594 obj = (Object3D)e.nextElement();
2745
- obj.SetBumpTexture(null);
3595
+ obj.ResetBumpTexture();
27463596 }
27473597
27483598 refreshContents();
....@@ -2758,6 +3608,31 @@
27583608
27593609 refreshContents();
27603610 } 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
27613636 if (source == flashSelectionButton)
27623637 {
27633638 CameraPane.flash = true;
....@@ -2769,6 +3644,10 @@
27693644 if (source == twoButton)
27703645 {
27713646 radio.layout = twoButton;
3647
+
3648
+ if (CameraPane.FULLSCREEN)
3649
+ fullscreenLayout = radio.layout;
3650
+
27723651 // bug
27733652 //gridPanel.setDividerLocation(1.0);
27743653 //bigPanel.setDividerLocation(0.0);
....@@ -2801,10 +3680,31 @@
28013680 bigThree.ClearUI();
28023681 bigThree.add(centralPanel);
28033682 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
+
28043701 } else
28053702 if (source == threeButton)
28063703 {
28073704 radio.layout = threeButton;
3705
+
3706
+ if (CameraPane.FULLSCREEN)
3707
+ fullscreenLayout = radio.layout;
28083708
28093709 // bigThree.remove(scenePanel);
28103710 // bigThree.remove(centralPanel);
....@@ -2834,13 +3734,18 @@
28343734 // centralPanel.setVisible(true);
28353735 // XYZPanel.setVisible(true);
28363736 bigThree.ClearUI();
3737
+ bigThree.add(scenePanel);
28373738 bigThree.add(centralPanel);
2838
- bigThree.add(XYZPanel);
28393739 bigThree.FlushUI();
3740
+
3741
+ cameraView.requestFocusInWindow();
28403742 } else
28413743 if (source == fourButton)
28423744 {
28433745 radio.layout = fourButton;
3746
+
3747
+ if (CameraPane.FULLSCREEN)
3748
+ fullscreenLayout = radio.layout;
28443749
28453750 // bigThree.remove(scenePanel);
28463751 // bigThree.remove(centralPanel);
....@@ -2872,10 +3777,15 @@
28723777 bigThree.ClearUI();
28733778 bigThree.add(scenePanel);
28743779 bigThree.FlushUI();
3780
+
3781
+ cameraView.requestFocusInWindow();
28753782 } else
28763783 if (source == sixButton)
28773784 {
28783785 radio.layout = sixButton;
3786
+
3787
+ if (CameraPane.FULLSCREEN)
3788
+ fullscreenLayout = radio.layout;
28793789
28803790 // bigThree.remove(scenePanel);
28813791 // bigThree.remove(centralPanel);
....@@ -2905,13 +3815,18 @@
29053815 // centralPanel.setVisible(true);
29063816 // XYZPanel.setVisible(false);
29073817 bigThree.ClearUI();
2908
- bigThree.add(scenePanel);
29093818 bigThree.add(centralPanel);
3819
+ bigThree.add(scenePanel);
29103820 bigThree.FlushUI();
3821
+
3822
+ cameraView.requestFocusInWindow();
29113823 } else
29123824 if (source == sevenButton)
29133825 {
29143826 radio.layout = sevenButton;
3827
+
3828
+ if (CameraPane.FULLSCREEN)
3829
+ fullscreenLayout = radio.layout;
29153830
29163831 // bigThree.remove(scenePanel);
29173832 // bigThree.remove(centralPanel);
....@@ -2945,6 +3860,8 @@
29453860 bigThree.add(centralPanel);
29463861 bigThree.add(XYZPanel);
29473862 bigThree.FlushUI();
3863
+
3864
+ cameraView.requestFocusInWindow();
29483865 } else
29493866 if (source == rootButton)
29503867 {
....@@ -2956,6 +3873,7 @@
29563873 EditObject(obj);
29573874 }
29583875
3876
+ cameraView.requestFocusInWindow();
29593877 refreshContents(true);
29603878 } else
29613879 if (source == closeButton)
....@@ -2965,22 +3883,37 @@
29653883 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663884 {
29673885 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3886
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693887 {
3888
+ // Patch to avoid bug with transparency.
3889
+ if (!ab.hadMaterial)
3890
+ {
3891
+ ab.object.material = null;
3892
+ }
3893
+
29703894 buttonGroup.remove(ab);
29713895 radioPanel.remove(ab);
29723896
2973
- ab.GetObject().editWindow = null;
3897
+ //ab.GetObject().editWindow = null;
3898
+ ab.GetObject().manipWindow = null;
29743899 // ab.GetObject().objectUI = null; // ?????????
29753900
29763901 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773902 break;
29783903 }
29793904 }
3905
+
3906
+ cameraView.requestFocusInWindow();
29803907 refreshContents(true);
29813908 } else
29823909 if (source == editItem || source == editButton)
29833910 {
3911
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3912
+ {
3913
+ Object3D child = (Object3D)e.nextElement();
3914
+ child.pinned = true;
3915
+ }
3916
+
29843917 EditSelection(false);
29853918 } else
29863919 if (source == uneditButton)
....@@ -2989,11 +3922,12 @@
29893922 {
29903923 Object3D child = (Object3D)e.nextElement();
29913924 if(child.editWindow != null)
2992
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3925
+ child.pinned = false;
29933926 child.CloseUI();
29943927 listUI.remove(child);
3928
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29953929
2996
- child.editWindow = null; // ???????????
3930
+ //child.editWindow = null; // ???????????
29973931 }
29983932 objEditor.ctrlPanel.FlushUI();
29993933 //objEditor.jTree.clearSelection();
....@@ -3006,16 +3940,18 @@
30063940 //copy.ClearUI();
30073941 for (Object3D obj : listUI)
30083942 {
3943
+ obj.pinned = false;
30093944 obj.CloseUI();
30103945 }
30113946 listUI.clear();
3947
+ SetPinStates(group.selection.size() > 0);
30123948 refreshContents(true);
30133949 } else
30143950 if (source == allParamsButton)
30153951 {
30163952 assert(copy == group);
30173953
3018
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3954
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30193955
30203956 for (Object3D obj : listUI)
30213957 {
....@@ -3064,6 +4000,9 @@
30644000 }
30654001
30664002 copy = group;
4003
+
4004
+ SetUndoStates();
4005
+
30674006 //Globals.theRenderer.object = group;
30684007 if(!useclient)
30694008 {
....@@ -3079,20 +4018,49 @@
30794018 frontView.object = group;
30804019 sideView.object = group;
30814020 }
3082
- group.editWindow = this;
4021
+
4022
+// fix "+" issue
4023
+ //group.editWindow = this;
4024
+ group.manipWindow = this;
4025
+
30834026 /*
30844027 currentLayout = radio.layout;
30854028 if (currentLayout == null)
30864029 currentLayout = sevenButton;
30874030 */
30884031 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);
30894040 keepparent = group.parent;
30904041 // PARENT = NULL or not???
30914042 //group.parent = null; // ROOT
30924043 //group.attributes = -1;
30934044 ResetModel();
4045
+
4046
+ cameraView.requestFocusInWindow();
30944047 refreshContents(true);
3095
- }
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
+ }
30964064 else
30974065 {
30984066 //return super.action(event, arg);
....@@ -3101,7 +4069,6 @@
31014069 }
31024070
31034071 boolean useclient = false;
3104
- cRadio radio;
31054072
31064073 void ToggleRoot()
31074074 {
....@@ -3340,7 +4307,8 @@
33404307
33414308 int size = obj.MemorySize();
33424309
3343
- 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)");
33444312 }
33454313 }
33464314 catch (Exception e)
....@@ -3421,6 +4389,13 @@
34214389 void GenNormals(boolean crease)
34224390 {
34234391 group.GenNormalsS(crease);
4392
+
4393
+ refreshContents();
4394
+ }
4395
+
4396
+ void GenNormalsMESH()
4397
+ {
4398
+ group.GenNormalsMeshS();
34244399
34254400 refreshContents();
34264401 }
....@@ -3652,7 +4627,16 @@
36524627 String pigment = Object3D.GetPigment(tex);
36534628 //String bump = Object3D.GetBump(tex);
36544629
3655
- 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
+ }
36564640
36574641 double s = v.s;
36584642
....@@ -4039,6 +5023,18 @@
40395023 refreshContents();
40405024 }
40415025
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);
5035
+ refreshContents();
5036
+ }
5037
+
40425038 void SetTexRes(int tr)
40435039 {
40445040 group.selection.SetTexRes(tr);
....@@ -4110,28 +5106,25 @@
41105106 // }
41115107 // }
41125108
4113
- static boolean allparams = true;
4114
-
4115
- static Vector<Object3D> listUI = new Vector<Object3D>();
4116
-
41175109 void EditSelection(boolean newWindow)
41185110 {
5111
+ if (group.selection == null)
5112
+ {
5113
+ EditElement(group, newWindow); // ? new
5114
+ return;
5115
+ }
5116
+
41195117 // aConstraints.gridy = 0;
41205118 for (int i=0; i<group.selection.size(); i++)
41215119 {
41225120 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41235121 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4124
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5122
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41255123
41265124 Object3D elem = (Object3D)group.selection.elementAt(i);
4127
- if(elem != group)
5125
+ if(elem != group || !newWindow)
41285126 {
4129
- // if (!(elem instanceof Composite))
4130
- // newWindow = false;
4131
- listUI.add(elem);
4132
- elem.openEditWindow(this, newWindow); //, false);
4133
- System.out.println("edit : " + elem);
4134
- elem.editWindow.refreshContents(true); // ? new
5127
+ EditElement(elem, newWindow); // ? new
41355128 }
41365129 }
41375130 }
....@@ -4194,9 +5187,7 @@
41945187
41955188 freezemodel = false;
41965189 }
4197
-
4198
- boolean flashIt = true;
4199
-
5190
+
42005191 public void valueChanged(TreeSelectionEvent e)
42015192 //public boolean handleEvent(Event event)
42025193 {
....@@ -4206,7 +5197,8 @@
42065197 //new Exception().printStackTrace();
42075198
42085199 freezemodel = true;
4209
-
5200
+ ClearUnpinned();
5201
+
42105202 /**/
42115203 //switch (event.id)
42125204 {
....@@ -4214,7 +5206,6 @@
42145206 //case 702: // Event.LIST_DESELECT
42155207 group.deselectAll();
42165208 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4217
- objEditor.ClearInfo(); // .GetMaterial());
42185209 if (tps != null)
42195210 {
42205211 for (int i=0; i < tps.length; i++)
....@@ -4223,10 +5214,8 @@
42235214
42245215 //if (child.parent != null)
42255216 //child.parent.addSelectee(child);
5217
+ objEditor.SetMaterial(child);
42265218 group.addSelectee(child);
4227
- objEditor.SetMaterial(child); // .GetMaterial());
4228
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4229
- System.err.println("info : " + child.GetPath());
42305219 }
42315220 }
42325221 // else
....@@ -4236,20 +5225,28 @@
42365225 // System.err.println("info : " + group.GetPath());
42375226 // }
42385227
4239
- objEditor.SetText(); // jan 2014
4240
-
4241
- 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))
42425229 CameraPane.flash = true;
42435230
4244
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5231
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42455232 // a camera
42465233 {
4247
- CameraPane.camerachangeframe = 0; // don't refuse it
4248
- 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
+ }
42495239 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42505240 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42515241 }
42525242
5243
+ if (tps != null && tps.length == 1)
5244
+ {
5245
+ EditSelection(false);
5246
+ }
5247
+
5248
+ SetPinStates(tps != null && tps.length > 0);
5249
+
42535250 refreshContents();
42545251 //return true;
42555252 }
....@@ -4258,6 +5255,37 @@
42585255
42595256 freezemodel = false;
42605257 }
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
+ }
42615289
42625290 void linkSomething(Object3D thing)
42635291 {
....@@ -4329,6 +5357,7 @@
43295357 {
43305358 if (group.selection.isEmpty())
43315359 return;
5360
+
43325361 Grafreed.clipboardIsTempGroup = false;
43335362 Composite tGroup = null;
43345363 if (group.selection.size() > 0) // 1)
....@@ -4339,6 +5368,8 @@
43395368
43405369 if (cut)
43415370 {
5371
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5372
+// Save();
43425373 //int indices[] = jList.getSelectedIndices();
43435374 //for (int i = indices.length - 1; i >= 0; i--)
43445375 //jList.remove(indices[i]);
....@@ -4428,8 +5459,10 @@
44285459 }
44295460
44305461 }
5462
+
44315463 if (Grafreed.clipboardIsTempGroup)
44325464 Grafreed.clipboard = tGroup;
5465
+
44335466 if (cut)
44345467 {
44355468 ResetModel();
....@@ -4439,6 +5472,10 @@
44395472
44405473 void paste(boolean expand)
44415474 {
5475
+ if (Globals.REPLACEONMAKE)
5476
+ Save();
5477
+ boolean keep = Globals.REPLACEONMAKE;
5478
+ Globals.REPLACEONMAKE = false;
44425479 // if (GrafreeD.clipboard == null)
44435480 // return;
44445481 boolean first = true;
....@@ -4498,6 +5535,7 @@
44985535 Grafreed.clipboard.get(0).parent = keepparent;
44995536 }
45005537
5538
+ Globals.REPLACEONMAKE = keep;
45015539 ResetModel();
45025540 refreshContents();
45035541 }
....@@ -4633,6 +5671,10 @@
46335671
46345672 void group(Object3D csg, boolean grab)
46355673 {
5674
+ if (Globals.REPLACEONMAKE)
5675
+ Save();
5676
+ boolean keep = Globals.REPLACEONMAKE;
5677
+ Globals.REPLACEONMAKE = false;
46365678 if (//false) // why??
46375679 !group.selection.isEmpty())
46385680 {
....@@ -4746,10 +5788,15 @@
47465788 //node.add(csg);
47475789 //makeSomething(node);
47485790 makeSomething(csg);
5791
+ Globals.REPLACEONMAKE = keep;
47495792 }
47505793
47515794 void Ungroup(Object3D g)
47525795 {
5796
+ if (Globals.REPLACEONMAKE)
5797
+ Save();
5798
+ boolean keep = Globals.REPLACEONMAKE;
5799
+ Globals.REPLACEONMAKE = false;
47535800 if (g instanceof HiddenObject)
47545801 {
47555802 HiddenObject h = (HiddenObject) g;
....@@ -4766,6 +5813,7 @@
47665813 objEditor.makeSomething(g.get(i), false);
47675814 }
47685815 }
5816
+ Globals.REPLACEONMAKE = keep;
47695817 }
47705818
47715819 void ungroup()
....@@ -4961,21 +6009,6 @@
49616009 }
49626010 */
49636011
4964
- void ImportGFD()
4965
- {
4966
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4967
- browser.show();
4968
- String filename = browser.getFile();
4969
- if (filename != null && filename.length() > 0)
4970
- {
4971
- String fullname = browser.getDirectory() + filename;
4972
-
4973
- //Object3D readobj =
4974
- objEditor.ReadGFD(fullname, objEditor);
4975
- //makeSomething(readobj);
4976
- }
4977
- }
4978
-
49796012 /*
49806013 public void Callback(Object obj)
49816014 {
....@@ -4999,23 +6032,6 @@
49996032 }
50006033 */
50016034
5002
- void ImportVRMLX3D()
5003
- {
5004
- if (Grafreed.standAlone)
5005
- {
5006
- /**/
5007
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5008
- browser.show();
5009
- String filename = browser.getFile();
5010
- if (filename != null && filename.length() > 0)
5011
- {
5012
- String fullname = browser.getDirectory() + filename;
5013
- LoadVRMLX3D(fullname);
5014
- }
5015
- /**/
5016
- }
5017
- }
5018
-
50196035 String GetFile(String dialogName)
50206036 {
50216037 if (Grafreed.standAlone)
....@@ -5086,7 +6102,43 @@
50866102 cButton clearpanelButton;
50876103 cButton unselectButton;
50886104
6105
+ cButton restoreCameraButton;
6106
+
50896107 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;
50906142
50916143 cButton screenfitButton;
50926144 cButton screenfitpointButton;
....@@ -5099,14 +6151,6 @@
50996151
51006152 cButton setsupportButton;
51016153
5102
- cButton twoButton;
5103
- cButton sixButton;
5104
- cButton threeButton;
5105
- cButton sevenButton;
5106
- cButton fourButton; // full panel
5107
- cButton oneButton; // full XYZ
5108
- //cButton currentLayout;
5109
-
51106154 //
51116155 //Composite
51126156 Object3D // to do !!
....@@ -5116,9 +6160,11 @@
51166160 //JTree jTree;
51176161 private MenuItem lookAtItem;
51186162 private MenuItem lookFromItem;
5119
- private MenuItem switchItem;
6163
+ private MenuItem switchViewItem;
51206164 private MenuItem cutItem;
5121
- private MenuItem duplicateItem;
6165
+ private MenuItem undoItem;
6166
+ private MenuItem redoItem;
6167
+ private JMenuItem duplicateItem;
51226168 private MenuItem cloneItem;
51236169 private MenuItem cloneSupportItem;
51246170 private MenuItem overwriteGeoItem;
....@@ -5131,7 +6177,7 @@
51316177 private MenuItem linkverticesItem;
51326178 private MenuItem relinkverticesItem;
51336179 private MenuItem setMasterItem;
5134
- private MenuItem resetMeshItem;
6180
+ private MenuItem resetAllItem;
51356181 private MenuItem stepAllItem;
51366182 private MenuItem revertMeshItem;
51376183 private MenuItem poseMeshItem;
....@@ -5146,7 +6192,7 @@
51466192 private MenuItem pasteLinkItem;
51476193 private MenuItem pasteCloneItem;
51486194 private MenuItem pasteExpandItem;
5149
- private MenuItem clearItem;
6195
+ private MenuItem deleteItem;
51506196 private MenuItem clearAllItem;
51516197 private MenuItem genUVItem;
51526198 private MenuItem genNormalsMESHItem;
....@@ -5181,6 +6227,10 @@
51816227 private MenuItem showleavesItem;
51826228 private MenuItem markleavesItem;
51836229 private MenuItem unmarkleavesItem;
6230
+ private MenuItem rewindleavesItem;
6231
+ private MenuItem unrewindleavesItem;
6232
+ private MenuItem randomleavesItem;
6233
+ private MenuItem unrandomleavesItem;
51846234
51856235 private MenuItem flipVItem;
51866236 private MenuItem unflipVItem;
....@@ -5202,7 +6252,7 @@
52026252 private MenuItem frontItem;
52036253 private MenuItem cameraItem;
52046254 private MenuItem compositeItem;
5205
- private MenuItem randomItem;
6255
+ private MenuItem switchItem;
52066256 private MenuItem physicsItem;
52076257 private MenuItem frameselectorItem;
52086258 private MenuItem scriptNodeItem;
....@@ -5226,6 +6276,8 @@
52266276 private MenuItem attachBumpItem;
52276277 private MenuItem detachBumpItem;
52286278 private MenuItem pigmentBumpItem;
6279
+ private MenuItem embedTexturesItem;
6280
+ private MenuItem deEmbedTexturesItem;
52296281
52306282 private MenuItem particleItem;
52316283 private MenuItem ragdollItem;
....@@ -5264,11 +6316,6 @@
52646316 private MenuItem doubleItem;
52656317 private MenuItem tripleItem;
52666318
5267
- private MenuItem importGFDItem;
5268
- private MenuItem importVRMLX3DItem;
5269
- private MenuItem import3DSItem;
5270
- private MenuItem importOBJItem;
5271
-
52726319 private MenuItem computeAOItem;
52736320 private MenuItem recompileItem;
52746321 private MenuItem editScriptItem;
....@@ -5278,4 +6325,8 @@
52786325 private MenuItem analyzeItem;
52796326 private MenuItem dumpItem;
52806327 //boolean freezemodel = false;
6328
+
6329
+ Menu cameraMenu;
6330
+ MenuItem editCameraItem;
6331
+ MenuItem restoreCameraItem;
52816332 }