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 }
....@@ -80,10 +422,22 @@
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)
....@@ -150,11 +505,19 @@
150505
151506 void SetupMenu2(GroupEditor oe)
152507 {
508
+ oe.jTree = new cTree();
509
+
153510 Menu menu;
154511 oe.menuBar.add(menu = new Menu("Edit"));
155512 //editItem = menu.add(new MenuItem("Edit"));
156513 //editItem.addActionListener(this);
157
- 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"));
158521 duplicateItem.addActionListener(this);
159522 cloneItem = menu.add(new MenuItem("Clone"));
160523 cloneItem.addActionListener(this);
....@@ -170,7 +533,6 @@
170533 copyItem.addActionListener(this);
171534 pasteItem = menu.add(new MenuItem("Paste"));
172535 pasteItem.addActionListener(this);
173
- menu.add("-");
174536
175537 menu.add("-");
176538 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -182,8 +544,8 @@
182544 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
183545 // pasteExpandItem.addActionListener(this);
184546 menu.add("-");
185
- clearItem = menu.add(new MenuItem("Clear"));
186
- clearItem.addActionListener(this);
547
+ deleteItem = menu.add(new MenuItem("Delete"));
548
+ deleteItem.addActionListener(this);
187549
188550 if (Globals.ADVANCED)
189551 {
....@@ -197,23 +559,23 @@
197559 //zBufferItem.addActionListener(this);
198560 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
199561 //normalLensItem.addActionListener(this);
200
- cameraMenu.add(revertCameraItem = new MenuItem("Revert Camera"));
201
- revertCameraItem.addActionListener(this);
562
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
563
+ restoreCameraItem.addActionListener(this);
202564
203
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
204
- toggleFullScreenItem.addItemListener(this);
205
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
206
- cameraMenu.add("-");
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);
207577
208
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
209
- toggleTextureItem.addItemListener(this);
210
- toggleTextureItem.setState(CameraPane.textureon);
211
-
212
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
213
- toggleSwitchItem.addItemListener(this);
214
- toggleSwitchItem.setState(CameraPane.SWITCH);
215
-
216
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
578
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
217579 toggleHandleItem.addItemListener(this);
218580 toggleHandleItem.setState(CameraPane.HANDLES);
219581
....@@ -240,7 +602,7 @@
240602
241603 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
242604 toggleDebugItem.addItemListener(this);
243
- toggleDebugItem.setState(CameraPane.DEBUG);
605
+ toggleDebugItem.setState(Globals.DEBUG);
244606
245607 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
246608 toggleFrustumItem.addItemListener(this);
....@@ -261,14 +623,14 @@
261623 // animationItem.addItemListener(this);
262624 // animationItem.setState(CameraPane.ANIMATION);
263625 cameraMenu.add("-");
264
- cameraMenu.add(editCameraItem = new MenuItem("Freeze Camera"));
626
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
265627 editCameraItem.addActionListener(this);
266628
267629 if (Globals.ADVANCED)
268630 {
269631 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
270632 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
271
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
633
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
272634 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
273635 oe.cameraMenu.add("-");
274636 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -276,7 +638,7 @@
276638 editLeafItem.addActionListener(this);
277639 lookAtItem.addActionListener(this);
278640 //lookFromItem.addActinoListener(this);
279
- //switchItem.addActionListener(this);
641
+ //switchViewItem.addActionListener(this);
280642 }
281643
282644 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -321,21 +683,29 @@
321683 }
322684
323685 oe.menuBar.add(menu = new Menu("Group"));
324
- grabItem = menu.add(new MenuItem("Grab"));
325
- grabItem.addActionListener(this);
686
+// grabItem = menu.add(new MenuItem("Grab"));
687
+// grabItem.addActionListener(this);
326688 backItem = menu.add(new MenuItem("Back"));
327689 backItem.addActionListener(this);
328690 frontItem = menu.add(new MenuItem("Front"));
329691 frontItem.addActionListener(this);
330
- compositeItem = menu.add(new MenuItem("Composite"));
331
- compositeItem.addActionListener(this);
692
+// compositeItem = menu.add(new MenuItem("Composite"));
693
+// compositeItem.addActionListener(this);
694
+
695
+ if (Globals.ADVANCED)
696
+ {
332697 hideItem = menu.add(new MenuItem("Hidden Group"));
333698 hideItem.addActionListener(this);
699
+ }
334700 ungroupItem = menu.add(new MenuItem("Ungroup"));
335701 ungroupItem.addActionListener(this);
336
- menu.add("-");
337
- randomItem = menu.add(new MenuItem("Switch node"));
338
- 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
+ {
339709 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
340710 switchGeoItem.addActionListener(this);
341711 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -343,8 +713,6 @@
343713 morphItem = menu.add(new MenuItem("Morph Group"));
344714 morphItem.addActionListener(this);
345715
346
- if (Globals.ADVANCED)
347
- {
348716 menu.add("-");
349717 physicsItem = menu.add(new MenuItem("Physics"));
350718 physicsItem.addActionListener(this);
....@@ -352,30 +720,29 @@
352720 frameselectorItem.addActionListener(this);
353721 scriptNodeItem = menu.add(new MenuItem("Script Node"));
354722 scriptNodeItem.addActionListener(this);
355
- cameraItem = menu.add(new MenuItem("Camera"));
356
- cameraItem.addActionListener(this);
357723 }
358724
359725 oe.menuBar.add(menu = new Menu("Object"));
360
- textureItem = menu.add(new MenuItem("Texture"));
361
- textureItem.addActionListener(this);
726
+// textureItem = menu.add(new MenuItem("Texture"));
727
+// textureItem.addActionListener(this);
362728 billboardItem = menu.add(new MenuItem("Billboard"));
363729 billboardItem.addActionListener(this);
364730 csgItem = menu.add(new MenuItem("CSG"));
365731 csgItem.addActionListener(this);
366
- shadowXItem = menu.add(new MenuItem("Shadow X"));
732
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
367733 shadowXItem.addActionListener(this);
368
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
734
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
369735 shadowYItem.addActionListener(this);
370
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
736
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
371737 shadowZItem.addActionListener(this);
738
+ attributeItem = menu.add(new MenuItem("Attribute"));
739
+ attributeItem.addActionListener(this);
740
+
372741 if (Globals.ADVANCED)
373742 {
374743 menu.add("-");
375744 linkerItem = menu.add(new MenuItem("Linker"));
376745 linkerItem.addActionListener(this);
377
- attributeItem = menu.add(new MenuItem("Attribute"));
378
- attributeItem.addActionListener(this);
379746 templateItem = menu.add(new MenuItem("Template"));
380747 templateItem.addActionListener(this);
381748 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -404,7 +771,7 @@
404771 genNormalsMESHItem.addActionListener(this);
405772 if (Globals.ADVANCED)
406773 {
407
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
774
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
408775 genNormalsMINEItem.addActionListener(this);
409776 }
410777 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -464,6 +831,14 @@
464831 markleavesItem.addActionListener(this);
465832 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
466833 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);
467842 menu.add("-");
468843 flipVItem = menu.add(new MenuItem("Flip V"));
469844 flipVItem.addActionListener(this);
....@@ -489,10 +864,15 @@
489864 attachBumpItem.addActionListener(this);
490865 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
491866 pigmentBumpItem.addActionListener(this);
867
+ //embedTexturesItem
492868 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
493869 detachPigmentItem.addActionListener(this);
494870 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
495871 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);
496876 menu.add("-");
497877 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
498878 sortbysizeItem.addActionListener(this);
....@@ -519,8 +899,88 @@
519899 buildToolsMenu(menu);
520900 }
521901
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
+
522970 void SetupUI2(ObjEditor oe)
523971 {
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
+
524984 //new Exception().printStackTrace();
525985
526986 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -549,27 +1009,83 @@
5491009 oe.radioPanel.add(dummyButton);
5501010 oe.buttonGroup.add(dummyButton);
5511011 */
1012
+ cGridBag copyOptionsPanel = new cGridBag();
1013
+
1014
+ copyOptionsPanel.preferredHeight = 2;
1015
+
5521016 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
5531017
554
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
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);
5551073 liveCB.setToolTipText("Enable animation");
5561074 liveCB.addItemListener(this);
5571075
558
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5591077 oneStepButton.setToolTipText("Animate one step forward");
5601078 oneStepButton.addActionListener(this);
5611079
562
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
1080
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
5631081 fastCB.setToolTipText("Fast mode");
5641082 fastCB.addItemListener(this);
5651083
566
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
567
- trackCB.setToolTipText("Enable tracking");
568
- trackCB.addItemListener(this);
569
-
570
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
571
- screenfitButton.setToolTipText("Screen fit");
572
- 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);
5731089
5741090 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
5751091 // screenfitpointButton.addActionListener(this);
....@@ -579,67 +1095,152 @@
5791095 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5801096 snapobjectButton.addActionListener(this);
5811097 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");
5821102 }
5831103
584
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585
- flashSelectionButton.setToolTipText("Show selection");
586
- flashSelectionButton.addActionListener(this);
1104
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
5871105
588
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
589
-
590
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
591
- 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");
5921108 twoButton.addActionListener(this);
593
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
594
- fourButton.addActionListener(this);
595
- fourButton.setToolTipText("Show left panel only");
596
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- sixButton.setToolTipText("2-column layout left");
598
- sixButton.addActionListener(this);
599
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
- 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");
6011113 threeButton.addActionListener(this);
602
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- sevenButton.setToolTipText("3-column layout");
604
- 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);
6051120 //
6061121
607
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
608
- 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");
6091124 rootButton.addActionListener(this);
6101125
611
- 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);
6121127 closeButton.setToolTipText("Close tab");
6131128 closeButton.addActionListener(this);
6141129 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
6151130 //clearButton.addActionListener(this);
616
-
617
- cGridBag commandsPanel = new cGridBag();
1131
+
1132
+ cGridBag row1 = new cGridBag();
6181133
619
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- 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");
6211217 editButton.addActionListener(this);
6221218
623
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
- uneditButton.setToolTipText("Unedit selection");
1219
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1220
+ uneditButton.setToolTipText("Unpin and remove selection controls");
6251221 uneditButton.addActionListener(this);
6261222
627
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
628
- allParamsButton.setToolTipText("Edit all params");
1223
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1224
+ allParamsButton.setToolTipText("Show all controls");
6291225 allParamsButton.addActionListener(this);
6301226
631
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
- clearPanelButton.setToolTipText("Clear edit panel");
1227
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1228
+ clearPanelButton.setToolTipText("Clear all controls");
6331229 clearPanelButton.addActionListener(this);
6341230
635
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
- unselectButton.setToolTipText("Unselect");
637
- unselectButton.addActionListener(this);
1231
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1232
+ //unselectButton.setToolTipText("Unselect");
1233
+ //unselectButton.addActionListener(this);
6381234
639
- 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);
6401238
641
- oe.treePanel.add(commandsPanel);
642
- oe.treePanel.Return();
1239
+ editCommandsPanel.preferredHeight = 1;
1240
+
1241
+ SetPinStates(false);
1242
+// oe.treePanel.add(commandsPanel);
1243
+// oe.treePanel.Return();
6431244
6441245 // oe.aConstraints.gridx += 1;
6451246 // oe.aConstraints.weighty = 0;
....@@ -656,32 +1257,20 @@
6561257
6571258 JScrollPane jSP;
6581259 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
659
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1260
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6601261 ResetModel();
6611262
6621263 oe.treePanel.add(jSPPanel);
6631264 oe.treePanel.Return();
6641265
665
- cGridBag copyOptionsPanel = new cGridBag();
666
-
667
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
668
- colorCB.setToolTipText("Copy color when dropped");
669
- colorCB.addItemListener(this);
670
-
671
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
672
- materialCB.setToolTipText("Copy material when dropped");
673
- materialCB.addItemListener(this);
674
-
675
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
676
- textureCB.setToolTipText("Copy texture when dropped");
677
- textureCB.addItemListener(this);
678
-
679
- copyOptionsPanel.preferredHeight = 1;
6801266 oe.treePanel.add(copyOptionsPanel);
6811267 oe.treePanel.Return();
1268
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1269
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1270
+ sliderPane.preferredHeight = 1;
6821271
683
-// mainPanel.setDividerLocation(0.5); //1.0);
684
-// mainPanel.setResizeWeight(0.5);
1272
+// mainPanel.setDividerLocation(0.1); //1.0);
1273
+ mainPanel.setResizeWeight(0.4);
6851274
6861275 //jList.addListSelectionListener(this);
6871276 oe.jTree.addTreeSelectionListener(this);
....@@ -689,7 +1278,7 @@
6891278 //jTree.setEditable(true);
6901279 oe.jTree.setDragEnabled(true);
6911280 //jTree.setPreferredSize(new Dimension(10,10));
692
- jSP.setPreferredSize(new Dimension(100,200));
1281
+ //jSP.setPreferredSize(new Dimension(100,200));
6931282
6941283 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6951284
....@@ -701,29 +1290,49 @@
7011290 dgr.addDragGestureListener(this);
7021291 }catch(Exception e) {}
7031292 */
704
- radio.layout = sevenButton;
1293
+ radio.layout = threeButton; // sixButton;
7051294 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7061295 }
7071296
7081297 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7091298 {
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
+
7101313 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7111314 boxCB.setToolTipText("Display bounding boxes");
7121315 boxCB.addItemListener(this);
7131316
7141317 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
715
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1318
+ zoomBoxCB.setToolTipText("Display only for wheel");
7161319 zoomBoxCB.addItemListener(this);
7171320
7181321 if (true) // Globals.ADVANCED)
7191322 {
720
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
721
- supportCB.setToolTipText("Enable rigging");
722
- 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);
7231330
7241331 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7251332 // localCB.addItemListener(this);
7261333
1334
+ panel.Return();
1335
+
7271336 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7281337 crowdCB.setToolTipText("Used for crowds");
7291338 crowdCB.addItemListener(this);
....@@ -732,14 +1341,19 @@
7321341 smoothCB.setToolTipText("Snapping delay");
7331342 smoothCB.addItemListener(this);
7341343
735
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
736
- slowCB.setToolTipText("Smooth interpolation");
737
- 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);
7381350
7391351 // constraints.gridy += 1;
7401352 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7411353 // speakerMocapCB.addItemListener(this);
7421354
1355
+ panel.Return();
1356
+
7431357 if (false)
7441358 {
7451359 // handled in scripts
....@@ -754,34 +1368,74 @@
7541368 //constraints.gridy += 1;
7551369 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
7561370 smoothfocusCB.addItemListener(this);
1371
+ panel.Return();
7571372 }
7581373
7591374 //constraints.gridx += 1;
7601375 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7611376 // debugCB.addItemListener(this);
7621377
1378
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1379
+ trackCB.setToolTipText("Enable tracking target");
1380
+ trackCB.addItemListener(this);
1381
+
7631382 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1383
+ oeilCB.setToolTipText("Move camera when tracking");
7641384 oeilCB.addItemListener(this);
7651385
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
+ {
7661406 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7671407 lookAtCB.setToolTipText("Look-at target");
7681408 lookAtCB.addItemListener(this);
1409
+ }
7691410
7701411 }
7711412
7721413 cGridBag fill = new cGridBag();
773
-
7741414 fill.preferredHeight = 200;
1415
+ cGridBag fill2 = new cGridBag();
1416
+ fill2.preferredHeight = 200;
1417
+ cGridBag fill3 = new cGridBag();
1418
+ fill3.preferredHeight = 200;
7751419
7761420 panel.add(fill);
1421
+ panel.add(fill2);
1422
+ panel.add(fill3);
7771423
7781424 }
7791425
7801426 void EditObject(Object3D obj)
7811427 {
7821428 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
+
7831437 radioButton.SetObject(obj);
784
- radioButton.layout = sevenButton;
1438
+ radioButton.layout = threeButton; // sixButton;
7851439 radioButton.SetCamera(cameraView.renderCamera, false);
7861440 radioButton.addActionListener(this);
7871441 radioPanel.add(radioButton);
....@@ -791,6 +1445,8 @@
7911445
7921446 void SetupViews(ObjEditor oe)
7931447 {
1448
+ theFrame = this;
1449
+
7941450 oe.SetupViews();
7951451
7961452 System.out.println("SetupViews");
....@@ -799,23 +1455,30 @@
7991455 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8001456 }
8011457
802
- JCheckBox liveCB;
803
- JCheckBox supportCB;
804
- JCheckBox localCB;
805
- JCheckBox crowdCB;
806
- JCheckBox smoothCB;
807
- JCheckBox fastCB;
808
- JCheckBox slowCB;
809
- JCheckBox boxCB;
810
- JCheckBox zoomBoxCB;
811
- JCheckBox trackCB;
812
- 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;
8131473 // JCheckBox speakerMocapCB;
814
- JCheckBox speakerCameraCB;
815
- JCheckBox speakerFocusCB;
816
- JCheckBox debugCB;
817
- JCheckBox oeilCB;
818
- JCheckBox lookAtCB;
1474
+ cCheckBox speakerCameraCB;
1475
+ cCheckBox speakerFocusCB;
1476
+ cCheckBox debugCB;
1477
+
1478
+ cCheckBox oeilCB;
1479
+ cCheckBox shadowCB;
1480
+ cCheckBox autokeepCB;
1481
+ cCheckBox lookAtCB;
8191482
8201483 // static int COLOR = 1;
8211484 // static int MATERIAL = 2;
....@@ -823,9 +1486,9 @@
8231486
8241487 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8251488
826
- JCheckBox colorCB;
827
- JCheckBox materialCB;
828
- JCheckBox textureCB;
1489
+ cCheckBox colorCB;
1490
+ cCheckBox materialCB;
1491
+ cCheckBox textureCB;
8291492
8301493 public void itemStateChanged(ItemEvent e)
8311494 {
....@@ -853,6 +1516,7 @@
8531516 } else if(e.getSource() == liveCB)
8541517 {
8551518 cameraView.ToggleLive();
1519
+ refreshContents(false);
8561520 }
8571521 else if(e.getSource() == supportCB)
8581522 {
....@@ -868,6 +1532,12 @@
8681532 {
8691533 cameraView.ToggleInertia();
8701534 cameraView.repaint();
1535
+ }
1536
+ else if(e.getSource() == minshaderCB)
1537
+ {
1538
+ Globals.MINSHADER ^= true;
1539
+ cameraView.programInitialized = false;
1540
+ cameraView.repaint();
8711541 }
8721542 else if(e.getSource() == localCB)
8731543 {
....@@ -917,6 +1587,18 @@
9171587 {
9181588 cameraView.ToggleOeil();
9191589 }
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
+ }
9201602 else if(e.getSource() == lookAtCB)
9211603 {
9221604 cameraView.ToggleLookAt();
....@@ -933,7 +1615,8 @@
9331615
9341616 /**/
9351617 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
936
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1618
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1619
+ TreePath path = objEditor.jTree.getSelectionPath();
9371620 if ((path == null) || (path.getPathCount() <= 1)) {
9381621 // We can't move the root node or an empty selection
9391622 return;
....@@ -996,8 +1679,6 @@
9961679 }
9971680 }
9981681
999
- String string = (String) object;
1000
-
10011682 System.out.println("Transfer = " + object + "; drop : " + target);
10021683 // if( object instanceof java.io.File[])
10031684 // {
....@@ -1005,6 +1686,8 @@
10051686 // objEditor.DropFile((java.io.File[]) object, true);
10061687 // return;
10071688 // }
1689
+
1690
+ String string = object.toString();
10081691
10091692 // File path for Mac and Windows
10101693 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1050,23 +1733,33 @@
10501733
10511734 assert target == objEditor.jTree;
10521735 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1736
+ Object3D destinationLeaf;
10531737 try {
1054
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1738
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10551739 } catch (Exception e) {
10561740 System.out.println("destinationPath : " + destinationPath);
10571741 return;
10581742 }
10591743
1060
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1744
+ for (int i=group.selection.size(); --i>=0;)
10611745 {
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
+// {
10621755 loadClipboard(true);
10631756 objEditor.jTree.setSelectionPath(destinationPath);
10641757 pasteInto(false, false);
1065
- } else {
1066
- loadClipboard(false);
1067
- objEditor.jTree.setSelectionPath(destinationPath);
1068
- pasteInto(false, false); // true); // ???
1069
- }
1758
+// } else {
1759
+// loadClipboard(false);
1760
+// objEditor.jTree.setSelectionPath(destinationPath);
1761
+// pasteInto(false, false); // true); // ???
1762
+// }
10701763 }
10711764 public void dropActionChanged(DropTargetDragEvent dtde)
10721765 // Called if the user has modified the current drop gesture
....@@ -1171,22 +1864,30 @@
11711864 {
11721865 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11731866 //heightFieldItem.addActionListener(this);
1174
- gridItem = menu.add(new MenuItem("Grid"));
1175
- gridItem.addActionListener(this);
1176
- rectoidItem = menu.add(new MenuItem("Box"));
1177
- rectoidItem.addActionListener(this);
1178
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1179
- ellipsoidItem.addActionListener(this);
1180
- coneItem = menu.add(new MenuItem("Cone"));
1181
- coneItem.addActionListener(this);
1182
- torusItem = menu.add(new MenuItem("Torus"));
1183
- torusItem.addActionListener(this);
1184
- superItem = menu.add(new MenuItem("Superellipsoid"));
1185
- 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
+ {
11861885 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11871886 kleinItem.addActionListener(this);
1188
- particleItem = menu.add(new MenuItem("Particle system"));
1189
- particleItem.addActionListener(this);
1887
+ }
1888
+
1889
+// particleItem = menu.add(new MenuItem("Particle system"));
1890
+// particleItem.addActionListener(this);
11901891 if (Globals.ADVANCED)
11911892 {
11921893 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1212,15 +1913,15 @@
12121913 }
12131914 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12141915 bezierItem.addActionListener(this);
1215
- overlayItem = menu.add(new MenuItem("Overlay"));
1216
- overlayItem.addActionListener(this);
1217
- lightItem = menu.add(new MenuItem("Light"));
1218
- 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);
12191920 menu.add("-");
12201921 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12211922 //superLoopItem.addActionListener(this);
1222
- loopItem = menu.add(new MenuItem("Loop"));
1223
- loopItem.addActionListener(this);
1923
+// loopItem = menu.add(new MenuItem("Loop"));
1924
+// loopItem.addActionListener(this);
12241925 doubleItem = menu.add(new MenuItem("Fork"));
12251926 doubleItem.addActionListener(this);
12261927 if (Globals.ADVANCED)
....@@ -1236,6 +1937,9 @@
12361937 animationItem.addItemListener(this);
12371938 animationItem.setState(Globals.ANIMATION);
12381939
1940
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1941
+ archiveItem.addActionListener(this);
1942
+
12391943 menu.add("-");
12401944 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12411945 parseverticesItem.addActionListener(this);
....@@ -1248,6 +1952,8 @@
12481952 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12491953 reduce34MorphItem.addActionListener(this);
12501954 menu.add("-");
1955
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1956
+ memoryItem.addActionListener(this);
12511957 menu.add(computeAOItem = new MenuItem("Compute AO"));
12521958 computeAOItem.addActionListener(this);
12531959
....@@ -1256,11 +1962,9 @@
12561962 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12571963 mirrorItem.addActionListener(this);
12581964 menu.add("-");
1259
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1260
- memoryItem.addActionListener(this);
12611965 menu.add(analyzeItem = new MenuItem("Analyze"));
12621966 analyzeItem.addActionListener(this);
1263
- menu.add(dumpItem = new MenuItem("Dump"));
1967
+ menu.add(dumpItem = new MenuItem("Print"));
12641968 dumpItem.addActionListener(this);
12651969 // menu.add(pathItem = new MenuItem("From-to path"));
12661970 // pathItem.addActionListener(this);
....@@ -1401,9 +2105,34 @@
14012105 shadow.material = new cMaterial(obj.material);
14022106 shadow.material.diffuse = 0.0001f;
14032107 shadow.material.specular = 0.0001f;
2108
+ //shadow.projectedVertices[1].x = 300;
14042109
14052110 makeSomething(shadow);
14062111 }
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
+ }
14072136
14082137 /**
14092138 * applyExample
....@@ -1648,7 +2377,7 @@
16482377 {
16492378 ScreenFit();
16502379 } else
1651
- if (source == switchItem)
2380
+ if (source == switchViewItem)
16522381 {
16532382 cVector v1 = new cVector();
16542383 cVector v2 = new cVector();
....@@ -1657,11 +2386,11 @@
16572386 objEditor.cameraView.renderCamera.setAim(v2, v1);
16582387 objEditor.cameraView.repaint();
16592388 } else
1660
- if (source == rectoidItem)
2389
+ if (source == rectoidItem || source == boxButton)
16612390 {
16622391 makeSomething(new Box());
16632392 } else
1664
- if (source == particleItem)
2393
+ if (source == particleItem || source == particlesButton)
16652394 {
16662395 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16672396 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1740,27 +2469,27 @@
17402469
17412470 makeSomething(obj);
17422471 } else
1743
- if (source == gridItem)
2472
+ if (source == gridItem || source == gridButton)
17442473 {
17452474 makeSomething(new Grid());
17462475 } else
1747
- if (source == ellipsoidItem)
2476
+ if (source == ellipsoidItem || source == sphereButton)
17482477 {
17492478 makeSomething(new Sphere());
17502479 } else
1751
- if (source == coneItem)
2480
+ if (source == coneItem || source == coneButton)
17522481 {
17532482 makeSomething(new Cone());
17542483 } else
1755
- if (source == torusItem)
2484
+ if (source == torusItem || source == torusButton)
17562485 {
17572486 makeSomething(new Torus());
17582487 } else
1759
- if (source == superItem)
2488
+ if (source == superItem || source == superButton)
17602489 {
17612490 makeSomething(new Superellipsoid());
17622491 } else
1763
- if (source == kleinItem)
2492
+ if (source == kleinItem || source == kleinButton)
17642493 {
17652494 makeSomething(new Klein());
17662495 } else
....@@ -1780,7 +2509,7 @@
17802509 {
17812510 makeSomething(new BezierSurface());
17822511 } else
1783
- if (source == overlayItem)
2512
+ if (source == overlayItem || source == overlayButton)
17842513 {
17852514 /*
17862515 Object3D obj = new BezierSurface(5,8);
....@@ -1828,10 +2557,27 @@
18282557 s.setup();
18292558 makeSomething(s);
18302559 } else
1831
- if (source == lightItem)
2560
+ if (source == lightItem || source == lightButton)
18322561 {
18332562 makeSomething(new Light());
18342563 } 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
18352581 if (source == csgItem)
18362582 {
18372583 group(new CSG());
....@@ -1878,30 +2624,30 @@
18782624
18792625 group(g);
18802626 } else
1881
- if (source == loopItem)
2627
+ if (source == loopItem || source == loopButton)
18822628 {
18832629 Composite csg = new GroupLeaf();
18842630 csg.count = 5;
18852631 group(csg);
1886
- Composite child = new cGroup();
2632
+ Composite child = new cGroup("Branch");
18872633 csg.addChild(child);
18882634 child.addChild(csg);
18892635 } else
18902636 if (source == doubleItem)
18912637 {
1892
- Composite csg = new GroupLeaf();
2638
+ Composite csg = new GroupLeaf("Fork");
18932639 csg.count = 5;
18942640 group(csg);
1895
- Composite child = new cGroup();
2641
+ Composite child = new cGroup("Branch A");
18962642 csg.addChild(child);
18972643 child.addChild(csg);
1898
- child = new cGroup();
2644
+ child = new cGroup("Branch B");
18992645 csg.addChild(child);
19002646 child.addChild(csg);
19012647 } else
19022648 if (source == tripleItem)
19032649 {
1904
- Composite csg = new GroupLeaf();
2650
+ Composite csg = new GroupLeaf("Trident");
19052651 csg.count = 4;
19062652 group(csg);
19072653 Composite child = new cGroup();
....@@ -1917,7 +2663,7 @@
19172663 if (source == computeAOItem)
19182664 {
19192665 Globals.drawMode = CameraPane.OCCLUSION;
1920
- Globals.theRenderer.repaint();
2666
+ cameraView.repaint();
19212667 } else
19222668 if (source == recompileItem)
19232669 {
....@@ -1932,7 +2678,7 @@
19322678 if (source == invariantsItem)
19332679 {
19342680 System.out.println("Invariants:");
1935
- Grafreed.grafreeD.universe.invariants();
2681
+ Grafreed.grafreed.universe.invariants();
19362682 } else
19372683 if (source == memoryItem)
19382684 {
....@@ -1951,6 +2697,53 @@
19512697 {
19522698 DumpObject();
19532699 } 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
19542747 if (source == oneStepButton)
19552748 {
19562749 Globals.ONESTEP = true;
....@@ -1958,17 +2751,14 @@
19582751 } else
19592752 if (source == screenfitButton)
19602753 {
1961
- //Reload(lastConverter, lastFilename, true);
19622754 ScreenFit();
19632755 } else
19642756 if (source == screenfitpointButton)
19652757 {
1966
- //Reload(lastConverter, lastFilename, true);
19672758 ScreenFitPoint();
19682759 } else
19692760 if (source == snapobjectButton)
19702761 {
1971
- //Reload(lastConverter, lastFilename, true);
19722762 SnapObject();
19732763 } else
19742764 // if (event.getSource() == recompileButton)
....@@ -2004,6 +2794,14 @@
20042794 if (source == cutItem || source == clearButton)
20052795 {
20062796 loadClipboard(true);
2797
+ } else
2798
+ if (source == undoItem)
2799
+ {
2800
+ PreviousVersion();
2801
+ } else
2802
+ if (source == redoItem)
2803
+ {
2804
+ NextVersion();
20072805 } else
20082806 if (source == duplicateItem)
20092807 {
....@@ -2324,7 +3122,7 @@
23243122 {
23253123 StepAll();
23263124 } else
2327
- if (source == clearItem) // || event.getSource() == clearButton)
3125
+ if (source == deleteItem) // || event.getSource() == clearButton)
23283126 {
23293127 //int indices[] = jList.getSelectedIndices();
23303128 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2336,9 +3134,9 @@
23363134 {
23373135 ClearSelection(true);
23383136 } else
2339
- if (source == grabItem)
3137
+ if (source == grabItem || source == groupButton)
23403138 {
2341
- group(new cGroup(), true);
3139
+ group(new cGroup(), false); // true);
23423140 } else
23433141 if (source == hideItem)
23443142 {
....@@ -2356,11 +3154,11 @@
23563154 {
23573155 makeSomething(new Camera());
23583156 } else
2359
- if (source == compositeItem)
3157
+ if (source == compositeItem || source == compositeButton)
23603158 {
23613159 group(new Composite());
23623160 } else
2363
- if (source == randomItem)
3161
+ if (source == switchItem || source == switchButton)
23643162 {
23653163 RandomNode random = new RandomNode();
23663164 group(random);
....@@ -2462,7 +3260,7 @@
24623260 {
24633261 group(new cLinker());
24643262 } else
2465
- if (source == textureItem)
3263
+ if (source == textureItem || source == textureButton)
24663264 {
24673265 group(new TextureNode());
24683266 } else
....@@ -2482,17 +3280,30 @@
24823280 {
24833281 CastShadow(2);
24843282 } else
2485
- if (source == ungroupItem)
3283
+ if (source == ungroupItem || source == ungroupButton)
24863284 {
2487
- //ungroup();
3285
+ boolean hasRoot = false;
3286
+
24883287 for (int i=0; i<group.selection.size(); i++)
24893288 {
2490
- Ungroup(group.selection.get(i));
3289
+ if (group.selection.get(i) == group)
3290
+ {
3291
+ hasRoot = true;
3292
+ break;
3293
+ }
24913294 }
24923295
2493
- ClearSelection(false);
2494
-
2495
- 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
+ }
24963307 } else
24973308 if (source == genUVItem)
24983309 {
....@@ -2504,7 +3315,7 @@
25043315 } else
25053316 if (source == genNormalsMESHItem)
25063317 {
2507
- GenNormals(true); // TODO
3318
+ GenNormalsMESH();
25083319 } else
25093320 if (source == genNormalsORGANItem)
25103321 {
....@@ -2569,6 +3380,22 @@
25693380 if (source == unmarkleavesItem)
25703381 {
25713382 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);
25723399 } else
25733400 if (source == flipVItem)
25743401 {
....@@ -2777,7 +3604,7 @@
27773604 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27783605 {
27793606 obj = (Object3D)e.nextElement();
2780
- obj.SetBumpTexture(null);
3607
+ obj.ResetBumpTexture();
27813608 }
27823609
27833610 refreshContents();
....@@ -2793,6 +3620,31 @@
27933620
27943621 refreshContents();
27953622 } 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
27963648 if (source == flashSelectionButton)
27973649 {
27983650 CameraPane.flash = true;
....@@ -2804,6 +3656,10 @@
28043656 if (source == twoButton)
28053657 {
28063658 radio.layout = twoButton;
3659
+
3660
+ if (CameraPane.FULLSCREEN)
3661
+ fullscreenLayout = radio.layout;
3662
+
28073663 // bug
28083664 //gridPanel.setDividerLocation(1.0);
28093665 //bigPanel.setDividerLocation(0.0);
....@@ -2836,10 +3692,31 @@
28363692 bigThree.ClearUI();
28373693 bigThree.add(centralPanel);
28383694 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
+
28393713 } else
28403714 if (source == threeButton)
28413715 {
28423716 radio.layout = threeButton;
3717
+
3718
+ if (CameraPane.FULLSCREEN)
3719
+ fullscreenLayout = radio.layout;
28433720
28443721 // bigThree.remove(scenePanel);
28453722 // bigThree.remove(centralPanel);
....@@ -2869,13 +3746,18 @@
28693746 // centralPanel.setVisible(true);
28703747 // XYZPanel.setVisible(true);
28713748 bigThree.ClearUI();
3749
+ bigThree.add(scenePanel);
28723750 bigThree.add(centralPanel);
2873
- bigThree.add(XYZPanel);
28743751 bigThree.FlushUI();
3752
+
3753
+ cameraView.requestFocusInWindow();
28753754 } else
28763755 if (source == fourButton)
28773756 {
28783757 radio.layout = fourButton;
3758
+
3759
+ if (CameraPane.FULLSCREEN)
3760
+ fullscreenLayout = radio.layout;
28793761
28803762 // bigThree.remove(scenePanel);
28813763 // bigThree.remove(centralPanel);
....@@ -2907,10 +3789,15 @@
29073789 bigThree.ClearUI();
29083790 bigThree.add(scenePanel);
29093791 bigThree.FlushUI();
3792
+
3793
+ cameraView.requestFocusInWindow();
29103794 } else
29113795 if (source == sixButton)
29123796 {
29133797 radio.layout = sixButton;
3798
+
3799
+ if (CameraPane.FULLSCREEN)
3800
+ fullscreenLayout = radio.layout;
29143801
29153802 // bigThree.remove(scenePanel);
29163803 // bigThree.remove(centralPanel);
....@@ -2940,13 +3827,18 @@
29403827 // centralPanel.setVisible(true);
29413828 // XYZPanel.setVisible(false);
29423829 bigThree.ClearUI();
2943
- bigThree.add(scenePanel);
29443830 bigThree.add(centralPanel);
3831
+ bigThree.add(scenePanel);
29453832 bigThree.FlushUI();
3833
+
3834
+ cameraView.requestFocusInWindow();
29463835 } else
29473836 if (source == sevenButton)
29483837 {
29493838 radio.layout = sevenButton;
3839
+
3840
+ if (CameraPane.FULLSCREEN)
3841
+ fullscreenLayout = radio.layout;
29503842
29513843 // bigThree.remove(scenePanel);
29523844 // bigThree.remove(centralPanel);
....@@ -2980,6 +3872,8 @@
29803872 bigThree.add(centralPanel);
29813873 bigThree.add(XYZPanel);
29823874 bigThree.FlushUI();
3875
+
3876
+ cameraView.requestFocusInWindow();
29833877 } else
29843878 if (source == rootButton)
29853879 {
....@@ -2991,6 +3885,7 @@
29913885 EditObject(obj);
29923886 }
29933887
3888
+ cameraView.requestFocusInWindow();
29943889 refreshContents(true);
29953890 } else
29963891 if (source == closeButton)
....@@ -3000,22 +3895,37 @@
30003895 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30013896 {
30023897 ab = (cRadio)e.nextElement();
3003
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3898
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30043899 {
3900
+ // Patch to avoid bug with transparency.
3901
+ if (!ab.hadMaterial)
3902
+ {
3903
+ ab.object.material = null;
3904
+ }
3905
+
30053906 buttonGroup.remove(ab);
30063907 radioPanel.remove(ab);
30073908
3008
- ab.GetObject().editWindow = null;
3909
+ //ab.GetObject().editWindow = null;
3910
+ ab.GetObject().manipWindow = null;
30093911 // ab.GetObject().objectUI = null; // ?????????
30103912
30113913 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30123914 break;
30133915 }
30143916 }
3917
+
3918
+ cameraView.requestFocusInWindow();
30153919 refreshContents(true);
30163920 } else
30173921 if (source == editItem || source == editButton)
30183922 {
3923
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3924
+ {
3925
+ Object3D child = (Object3D)e.nextElement();
3926
+ child.pinned = true;
3927
+ }
3928
+
30193929 EditSelection(false);
30203930 } else
30213931 if (source == uneditButton)
....@@ -3024,11 +3934,12 @@
30243934 {
30253935 Object3D child = (Object3D)e.nextElement();
30263936 if(child.editWindow != null)
3027
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3937
+ child.pinned = false;
30283938 child.CloseUI();
30293939 listUI.remove(child);
3940
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30303941
3031
- child.editWindow = null; // ???????????
3942
+ //child.editWindow = null; // ???????????
30323943 }
30333944 objEditor.ctrlPanel.FlushUI();
30343945 //objEditor.jTree.clearSelection();
....@@ -3041,16 +3952,18 @@
30413952 //copy.ClearUI();
30423953 for (Object3D obj : listUI)
30433954 {
3955
+ obj.pinned = false;
30443956 obj.CloseUI();
30453957 }
30463958 listUI.clear();
3959
+ SetPinStates(group.selection.size() > 0);
30473960 refreshContents(true);
30483961 } else
30493962 if (source == allParamsButton)
30503963 {
30513964 assert(copy == group);
30523965
3053
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3966
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30543967
30553968 for (Object3D obj : listUI)
30563969 {
....@@ -3099,6 +4012,9 @@
30994012 }
31004013
31014014 copy = group;
4015
+
4016
+ SetUndoStates();
4017
+
31024018 //Globals.theRenderer.object = group;
31034019 if(!useclient)
31044020 {
....@@ -3115,7 +4031,9 @@
31154031 sideView.object = group;
31164032 }
31174033
3118
-// fix "+" issue group.editWindow = this;
4034
+// fix "+" issue
4035
+ //group.editWindow = this;
4036
+ group.manipWindow = this;
31194037
31204038 /*
31214039 currentLayout = radio.layout;
....@@ -3123,20 +4041,32 @@
31234041 currentLayout = sevenButton;
31244042 */
31254043 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);
31264052 keepparent = group.parent;
31274053 // PARENT = NULL or not???
31284054 //group.parent = null; // ROOT
31294055 //group.attributes = -1;
31304056 ResetModel();
4057
+
4058
+ cameraView.requestFocusInWindow();
31314059 refreshContents(true);
31324060 } else if (event.getSource() == editCameraItem)
31334061 {
31344062 cameraView.ProtectCamera();
4063
+ cameraView.requestFocusInWindow();
31354064 cameraView.repaint();
31364065 return;
3137
- } else if (event.getSource() == revertCameraItem)
4066
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31384067 {
31394068 cameraView.RevertCamera();
4069
+ cameraView.requestFocusInWindow();
31404070 cameraView.repaint();
31414071 return;
31424072 // } else if (event.getSource() == textureButton)
....@@ -3151,7 +4081,6 @@
31514081 }
31524082
31534083 boolean useclient = false;
3154
- cRadio radio;
31554084
31564085 void ToggleRoot()
31574086 {
....@@ -3390,7 +4319,8 @@
33904319
33914320 int size = obj.MemorySize();
33924321
3393
- 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)");
33944324 }
33954325 }
33964326 catch (Exception e)
....@@ -3471,6 +4401,13 @@
34714401 void GenNormals(boolean crease)
34724402 {
34734403 group.GenNormalsS(crease);
4404
+
4405
+ refreshContents();
4406
+ }
4407
+
4408
+ void GenNormalsMESH()
4409
+ {
4410
+ group.GenNormalsMeshS();
34744411
34754412 refreshContents();
34764413 }
....@@ -3706,7 +4643,7 @@
37064643
37074644 try
37084645 {
3709
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4646
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
37104647 }
37114648 catch (Exception e)
37124649 {
....@@ -4098,6 +5035,18 @@
40985035 refreshContents();
40995036 }
41005037
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
+
41015050 void SetTexRes(int tr)
41025051 {
41035052 group.selection.SetTexRes(tr);
....@@ -4169,28 +5118,25 @@
41695118 // }
41705119 // }
41715120
4172
- static boolean allparams = true;
4173
-
4174
- static Vector<Object3D> listUI = new Vector<Object3D>();
4175
-
41765121 void EditSelection(boolean newWindow)
41775122 {
5123
+ if (group.selection == null)
5124
+ {
5125
+ EditElement(group, newWindow); // ? new
5126
+ return;
5127
+ }
5128
+
41785129 // aConstraints.gridy = 0;
41795130 for (int i=0; i<group.selection.size(); i++)
41805131 {
41815132 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41825133 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4183
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5134
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41845135
41855136 Object3D elem = (Object3D)group.selection.elementAt(i);
41865137 if(elem != group || !newWindow)
41875138 {
4188
- // if (!(elem instanceof Composite))
4189
- // newWindow = false;
4190
- listUI.add(elem);
4191
- elem.openEditWindow(this, newWindow); //, false);
4192
- System.out.println("edit : " + elem);
4193
- elem.editWindow.refreshContents(true); // ? new
5139
+ EditElement(elem, newWindow); // ? new
41945140 }
41955141 }
41965142 }
....@@ -4253,9 +5199,7 @@
42535199
42545200 freezemodel = false;
42555201 }
4256
-
4257
- boolean flashIt = true;
4258
-
5202
+
42595203 public void valueChanged(TreeSelectionEvent e)
42605204 //public boolean handleEvent(Event event)
42615205 {
....@@ -4265,7 +5209,8 @@
42655209 //new Exception().printStackTrace();
42665210
42675211 freezemodel = true;
4268
-
5212
+ ClearUnpinned();
5213
+
42695214 /**/
42705215 //switch (event.id)
42715216 {
....@@ -4273,7 +5218,6 @@
42735218 //case 702: // Event.LIST_DESELECT
42745219 group.deselectAll();
42755220 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4276
- objEditor.ClearInfo(); // .GetMaterial());
42775221 if (tps != null)
42785222 {
42795223 for (int i=0; i < tps.length; i++)
....@@ -4282,10 +5226,8 @@
42825226
42835227 //if (child.parent != null)
42845228 //child.parent.addSelectee(child);
5229
+ objEditor.SetMaterial(child);
42855230 group.addSelectee(child);
4286
- objEditor.SetMaterial(child); // .GetMaterial());
4287
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4288
- System.err.println("info : " + child.GetPath());
42895231 }
42905232 }
42915233 // else
....@@ -4295,20 +5237,28 @@
42955237 // System.err.println("info : " + group.GetPath());
42965238 // }
42975239
4298
- objEditor.SetText(); // jan 2014
4299
-
4300
- 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))
43015241 CameraPane.flash = true;
43025242
4303
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5243
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43045244 // a camera
43055245 {
4306
- CameraPane.camerachangeframe = 0; // don't refuse it
4307
- 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
+ }
43085251 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
43095252 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43105253 }
43115254
5255
+ if (tps != null && tps.length == 1)
5256
+ {
5257
+ EditSelection(false);
5258
+ }
5259
+
5260
+ SetPinStates(tps != null && tps.length > 0);
5261
+
43125262 refreshContents();
43135263 //return true;
43145264 }
....@@ -4317,6 +5267,37 @@
43175267
43185268 freezemodel = false;
43195269 }
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
+ }
43205301
43215302 void linkSomething(Object3D thing)
43225303 {
....@@ -4388,6 +5369,7 @@
43885369 {
43895370 if (group.selection.isEmpty())
43905371 return;
5372
+
43915373 Grafreed.clipboardIsTempGroup = false;
43925374 Composite tGroup = null;
43935375 if (group.selection.size() > 0) // 1)
....@@ -4398,6 +5380,8 @@
43985380
43995381 if (cut)
44005382 {
5383
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5384
+// Save();
44015385 //int indices[] = jList.getSelectedIndices();
44025386 //for (int i = indices.length - 1; i >= 0; i--)
44035387 //jList.remove(indices[i]);
....@@ -4487,8 +5471,10 @@
44875471 }
44885472
44895473 }
5474
+
44905475 if (Grafreed.clipboardIsTempGroup)
44915476 Grafreed.clipboard = tGroup;
5477
+
44925478 if (cut)
44935479 {
44945480 ResetModel();
....@@ -4498,6 +5484,10 @@
44985484
44995485 void paste(boolean expand)
45005486 {
5487
+ if (Globals.REPLACEONMAKE)
5488
+ Save();
5489
+ boolean keep = Globals.REPLACEONMAKE;
5490
+ Globals.REPLACEONMAKE = false;
45015491 // if (GrafreeD.clipboard == null)
45025492 // return;
45035493 boolean first = true;
....@@ -4557,6 +5547,7 @@
45575547 Grafreed.clipboard.get(0).parent = keepparent;
45585548 }
45595549
5550
+ Globals.REPLACEONMAKE = keep;
45605551 ResetModel();
45615552 refreshContents();
45625553 }
....@@ -4692,6 +5683,10 @@
46925683
46935684 void group(Object3D csg, boolean grab)
46945685 {
5686
+ if (Globals.REPLACEONMAKE)
5687
+ Save();
5688
+ boolean keep = Globals.REPLACEONMAKE;
5689
+ Globals.REPLACEONMAKE = false;
46955690 if (//false) // why??
46965691 !group.selection.isEmpty())
46975692 {
....@@ -4805,10 +5800,15 @@
48055800 //node.add(csg);
48065801 //makeSomething(node);
48075802 makeSomething(csg);
5803
+ Globals.REPLACEONMAKE = keep;
48085804 }
48095805
48105806 void Ungroup(Object3D g)
48115807 {
5808
+ if (Globals.REPLACEONMAKE)
5809
+ Save();
5810
+ boolean keep = Globals.REPLACEONMAKE;
5811
+ Globals.REPLACEONMAKE = false;
48125812 if (g instanceof HiddenObject)
48135813 {
48145814 HiddenObject h = (HiddenObject) g;
....@@ -4825,6 +5825,7 @@
48255825 objEditor.makeSomething(g.get(i), false);
48265826 }
48275827 }
5828
+ Globals.REPLACEONMAKE = keep;
48285829 }
48295830
48305831 void ungroup()
....@@ -5113,7 +6114,43 @@
51136114 cButton clearpanelButton;
51146115 cButton unselectButton;
51156116
6117
+ cButton restoreCameraButton;
6118
+
51166119 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;
51176154
51186155 cButton screenfitButton;
51196156 cButton screenfitpointButton;
....@@ -5126,14 +6163,6 @@
51266163
51276164 cButton setsupportButton;
51286165
5129
- cButton twoButton;
5130
- cButton sixButton;
5131
- cButton threeButton;
5132
- cButton sevenButton;
5133
- cButton fourButton; // full panel
5134
- cButton oneButton; // full XYZ
5135
- //cButton currentLayout;
5136
-
51376166 //
51386167 //Composite
51396168 Object3D // to do !!
....@@ -5143,9 +6172,11 @@
51436172 //JTree jTree;
51446173 private MenuItem lookAtItem;
51456174 private MenuItem lookFromItem;
5146
- private MenuItem switchItem;
6175
+ private MenuItem switchViewItem;
51476176 private MenuItem cutItem;
5148
- private MenuItem duplicateItem;
6177
+ private MenuItem undoItem;
6178
+ private MenuItem redoItem;
6179
+ private JMenuItem duplicateItem;
51496180 private MenuItem cloneItem;
51506181 private MenuItem cloneSupportItem;
51516182 private MenuItem overwriteGeoItem;
....@@ -5173,7 +6204,7 @@
51736204 private MenuItem pasteLinkItem;
51746205 private MenuItem pasteCloneItem;
51756206 private MenuItem pasteExpandItem;
5176
- private MenuItem clearItem;
6207
+ private MenuItem deleteItem;
51776208 private MenuItem clearAllItem;
51786209 private MenuItem genUVItem;
51796210 private MenuItem genNormalsMESHItem;
....@@ -5208,6 +6239,10 @@
52086239 private MenuItem showleavesItem;
52096240 private MenuItem markleavesItem;
52106241 private MenuItem unmarkleavesItem;
6242
+ private MenuItem rewindleavesItem;
6243
+ private MenuItem unrewindleavesItem;
6244
+ private MenuItem randomleavesItem;
6245
+ private MenuItem unrandomleavesItem;
52116246
52126247 private MenuItem flipVItem;
52136248 private MenuItem unflipVItem;
....@@ -5229,7 +6264,7 @@
52296264 private MenuItem frontItem;
52306265 private MenuItem cameraItem;
52316266 private MenuItem compositeItem;
5232
- private MenuItem randomItem;
6267
+ private MenuItem switchItem;
52336268 private MenuItem physicsItem;
52346269 private MenuItem frameselectorItem;
52356270 private MenuItem scriptNodeItem;
....@@ -5253,6 +6288,8 @@
52536288 private MenuItem attachBumpItem;
52546289 private MenuItem detachBumpItem;
52556290 private MenuItem pigmentBumpItem;
6291
+ private MenuItem embedTexturesItem;
6292
+ private MenuItem deEmbedTexturesItem;
52566293
52576294 private MenuItem particleItem;
52586295 private MenuItem ragdollItem;
....@@ -5303,5 +6340,5 @@
53036340
53046341 Menu cameraMenu;
53056342 MenuItem editCameraItem;
5306
- MenuItem revertCameraItem;
6343
+ MenuItem restoreCameraItem;
53076344 }