Normand Briere
2019-08-09 912749d2520afedd9b56458d771400c261fe2b88
GroupEditor.java
....@@ -16,6 +16,7 @@
1616 //import buoy.widget.BFileChooser;
1717
1818 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
19
+ Grafreed.iResourceCallBack,
1920 ObjectUI,
2021 Runnable,
2122 ActionListener,
....@@ -23,6 +24,341 @@
2324 DragGestureListener, DragSourceListener, DropTargetListener,
2425 ItemListener // ListSelectionListener
2526 {
27
+
28
+ public void AddSkyboxButton(String f, String s, cGridBag row)
29
+ {
30
+ cButton skyboxButton;
31
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
32
+ row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
33
+ //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
+ skyboxButton.setToolTipText(s);
35
+ skyboxButton.addActionListener(new ActionListener()
36
+ {
37
+ @Override
38
+ public void actionPerformed(ActionEvent e)
39
+ {
40
+ ChangeSkybox(path);
41
+ }
42
+ });
43
+ }
44
+
45
+ public void AddTextureButton(String f, String c, final String t, int count, cGridBag row)
46
+ {
47
+ cButton textureButton;
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
49
+ row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
+ textureButton.setToolTipText(c + count);
51
+ textureButton.addActionListener(new ActionListener()
52
+ {
53
+ @Override
54
+ public void actionPerformed(ActionEvent e)
55
+ {
56
+ ChangeTexture(path + t);
57
+ }
58
+ });
59
+ }
60
+
61
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
62
+ {
63
+ cGridBag tab0 = new cGridBag().setVertical(true);
64
+
65
+ tab0.setName("Urban");
66
+ skyboxpanel.add(tab0);
67
+
68
+ cGridBag row0 = new cGridBag();
69
+ cGridBag row1 = new cGridBag();
70
+ cGridBag row2 = new cGridBag();
71
+ cGridBag row3 = new cGridBag();
72
+ cGridBag row4 = new cGridBag();
73
+ cGridBag row5 = new cGridBag();
74
+ cGridBag row6 = new cGridBag();
75
+
76
+ AddSkyboxButton("default", "rgb", row0);
77
+ //AddSkyboxButton("default", "cornell", row0);
78
+ AddSkyboxButton("penguins", "dust", row0);
79
+ AddSkyboxButton("penguins", "tropic", row0);
80
+ AddSkyboxButton("penguins", "yonder", row0);
81
+
82
+ AddSkyboxButton("default", "uffizi", row1);
83
+ AddSkyboxButton("bridge", "Bridge", row1);
84
+ AddSkyboxButton("bridge", "Bridge2", row1);
85
+ AddSkyboxButton("urban", "GamlaStan2", row1);
86
+
87
+ AddSkyboxButton("urban", "Parliament", row2);
88
+ AddSkyboxButton("urban", "Roundabout", row2);
89
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
90
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
91
+
92
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
93
+ AddSkyboxButton("urban", "UnionSquare", row3);
94
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
95
+ AddSkyboxButton("park", "BerzeliiPark", row3);
96
+
97
+ AddSkyboxButton("park", "Buddha", row4);
98
+ AddSkyboxButton("park", "CNTower2", row4);
99
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
100
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
101
+
102
+ AddSkyboxButton("park", "Park", row5);
103
+ AddSkyboxButton("park", "Pond", row5);
104
+ AddSkyboxButton("park", "Skansen", row5);
105
+ AddSkyboxButton("park", "Skansen2", row5);
106
+
107
+ AddSkyboxButton("park", "Skansen3", row6);
108
+ AddSkyboxButton("park", "Skansen4", row6);
109
+ AddSkyboxButton("park", "Skansen5", row6);
110
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
111
+
112
+ tab0.add(row0);
113
+ tab0.add(row1);
114
+ tab0.add(row2);
115
+ tab0.add(row3);
116
+ tab0.add(row4);
117
+ tab0.add(row5);
118
+ tab0.add(row6);
119
+
120
+ for (int i=5; --i>=0;)
121
+ {
122
+ //oe.toolboxPanel.Return();
123
+ //tab0.add(new cGridBag());
124
+ }
125
+ }
126
+
127
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
128
+ {
129
+ cGridBag tab0 = new cGridBag().setVertical(true);
130
+
131
+ tab0.setName("Nature");
132
+ skyboxpanel.add(tab0);
133
+
134
+ cGridBag row0 = new cGridBag();
135
+ cGridBag row1 = new cGridBag();
136
+ cGridBag row2 = new cGridBag();
137
+ cGridBag row3 = new cGridBag();
138
+ cGridBag row4 = new cGridBag();
139
+ cGridBag row5 = new cGridBag();
140
+ cGridBag row6 = new cGridBag();
141
+
142
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
143
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
144
+ AddSkyboxButton("beach", "PalmTrees", row0);
145
+ AddSkyboxButton("beach", "Tenerife", row0);
146
+
147
+ AddSkyboxButton("beach", "Tenerife2", row1);
148
+ AddSkyboxButton("beach", "Tenerife3", row1);
149
+ AddSkyboxButton("field", "FishPond", row1);
150
+ AddSkyboxButton("field", "Footballfield", row1);
151
+
152
+ AddSkyboxButton("field", "Meadow", row2);
153
+ AddSkyboxButton("field", "Sorsele", row2);
154
+ AddSkyboxButton("field", "Sorsele2", row2);
155
+ AddSkyboxButton("field", "Sorsele3", row2);
156
+
157
+ AddSkyboxButton("forest", "Brudslojan", row3);
158
+ AddSkyboxButton("forest", "Langholmen2", row3);
159
+ AddSkyboxButton("forest", "Plants", row3);
160
+ AddSkyboxButton("mountain", "Maskonaive", row3);
161
+
162
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
163
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
164
+ AddSkyboxButton("mountain", "Teide", row4);
165
+ AddSkyboxButton("park", "Tantolunden4", row4);
166
+
167
+ AddSkyboxButton("park", "Stairs", row5);
168
+ AddSkyboxButton("default", "skycube", row6);
169
+ AddSkyboxButton("rocky", "Langholmen", row5);
170
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
171
+
172
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
173
+ AddSkyboxButton("default", "CloudyHills", row6);
174
+ AddSkyboxButton("daz", "Autumn", row6);
175
+ AddSkyboxButton("daz", "MountainTrail", row6);
176
+ /*
177
+Autumn
178
+Greenlands
179
+MountainTrail
180
+Oasis
181
+TheRock
182
+TopOfTheWorld
183
+Winter
184
+ */
185
+
186
+ tab0.add(row0);
187
+ tab0.add(row1);
188
+ tab0.add(row2);
189
+ tab0.add(row3);
190
+ tab0.add(row4);
191
+ tab0.add(row5);
192
+ tab0.add(row6);
193
+
194
+ for (int i=5; --i>=0;)
195
+ {
196
+ //oe.toolboxPanel.Return();
197
+ //tab0.add(new cGridBag());
198
+ }
199
+ }
200
+
201
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
202
+ {
203
+ cGridBag tab0 = new cGridBag().setVertical(true);
204
+
205
+ tab0.setName("Night");
206
+ skyboxpanel.add(tab0);
207
+
208
+ cGridBag row0 = new cGridBag();
209
+ cGridBag row1 = new cGridBag();
210
+ cGridBag row2 = new cGridBag();
211
+ cGridBag row3 = new cGridBag();
212
+ cGridBag row4 = new cGridBag();
213
+ cGridBag row5 = new cGridBag();
214
+ cGridBag row6 = new cGridBag();
215
+
216
+ AddSkyboxButton("night", "NightPath", row0);
217
+ AddSkyboxButton("night", "PondNight", row0);
218
+ AddSkyboxButton("night", "Powerlines", row0);
219
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
220
+
221
+ AddSkyboxButton("urban", "CNTower", row1);
222
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
223
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
224
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
225
+
226
+ AddSkyboxButton("penguins", "kenon_star", row2);
227
+ AddSkyboxButton("persson", "corona", row2);
228
+ AddSkyboxButton("persson", "spaceskybox", row2);
229
+ AddSkyboxButton("indoors", "Vasa", row2);
230
+
231
+ AddSkyboxButton("winter", "Backyard", row3);
232
+ AddSkyboxButton("winter", "Creek", row3);
233
+ AddSkyboxButton("winter", "FootballField3", row3);
234
+ AddSkyboxButton("winter", "Forest", row3);
235
+
236
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
237
+ AddSkyboxButton("winter", "House", row4);
238
+ AddSkyboxButton("winter", "IceLake", row4);
239
+ AddSkyboxButton("winter", "IceRiver", row4);
240
+
241
+ AddSkyboxButton("winter", "Park3", row5);
242
+ AddSkyboxButton("winter", "PondWinter", row5);
243
+ AddSkyboxButton("winter", "Tantolunden5", row5);
244
+ AddSkyboxButton("winter", "Vindelalven", row5);
245
+
246
+ AddSkyboxButton("daz", "TheRock", row6);
247
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
248
+ AddSkyboxButton("daz", "Winter", row6);
249
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
250
+
251
+ tab0.add(row0);
252
+ tab0.add(row1);
253
+ tab0.add(row2);
254
+ tab0.add(row3);
255
+ tab0.add(row4);
256
+ tab0.add(row5);
257
+ tab0.add(row6);
258
+
259
+ for (int i=5; --i>=0;)
260
+ {
261
+ //oe.toolboxPanel.Return();
262
+ //tab0.add(new cGridBag());
263
+ }
264
+ }
265
+
266
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
267
+ {
268
+ cGridBag tab0 = new cGridBag().setVertical(true);
269
+
270
+ tab0.setName("Others");
271
+ skyboxpanel.add(tab0);
272
+
273
+ cGridBag row0 = new cGridBag();
274
+ cGridBag row1 = new cGridBag();
275
+ cGridBag row2 = new cGridBag();
276
+ cGridBag row3 = new cGridBag();
277
+ cGridBag row4 = new cGridBag();
278
+ cGridBag row5 = new cGridBag();
279
+ cGridBag row6 = new cGridBag();
280
+
281
+ AddSkyboxButton("mayhem", "afterrain", row0);
282
+ AddSkyboxButton("mayhem", "aqua4", row0);
283
+ AddSkyboxButton("mayhem", "aqua9", row0);
284
+ AddSkyboxButton("mayhem", "flame", row0);
285
+
286
+ AddSkyboxButton("mayhem", "h2s", row1);
287
+ AddSkyboxButton("mayhem", "prehistoric", row1);
288
+ AddSkyboxButton("mayhem", "scorched", row1);
289
+ AddSkyboxButton("penguins", "desertdawn", row1);
290
+
291
+ AddSkyboxButton("persson", "Citadella", row2);
292
+ AddSkyboxButton("persson", "Citadella2", row2);
293
+ AddSkyboxButton("persson", "clouds1", row2);
294
+ AddSkyboxButton("penguins", "wrath", row2);
295
+
296
+ AddSkyboxButton("persson", "FishermansBastion", row3);
297
+ AddSkyboxButton("persson", "HeroesSquare", row3);
298
+ AddSkyboxButton("indoors", "DallasW", row3);
299
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
300
+
301
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
302
+ AddSkyboxButton("persson", "PereaBeach1", row4);
303
+ AddSkyboxButton("persson", "PereaBeach2", row4);
304
+ AddSkyboxButton("persson", "redeclipse", row4);
305
+
306
+ AddSkyboxButton("daz", "Greenlands", row5);
307
+ AddSkyboxButton("daz", "Oasis", row5);
308
+ AddSkyboxButton("elyvisions", "arch3", row5);
309
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
310
+
311
+ AddSkyboxButton("elyvisions", "rainbow", row6);
312
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
313
+ AddSkyboxButton("elyvisions", "heaven", row6);
314
+ AddSkyboxButton("elyvisions", "hot", row6);
315
+
316
+ tab0.add(row0);
317
+ tab0.add(row1);
318
+ tab0.add(row2);
319
+ tab0.add(row3);
320
+ tab0.add(row4);
321
+ tab0.add(row5);
322
+ tab0.add(row6);
323
+
324
+ for (int i=5; --i>=0;)
325
+ {
326
+ //oe.toolboxPanel.Return();
327
+ //tab0.add(new cGridBag());
328
+ }
329
+ }
330
+
331
+ public void ChangeSkybox(String skybox)
332
+ {
333
+ //cameraView.envyoff = false;
334
+ group.skyboxname = skybox;
335
+ group.skyboxext = "jpg";
336
+ cameraView.repaint();
337
+ }
338
+
339
+ public void CreateSkyboxPanel(cGridBag skyboxPanel)
340
+ {
341
+ JTabbedPane skyboxpane = new JTabbedPane();
342
+
343
+ AddSkyboxTab0(skyboxpane);
344
+ AddSkyboxTab1(skyboxpane);
345
+ AddSkyboxTab2(skyboxpane);
346
+ AddSkyboxTab3(skyboxpane);
347
+
348
+ skyboxPanel.add(skyboxpane);
349
+ }
350
+
351
+ public void ChangeTexture(String texture)
352
+ {
353
+ for (int i=0; i<group.selection.size(); i++)
354
+ {
355
+ Object3D obj = group.selection.get(i);
356
+ obj.SetPigmentTexture("@" + texture);
357
+ }
358
+
359
+ refreshContents();
360
+ }
361
+
26362 //ObjEditor objEditor;
27363 public void closeUI2()
28364 {
....@@ -60,6 +396,12 @@
60396 this.copy = this.group = group;
61397 //selectees = this.group.selectees;
62398
399
+ if (copy.versionlist == null)
400
+ {
401
+ copy.versionlist = new Object3D[100];
402
+ copy.versionindex = -1;
403
+ }
404
+
63405 if(ui)
64406 SetupUI(objEditor);
65407 }
....@@ -74,16 +416,28 @@
74416 this.copy = this.group = copy;
75417 //selectees = this.group.selectees;
76418
77
- SetupMenu2(objEditor);
419
+ SetupMenu2(this); //objEditor);
78420 SetupUI2(objEditor);
79421 objEditor.SetupUI(true);
80422 SetupViews(objEditor);
81423
82424 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
425
+
426
+ if (copy.versionlist == null)
427
+ {
428
+ copy.versionlist = new Object3D[100];
429
+ copy.versionindex = -1;
430
+
431
+ Save(true);
432
+ }
83433 }
84434
85435 void CloneSelection(boolean supports)
86436 {
437
+ if (Globals.REPLACEONMAKE)
438
+ Save();
439
+ boolean keep = Globals.REPLACEONMAKE;
440
+ Globals.REPLACEONMAKE = false;
87441 // Object3D keep = GrafreeD.clipboard;
88442 //Object3D obj;
89443 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +448,7 @@
94448
95449 makeSomething(clone, i==group.selection.size()-1);
96450 }
451
+ Globals.REPLACEONMAKE = keep;
97452 }
98453
99454 void CloneClipboard(boolean supports)
....@@ -148,28 +503,21 @@
148503
149504 //JTextField nameField;
150505
151
- void SetupMenu2(ObjEditor oe)
506
+ void SetupMenu2(GroupEditor oe)
152507 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
508
+ oe.jTree = new cTree();
509
+
168510 Menu menu;
169511 oe.menuBar.add(menu = new Menu("Edit"));
170512 //editItem = menu.add(new MenuItem("Edit"));
171513 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
514
+
515
+// undoItem = menu.add(new MenuItem("Undo"));
516
+// undoItem.addActionListener(this);
517
+// redoItem = menu.add(new MenuItem("Redo"));
518
+// redoItem.addActionListener(this);
519
+// menu.add("-");
520
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173521 duplicateItem.addActionListener(this);
174522 cloneItem = menu.add(new MenuItem("Clone"));
175523 cloneItem.addActionListener(this);
....@@ -185,7 +533,6 @@
185533 copyItem.addActionListener(this);
186534 pasteItem = menu.add(new MenuItem("Paste"));
187535 pasteItem.addActionListener(this);
188
- menu.add("-");
189536
190537 menu.add("-");
191538 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,8 +544,8 @@
197544 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
198545 // pasteExpandItem.addActionListener(this);
199546 menu.add("-");
200
- clearItem = menu.add(new MenuItem("Clear"));
201
- clearItem.addActionListener(this);
547
+ deleteItem = menu.add(new MenuItem("Delete"));
548
+ deleteItem.addActionListener(this);
202549
203550 if (Globals.ADVANCED)
204551 {
....@@ -206,14 +553,97 @@
206553 clearAllItem = menu.add(new MenuItem("Clear All"));
207554 clearAllItem.addActionListener(this);
208555 }
556
+
557
+ menuBar.add(cameraMenu = new Menu("View"));
558
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
559
+ //zBufferItem.addActionListener(this);
560
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
561
+ //normalLensItem.addActionListener(this);
562
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
563
+ restoreCameraItem.addActionListener(this);
564
+
565
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
566
+// toggleFullScreenItem.addItemListener(this);
567
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
568
+// cameraMenu.add("-");
569
+//
570
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
571
+// toggleTextureItem.addItemListener(this);
572
+// toggleTextureItem.setState(CameraPane.textureon);
573
+//
574
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
575
+// toggleSwitchItem.addItemListener(this);
576
+// toggleSwitchItem.setState(CameraPane.SWITCH);
577
+
578
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
579
+ toggleHandleItem.addItemListener(this);
580
+ toggleHandleItem.setState(CameraPane.HANDLES);
581
+
582
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
583
+ togglePaintItem.addItemListener(this);
584
+ togglePaintItem.setState(CameraPane.PAINTMODE);
585
+
586
+ if (Globals.ADVANCED)
587
+ {
588
+ cameraMenu.add("-");
589
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
590
+ toggleLiveItem.addItemListener(this);
591
+ toggleLiveItem.setState(Globals.isLIVE());
209592
593
+ cameraMenu.add(stepItem = new MenuItem("Step"));
594
+ stepItem.addActionListener(this);
595
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
596
+ // toggleDLItem.addItemListener(this);
597
+ // toggleDLItem.setState(false);
598
+
599
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
600
+ toggleRenderItem.addItemListener(this);
601
+ toggleRenderItem.setState(!CameraPane.frozen);
602
+
603
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
604
+ toggleDebugItem.addItemListener(this);
605
+ toggleDebugItem.setState(Globals.DEBUG);
606
+
607
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
608
+ toggleFrustumItem.addItemListener(this);
609
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
610
+
611
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
612
+ toggleFootContactItem.addItemListener(this);
613
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
614
+
615
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
616
+ toggleTimelineItem.addItemListener(this);
617
+ }
618
+
619
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
620
+// toggleRootItem.addItemListener(this);
621
+// toggleRootItem.setState(false);
622
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
623
+// animationItem.addItemListener(this);
624
+// animationItem.setState(CameraPane.ANIMATION);
625
+ cameraMenu.add("-");
626
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
627
+ editCameraItem.addActionListener(this);
628
+
629
+ if (Globals.ADVANCED)
630
+ {
631
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
632
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
633
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
634
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
635
+ oe.cameraMenu.add("-");
636
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
637
+ openWindowItem.addActionListener(this);
638
+ editLeafItem.addActionListener(this);
639
+ lookAtItem.addActionListener(this);
640
+ //lookFromItem.addActinoListener(this);
641
+ //switchViewItem.addActionListener(this);
642
+ }
643
+
210644 oe.menuBar.add(menu = new Menu("Setting"));
211645 if (Globals.ADVANCED)
212646 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217647 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218648 revertMeshItem.addActionListener(this);
219649 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +683,29 @@
253683 }
254684
255685 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
686
+// grabItem = menu.add(new MenuItem("Grab"));
687
+// grabItem.addActionListener(this);
258688 backItem = menu.add(new MenuItem("Back"));
259689 backItem.addActionListener(this);
260690 frontItem = menu.add(new MenuItem("Front"));
261691 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
692
+// compositeItem = menu.add(new MenuItem("Composite"));
693
+// compositeItem.addActionListener(this);
694
+
695
+ if (Globals.ADVANCED)
696
+ {
264697 hideItem = menu.add(new MenuItem("Hidden Group"));
265698 hideItem.addActionListener(this);
699
+ }
266700 ungroupItem = menu.add(new MenuItem("Ungroup"));
267701 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- randomItem.addActionListener(this);
702
+
703
+// menu.add("-");
704
+//
705
+// switchItem = menu.add(new MenuItem("Switch node"));
706
+// switchItem.addActionListener(this);
707
+ if (Globals.ADVANCED)
708
+ {
271709 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272710 switchGeoItem.addActionListener(this);
273711 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +713,6 @@
275713 morphItem = menu.add(new MenuItem("Morph Group"));
276714 morphItem.addActionListener(this);
277715
278
- if (Globals.ADVANCED)
279
- {
280716 menu.add("-");
281717 physicsItem = menu.add(new MenuItem("Physics"));
282718 physicsItem.addActionListener(this);
....@@ -284,30 +720,29 @@
284720 frameselectorItem.addActionListener(this);
285721 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286722 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289723 }
290724
291725 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
726
+// textureItem = menu.add(new MenuItem("Texture"));
727
+// textureItem.addActionListener(this);
294728 billboardItem = menu.add(new MenuItem("Billboard"));
295729 billboardItem.addActionListener(this);
296730 csgItem = menu.add(new MenuItem("CSG"));
297731 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
732
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299733 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
734
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301735 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
736
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303737 shadowZItem.addActionListener(this);
738
+ attributeItem = menu.add(new MenuItem("Attribute"));
739
+ attributeItem.addActionListener(this);
740
+
304741 if (Globals.ADVANCED)
305742 {
306743 menu.add("-");
307744 linkerItem = menu.add(new MenuItem("Linker"));
308745 linkerItem.addActionListener(this);
309
- attributeItem = menu.add(new MenuItem("Attribute"));
310
- attributeItem.addActionListener(this);
311746 templateItem = menu.add(new MenuItem("Template"));
312747 templateItem.addActionListener(this);
313748 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -336,7 +771,7 @@
336771 genNormalsMESHItem.addActionListener(this);
337772 if (Globals.ADVANCED)
338773 {
339
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
774
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
340775 genNormalsMINEItem.addActionListener(this);
341776 }
342777 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -372,6 +807,10 @@
372807 oe.menuBar.add(menu = new Menu("Attributes"));
373808 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
374809 clearMaterialsItem.addActionListener(this);
810
+ resetAllItem = menu.add(new MenuItem("Reset All"));
811
+ resetAllItem.addActionListener(this);
812
+ stepAllItem = menu.add(new MenuItem("Step All"));
813
+ stepAllItem.addActionListener(this);
375814 menu.add("-");
376815 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
377816 liveleavesItem.addActionListener(this);
....@@ -392,6 +831,14 @@
392831 markleavesItem.addActionListener(this);
393832 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394833 unmarkleavesItem.addActionListener(this);
834
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
835
+ rewindleavesItem.addActionListener(this);
836
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
837
+ unrewindleavesItem.addActionListener(this);
838
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
839
+ randomleavesItem.addActionListener(this);
840
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
841
+ unrandomleavesItem.addActionListener(this);
395842 menu.add("-");
396843 flipVItem = menu.add(new MenuItem("Flip V"));
397844 flipVItem.addActionListener(this);
....@@ -417,10 +864,15 @@
417864 attachBumpItem.addActionListener(this);
418865 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
419866 pigmentBumpItem.addActionListener(this);
867
+ //embedTexturesItem
420868 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
421869 detachPigmentItem.addActionListener(this);
422870 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
423871 detachBumpItem.addActionListener(this);
872
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
873
+ embedTexturesItem.addActionListener(this);
874
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
875
+ deEmbedTexturesItem.addActionListener(this);
424876 menu.add("-");
425877 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
426878 sortbysizeItem.addActionListener(this);
....@@ -443,25 +895,92 @@
443895 oe.menuBar.add(menu = new Menu("Insert"));
444896 buildCreateMenu(menu);
445897
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
-
459898 oe.menuBar.add(menu = new Menu("Tools"));
460899 buildToolsMenu(menu);
461900 }
462901
902
+ JTabbedPane resourcecontainer;
903
+ cGridBag currenttab;
904
+ boolean added; // patch for jar
905
+
906
+ int tabcount = 0;
907
+ int colcount = 0;
908
+ int rowcount = 0;
909
+ int texturecount = 0;
910
+
911
+ int columns = 5;
912
+ int rows = 7;
913
+
914
+ public void ResourceCallBack(String[] path)
915
+ {
916
+// for (int i = 0; i < path.length; i++)
917
+// System.out.print(path[i] + "/");
918
+// System.out.println();
919
+
920
+ if (//rowcount == 0 ||
921
+ path.length == 1)
922
+ {
923
+ currenttab = new cGridBag();
924
+ added = false;
925
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
926
+ currenttab.setName(tabname);
927
+ rowcount = 1;
928
+ colcount = 0;
929
+ texturecount = 0;
930
+ }
931
+
932
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
933
+ {
934
+ if (!added)
935
+ {
936
+ added = true;
937
+ resourcecontainer.add(currenttab);
938
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
939
+ resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
940
+ }
941
+
942
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
943
+
944
+ if (++colcount >= columns)
945
+ {
946
+ colcount = 0;
947
+ currenttab.Return();
948
+
949
+ if (rowcount++ >= rows)
950
+ {
951
+ rowcount = 0;
952
+ }
953
+ }
954
+ }
955
+ else
956
+ {
957
+// if (!path[path.length-1].equals("icons"))
958
+// resourcecontainer.Return();
959
+ }
960
+ }
961
+
962
+ void CreateTexturePanel(cGridBag container)
963
+ {
964
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
965
+ container.add(resourcecontainer);
966
+
967
+ Grafreed.ParseResources("textures", this);
968
+ }
969
+
463970 void SetupUI2(ObjEditor oe)
464971 {
972
+ // June 2019
973
+ if (oe == null)
974
+ {
975
+ //super.SetupUI2(this);
976
+ //return;
977
+ }
978
+
979
+ if (copy != group)
980
+ {
981
+ //super.SetupUI2(this);
982
+ }
983
+
465984 //new Exception().printStackTrace();
466985
467986 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +1009,83 @@
4901009 oe.radioPanel.add(dummyButton);
4911010 oe.buttonGroup.add(dummyButton);
4921011 */
1012
+ cGridBag copyOptionsPanel = new cGridBag();
1013
+
1014
+ copyOptionsPanel.preferredHeight = 2;
1015
+
4931016 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
4941017
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
496
- liveCB.setToolTipText("Enabled animation");
1018
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1019
+ //minButton.setToolTipText("Minimize window");
1020
+ //minButton.addActionListener(this);
1021
+
1022
+ if (Globals.ADVANCED)
1023
+ {
1024
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
+ maxButton.setToolTipText("Maximize window");
1026
+ maxButton.addActionListener(this);
1027
+ }
1028
+
1029
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1030
+ fullButton.setToolTipText("Full-screen window");
1031
+ fullButton.addActionListener(this);
1032
+
1033
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1034
+ screenfitButton.setToolTipText("Screen fit");
1035
+ screenfitButton.addActionListener(this);
1036
+
1037
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1038
+ restoreCameraButton.setToolTipText("Restore viewpoint");
1039
+ restoreCameraButton.addActionListener(this);
1040
+
1041
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
+ saveVersionButton.setToolTipText("Duplicate current version");
1043
+ saveVersionButton.addActionListener(this);
1044
+
1045
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1046
+ deleteVersionButton.setToolTipText("Delete current version");
1047
+ deleteVersionButton.addActionListener(this);
1048
+
1049
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ previousVersionButton.setToolTipText("Previous version");
1051
+ previousVersionButton.addActionListener(this);
1052
+ previousVersionButton.setEnabled(false);
1053
+
1054
+ cGridBag updown = new cGridBag().setVertical(true);
1055
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ restoreButton.setToolTipText("Undo (restore current version)");
1057
+ restoreButton.addActionListener(this);
1058
+ //restoreButton.setEnabled(false);
1059
+
1060
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+ replaceButton.setToolTipText("Save (replace current version)");
1062
+ replaceButton.addActionListener(this);
1063
+ //replaceButton.setEnabled(false);
1064
+
1065
+ copyOptionsPanel.add(updown);
1066
+
1067
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ nextVersionButton.setToolTipText("Next version");
1069
+ nextVersionButton.addActionListener(this);
1070
+ nextVersionButton.setEnabled(false);
1071
+
1072
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1073
+ liveCB.setToolTipText("Enable animation");
4971074 liveCB.addItemListener(this);
4981075
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5001077 oneStepButton.setToolTipText("Animate one step forward");
5011078 oneStepButton.addActionListener(this);
5021079
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
1080
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
5041081 fastCB.setToolTipText("Fast mode");
5051082 fastCB.addItemListener(this);
5061083
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);
1084
+ //oe.toolboxPanel.Return();
1085
+
1086
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
1087
+// trackCB.setToolTipText("Enable tracking");
1088
+// trackCB.addItemListener(this);
5141089
5151090 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
5161091 // screenfitpointButton.addActionListener(this);
....@@ -520,67 +1095,152 @@
5201095 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5211096 snapobjectButton.addActionListener(this);
5221097 snapobjectButton.setToolTipText("Snap Object");
1098
+
1099
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1100
+ fourButton.addActionListener(this);
1101
+ fourButton.setToolTipText("Show control panel only");
5231102 }
5241103
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
1104
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
5281105
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");
1106
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1107
+ twoButton.setToolTipText("Show 3D view only");
5331108 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");
1109
+ this.fullscreenLayout = twoButton;
1110
+
1111
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1112
+ threeButton.setToolTipText("Show controls and 3D view");
5421113 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544
- sevenButton.setToolTipText("3-column layout");
545
- sevenButton.addActionListener(this);
1114
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1115
+ sixButton.setToolTipText("Show 3D view and controls");
1116
+ sixButton.addActionListener(this);
1117
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1118
+// sevenButton.setToolTipText("3-column layout");
1119
+// sevenButton.addActionListener(this);
5461120 //
5471121
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549
- rootButton.setToolTipText("Edit selection in new tab");
1122
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1123
+ rootButton.setToolTipText("Open selection in new tab");
5501124 rootButton.addActionListener(this);
5511125
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1126
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5531127 closeButton.setToolTipText("Close tab");
5541128 closeButton.addActionListener(this);
5551129 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5561130 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
1131
+
1132
+ cGridBag row1 = new cGridBag();
5591133
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- editButton.setToolTipText("Edit selection");
1134
+ // INSERT
1135
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1136
+ gridButton.setToolTipText("Create grid");
1137
+ gridButton.addActionListener(this);
1138
+
1139
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1140
+ boxButton.setToolTipText("Create box");
1141
+ boxButton.addActionListener(this);
1142
+
1143
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1144
+ sphereButton.setToolTipText("Create sphere");
1145
+ sphereButton.addActionListener(this);
1146
+
1147
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1148
+ coneButton.setToolTipText("Create cone");
1149
+ coneButton.addActionListener(this);
1150
+
1151
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1152
+ torusButton.setToolTipText("Create torus");
1153
+ torusButton.addActionListener(this);
1154
+
1155
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1156
+ superButton.setToolTipText("Create superellipsoid");
1157
+ superButton.addActionListener(this);
1158
+
1159
+ if (Globals.ADVANCED)
1160
+ {
1161
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1162
+ kleinButton.setToolTipText("Create Klein bottle");
1163
+ kleinButton.addActionListener(this);
1164
+ }
1165
+
1166
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1167
+ particlesButton.setToolTipText("Create particle system");
1168
+ particlesButton.addActionListener(this);
1169
+
1170
+ oe.toolboxPanel.add(row1);
1171
+
1172
+ cGridBag row2 = new cGridBag();
1173
+
1174
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1175
+ groupButton.setToolTipText("Create group");
1176
+ groupButton.addActionListener(this);
1177
+
1178
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1179
+ compositeButton.setToolTipText("Create composite");
1180
+ compositeButton.addActionListener(this);
1181
+
1182
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1183
+ switchButton.setToolTipText("Create item switcher");
1184
+ switchButton.addActionListener(this);
1185
+
1186
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1187
+ loopButton.setToolTipText("Create loop");
1188
+ loopButton.addActionListener(this);
1189
+
1190
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1191
+ textureButton.setToolTipText("Create texture");
1192
+ textureButton.addActionListener(this);
1193
+
1194
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1195
+ overlayButton.setToolTipText("Create overlay");
1196
+ overlayButton.addActionListener(this);
1197
+
1198
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1199
+ lightButton.setToolTipText("Create light");
1200
+ lightButton.addActionListener(this);
1201
+
1202
+ oe.toolboxPanel.add(row2);
1203
+
1204
+ cGridBag textures = new cGridBag();
1205
+
1206
+ CreateTexturePanel(textures);
1207
+
1208
+ oe.toolboxPanel.add(textures);
1209
+
1210
+ textures.preferredHeight = 100;
1211
+
1212
+ CreateSkyboxPanel(oe.skyboxPanel);
1213
+
1214
+ // EDIT panel
1215
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1216
+ editButton.setToolTipText("Pin selection controls");
5621217 editButton.addActionListener(this);
5631218
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
1219
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5661221 uneditButton.addActionListener(this);
5671222
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
1223
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1224
+ allParamsButton.setToolTipText("Show all controls");
5701225 allParamsButton.addActionListener(this);
5711226
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573
- clearPanelButton.setToolTipText("Clear edit panel");
1227
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1228
+ clearPanelButton.setToolTipText("Clear all controls");
5741229 clearPanelButton.addActionListener(this);
5751230
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577
- unselectButton.setToolTipText("Unselect");
578
- unselectButton.addActionListener(this);
1231
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ //unselectButton.setToolTipText("Unselect");
1233
+ //unselectButton.addActionListener(this);
5791234
580
- commandsPanel.preferredHeight = 1;
1235
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1236
+ flashSelectionButton.setToolTipText("Highlight selection");
1237
+ flashSelectionButton.addActionListener(this);
5811238
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
1239
+ editCommandsPanel.preferredHeight = 1;
1240
+
1241
+ SetPinStates(false);
1242
+// oe.treePanel.add(commandsPanel);
1243
+// oe.treePanel.Return();
5841244
5851245 // oe.aConstraints.gridx += 1;
5861246 // oe.aConstraints.weighty = 0;
....@@ -597,32 +1257,20 @@
5971257
5981258 JScrollPane jSP;
5991259 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1260
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6011261 ResetModel();
6021262
6031263 oe.treePanel.add(jSPPanel);
6041264 oe.treePanel.Return();
6051265
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;
6211266 oe.treePanel.add(copyOptionsPanel);
6221267 oe.treePanel.Return();
1268
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1269
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1270
+ sliderPane.preferredHeight = 1;
6231271
624
-// mainPanel.setDividerLocation(0.5); //1.0);
625
-// mainPanel.setResizeWeight(0.5);
1272
+// mainPanel.setDividerLocation(0.1); //1.0);
1273
+ mainPanel.setResizeWeight(0.4);
6261274
6271275 //jList.addListSelectionListener(this);
6281276 oe.jTree.addTreeSelectionListener(this);
....@@ -630,7 +1278,7 @@
6301278 //jTree.setEditable(true);
6311279 oe.jTree.setDragEnabled(true);
6321280 //jTree.setPreferredSize(new Dimension(10,10));
633
- jSP.setPreferredSize(new Dimension(100,200));
1281
+ //jSP.setPreferredSize(new Dimension(100,200));
6341282
6351283 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6361284
....@@ -642,29 +1290,49 @@
6421290 dgr.addDragGestureListener(this);
6431291 }catch(Exception e) {}
6441292 */
645
- radio.layout = sevenButton;
1293
+ radio.layout = threeButton; // sixButton;
6461294 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6471295 }
6481296
6491297 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6501298 {
1299
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1300
+ colorCB.setToolTipText("Copy color when dropped");
1301
+ colorCB.addItemListener(this);
1302
+
1303
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1304
+ materialCB.setToolTipText("Copy material when dropped");
1305
+ materialCB.addItemListener(this);
1306
+
1307
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1308
+ textureCB.setToolTipText("Copy texture when dropped");
1309
+ textureCB.addItemListener(this);
1310
+
1311
+ panel.Return();
1312
+
6511313 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
6521314 boxCB.setToolTipText("Display bounding boxes");
6531315 boxCB.addItemListener(this);
6541316
6551317 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1318
+ zoomBoxCB.setToolTipText("Display only for wheel");
6571319 zoomBoxCB.addItemListener(this);
6581320
6591321 if (true) // Globals.ADVANCED)
6601322 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- supportCB.addItemListener(this);
1323
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1324
+// supportCB.setToolTipText("Enable rigging");
1325
+// supportCB.addItemListener(this);
1326
+
1327
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1328
+ freezeCB.setToolTipText("Fast moving camera");
1329
+ freezeCB.addItemListener(this);
6641330
6651331 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6661332 // localCB.addItemListener(this);
6671333
1334
+ panel.Return();
1335
+
6681336 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6691337 crowdCB.setToolTipText("Used for crowds");
6701338 crowdCB.addItemListener(this);
....@@ -673,14 +1341,19 @@
6731341 smoothCB.setToolTipText("Snapping delay");
6741342 smoothCB.addItemListener(this);
6751343
676
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
677
- slowCB.setToolTipText("Smooth interpolation");
678
- slowCB.addItemListener(this);
1344
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1345
+// slowCB.setToolTipText("Smooth interpolation");
1346
+// slowCB.addItemListener(this);
1347
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1348
+ minshaderCB.setToolTipText("Minimal fast shader");
1349
+ minshaderCB.addItemListener(this);
6791350
6801351 // constraints.gridy += 1;
6811352 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6821353 // speakerMocapCB.addItemListener(this);
6831354
1355
+ panel.Return();
1356
+
6841357 if (false)
6851358 {
6861359 // handled in scripts
....@@ -695,42 +1368,85 @@
6951368 //constraints.gridy += 1;
6961369 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6971370 smoothfocusCB.addItemListener(this);
1371
+ panel.Return();
6981372 }
6991373
7001374 //constraints.gridx += 1;
7011375 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7021376 // debugCB.addItemListener(this);
7031377
1378
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1379
+ trackCB.setToolTipText("Enable tracking target");
1380
+ trackCB.addItemListener(this);
1381
+
7041382 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1383
+ oeilCB.setToolTipText("Move camera when tracking");
7051384 oeilCB.addItemListener(this);
7061385
1386
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1387
+ shadowCB.setToolTipText("When live compute shadows");
1388
+ shadowCB.addItemListener(this);
1389
+
1390
+ panel.Return();
1391
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1392
+ toggleTextureCB.setToolTipText("Load textures");
1393
+ toggleTextureCB.addItemListener(this);
1394
+
1395
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1396
+ toggleSwitchCB.setToolTipText("Choose a single item");
1397
+ toggleSwitchCB.addItemListener(this);
1398
+
1399
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1400
+ autokeepCB.setToolTipText("On structure change");
1401
+ autokeepCB.addItemListener(this);
1402
+
1403
+ panel.Return();
1404
+ if (Globals.ADVANCED)
1405
+ {
7071406 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7081407 lookAtCB.setToolTipText("Look-at target");
7091408 lookAtCB.addItemListener(this);
1409
+ }
7101410
7111411 }
7121412
7131413 cGridBag fill = new cGridBag();
714
-
7151414 fill.preferredHeight = 200;
1415
+ cGridBag fill2 = new cGridBag();
1416
+ fill2.preferredHeight = 200;
1417
+ cGridBag fill3 = new cGridBag();
1418
+ fill3.preferredHeight = 200;
7161419
7171420 panel.add(fill);
1421
+ panel.add(fill2);
1422
+ panel.add(fill3);
7181423
7191424 }
7201425
7211426 void EditObject(Object3D obj)
7221427 {
7231428 cRadio radioButton = new cRadio(obj.name);
1429
+
1430
+ // June 2019. Patch to avoid bug with transparency.
1431
+ radioButton.hadMaterial = obj.material != null;
1432
+ if (!radioButton.hadMaterial)
1433
+ {
1434
+ obj.material = new cMaterial();
1435
+ }
1436
+
7241437 radioButton.SetObject(obj);
725
- radioButton.layout = sevenButton;
1438
+ radioButton.layout = threeButton; // sixButton;
7261439 radioButton.SetCamera(cameraView.renderCamera, false);
7271440 radioButton.addActionListener(this);
7281441 radioPanel.add(radioButton);
7291442 buttonGroup.add(radioButton);
7301443 radioButton.doClick();
7311444 }
1445
+
7321446 void SetupViews(ObjEditor oe)
7331447 {
1448
+ theFrame = this;
1449
+
7341450 oe.SetupViews();
7351451
7361452 System.out.println("SetupViews");
....@@ -739,23 +1455,30 @@
7391455 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7401456 }
7411457
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;
1458
+ cToggleButton liveCB;
1459
+ cCheckBox supportCB;
1460
+ cCheckBox localCB;
1461
+ cCheckBox crowdCB;
1462
+ cCheckBox smoothCB;
1463
+ cCheckBox minshaderCB;
1464
+
1465
+ cToggleButton fastCB;
1466
+ cCheckBox slowCB;
1467
+ cCheckBox boxCB;
1468
+ cCheckBox zoomBoxCB;
1469
+ cCheckBox freezeCB;
1470
+ //cToggleButton trackCB;
1471
+ cCheckBox trackCB;
1472
+ cCheckBox smoothfocusCB;
7531473 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
1474
+ cCheckBox speakerCameraCB;
1475
+ cCheckBox speakerFocusCB;
1476
+ cCheckBox debugCB;
1477
+
1478
+ cCheckBox oeilCB;
1479
+ cCheckBox shadowCB;
1480
+ cCheckBox autokeepCB;
1481
+ cCheckBox lookAtCB;
7591482
7601483 // static int COLOR = 1;
7611484 // static int MATERIAL = 2;
....@@ -763,9 +1486,9 @@
7631486
7641487 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7651488
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
1489
+ cCheckBox colorCB;
1490
+ cCheckBox materialCB;
1491
+ cCheckBox textureCB;
7691492
7701493 public void itemStateChanged(ItemEvent e)
7711494 {
....@@ -793,6 +1516,7 @@
7931516 } else if(e.getSource() == liveCB)
7941517 {
7951518 cameraView.ToggleLive();
1519
+ refreshContents(false);
7961520 }
7971521 else if(e.getSource() == supportCB)
7981522 {
....@@ -808,6 +1532,12 @@
8081532 {
8091533 cameraView.ToggleInertia();
8101534 cameraView.repaint();
1535
+ }
1536
+ else if(e.getSource() == minshaderCB)
1537
+ {
1538
+ Globals.MINSHADER ^= true;
1539
+ cameraView.programInitialized = false;
1540
+ cameraView.repaint();
8111541 }
8121542 else if(e.getSource() == localCB)
8131543 {
....@@ -857,6 +1587,18 @@
8571587 {
8581588 cameraView.ToggleOeil();
8591589 }
1590
+ else if(e.getSource() == shadowCB)
1591
+ {
1592
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1593
+ }
1594
+ else if(e.getSource() == freezeCB)
1595
+ {
1596
+ Globals.FREEZEONMOVE ^= true;
1597
+ }
1598
+ else if(e.getSource() == autokeepCB)
1599
+ {
1600
+ Globals.REPLACEONMAKE ^= true;
1601
+ }
8601602 else if(e.getSource() == lookAtCB)
8611603 {
8621604 cameraView.ToggleLookAt();
....@@ -873,7 +1615,8 @@
8731615
8741616 /**/
8751617 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
876
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1618
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1619
+ TreePath path = objEditor.jTree.getSelectionPath();
8771620 if ((path == null) || (path.getPathCount() <= 1)) {
8781621 // We can't move the root node or an empty selection
8791622 return;
....@@ -936,8 +1679,6 @@
9361679 }
9371680 }
9381681
939
- String string = (String) object;
940
-
9411682 System.out.println("Transfer = " + object + "; drop : " + target);
9421683 // if( object instanceof java.io.File[])
9431684 // {
....@@ -945,6 +1686,8 @@
9451686 // objEditor.DropFile((java.io.File[]) object, true);
9461687 // return;
9471688 // }
1689
+
1690
+ String string = object.toString();
9481691
9491692 // File path for Mac and Windows
9501693 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -990,23 +1733,33 @@
9901733
9911734 assert target == objEditor.jTree;
9921735 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1736
+ Object3D destinationLeaf;
9931737 try {
994
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1738
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9951739 } catch (Exception e) {
9961740 System.out.println("destinationPath : " + destinationPath);
9971741 return;
9981742 }
9991743
1000
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1744
+ for (int i=group.selection.size(); --i>=0;)
10011745 {
1746
+ Object3D child = (Object3D)group.selection.elementAt(i);
1747
+
1748
+ // Cannot move into itself
1749
+ if (child == destinationLeaf)
1750
+ return;
1751
+ }
1752
+
1753
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1754
+// {
10021755 loadClipboard(true);
10031756 objEditor.jTree.setSelectionPath(destinationPath);
10041757 pasteInto(false, false);
1005
- } else {
1006
- loadClipboard(false);
1007
- objEditor.jTree.setSelectionPath(destinationPath);
1008
- pasteInto(false, false); // true); // ???
1009
- }
1758
+// } else {
1759
+// loadClipboard(false);
1760
+// objEditor.jTree.setSelectionPath(destinationPath);
1761
+// pasteInto(false, false); // true); // ???
1762
+// }
10101763 }
10111764 public void dropActionChanged(DropTargetDragEvent dtde)
10121765 // Called if the user has modified the current drop gesture
....@@ -1111,22 +1864,30 @@
11111864 {
11121865 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11131866 //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);
1867
+// gridItem = menu.add(new MenuItem("Grid"));
1868
+// gridItem.addActionListener(this);
1869
+// rectoidItem = menu.add(new MenuItem("Box"));
1870
+// rectoidItem.addActionListener(this);
1871
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1872
+// ellipsoidItem.addActionListener(this);
1873
+// coneItem = menu.add(new MenuItem("Cone"));
1874
+// coneItem.addActionListener(this);
1875
+// torusItem = menu.add(new MenuItem("Torus"));
1876
+// torusItem.addActionListener(this);
1877
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1878
+// superItem.addActionListener(this);
1879
+
1880
+ cameraItem = menu.add(new MenuItem("Camera"));
1881
+ cameraItem.addActionListener(this);
1882
+
1883
+ if (!Globals.ADVANCED)
1884
+ {
11261885 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11271886 kleinItem.addActionListener(this);
1128
- particleItem = menu.add(new MenuItem("Particle system"));
1129
- particleItem.addActionListener(this);
1887
+ }
1888
+
1889
+// particleItem = menu.add(new MenuItem("Particle system"));
1890
+// particleItem.addActionListener(this);
11301891 if (Globals.ADVANCED)
11311892 {
11321893 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1152,15 +1913,15 @@
11521913 }
11531914 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11541915 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);
1916
+// overlayItem = menu.add(new MenuItem("Overlay"));
1917
+// overlayItem.addActionListener(this);
1918
+// lightItem = menu.add(new MenuItem("Light"));
1919
+// lightItem.addActionListener(this);
11591920 menu.add("-");
11601921 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11611922 //superLoopItem.addActionListener(this);
1162
- loopItem = menu.add(new MenuItem("Loop"));
1163
- loopItem.addActionListener(this);
1923
+// loopItem = menu.add(new MenuItem("Loop"));
1924
+// loopItem.addActionListener(this);
11641925 doubleItem = menu.add(new MenuItem("Fork"));
11651926 doubleItem.addActionListener(this);
11661927 if (Globals.ADVANCED)
....@@ -1176,6 +1937,9 @@
11761937 animationItem.addItemListener(this);
11771938 animationItem.setState(Globals.ANIMATION);
11781939
1940
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1941
+ archiveItem.addActionListener(this);
1942
+
11791943 menu.add("-");
11801944 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11811945 parseverticesItem.addActionListener(this);
....@@ -1188,6 +1952,8 @@
11881952 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11891953 reduce34MorphItem.addActionListener(this);
11901954 menu.add("-");
1955
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1956
+ memoryItem.addActionListener(this);
11911957 menu.add(computeAOItem = new MenuItem("Compute AO"));
11921958 computeAOItem.addActionListener(this);
11931959
....@@ -1196,11 +1962,9 @@
11961962 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11971963 mirrorItem.addActionListener(this);
11981964 menu.add("-");
1199
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1200
- memoryItem.addActionListener(this);
12011965 menu.add(analyzeItem = new MenuItem("Analyze"));
12021966 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1967
+ menu.add(dumpItem = new MenuItem("Print"));
12041968 dumpItem.addActionListener(this);
12051969 // menu.add(pathItem = new MenuItem("From-to path"));
12061970 // pathItem.addActionListener(this);
....@@ -1341,9 +2105,34 @@
13412105 shadow.material = new cMaterial(obj.material);
13422106 shadow.material.diffuse = 0.0001f;
13432107 shadow.material.specular = 0.0001f;
2108
+ //shadow.projectedVertices[1].x = 300;
13442109
13452110 makeSomething(shadow);
13462111 }
2112
+
2113
+ private void ClearUnpinned()
2114
+ {
2115
+ //for (Object3D obj : listUI)
2116
+ for (int i=listUI.size(); --i>=0;)
2117
+ {
2118
+ Object3D obj = listUI.elementAt(i);
2119
+ if (!obj.pinned)
2120
+ {
2121
+ obj.CloseUI();
2122
+ listUI.remove(i);
2123
+ }
2124
+ }
2125
+ }
2126
+
2127
+ private void EditElement(Object3D elem, boolean newWindow)
2128
+ {
2129
+ // if (!(elem instanceof Composite))
2130
+ // newWindow = false;
2131
+ listUI.add(elem);
2132
+ elem.openEditWindow(this, newWindow); //, false);
2133
+ System.out.println("edit : " + elem);
2134
+ elem.editWindow.refreshContents(true); // ? new
2135
+ }
13472136
13482137 /**
13492138 * applyExample
....@@ -1588,7 +2377,7 @@
15882377 {
15892378 ScreenFit();
15902379 } else
1591
- if (source == switchItem)
2380
+ if (source == switchViewItem)
15922381 {
15932382 cVector v1 = new cVector();
15942383 cVector v2 = new cVector();
....@@ -1597,11 +2386,11 @@
15972386 objEditor.cameraView.renderCamera.setAim(v2, v1);
15982387 objEditor.cameraView.repaint();
15992388 } else
1600
- if (source == rectoidItem)
2389
+ if (source == rectoidItem || source == boxButton)
16012390 {
16022391 makeSomething(new Box());
16032392 } else
1604
- if (source == particleItem)
2393
+ if (source == particleItem || source == particlesButton)
16052394 {
16062395 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16072396 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1680,27 +2469,27 @@
16802469
16812470 makeSomething(obj);
16822471 } else
1683
- if (source == gridItem)
2472
+ if (source == gridItem || source == gridButton)
16842473 {
16852474 makeSomething(new Grid());
16862475 } else
1687
- if (source == ellipsoidItem)
2476
+ if (source == ellipsoidItem || source == sphereButton)
16882477 {
16892478 makeSomething(new Sphere());
16902479 } else
1691
- if (source == coneItem)
2480
+ if (source == coneItem || source == coneButton)
16922481 {
16932482 makeSomething(new Cone());
16942483 } else
1695
- if (source == torusItem)
2484
+ if (source == torusItem || source == torusButton)
16962485 {
16972486 makeSomething(new Torus());
16982487 } else
1699
- if (source == superItem)
2488
+ if (source == superItem || source == superButton)
17002489 {
17012490 makeSomething(new Superellipsoid());
17022491 } else
1703
- if (source == kleinItem)
2492
+ if (source == kleinItem || source == kleinButton)
17042493 {
17052494 makeSomething(new Klein());
17062495 } else
....@@ -1720,7 +2509,7 @@
17202509 {
17212510 makeSomething(new BezierSurface());
17222511 } else
1723
- if (source == overlayItem)
2512
+ if (source == overlayItem || source == overlayButton)
17242513 {
17252514 /*
17262515 Object3D obj = new BezierSurface(5,8);
....@@ -1768,10 +2557,27 @@
17682557 s.setup();
17692558 makeSomething(s);
17702559 } else
1771
- if (source == lightItem)
2560
+ if (source == lightItem || source == lightButton)
17722561 {
17732562 makeSomething(new Light());
17742563 } else
2564
+// if (source == skybox1Button ||
2565
+// source == skybox2Button ||
2566
+// source == skybox3Button ||
2567
+// source == skybox4Button ||
2568
+// source == skybox5Button ||
2569
+// source == skybox6Button ||
2570
+// source == skybox7Button ||
2571
+// source == skybox11Button ||
2572
+// source == skybox12Button ||
2573
+// source == skybox13Button ||
2574
+// source == skybox14Button ||
2575
+// source == skybox15Button ||
2576
+// source == skybox16Button ||
2577
+// source == skybox17Button)
2578
+// {
2579
+// ChangeSkybox(source);
2580
+// } else
17752581 if (source == csgItem)
17762582 {
17772583 group(new CSG());
....@@ -1818,30 +2624,30 @@
18182624
18192625 group(g);
18202626 } else
1821
- if (source == loopItem)
2627
+ if (source == loopItem || source == loopButton)
18222628 {
18232629 Composite csg = new GroupLeaf();
18242630 csg.count = 5;
18252631 group(csg);
1826
- Composite child = new cGroup();
2632
+ Composite child = new cGroup("Branch");
18272633 csg.addChild(child);
18282634 child.addChild(csg);
18292635 } else
18302636 if (source == doubleItem)
18312637 {
1832
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Fork");
18332639 csg.count = 5;
18342640 group(csg);
1835
- Composite child = new cGroup();
2641
+ Composite child = new cGroup("Branch A");
18362642 csg.addChild(child);
18372643 child.addChild(csg);
1838
- child = new cGroup();
2644
+ child = new cGroup("Branch B");
18392645 csg.addChild(child);
18402646 child.addChild(csg);
18412647 } else
18422648 if (source == tripleItem)
18432649 {
1844
- Composite csg = new GroupLeaf();
2650
+ Composite csg = new GroupLeaf("Trident");
18452651 csg.count = 4;
18462652 group(csg);
18472653 Composite child = new cGroup();
....@@ -1854,35 +2660,10 @@
18542660 csg.addChild(child);
18552661 child.addChild(csg);
18562662 } 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
18822663 if (source == computeAOItem)
18832664 {
18842665 Globals.drawMode = CameraPane.OCCLUSION;
1885
- Globals.theRenderer.repaint();
2666
+ cameraView.repaint();
18862667 } else
18872668 if (source == recompileItem)
18882669 {
....@@ -1897,7 +2678,7 @@
18972678 if (source == invariantsItem)
18982679 {
18992680 System.out.println("Invariants:");
1900
- Grafreed.grafreeD.universe.invariants();
2681
+ Grafreed.grafreed.universe.invariants();
19012682 } else
19022683 if (source == memoryItem)
19032684 {
....@@ -1916,6 +2697,53 @@
19162697 {
19172698 DumpObject();
19182699 } else
2700
+ if (source == minButton)
2701
+ {
2702
+ Minimize();
2703
+ } else
2704
+ if (source == maxButton)
2705
+ {
2706
+ Maximize();
2707
+ } else
2708
+ if (source == fullButton)
2709
+ {
2710
+ ToggleFullScreen();
2711
+ } else
2712
+ if (source == previousVersionButton)
2713
+ {
2714
+ // Go to previous version
2715
+ //if (!Undo())
2716
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2717
+ PreviousVersion();
2718
+ } else
2719
+ if (source == restoreButton)
2720
+ {
2721
+ // Restore current version
2722
+ Restore();
2723
+ //restoreButton.setEnabled(false);
2724
+ } else
2725
+ if (source == replaceButton)
2726
+ {
2727
+ // Overwrite current version
2728
+ Replace();
2729
+ //replaceButton.setEnabled(false);
2730
+ } else
2731
+ if (source == nextVersionButton)
2732
+ {
2733
+ // Go to next version
2734
+ NextVersion();
2735
+ } else
2736
+ if (source == saveVersionButton)
2737
+ {
2738
+ // Save a new version
2739
+ if (!Save(true))
2740
+ java.awt.Toolkit.getDefaultToolkit().beep();
2741
+ } else
2742
+ if (source == deleteVersionButton)
2743
+ {
2744
+ // Delete a new version
2745
+ DeleteVersion();
2746
+ } else
19192747 if (source == oneStepButton)
19202748 {
19212749 Globals.ONESTEP = true;
....@@ -1923,17 +2751,14 @@
19232751 } else
19242752 if (source == screenfitButton)
19252753 {
1926
- //Reload(lastConverter, lastFilename, true);
19272754 ScreenFit();
19282755 } else
19292756 if (source == screenfitpointButton)
19302757 {
1931
- //Reload(lastConverter, lastFilename, true);
19322758 ScreenFitPoint();
19332759 } else
19342760 if (source == snapobjectButton)
19352761 {
1936
- //Reload(lastConverter, lastFilename, true);
19372762 SnapObject();
19382763 } else
19392764 // if (event.getSource() == recompileButton)
....@@ -1969,6 +2794,14 @@
19692794 if (source == cutItem || source == clearButton)
19702795 {
19712796 loadClipboard(true);
2797
+ } else
2798
+ if (source == undoItem)
2799
+ {
2800
+ PreviousVersion();
2801
+ } else
2802
+ if (source == redoItem)
2803
+ {
2804
+ NextVersion();
19722805 } else
19732806 if (source == duplicateItem)
19742807 {
....@@ -2281,7 +3114,7 @@
22813114 {
22823115 RevertMeshes();
22833116 } else
2284
- if (source == resetMeshItem)
3117
+ if (source == resetAllItem)
22853118 {
22863119 ResetAll();
22873120 } else
....@@ -2289,7 +3122,7 @@
22893122 {
22903123 StepAll();
22913124 } else
2292
- if (source == clearItem) // || event.getSource() == clearButton)
3125
+ if (source == deleteItem) // || event.getSource() == clearButton)
22933126 {
22943127 //int indices[] = jList.getSelectedIndices();
22953128 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2301,9 +3134,9 @@
23013134 {
23023135 ClearSelection(true);
23033136 } else
2304
- if (source == grabItem)
3137
+ if (source == grabItem || source == groupButton)
23053138 {
2306
- group(new cGroup(), true);
3139
+ group(new cGroup(), false); // true);
23073140 } else
23083141 if (source == hideItem)
23093142 {
....@@ -2321,11 +3154,11 @@
23213154 {
23223155 makeSomething(new Camera());
23233156 } else
2324
- if (source == compositeItem)
3157
+ if (source == compositeItem || source == compositeButton)
23253158 {
23263159 group(new Composite());
23273160 } else
2328
- if (source == randomItem)
3161
+ if (source == switchItem || source == switchButton)
23293162 {
23303163 RandomNode random = new RandomNode();
23313164 group(random);
....@@ -2427,7 +3260,7 @@
24273260 {
24283261 group(new cLinker());
24293262 } else
2430
- if (source == textureItem)
3263
+ if (source == textureItem || source == textureButton)
24313264 {
24323265 group(new TextureNode());
24333266 } else
....@@ -2447,17 +3280,30 @@
24473280 {
24483281 CastShadow(2);
24493282 } else
2450
- if (source == ungroupItem)
3283
+ if (source == ungroupItem || source == ungroupButton)
24513284 {
2452
- //ungroup();
3285
+ boolean hasRoot = false;
3286
+
24533287 for (int i=0; i<group.selection.size(); i++)
24543288 {
2455
- Ungroup(group.selection.get(i));
3289
+ if (group.selection.get(i) == group)
3290
+ {
3291
+ hasRoot = true;
3292
+ break;
3293
+ }
24563294 }
24573295
2458
- ClearSelection(false);
2459
-
2460
- refreshContents();
3296
+ if (!hasRoot)
3297
+ {
3298
+ for (int i=0; i<group.selection.size(); i++)
3299
+ {
3300
+ Ungroup(group.selection.get(i));
3301
+ }
3302
+
3303
+ ClearSelection(false);
3304
+
3305
+ refreshContents();
3306
+ }
24613307 } else
24623308 if (source == genUVItem)
24633309 {
....@@ -2469,7 +3315,7 @@
24693315 } else
24703316 if (source == genNormalsMESHItem)
24713317 {
2472
- GenNormals(true); // TODO
3318
+ GenNormalsMESH();
24733319 } else
24743320 if (source == genNormalsORGANItem)
24753321 {
....@@ -2534,6 +3380,22 @@
25343380 if (source == unmarkleavesItem)
25353381 {
25363382 MarkLeaves(false);
3383
+ } else
3384
+ if (source == rewindleavesItem)
3385
+ {
3386
+ RewindLeaves(true);
3387
+ } else
3388
+ if (source == unrewindleavesItem)
3389
+ {
3390
+ RewindLeaves(false);
3391
+ } else
3392
+ if (source == randomleavesItem)
3393
+ {
3394
+ RandomLeaves(true);
3395
+ } else
3396
+ if (source == unrandomleavesItem)
3397
+ {
3398
+ RandomLeaves(false);
25373399 } else
25383400 if (source == flipVItem)
25393401 {
....@@ -2742,7 +3604,7 @@
27423604 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27433605 {
27443606 obj = (Object3D)e.nextElement();
2745
- obj.SetBumpTexture(null);
3607
+ obj.ResetBumpTexture();
27463608 }
27473609
27483610 refreshContents();
....@@ -2758,6 +3620,31 @@
27583620
27593621 refreshContents();
27603622 } else
3623
+ if (source == embedTexturesItem)
3624
+ {
3625
+ Object3D obj;
3626
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3627
+ {
3628
+ obj = (Object3D)e.nextElement();
3629
+ obj.EmbedTextures(true);
3630
+ }
3631
+
3632
+ refreshContents();
3633
+ } else
3634
+ if (source == deEmbedTexturesItem)
3635
+ {
3636
+ Object3D obj;
3637
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3638
+ {
3639
+ obj = (Object3D)e.nextElement();
3640
+ obj.EmbedTextures(false);
3641
+ }
3642
+
3643
+ CameraPane.texturepigment.clear();
3644
+ CameraPane.texturebump.clear();
3645
+
3646
+ refreshContents();
3647
+ } else
27613648 if (source == flashSelectionButton)
27623649 {
27633650 CameraPane.flash = true;
....@@ -2769,6 +3656,10 @@
27693656 if (source == twoButton)
27703657 {
27713658 radio.layout = twoButton;
3659
+
3660
+ if (CameraPane.FULLSCREEN)
3661
+ fullscreenLayout = radio.layout;
3662
+
27723663 // bug
27733664 //gridPanel.setDividerLocation(1.0);
27743665 //bigPanel.setDividerLocation(0.0);
....@@ -2801,10 +3692,31 @@
28013692 bigThree.ClearUI();
28023693 bigThree.add(centralPanel);
28033694 bigThree.FlushUI();
3695
+
3696
+ cameraView.requestFocusInWindow();
3697
+
3698
+// refreshContents(true);
3699
+//
3700
+// try
3701
+// {
3702
+// java.awt.Robot bot = new java.awt.Robot();
3703
+// int mask = InputEvent.BUTTON1_MASK;
3704
+// bot.mouseMove(100, 100);
3705
+// bot.mousePress(mask);
3706
+// bot.mouseRelease(mask);
3707
+// }
3708
+// catch (Exception e)
3709
+// {
3710
+//
3711
+// }
3712
+
28043713 } else
28053714 if (source == threeButton)
28063715 {
28073716 radio.layout = threeButton;
3717
+
3718
+ if (CameraPane.FULLSCREEN)
3719
+ fullscreenLayout = radio.layout;
28083720
28093721 // bigThree.remove(scenePanel);
28103722 // bigThree.remove(centralPanel);
....@@ -2834,13 +3746,18 @@
28343746 // centralPanel.setVisible(true);
28353747 // XYZPanel.setVisible(true);
28363748 bigThree.ClearUI();
3749
+ bigThree.add(scenePanel);
28373750 bigThree.add(centralPanel);
2838
- bigThree.add(XYZPanel);
28393751 bigThree.FlushUI();
3752
+
3753
+ cameraView.requestFocusInWindow();
28403754 } else
28413755 if (source == fourButton)
28423756 {
28433757 radio.layout = fourButton;
3758
+
3759
+ if (CameraPane.FULLSCREEN)
3760
+ fullscreenLayout = radio.layout;
28443761
28453762 // bigThree.remove(scenePanel);
28463763 // bigThree.remove(centralPanel);
....@@ -2872,10 +3789,15 @@
28723789 bigThree.ClearUI();
28733790 bigThree.add(scenePanel);
28743791 bigThree.FlushUI();
3792
+
3793
+ cameraView.requestFocusInWindow();
28753794 } else
28763795 if (source == sixButton)
28773796 {
28783797 radio.layout = sixButton;
3798
+
3799
+ if (CameraPane.FULLSCREEN)
3800
+ fullscreenLayout = radio.layout;
28793801
28803802 // bigThree.remove(scenePanel);
28813803 // bigThree.remove(centralPanel);
....@@ -2905,13 +3827,18 @@
29053827 // centralPanel.setVisible(true);
29063828 // XYZPanel.setVisible(false);
29073829 bigThree.ClearUI();
2908
- bigThree.add(scenePanel);
29093830 bigThree.add(centralPanel);
3831
+ bigThree.add(scenePanel);
29103832 bigThree.FlushUI();
3833
+
3834
+ cameraView.requestFocusInWindow();
29113835 } else
29123836 if (source == sevenButton)
29133837 {
29143838 radio.layout = sevenButton;
3839
+
3840
+ if (CameraPane.FULLSCREEN)
3841
+ fullscreenLayout = radio.layout;
29153842
29163843 // bigThree.remove(scenePanel);
29173844 // bigThree.remove(centralPanel);
....@@ -2945,6 +3872,8 @@
29453872 bigThree.add(centralPanel);
29463873 bigThree.add(XYZPanel);
29473874 bigThree.FlushUI();
3875
+
3876
+ cameraView.requestFocusInWindow();
29483877 } else
29493878 if (source == rootButton)
29503879 {
....@@ -2956,6 +3885,7 @@
29563885 EditObject(obj);
29573886 }
29583887
3888
+ cameraView.requestFocusInWindow();
29593889 refreshContents(true);
29603890 } else
29613891 if (source == closeButton)
....@@ -2965,22 +3895,37 @@
29653895 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663896 {
29673897 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3898
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693899 {
3900
+ // Patch to avoid bug with transparency.
3901
+ if (!ab.hadMaterial)
3902
+ {
3903
+ ab.object.material = null;
3904
+ }
3905
+
29703906 buttonGroup.remove(ab);
29713907 radioPanel.remove(ab);
29723908
2973
- ab.GetObject().editWindow = null;
3909
+ //ab.GetObject().editWindow = null;
3910
+ ab.GetObject().manipWindow = null;
29743911 // ab.GetObject().objectUI = null; // ?????????
29753912
29763913 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773914 break;
29783915 }
29793916 }
3917
+
3918
+ cameraView.requestFocusInWindow();
29803919 refreshContents(true);
29813920 } else
29823921 if (source == editItem || source == editButton)
29833922 {
3923
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3924
+ {
3925
+ Object3D child = (Object3D)e.nextElement();
3926
+ child.pinned = true;
3927
+ }
3928
+
29843929 EditSelection(false);
29853930 } else
29863931 if (source == uneditButton)
....@@ -2989,11 +3934,12 @@
29893934 {
29903935 Object3D child = (Object3D)e.nextElement();
29913936 if(child.editWindow != null)
2992
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3937
+ child.pinned = false;
29933938 child.CloseUI();
29943939 listUI.remove(child);
3940
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29953941
2996
- child.editWindow = null; // ???????????
3942
+ //child.editWindow = null; // ???????????
29973943 }
29983944 objEditor.ctrlPanel.FlushUI();
29993945 //objEditor.jTree.clearSelection();
....@@ -3006,16 +3952,18 @@
30063952 //copy.ClearUI();
30073953 for (Object3D obj : listUI)
30083954 {
3955
+ obj.pinned = false;
30093956 obj.CloseUI();
30103957 }
30113958 listUI.clear();
3959
+ SetPinStates(group.selection.size() > 0);
30123960 refreshContents(true);
30133961 } else
30143962 if (source == allParamsButton)
30153963 {
30163964 assert(copy == group);
30173965
3018
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3966
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30193967
30203968 for (Object3D obj : listUI)
30213969 {
....@@ -3064,6 +4012,9 @@
30644012 }
30654013
30664014 copy = group;
4015
+
4016
+ SetUndoStates();
4017
+
30674018 //Globals.theRenderer.object = group;
30684019 if(!useclient)
30694020 {
....@@ -3079,20 +4030,49 @@
30794030 frontView.object = group;
30804031 sideView.object = group;
30814032 }
3082
- group.editWindow = this;
4033
+
4034
+// fix "+" issue
4035
+ //group.editWindow = this;
4036
+ group.manipWindow = this;
4037
+
30834038 /*
30844039 currentLayout = radio.layout;
30854040 if (currentLayout == null)
30864041 currentLayout = sevenButton;
30874042 */
30884043 radio.layout.doClick();
4044
+
4045
+ ClearUnpinned();
4046
+
4047
+ //Grafreed.Assert(group != null);
4048
+ //Grafreed.Assert(group.selection != null);
4049
+ SetPinStates(group.selection == null || group.selection.size() > 0);
4050
+ if (group.selection == null || group.selection.size() == 1)
4051
+ EditSelection(false);
30894052 keepparent = group.parent;
30904053 // PARENT = NULL or not???
30914054 //group.parent = null; // ROOT
30924055 //group.attributes = -1;
30934056 ResetModel();
4057
+
4058
+ cameraView.requestFocusInWindow();
30944059 refreshContents(true);
3095
- }
4060
+ } else if (event.getSource() == editCameraItem)
4061
+ {
4062
+ cameraView.ProtectCamera();
4063
+ cameraView.requestFocusInWindow();
4064
+ cameraView.repaint();
4065
+ return;
4066
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
4067
+ {
4068
+ cameraView.RevertCamera();
4069
+ cameraView.requestFocusInWindow();
4070
+ cameraView.repaint();
4071
+ return;
4072
+ // } else if (event.getSource() == textureButton)
4073
+ // {
4074
+ // return; // true;
4075
+ }
30964076 else
30974077 {
30984078 //return super.action(event, arg);
....@@ -3101,7 +4081,6 @@
31014081 }
31024082
31034083 boolean useclient = false;
3104
- cRadio radio;
31054084
31064085 void ToggleRoot()
31074086 {
....@@ -3340,7 +4319,8 @@
33404319
33414320 int size = obj.MemorySize();
33424321
3343
- System.err.println((size/1024) + " KB is the size of " + obj);
4322
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4323
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33444324 }
33454325 }
33464326 catch (Exception e)
....@@ -3421,6 +4401,13 @@
34214401 void GenNormals(boolean crease)
34224402 {
34234403 group.GenNormalsS(crease);
4404
+
4405
+ refreshContents();
4406
+ }
4407
+
4408
+ void GenNormalsMESH()
4409
+ {
4410
+ group.GenNormalsMeshS();
34244411
34254412 refreshContents();
34264413 }
....@@ -3652,7 +4639,16 @@
36524639 String pigment = Object3D.GetPigment(tex);
36534640 //String bump = Object3D.GetBump(tex);
36544641
3655
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4642
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4643
+
4644
+ try
4645
+ {
4646
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4647
+ }
4648
+ catch (Exception e)
4649
+ {
4650
+ System.err.println("FAIL: " + node);
4651
+ }
36564652
36574653 double s = v.s;
36584654
....@@ -4039,6 +5035,18 @@
40395035 refreshContents();
40405036 }
40415037
5038
+ void RewindLeaves(boolean hide)
5039
+ {
5040
+ group.selection.RewindLeaves(hide);
5041
+ refreshContents();
5042
+ }
5043
+
5044
+ void RandomLeaves(boolean hide)
5045
+ {
5046
+ group.selection.RandomLeaves(hide);
5047
+ refreshContents();
5048
+ }
5049
+
40425050 void SetTexRes(int tr)
40435051 {
40445052 group.selection.SetTexRes(tr);
....@@ -4110,28 +5118,25 @@
41105118 // }
41115119 // }
41125120
4113
- static boolean allparams = true;
4114
-
4115
- static Vector<Object3D> listUI = new Vector<Object3D>();
4116
-
41175121 void EditSelection(boolean newWindow)
41185122 {
5123
+ if (group.selection == null)
5124
+ {
5125
+ EditElement(group, newWindow); // ? new
5126
+ return;
5127
+ }
5128
+
41195129 // aConstraints.gridy = 0;
41205130 for (int i=0; i<group.selection.size(); i++)
41215131 {
41225132 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41235133 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4124
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5134
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41255135
41265136 Object3D elem = (Object3D)group.selection.elementAt(i);
4127
- if(elem != group)
5137
+ if(elem != group || !newWindow)
41285138 {
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
5139
+ EditElement(elem, newWindow); // ? new
41355140 }
41365141 }
41375142 }
....@@ -4194,9 +5199,7 @@
41945199
41955200 freezemodel = false;
41965201 }
4197
-
4198
- boolean flashIt = true;
4199
-
5202
+
42005203 public void valueChanged(TreeSelectionEvent e)
42015204 //public boolean handleEvent(Event event)
42025205 {
....@@ -4206,7 +5209,8 @@
42065209 //new Exception().printStackTrace();
42075210
42085211 freezemodel = true;
4209
-
5212
+ ClearUnpinned();
5213
+
42105214 /**/
42115215 //switch (event.id)
42125216 {
....@@ -4214,7 +5218,6 @@
42145218 //case 702: // Event.LIST_DESELECT
42155219 group.deselectAll();
42165220 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4217
- objEditor.ClearInfo(); // .GetMaterial());
42185221 if (tps != null)
42195222 {
42205223 for (int i=0; i < tps.length; i++)
....@@ -4223,10 +5226,8 @@
42235226
42245227 //if (child.parent != null)
42255228 //child.parent.addSelectee(child);
5229
+ objEditor.SetMaterial(child);
42265230 group.addSelectee(child);
4227
- objEditor.SetMaterial(child); // .GetMaterial());
4228
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4229
- System.err.println("info : " + child.GetPath());
42305231 }
42315232 }
42325233 // else
....@@ -4236,20 +5237,28 @@
42365237 // System.err.println("info : " + group.GetPath());
42375238 // }
42385239
4239
- objEditor.SetText(); // jan 2014
4240
-
4241
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5240
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42425241 CameraPane.flash = true;
42435242
4244
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5243
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42455244 // a camera
42465245 {
4247
- CameraPane.camerachangeframe = 0; // don't refuse it
4248
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5246
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5247
+ {
5248
+ CameraPane.camerachangeframe = 0; // don't refuse it
5249
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5250
+ }
42495251 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42505252 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42515253 }
42525254
5255
+ if (tps != null && tps.length == 1)
5256
+ {
5257
+ EditSelection(false);
5258
+ }
5259
+
5260
+ SetPinStates(tps != null && tps.length > 0);
5261
+
42535262 refreshContents();
42545263 //return true;
42555264 }
....@@ -4258,6 +5267,37 @@
42585267
42595268 freezemodel = false;
42605269 }
5270
+
5271
+ void SetPinStates(boolean enabled)
5272
+ {
5273
+ editButton.setEnabled(enabled);
5274
+ uneditButton.setEnabled(enabled);
5275
+ //unselectButton.setEnabled(enabled);
5276
+ flashSelectionButton.setEnabled(enabled);
5277
+
5278
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5279
+ }
5280
+
5281
+ void refreshContents(boolean cp)
5282
+ {
5283
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5284
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5285
+ {
5286
+ objEditor.ClearInfo(); // .GetMaterial());
5287
+
5288
+ for (int i=0; i < group.selection.Size(); i++)
5289
+ {
5290
+ Object3D child = (Object3D) group.selection.get(i);
5291
+
5292
+ objEditor.AddInfo(child, this, true);
5293
+ System.err.println("info : " + child.GetPath());
5294
+ }
5295
+
5296
+ objEditor.SetText(); // jan 2014
5297
+ }
5298
+
5299
+ super.refreshContents(cp);
5300
+ }
42615301
42625302 void linkSomething(Object3D thing)
42635303 {
....@@ -4329,6 +5369,7 @@
43295369 {
43305370 if (group.selection.isEmpty())
43315371 return;
5372
+
43325373 Grafreed.clipboardIsTempGroup = false;
43335374 Composite tGroup = null;
43345375 if (group.selection.size() > 0) // 1)
....@@ -4339,6 +5380,8 @@
43395380
43405381 if (cut)
43415382 {
5383
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5384
+// Save();
43425385 //int indices[] = jList.getSelectedIndices();
43435386 //for (int i = indices.length - 1; i >= 0; i--)
43445387 //jList.remove(indices[i]);
....@@ -4428,8 +5471,10 @@
44285471 }
44295472
44305473 }
5474
+
44315475 if (Grafreed.clipboardIsTempGroup)
44325476 Grafreed.clipboard = tGroup;
5477
+
44335478 if (cut)
44345479 {
44355480 ResetModel();
....@@ -4439,6 +5484,10 @@
44395484
44405485 void paste(boolean expand)
44415486 {
5487
+ if (Globals.REPLACEONMAKE)
5488
+ Save();
5489
+ boolean keep = Globals.REPLACEONMAKE;
5490
+ Globals.REPLACEONMAKE = false;
44425491 // if (GrafreeD.clipboard == null)
44435492 // return;
44445493 boolean first = true;
....@@ -4498,6 +5547,7 @@
44985547 Grafreed.clipboard.get(0).parent = keepparent;
44995548 }
45005549
5550
+ Globals.REPLACEONMAKE = keep;
45015551 ResetModel();
45025552 refreshContents();
45035553 }
....@@ -4633,6 +5683,10 @@
46335683
46345684 void group(Object3D csg, boolean grab)
46355685 {
5686
+ if (Globals.REPLACEONMAKE)
5687
+ Save();
5688
+ boolean keep = Globals.REPLACEONMAKE;
5689
+ Globals.REPLACEONMAKE = false;
46365690 if (//false) // why??
46375691 !group.selection.isEmpty())
46385692 {
....@@ -4746,10 +5800,15 @@
47465800 //node.add(csg);
47475801 //makeSomething(node);
47485802 makeSomething(csg);
5803
+ Globals.REPLACEONMAKE = keep;
47495804 }
47505805
47515806 void Ungroup(Object3D g)
47525807 {
5808
+ if (Globals.REPLACEONMAKE)
5809
+ Save();
5810
+ boolean keep = Globals.REPLACEONMAKE;
5811
+ Globals.REPLACEONMAKE = false;
47535812 if (g instanceof HiddenObject)
47545813 {
47555814 HiddenObject h = (HiddenObject) g;
....@@ -4766,6 +5825,7 @@
47665825 objEditor.makeSomething(g.get(i), false);
47675826 }
47685827 }
5828
+ Globals.REPLACEONMAKE = keep;
47695829 }
47705830
47715831 void ungroup()
....@@ -4961,21 +6021,6 @@
49616021 }
49626022 */
49636023
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
-
49796024 /*
49806025 public void Callback(Object obj)
49816026 {
....@@ -4999,23 +6044,6 @@
49996044 }
50006045 */
50016046
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
-
50196047 String GetFile(String dialogName)
50206048 {
50216049 if (Grafreed.standAlone)
....@@ -5086,7 +6114,43 @@
50866114 cButton clearpanelButton;
50876115 cButton unselectButton;
50886116
6117
+ cButton restoreCameraButton;
6118
+
50896119 cButton oneStepButton;
6120
+
6121
+ cButton groupButton;
6122
+ cButton ungroupButton;
6123
+ cButton compositeButton;
6124
+ cButton switchButton;
6125
+ cButton loopButton;
6126
+ cButton textureButton;
6127
+
6128
+ cButton skybox1Button;
6129
+ cButton skybox2Button;
6130
+ cButton skybox3Button;
6131
+ cButton skybox4Button;
6132
+ cButton skybox5Button;
6133
+ cButton skybox6Button;
6134
+ cButton skybox7Button;
6135
+
6136
+ cButton skybox11Button;
6137
+ cButton skybox12Button;
6138
+ cButton skybox13Button;
6139
+ cButton skybox14Button;
6140
+ cButton skybox15Button;
6141
+ cButton skybox16Button;
6142
+ cButton skybox17Button;
6143
+
6144
+ cButton gridButton;
6145
+ cButton boxButton;
6146
+ cButton sphereButton;
6147
+ cButton coneButton;
6148
+ cButton torusButton;
6149
+ cButton superButton;
6150
+ cButton kleinButton;
6151
+ cButton particlesButton;
6152
+ cButton overlayButton;
6153
+ cButton lightButton;
50906154
50916155 cButton screenfitButton;
50926156 cButton screenfitpointButton;
....@@ -5099,14 +6163,6 @@
50996163
51006164 cButton setsupportButton;
51016165
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
-
51106166 //
51116167 //Composite
51126168 Object3D // to do !!
....@@ -5116,9 +6172,11 @@
51166172 //JTree jTree;
51176173 private MenuItem lookAtItem;
51186174 private MenuItem lookFromItem;
5119
- private MenuItem switchItem;
6175
+ private MenuItem switchViewItem;
51206176 private MenuItem cutItem;
5121
- private MenuItem duplicateItem;
6177
+ private MenuItem undoItem;
6178
+ private MenuItem redoItem;
6179
+ private JMenuItem duplicateItem;
51226180 private MenuItem cloneItem;
51236181 private MenuItem cloneSupportItem;
51246182 private MenuItem overwriteGeoItem;
....@@ -5131,7 +6189,7 @@
51316189 private MenuItem linkverticesItem;
51326190 private MenuItem relinkverticesItem;
51336191 private MenuItem setMasterItem;
5134
- private MenuItem resetMeshItem;
6192
+ private MenuItem resetAllItem;
51356193 private MenuItem stepAllItem;
51366194 private MenuItem revertMeshItem;
51376195 private MenuItem poseMeshItem;
....@@ -5146,7 +6204,7 @@
51466204 private MenuItem pasteLinkItem;
51476205 private MenuItem pasteCloneItem;
51486206 private MenuItem pasteExpandItem;
5149
- private MenuItem clearItem;
6207
+ private MenuItem deleteItem;
51506208 private MenuItem clearAllItem;
51516209 private MenuItem genUVItem;
51526210 private MenuItem genNormalsMESHItem;
....@@ -5181,6 +6239,10 @@
51816239 private MenuItem showleavesItem;
51826240 private MenuItem markleavesItem;
51836241 private MenuItem unmarkleavesItem;
6242
+ private MenuItem rewindleavesItem;
6243
+ private MenuItem unrewindleavesItem;
6244
+ private MenuItem randomleavesItem;
6245
+ private MenuItem unrandomleavesItem;
51846246
51856247 private MenuItem flipVItem;
51866248 private MenuItem unflipVItem;
....@@ -5202,7 +6264,7 @@
52026264 private MenuItem frontItem;
52036265 private MenuItem cameraItem;
52046266 private MenuItem compositeItem;
5205
- private MenuItem randomItem;
6267
+ private MenuItem switchItem;
52066268 private MenuItem physicsItem;
52076269 private MenuItem frameselectorItem;
52086270 private MenuItem scriptNodeItem;
....@@ -5226,6 +6288,8 @@
52266288 private MenuItem attachBumpItem;
52276289 private MenuItem detachBumpItem;
52286290 private MenuItem pigmentBumpItem;
6291
+ private MenuItem embedTexturesItem;
6292
+ private MenuItem deEmbedTexturesItem;
52296293
52306294 private MenuItem particleItem;
52316295 private MenuItem ragdollItem;
....@@ -5264,11 +6328,6 @@
52646328 private MenuItem doubleItem;
52656329 private MenuItem tripleItem;
52666330
5267
- private MenuItem importGFDItem;
5268
- private MenuItem importVRMLX3DItem;
5269
- private MenuItem import3DSItem;
5270
- private MenuItem importOBJItem;
5271
-
52726331 private MenuItem computeAOItem;
52736332 private MenuItem recompileItem;
52746333 private MenuItem editScriptItem;
....@@ -5278,4 +6337,8 @@
52786337 private MenuItem analyzeItem;
52796338 private MenuItem dumpItem;
52806339 //boolean freezemodel = false;
6340
+
6341
+ Menu cameraMenu;
6342
+ MenuItem editCameraItem;
6343
+ MenuItem restoreCameraItem;
52816344 }