Normand Briere
2019-08-07 59de607850161a26863f92961d53caae7a2dabc8
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,314 @@
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 AddSkyboxTab0(JTabbedPane skyboxpanel)
46
+ {
47
+ cGridBag tab0 = new cGridBag().setVertical(true);
48
+
49
+ tab0.setName("Urban");
50
+ skyboxpanel.add(tab0);
51
+
52
+ cGridBag row0 = new cGridBag();
53
+ cGridBag row1 = new cGridBag();
54
+ cGridBag row2 = new cGridBag();
55
+ cGridBag row3 = new cGridBag();
56
+ cGridBag row4 = new cGridBag();
57
+ cGridBag row5 = new cGridBag();
58
+ cGridBag row6 = new cGridBag();
59
+
60
+ AddSkyboxButton("default", "rgb", row0);
61
+ //AddSkyboxButton("default", "cornell", row0);
62
+ AddSkyboxButton("penguins", "dust", row0);
63
+ AddSkyboxButton("penguins", "tropic", row0);
64
+ AddSkyboxButton("penguins", "yonder", row0);
65
+
66
+ AddSkyboxButton("default", "uffizi", row1);
67
+ AddSkyboxButton("bridge", "Bridge", row1);
68
+ AddSkyboxButton("bridge", "Bridge2", row1);
69
+ AddSkyboxButton("urban", "GamlaStan2", row1);
70
+
71
+ AddSkyboxButton("urban", "Parliament", row2);
72
+ AddSkyboxButton("urban", "Roundabout", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
74
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
75
+
76
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
77
+ AddSkyboxButton("urban", "UnionSquare", row3);
78
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
79
+ AddSkyboxButton("park", "BerzeliiPark", row3);
80
+
81
+ AddSkyboxButton("park", "Buddha", row4);
82
+ AddSkyboxButton("park", "CNTower2", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
84
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
85
+
86
+ AddSkyboxButton("park", "Park", row5);
87
+ AddSkyboxButton("park", "Pond", row5);
88
+ AddSkyboxButton("park", "Skansen", row5);
89
+ AddSkyboxButton("park", "Skansen2", row5);
90
+
91
+ AddSkyboxButton("park", "Skansen3", row6);
92
+ AddSkyboxButton("park", "Skansen4", row6);
93
+ AddSkyboxButton("park", "Skansen5", row6);
94
+ AddSkyboxButton("persson", "VancouverConventionCentre", row6);
95
+
96
+ tab0.add(row0);
97
+ tab0.add(row1);
98
+ tab0.add(row2);
99
+ tab0.add(row3);
100
+ tab0.add(row4);
101
+ tab0.add(row5);
102
+ tab0.add(row6);
103
+
104
+ for (int i=5; --i>=0;)
105
+ {
106
+ //oe.toolboxPanel.Return();
107
+ //tab0.add(new cGridBag());
108
+ }
109
+ }
110
+
111
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
112
+ {
113
+ cGridBag tab0 = new cGridBag().setVertical(true);
114
+
115
+ tab0.setName("Nature");
116
+ skyboxpanel.add(tab0);
117
+
118
+ cGridBag row0 = new cGridBag();
119
+ cGridBag row1 = new cGridBag();
120
+ cGridBag row2 = new cGridBag();
121
+ cGridBag row3 = new cGridBag();
122
+ cGridBag row4 = new cGridBag();
123
+ cGridBag row5 = new cGridBag();
124
+ cGridBag row6 = new cGridBag();
125
+
126
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
127
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
128
+ AddSkyboxButton("beach", "PalmTrees", row0);
129
+ AddSkyboxButton("beach", "Tenerife", row0);
130
+
131
+ AddSkyboxButton("beach", "Tenerife2", row1);
132
+ AddSkyboxButton("beach", "Tenerife3", row1);
133
+ AddSkyboxButton("field", "FishPond", row1);
134
+ AddSkyboxButton("field", "Footballfield", row1);
135
+
136
+ AddSkyboxButton("field", "Meadow", row2);
137
+ AddSkyboxButton("field", "Sorsele", row2);
138
+ AddSkyboxButton("field", "Sorsele2", row2);
139
+ AddSkyboxButton("field", "Sorsele3", row2);
140
+
141
+ AddSkyboxButton("forest", "Brudslojan", row3);
142
+ AddSkyboxButton("forest", "Langholmen2", row3);
143
+ AddSkyboxButton("forest", "Plants", row3);
144
+ AddSkyboxButton("mountain", "Maskonaive", row3);
145
+
146
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
147
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
148
+ AddSkyboxButton("mountain", "Teide", row4);
149
+ AddSkyboxButton("park", "Tantolunden4", row4);
150
+
151
+ AddSkyboxButton("park", "Stairs", row5);
152
+ AddSkyboxButton("default", "skycube", row6);
153
+ AddSkyboxButton("rocky", "Langholmen", row5);
154
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
155
+
156
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
157
+ AddSkyboxButton("default", "CloudyHills", row6);
158
+ AddSkyboxButton("daz", "Autumn", row6);
159
+ AddSkyboxButton("daz", "MountainTrail", row6);
160
+ /*
161
+Autumn
162
+Greenlands
163
+MountainTrail
164
+Oasis
165
+TheRock
166
+TopOfTheWorld
167
+Winter
168
+ */
169
+
170
+ tab0.add(row0);
171
+ tab0.add(row1);
172
+ tab0.add(row2);
173
+ tab0.add(row3);
174
+ tab0.add(row4);
175
+ tab0.add(row5);
176
+ tab0.add(row6);
177
+
178
+ for (int i=5; --i>=0;)
179
+ {
180
+ //oe.toolboxPanel.Return();
181
+ //tab0.add(new cGridBag());
182
+ }
183
+ }
184
+
185
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
186
+ {
187
+ cGridBag tab0 = new cGridBag().setVertical(true);
188
+
189
+ tab0.setName("Night");
190
+ skyboxpanel.add(tab0);
191
+
192
+ cGridBag row0 = new cGridBag();
193
+ cGridBag row1 = new cGridBag();
194
+ cGridBag row2 = new cGridBag();
195
+ cGridBag row3 = new cGridBag();
196
+ cGridBag row4 = new cGridBag();
197
+ cGridBag row5 = new cGridBag();
198
+ cGridBag row6 = new cGridBag();
199
+
200
+ AddSkyboxButton("night", "NightPath", row0);
201
+ AddSkyboxButton("night", "PondNight", row0);
202
+ AddSkyboxButton("night", "Powerlines", row0);
203
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
204
+
205
+ AddSkyboxButton("urban", "CNTower", row1);
206
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
207
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
208
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
209
+
210
+ AddSkyboxButton("penguins", "kenon_star", row2);
211
+ AddSkyboxButton("persson", "corona", row2);
212
+ AddSkyboxButton("persson", "spaceskybox", row2);
213
+ AddSkyboxButton("indoors", "Vasa", row2);
214
+
215
+ AddSkyboxButton("winter", "Backyard", row3);
216
+ AddSkyboxButton("winter", "Creek", row3);
217
+ AddSkyboxButton("winter", "FootballField3", row3);
218
+ AddSkyboxButton("winter", "Forest", row3);
219
+
220
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
221
+ AddSkyboxButton("winter", "House", row4);
222
+ AddSkyboxButton("winter", "IceLake", row4);
223
+ AddSkyboxButton("winter", "IceRiver", row4);
224
+
225
+ AddSkyboxButton("winter", "Park3", row5);
226
+ AddSkyboxButton("winter", "PondWinter", row5);
227
+ AddSkyboxButton("winter", "Tantolunden5", row5);
228
+ AddSkyboxButton("winter", "Vindelalven", row5);
229
+
230
+ AddSkyboxButton("daz", "TheRock", row6);
231
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
232
+ AddSkyboxButton("daz", "Winter", row6);
233
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
234
+
235
+ tab0.add(row0);
236
+ tab0.add(row1);
237
+ tab0.add(row2);
238
+ tab0.add(row3);
239
+ tab0.add(row4);
240
+ tab0.add(row5);
241
+ tab0.add(row6);
242
+
243
+ for (int i=5; --i>=0;)
244
+ {
245
+ //oe.toolboxPanel.Return();
246
+ //tab0.add(new cGridBag());
247
+ }
248
+ }
249
+
250
+ public void AddSkyboxTab3(JTabbedPane skyboxpanel)
251
+ {
252
+ cGridBag tab0 = new cGridBag().setVertical(true);
253
+
254
+ tab0.setName("Others");
255
+ skyboxpanel.add(tab0);
256
+
257
+ cGridBag row0 = new cGridBag();
258
+ cGridBag row1 = new cGridBag();
259
+ cGridBag row2 = new cGridBag();
260
+ cGridBag row3 = new cGridBag();
261
+ cGridBag row4 = new cGridBag();
262
+ cGridBag row5 = new cGridBag();
263
+ cGridBag row6 = new cGridBag();
264
+
265
+ AddSkyboxButton("mayhem", "afterrain", row0);
266
+ AddSkyboxButton("mayhem", "aqua4", row0);
267
+ AddSkyboxButton("mayhem", "aqua9", row0);
268
+ AddSkyboxButton("mayhem", "flame", row0);
269
+
270
+ AddSkyboxButton("mayhem", "h2s", row1);
271
+ AddSkyboxButton("mayhem", "prehistoric", row1);
272
+ AddSkyboxButton("mayhem", "scorched", row1);
273
+ AddSkyboxButton("penguins", "desertdawn", row1);
274
+
275
+ AddSkyboxButton("persson", "Citadella", row2);
276
+ AddSkyboxButton("persson", "Citadella2", row2);
277
+ AddSkyboxButton("persson", "clouds1", row2);
278
+ AddSkyboxButton("penguins", "wrath", row2);
279
+
280
+ AddSkyboxButton("persson", "FishermansBastion", row3);
281
+ AddSkyboxButton("persson", "HeroesSquare", row3);
282
+ AddSkyboxButton("indoors", "DallasW", row3);
283
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
284
+
285
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
286
+ AddSkyboxButton("persson", "PereaBeach1", row4);
287
+ AddSkyboxButton("persson", "PereaBeach2", row4);
288
+ AddSkyboxButton("persson", "redeclipse", row4);
289
+
290
+ AddSkyboxButton("daz", "Greenlands", row5);
291
+ AddSkyboxButton("daz", "Oasis", row5);
292
+ AddSkyboxButton("elyvisions", "arch3", row5);
293
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
294
+
295
+ AddSkyboxButton("elyvisions", "rainbow", row6);
296
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
297
+ AddSkyboxButton("elyvisions", "heaven", row6);
298
+ AddSkyboxButton("elyvisions", "hot", row6);
299
+
300
+ tab0.add(row0);
301
+ tab0.add(row1);
302
+ tab0.add(row2);
303
+ tab0.add(row3);
304
+ tab0.add(row4);
305
+ tab0.add(row5);
306
+ tab0.add(row6);
307
+
308
+ for (int i=5; --i>=0;)
309
+ {
310
+ //oe.toolboxPanel.Return();
311
+ //tab0.add(new cGridBag());
312
+ }
313
+ }
314
+
315
+ public void CallBack(String[] path)
316
+ {
317
+ for (int i = 0; i < path.length; i++)
318
+ {
319
+ System.out.print(path[i] + "/");
320
+ }
321
+
322
+ System.out.println();
323
+ }
324
+
325
+ public void ChangeSkybox(String skybox)
326
+ {
327
+ //cameraView.envyoff = false;
328
+ group.skyboxname = skybox;
329
+ group.skyboxext = "jpg";
330
+ cameraView.repaint();
331
+
332
+ Grafreed.ParseResources("textures", this);
333
+ }
334
+
26335 //ObjEditor objEditor;
27336 public void closeUI2()
28337 {
....@@ -60,6 +369,12 @@
60369 this.copy = this.group = group;
61370 //selectees = this.group.selectees;
62371
372
+ if (copy.versionlist == null)
373
+ {
374
+ copy.versionlist = new Object3D[100];
375
+ copy.versionindex = -1;
376
+ }
377
+
63378 if(ui)
64379 SetupUI(objEditor);
65380 }
....@@ -74,16 +389,28 @@
74389 this.copy = this.group = copy;
75390 //selectees = this.group.selectees;
76391
77
- SetupMenu2(objEditor);
392
+ SetupMenu2(this); //objEditor);
78393 SetupUI2(objEditor);
79394 objEditor.SetupUI(true);
80395 SetupViews(objEditor);
81396
82397 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
398
+
399
+ if (copy.versionlist == null)
400
+ {
401
+ copy.versionlist = new Object3D[100];
402
+ copy.versionindex = -1;
403
+
404
+ Save(true);
405
+ }
83406 }
84407
85408 void CloneSelection(boolean supports)
86409 {
410
+ if (Globals.REPLACEONMAKE)
411
+ Save();
412
+ boolean keep = Globals.REPLACEONMAKE;
413
+ Globals.REPLACEONMAKE = false;
87414 // Object3D keep = GrafreeD.clipboard;
88415 //Object3D obj;
89416 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,18 +421,19 @@
94421
95422 makeSomething(clone, i==group.selection.size()-1);
96423 }
424
+ Globals.REPLACEONMAKE = keep;
97425 }
98426
99427 void CloneClipboard(boolean supports)
100428 {
101
- assert(GrafreeD.clipboard.parent == null);
102
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
103
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
104
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
105
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
429
+ assert(Grafreed.clipboard.parent == null);
430
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
431
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
432
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
433
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
106434 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
435
+ makeSomething(CloneObject(Grafreed.clipboard, false));
436
+ Grafreed.clipboard.get(0).parent = keepparent;
109437 }
110438
111439 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +447,7 @@
119447 // obj.support = null;
120448 if (!supports)
121449 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
450
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123451 obj.parent = parent;
124452 // obj.support = support;
125453 // clone.support = support; // aout 2013
....@@ -148,30 +476,29 @@
148476
149477 //JTextField nameField;
150478
151
- void SetupMenu2(ObjEditor oe)
479
+ void SetupMenu2(GroupEditor oe)
152480 {
153
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
154
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
155
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
156
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
157
- oe.cameraMenu.add("-");
158
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
159
- openWindowItem.addActionListener(this);
160
- editLeafItem.addActionListener(this);
161
- lookAtItem.addActionListener(this);
162
- //lookFromItem.addActinoListener(this);
163
- //switchItem.addActionListener(this);
481
+ oe.jTree = new cTree();
482
+
164483 Menu menu;
165484 oe.menuBar.add(menu = new Menu("Edit"));
166485 //editItem = menu.add(new MenuItem("Edit"));
167486 //editItem.addActionListener(this);
168
- duplicateItem = menu.add(new MenuItem("Duplicate"));
487
+
488
+// undoItem = menu.add(new MenuItem("Undo"));
489
+// undoItem.addActionListener(this);
490
+// redoItem = menu.add(new MenuItem("Redo"));
491
+// redoItem.addActionListener(this);
492
+// menu.add("-");
493
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
169494 duplicateItem.addActionListener(this);
170
- menu.add("-");
171495 cloneItem = menu.add(new MenuItem("Clone"));
172496 cloneItem.addActionListener(this);
497
+ if (Globals.ADVANCED)
498
+ {
173499 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
174500 cloneSupportItem.addActionListener(this);
501
+ }
175502 menu.add("-");
176503 cutItem = menu.add(new MenuItem("Cut"));
177504 cutItem.addActionListener(this);
....@@ -179,27 +506,123 @@
179506 copyItem.addActionListener(this);
180507 pasteItem = menu.add(new MenuItem("Paste"));
181508 pasteItem.addActionListener(this);
509
+
510
+ menu.add("-");
511
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
512
+ pasteIntoItem.addActionListener(this);
182513 pasteLinkItem = menu.add(new MenuItem("Paste link"));
183514 pasteLinkItem.addActionListener(this);
184515 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
185516 pasteCloneItem.addActionListener(this);
186517 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
187518 // pasteExpandItem.addActionListener(this);
188
- clearItem = menu.add(new MenuItem("Clear"));
189
- clearItem.addActionListener(this);
519
+ menu.add("-");
520
+ deleteItem = menu.add(new MenuItem("Delete"));
521
+ deleteItem.addActionListener(this);
522
+
523
+ if (Globals.ADVANCED)
524
+ {
525
+ // Deletes the cameras...
190526 clearAllItem = menu.add(new MenuItem("Clear All"));
191527 clearAllItem.addActionListener(this);
528
+ }
529
+
530
+ menuBar.add(cameraMenu = new Menu("View"));
531
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
532
+ //zBufferItem.addActionListener(this);
533
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
534
+ //normalLensItem.addActionListener(this);
535
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
536
+ restoreCameraItem.addActionListener(this);
537
+
538
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
539
+// toggleFullScreenItem.addItemListener(this);
540
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
541
+// cameraMenu.add("-");
542
+//
543
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
544
+// toggleTextureItem.addItemListener(this);
545
+// toggleTextureItem.setState(CameraPane.textureon);
546
+//
547
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
548
+// toggleSwitchItem.addItemListener(this);
549
+// toggleSwitchItem.setState(CameraPane.SWITCH);
550
+
551
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
552
+ toggleHandleItem.addItemListener(this);
553
+ toggleHandleItem.setState(CameraPane.HANDLES);
554
+
555
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
556
+ togglePaintItem.addItemListener(this);
557
+ togglePaintItem.setState(CameraPane.PAINTMODE);
558
+
559
+ if (Globals.ADVANCED)
560
+ {
561
+ cameraMenu.add("-");
562
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
563
+ toggleLiveItem.addItemListener(this);
564
+ toggleLiveItem.setState(Globals.isLIVE());
192565
566
+ cameraMenu.add(stepItem = new MenuItem("Step"));
567
+ stepItem.addActionListener(this);
568
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
569
+ // toggleDLItem.addItemListener(this);
570
+ // toggleDLItem.setState(false);
571
+
572
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
573
+ toggleRenderItem.addItemListener(this);
574
+ toggleRenderItem.setState(!CameraPane.frozen);
575
+
576
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
577
+ toggleDebugItem.addItemListener(this);
578
+ toggleDebugItem.setState(Globals.DEBUG);
579
+
580
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
581
+ toggleFrustumItem.addItemListener(this);
582
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
583
+
584
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
585
+ toggleFootContactItem.addItemListener(this);
586
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
587
+
588
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
589
+ toggleTimelineItem.addItemListener(this);
590
+ }
591
+
592
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
593
+// toggleRootItem.addItemListener(this);
594
+// toggleRootItem.setState(false);
595
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
596
+// animationItem.addItemListener(this);
597
+// animationItem.setState(CameraPane.ANIMATION);
598
+ cameraMenu.add("-");
599
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
600
+ editCameraItem.addActionListener(this);
601
+
602
+ if (Globals.ADVANCED)
603
+ {
604
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
605
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
606
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
607
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
608
+ oe.cameraMenu.add("-");
609
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
610
+ openWindowItem.addActionListener(this);
611
+ editLeafItem.addActionListener(this);
612
+ lookAtItem.addActionListener(this);
613
+ //lookFromItem.addActinoListener(this);
614
+ //switchViewItem.addActionListener(this);
615
+ }
616
+
193617 oe.menuBar.add(menu = new Menu("Setting"));
194
- resetMeshItem = menu.add(new MenuItem("Reset All"));
195
- resetMeshItem.addActionListener(this);
196
- stepAllItem = menu.add(new MenuItem("Step All"));
197
- stepAllItem.addActionListener(this);
618
+ if (Globals.ADVANCED)
619
+ {
198620 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
199621 revertMeshItem.addActionListener(this);
200622 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
201623 resetreferencesItem.addActionListener(this);
202624 menu.add("-");
625
+ }
203626 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
204627 overwriteGeoItem.addActionListener(this);
205628 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -211,79 +634,104 @@
211634 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
212635 overwriteUVItem.addActionListener(this);
213636 menu.add("-");
637
+ if (Globals.ADVANCED)
638
+ {
214639 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
215640 generateMeshItem.addActionListener(this);
216641 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
217642 poseMeshItem.addActionListener(this);
218643 menu.add("-");
644
+ }
219645 resetsupportItem = menu.add(new MenuItem("Reset support"));
220646 resetsupportItem.addActionListener(this);
221647 linkverticesItem = menu.add(new MenuItem("Link to Support"));
222648 linkverticesItem.addActionListener(this);
223649 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
224650 relinkverticesItem.addActionListener(this);
651
+
652
+ if (Globals.ADVANCED)
653
+ {
225654 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
226655 setMasterItem.addActionListener(this);
656
+ }
227657
228658 oe.menuBar.add(menu = new Menu("Group"));
229
- grabItem = menu.add(new MenuItem("Grab"));
230
- grabItem.addActionListener(this);
659
+// grabItem = menu.add(new MenuItem("Grab"));
660
+// grabItem.addActionListener(this);
231661 backItem = menu.add(new MenuItem("Back"));
232662 backItem.addActionListener(this);
233663 frontItem = menu.add(new MenuItem("Front"));
234664 frontItem.addActionListener(this);
235
- compositeItem = menu.add(new MenuItem("Composite"));
236
- compositeItem.addActionListener(this);
237
- hideItem = menu.add(new MenuItem("Hide"));
665
+// compositeItem = menu.add(new MenuItem("Composite"));
666
+// compositeItem.addActionListener(this);
667
+
668
+ if (Globals.ADVANCED)
669
+ {
670
+ hideItem = menu.add(new MenuItem("Hidden Group"));
238671 hideItem.addActionListener(this);
672
+ }
239673 ungroupItem = menu.add(new MenuItem("Ungroup"));
240674 ungroupItem.addActionListener(this);
241
- menu.add("-");
242
- randomItem = menu.add(new MenuItem("Switch node"));
243
- randomItem.addActionListener(this);
675
+
676
+// menu.add("-");
677
+//
678
+// switchItem = menu.add(new MenuItem("Switch node"));
679
+// switchItem.addActionListener(this);
680
+ if (Globals.ADVANCED)
681
+ {
244682 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
245683 switchGeoItem.addActionListener(this);
246684 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
247685 switchTransfoItem.addActionListener(this);
686
+ morphItem = menu.add(new MenuItem("Morph Group"));
687
+ morphItem.addActionListener(this);
688
+
689
+ menu.add("-");
248690 physicsItem = menu.add(new MenuItem("Physics"));
249691 physicsItem.addActionListener(this);
250692 frameselectorItem = menu.add(new MenuItem("Frame Selector"));
251693 frameselectorItem.addActionListener(this);
252
- morphItem = menu.add(new MenuItem("Morph"));
253
- morphItem.addActionListener(this);
254694 scriptNodeItem = menu.add(new MenuItem("Script Node"));
255695 scriptNodeItem.addActionListener(this);
256
- cameraItem = menu.add(new MenuItem("Camera"));
257
- cameraItem.addActionListener(this);
696
+ }
258697
259698 oe.menuBar.add(menu = new Menu("Object"));
260
- textureItem = menu.add(new MenuItem("Texture"));
261
- textureItem.addActionListener(this);
699
+// textureItem = menu.add(new MenuItem("Texture"));
700
+// textureItem.addActionListener(this);
262701 billboardItem = menu.add(new MenuItem("Billboard"));
263702 billboardItem.addActionListener(this);
264703 csgItem = menu.add(new MenuItem("CSG"));
265704 csgItem.addActionListener(this);
266
- shadowXItem = menu.add(new MenuItem("Shadow X"));
705
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
267706 shadowXItem.addActionListener(this);
268
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
707
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
269708 shadowYItem.addActionListener(this);
270
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
709
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
271710 shadowZItem.addActionListener(this);
711
+ attributeItem = menu.add(new MenuItem("Attribute"));
712
+ attributeItem.addActionListener(this);
713
+
714
+ if (Globals.ADVANCED)
715
+ {
716
+ menu.add("-");
272717 linkerItem = menu.add(new MenuItem("Linker"));
273718 linkerItem.addActionListener(this);
274719 templateItem = menu.add(new MenuItem("Template"));
275720 templateItem.addActionListener(this);
276
- attributeItem = menu.add(new MenuItem("Attribute"));
277
- attributeItem.addActionListener(this);
278721 pointflowItem = menu.add(new MenuItem("Point Flow"));
279722 pointflowItem.addActionListener(this);
723
+ }
280724 menu.add("-");
281725 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
282726 resetTransformItem.addActionListener(this);
283727 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
284728 resetCentroidItem.addActionListener(this);
285
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
286
- transformgeometryItem.addActionListener(this);
729
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
730
+ resetCentroidXZItem.addActionListener(this);
731
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
732
+ transformGeometryItem.addActionListener(this);
733
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
734
+ transformChildrenItem.addActionListener(this);
287735
288736 oe.menuBar.add(menu = new Menu("Geometry"));
289737 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -294,8 +742,11 @@
294742 genNormalsCADItem.addActionListener(this);
295743 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
296744 genNormalsMESHItem.addActionListener(this);
297
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
745
+ if (Globals.ADVANCED)
746
+ {
747
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
298748 genNormalsMINEItem.addActionListener(this);
749
+ }
299750 stripifyItem = menu.add(new MenuItem("Stripify"));
300751 stripifyItem.addActionListener(this);
301752 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -317,23 +768,34 @@
317768 reduce34MeshItem.addActionListener(this);
318769 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
319770 increaseMeshItem.addActionListener(this);
320
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
321
- smoothMeshItem.addActionListener(this);
322771 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
323772 clipMeshItem.addActionListener(this);
773
+
774
+ if (Globals.ADVANCED)
775
+ {
776
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
777
+ smoothMeshItem.addActionListener(this);
778
+ }
324779
325780 oe.menuBar.add(menu = new Menu("Attributes"));
326781 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
327782 clearMaterialsItem.addActionListener(this);
783
+ resetAllItem = menu.add(new MenuItem("Reset All"));
784
+ resetAllItem.addActionListener(this);
785
+ stepAllItem = menu.add(new MenuItem("Step All"));
786
+ stepAllItem.addActionListener(this);
328787 menu.add("-");
329788 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
330789 liveleavesItem.addActionListener(this);
331790 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
332791 unliveleavesItem.addActionListener(this);
792
+ if (Globals.ADVANCED)
793
+ {
333794 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
334795 supportleavesItem.addActionListener(this);
335796 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
336797 unsupportleavesItem.addActionListener(this);
798
+ }
337799 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
338800 hideleavesItem.addActionListener(this);
339801 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -342,6 +804,14 @@
342804 markleavesItem.addActionListener(this);
343805 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
344806 unmarkleavesItem.addActionListener(this);
807
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
808
+ rewindleavesItem.addActionListener(this);
809
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
810
+ unrewindleavesItem.addActionListener(this);
811
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
812
+ randomleavesItem.addActionListener(this);
813
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
814
+ unrandomleavesItem.addActionListener(this);
345815 menu.add("-");
346816 flipVItem = menu.add(new MenuItem("Flip V"));
347817 flipVItem.addActionListener(this);
....@@ -367,45 +837,56 @@
367837 attachBumpItem.addActionListener(this);
368838 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
369839 pigmentBumpItem.addActionListener(this);
840
+ //embedTexturesItem
370841 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
371842 detachPigmentItem.addActionListener(this);
372843 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
373844 detachBumpItem.addActionListener(this);
845
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
846
+ embedTexturesItem.addActionListener(this);
847
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
848
+ deEmbedTexturesItem.addActionListener(this);
374849 menu.add("-");
375850 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
376851 sortbysizeItem.addActionListener(this);
377852 sortbynameItem = menu.add(new MenuItem("Sort by name"));
378853 sortbynameItem.addActionListener(this);
379854 menu.add("-");
855
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
856
+ shareGeometriesItem.addActionListener(this);
857
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
858
+ mergeGeometriesItem.addActionListener(this);
859
+ if (Globals.ADVANCED)
860
+ {
861
+ // Pretty much the same as duplicate and clone.
380862 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
381863 extractGeometriesItem.addActionListener(this);
382864 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
383865 cloneGeometriesItem.addActionListener(this);
384
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
385
- shareGeometriesItem.addActionListener(this);
386
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
387
- mergeGeometriesItem.addActionListener(this);
866
+ }
388867
389868 oe.menuBar.add(menu = new Menu("Insert"));
390869 buildCreateMenu(menu);
391870
392
-
393
- oe.menuBar.add(menu = new Menu("Include"));
394
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
395
- importGFDItem.addActionListener(this);
396
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
397
- importVRMLX3DItem.addActionListener(this);
398
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
399
- importOBJItem.addActionListener(this);
400
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
401
- import3DSItem.addActionListener(this);
402
-
403871 oe.menuBar.add(menu = new Menu("Tools"));
404872 buildToolsMenu(menu);
405873 }
406874
875
+
407876 void SetupUI2(ObjEditor oe)
408877 {
878
+ // June 2019
879
+ if (oe == null)
880
+ {
881
+ //super.SetupUI2(this);
882
+ //return;
883
+ }
884
+
885
+ if (copy != group)
886
+ {
887
+ //super.SetupUI2(this);
888
+ }
889
+
409890 //new Exception().printStackTrace();
410891
411892 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -434,93 +915,242 @@
434915 oe.radioPanel.add(dummyButton);
435916 oe.buttonGroup.add(dummyButton);
436917 */
918
+ cGridBag copyOptionsPanel = new cGridBag();
919
+
920
+ copyOptionsPanel.preferredHeight = 2;
921
+
437922 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
438923
439
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
440
- liveCB.setToolTipText("Enabled animation");
924
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
925
+ //minButton.setToolTipText("Minimize window");
926
+ //minButton.addActionListener(this);
927
+
928
+ if (Globals.ADVANCED)
929
+ {
930
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ maxButton.setToolTipText("Maximize window");
932
+ maxButton.addActionListener(this);
933
+ }
934
+
935
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
936
+ fullButton.setToolTipText("Full-screen window");
937
+ fullButton.addActionListener(this);
938
+
939
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
940
+ screenfitButton.setToolTipText("Screen fit");
941
+ screenfitButton.addActionListener(this);
942
+
943
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
944
+ restoreCameraButton.setToolTipText("Restore viewpoint");
945
+ restoreCameraButton.addActionListener(this);
946
+
947
+ copyOptionsPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
948
+ saveVersionButton.setToolTipText("Duplicate current version");
949
+ saveVersionButton.addActionListener(this);
950
+
951
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
952
+ deleteVersionButton.setToolTipText("Delete current version");
953
+ deleteVersionButton.addActionListener(this);
954
+
955
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
956
+ previousVersionButton.setToolTipText("Previous version");
957
+ previousVersionButton.addActionListener(this);
958
+ previousVersionButton.setEnabled(false);
959
+
960
+ cGridBag updown = new cGridBag().setVertical(true);
961
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
962
+ restoreButton.setToolTipText("Undo (restore current version)");
963
+ restoreButton.addActionListener(this);
964
+ //restoreButton.setEnabled(false);
965
+
966
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
967
+ replaceButton.setToolTipText("Save (replace current version)");
968
+ replaceButton.addActionListener(this);
969
+ //replaceButton.setEnabled(false);
970
+
971
+ copyOptionsPanel.add(updown);
972
+
973
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
974
+ nextVersionButton.setToolTipText("Next version");
975
+ nextVersionButton.addActionListener(this);
976
+ nextVersionButton.setEnabled(false);
977
+
978
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
979
+ liveCB.setToolTipText("Enable animation");
441980 liveCB.addItemListener(this);
442981
443
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
982
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
983
+ oneStepButton.setToolTipText("Animate one step forward");
984
+ oneStepButton.addActionListener(this);
985
+
986
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
444987 fastCB.setToolTipText("Fast mode");
445988 fastCB.addItemListener(this);
446989
447
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
448
- trackCB.setToolTipText("Enable tracking");
449
- trackCB.addItemListener(this);
450
-
451
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
452
- screenfitButton.setToolTipText("Screen fit");
453
- screenfitButton.addActionListener(this);
990
+ //oe.toolboxPanel.Return();
991
+
992
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
993
+// trackCB.setToolTipText("Enable tracking");
994
+// trackCB.addItemListener(this);
454995
455996 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
456997 // screenfitpointButton.addActionListener(this);
457998
458999 if (Globals.ADVANCED)
4591000 {
460
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1001
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
4611002 snapobjectButton.addActionListener(this);
4621003 snapobjectButton.setToolTipText("Snap Object");
1004
+
1005
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1006
+ fourButton.addActionListener(this);
1007
+ fourButton.setToolTipText("Show control panel only");
4631008 }
4641009
465
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
466
- flashSelectionButton.setToolTipText("Show selection");
467
- flashSelectionButton.addActionListener(this);
1010
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
4681011
469
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
470
-
471
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
472
- twoButton.setToolTipText("Show center view only");
1012
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
+ twoButton.setToolTipText("Show 3D view only");
4731014 twoButton.addActionListener(this);
474
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
475
- fourButton.addActionListener(this);
476
- fourButton.setToolTipText("Show left panel only");
477
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
478
- sixButton.setToolTipText("2-column layout left");
479
- sixButton.addActionListener(this);
480
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
481
- threeButton.setToolTipText("2-column layout right");
1015
+ this.fullscreenLayout = twoButton;
1016
+
1017
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ threeButton.setToolTipText("Show controls and 3D view");
4821019 threeButton.addActionListener(this);
483
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
484
- sevenButton.setToolTipText("3-column layout");
485
- sevenButton.addActionListener(this);
1020
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1021
+ sixButton.setToolTipText("Show 3D view and controls");
1022
+ sixButton.addActionListener(this);
1023
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1024
+// sevenButton.setToolTipText("3-column layout");
1025
+// sevenButton.addActionListener(this);
4861026 //
4871027
488
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
489
- rootButton.setToolTipText("Edit selection in new tab");
1028
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ rootButton.setToolTipText("Open selection in new tab");
4901030 rootButton.addActionListener(this);
4911031
492
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1032
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
4931033 closeButton.setToolTipText("Close tab");
4941034 closeButton.addActionListener(this);
4951035 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
4961036 //clearButton.addActionListener(this);
497
-
498
- cGridBag commandsPanel = new cGridBag();
1037
+
1038
+ cGridBag row1 = new cGridBag();
4991039
500
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
501
- editButton.setToolTipText("Edit selection");
1040
+ // INSERT
1041
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1042
+ gridButton.setToolTipText("Create grid");
1043
+ gridButton.addActionListener(this);
1044
+
1045
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1046
+ boxButton.setToolTipText("Create box");
1047
+ boxButton.addActionListener(this);
1048
+
1049
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ sphereButton.setToolTipText("Create sphere");
1051
+ sphereButton.addActionListener(this);
1052
+
1053
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+ coneButton.setToolTipText("Create cone");
1055
+ coneButton.addActionListener(this);
1056
+
1057
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ torusButton.setToolTipText("Create torus");
1059
+ torusButton.addActionListener(this);
1060
+
1061
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1062
+ superButton.setToolTipText("Create superellipsoid");
1063
+ superButton.addActionListener(this);
1064
+
1065
+ if (Globals.ADVANCED)
1066
+ {
1067
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ kleinButton.setToolTipText("Create Klein bottle");
1069
+ kleinButton.addActionListener(this);
1070
+ }
1071
+
1072
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1073
+ particlesButton.setToolTipText("Create particle system");
1074
+ particlesButton.addActionListener(this);
1075
+
1076
+ oe.toolboxPanel.add(row1);
1077
+
1078
+ cGridBag row2 = new cGridBag();
1079
+
1080
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1081
+ groupButton.setToolTipText("Create group");
1082
+ groupButton.addActionListener(this);
1083
+
1084
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1085
+ compositeButton.setToolTipText("Create composite");
1086
+ compositeButton.addActionListener(this);
1087
+
1088
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1089
+ switchButton.setToolTipText("Create item switcher");
1090
+ switchButton.addActionListener(this);
1091
+
1092
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1093
+ loopButton.setToolTipText("Create loop");
1094
+ loopButton.addActionListener(this);
1095
+
1096
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1097
+ textureButton.setToolTipText("Create texture");
1098
+ textureButton.addActionListener(this);
1099
+
1100
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1101
+ overlayButton.setToolTipText("Create overlay");
1102
+ overlayButton.addActionListener(this);
1103
+
1104
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1105
+ lightButton.setToolTipText("Create light");
1106
+ lightButton.addActionListener(this);
1107
+
1108
+ oe.toolboxPanel.add(row2);
1109
+
1110
+ // ENVYMAPS
1111
+ cGridBag skyboxpane = new cGridBag();
1112
+ skyboxpane.preferredHeight = 100;
1113
+
1114
+ oe.skyboxPanel.add(skyboxpane);
1115
+
1116
+ JTabbedPane skyboxpanel = new JTabbedPane();
1117
+ skyboxpane.add(skyboxpanel);
1118
+
1119
+ AddSkyboxTab0(skyboxpanel);
1120
+ AddSkyboxTab1(skyboxpanel);
1121
+ AddSkyboxTab2(skyboxpanel);
1122
+ AddSkyboxTab3(skyboxpanel);
1123
+
1124
+ // EDIT panel
1125
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1126
+ editButton.setToolTipText("Pin selection controls");
5021127 editButton.addActionListener(this);
5031128
504
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
505
- uneditButton.setToolTipText("Unedit selection");
1129
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1130
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5061131 uneditButton.addActionListener(this);
5071132
508
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
1133
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1134
+ allParamsButton.setToolTipText("Show all controle");
1135
+ allParamsButton.addActionListener(this);
1136
+
1137
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5091138 clearPanelButton.setToolTipText("Clear edit panel");
5101139 clearPanelButton.addActionListener(this);
5111140
512
- commandsPanel.add(allParamsButton = new cButton("A", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
513
- allParamsButton.setToolTipText("All params??");
514
- allParamsButton.addActionListener(this);
1141
+ //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1142
+ //unselectButton.setToolTipText("Unselect");
1143
+ //unselectButton.addActionListener(this);
5151144
516
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
517
- unselectButton.setToolTipText("Unselect");
518
- unselectButton.addActionListener(this);
519
-
520
- commandsPanel.preferredHeight = 1;
1145
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1146
+ flashSelectionButton.setToolTipText("Highlight selection");
1147
+ flashSelectionButton.addActionListener(this);
5211148
522
- oe.treePanel.add(commandsPanel);
523
- oe.treePanel.Return();
1149
+ editCommandsPanel.preferredHeight = 1;
1150
+
1151
+ SetPinStates(false);
1152
+// oe.treePanel.add(commandsPanel);
1153
+// oe.treePanel.Return();
5241154
5251155 // oe.aConstraints.gridx += 1;
5261156 // oe.aConstraints.weighty = 0;
....@@ -537,32 +1167,20 @@
5371167
5381168 JScrollPane jSP;
5391169 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
540
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1170
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
5411171 ResetModel();
5421172
5431173 oe.treePanel.add(jSPPanel);
5441174 oe.treePanel.Return();
5451175
546
- cGridBag copyOptionsPanel = new cGridBag();
547
-
548
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
549
- colorCB.setToolTipText("Copy color when dropped");
550
- colorCB.addItemListener(this);
551
-
552
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
553
- materialCB.setToolTipText("Copy material when dropped");
554
- materialCB.addItemListener(this);
555
-
556
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
557
- textureCB.setToolTipText("Copy texture when dropped");
558
- textureCB.addItemListener(this);
559
-
560
- copyOptionsPanel.preferredHeight = 1;
5611176 oe.treePanel.add(copyOptionsPanel);
5621177 oe.treePanel.Return();
1178
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1179
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1180
+ sliderPane.preferredHeight = 1;
5631181
564
-// mainPanel.setDividerLocation(0.5); //1.0);
565
-// mainPanel.setResizeWeight(0.5);
1182
+// mainPanel.setDividerLocation(0.1); //1.0);
1183
+ mainPanel.setResizeWeight(0.4);
5661184
5671185 //jList.addListSelectionListener(this);
5681186 oe.jTree.addTreeSelectionListener(this);
....@@ -570,7 +1188,7 @@
5701188 //jTree.setEditable(true);
5711189 oe.jTree.setDragEnabled(true);
5721190 //jTree.setPreferredSize(new Dimension(10,10));
573
- jSP.setPreferredSize(new Dimension(100,200));
1191
+ //jSP.setPreferredSize(new Dimension(100,200));
5741192
5751193 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
5761194
....@@ -582,19 +1200,49 @@
5821200 dgr.addDragGestureListener(this);
5831201 }catch(Exception e) {}
5841202 */
585
- radio.layout = sevenButton;
1203
+ radio.layout = threeButton; // sixButton;
5861204 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
5871205 }
5881206
5891207 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
5901208 {
591
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
592
- supportCB.setToolTipText("Enabled rigging");
593
- supportCB.addItemListener(this);
1209
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1210
+ colorCB.setToolTipText("Copy color when dropped");
1211
+ colorCB.addItemListener(this);
1212
+
1213
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1214
+ materialCB.setToolTipText("Copy material when dropped");
1215
+ materialCB.addItemListener(this);
1216
+
1217
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1218
+ textureCB.setToolTipText("Copy texture when dropped");
1219
+ textureCB.addItemListener(this);
1220
+
1221
+ panel.Return();
1222
+
1223
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
1224
+ boxCB.setToolTipText("Display bounding boxes");
1225
+ boxCB.addItemListener(this);
1226
+
1227
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
1228
+ zoomBoxCB.setToolTipText("Display only for wheel");
1229
+ zoomBoxCB.addItemListener(this);
1230
+
1231
+ if (true) // Globals.ADVANCED)
1232
+ {
1233
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1234
+// supportCB.setToolTipText("Enable rigging");
1235
+// supportCB.addItemListener(this);
1236
+
1237
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1238
+ freezeCB.setToolTipText("Fast moving camera");
1239
+ freezeCB.addItemListener(this);
5941240
5951241 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
5961242 // localCB.addItemListener(this);
5971243
1244
+ panel.Return();
1245
+
5981246 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
5991247 crowdCB.setToolTipText("Used for crowds");
6001248 crowdCB.addItemListener(this);
....@@ -603,22 +1251,19 @@
6031251 smoothCB.setToolTipText("Snapping delay");
6041252 smoothCB.addItemListener(this);
6051253
606
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
607
- slowCB.setToolTipText("Smooth interpolation");
608
- slowCB.addItemListener(this);
1254
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1255
+// slowCB.setToolTipText("Smooth interpolation");
1256
+// slowCB.addItemListener(this);
1257
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1258
+ minshaderCB.setToolTipText("Minimal fast shader");
1259
+ minshaderCB.addItemListener(this);
6091260
610
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
611
- boxCB.setToolTipText("Display bounding boxes");
612
- boxCB.addItemListener(this);
613
-
614
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
615
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
616
- zoomBoxCB.addItemListener(this);
617
-
6181261 // constraints.gridy += 1;
6191262 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6201263 // speakerMocapCB.addItemListener(this);
6211264
1265
+ panel.Return();
1266
+
6221267 if (false)
6231268 {
6241269 // handled in scripts
....@@ -633,40 +1278,85 @@
6331278 //constraints.gridy += 1;
6341279 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6351280 smoothfocusCB.addItemListener(this);
1281
+ panel.Return();
6361282 }
6371283
6381284 //constraints.gridx += 1;
6391285 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
6401286 // debugCB.addItemListener(this);
6411287
1288
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1289
+ trackCB.setToolTipText("Enable tracking target");
1290
+ trackCB.addItemListener(this);
1291
+
6421292 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1293
+ oeilCB.setToolTipText("Move camera when tracking");
6431294 oeilCB.addItemListener(this);
6441295
1296
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1297
+ shadowCB.setToolTipText("When live compute shadows");
1298
+ shadowCB.addItemListener(this);
1299
+
1300
+ panel.Return();
1301
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1302
+ toggleTextureCB.setToolTipText("Load textures");
1303
+ toggleTextureCB.addItemListener(this);
1304
+
1305
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1306
+ toggleSwitchCB.setToolTipText("Choose a single item");
1307
+ toggleSwitchCB.addItemListener(this);
1308
+
1309
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1310
+ autokeepCB.setToolTipText("On structure change");
1311
+ autokeepCB.addItemListener(this);
1312
+
1313
+ panel.Return();
1314
+ if (Globals.ADVANCED)
1315
+ {
6451316 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
6461317 lookAtCB.setToolTipText("Look-at target");
6471318 lookAtCB.addItemListener(this);
1319
+ }
1320
+
1321
+ }
6481322
6491323 cGridBag fill = new cGridBag();
650
-
6511324 fill.preferredHeight = 200;
1325
+ cGridBag fill2 = new cGridBag();
1326
+ fill2.preferredHeight = 200;
1327
+ cGridBag fill3 = new cGridBag();
1328
+ fill3.preferredHeight = 200;
6521329
6531330 panel.add(fill);
1331
+ panel.add(fill2);
1332
+ panel.add(fill3);
6541333
6551334 }
6561335
6571336 void EditObject(Object3D obj)
6581337 {
6591338 cRadio radioButton = new cRadio(obj.name);
1339
+
1340
+ // June 2019. Patch to avoid bug with transparency.
1341
+ radioButton.hadMaterial = obj.material != null;
1342
+ if (!radioButton.hadMaterial)
1343
+ {
1344
+ obj.material = new cMaterial();
1345
+ }
1346
+
6601347 radioButton.SetObject(obj);
661
- radioButton.layout = sevenButton;
1348
+ radioButton.layout = threeButton; // sixButton;
6621349 radioButton.SetCamera(cameraView.renderCamera, false);
6631350 radioButton.addActionListener(this);
6641351 radioPanel.add(radioButton);
6651352 buttonGroup.add(radioButton);
6661353 radioButton.doClick();
6671354 }
1355
+
6681356 void SetupViews(ObjEditor oe)
6691357 {
1358
+ theFrame = this;
1359
+
6701360 oe.SetupViews();
6711361
6721362 System.out.println("SetupViews");
....@@ -675,23 +1365,30 @@
6751365 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6761366 }
6771367
678
- JCheckBox liveCB;
679
- JCheckBox supportCB;
680
- JCheckBox localCB;
681
- JCheckBox crowdCB;
682
- JCheckBox smoothCB;
683
- JCheckBox fastCB;
684
- JCheckBox slowCB;
685
- JCheckBox boxCB;
686
- JCheckBox zoomBoxCB;
687
- JCheckBox trackCB;
688
- JCheckBox smoothfocusCB;
1368
+ cToggleButton liveCB;
1369
+ cCheckBox supportCB;
1370
+ cCheckBox localCB;
1371
+ cCheckBox crowdCB;
1372
+ cCheckBox smoothCB;
1373
+ cCheckBox minshaderCB;
1374
+
1375
+ cToggleButton fastCB;
1376
+ cCheckBox slowCB;
1377
+ cCheckBox boxCB;
1378
+ cCheckBox zoomBoxCB;
1379
+ cCheckBox freezeCB;
1380
+ //cToggleButton trackCB;
1381
+ cCheckBox trackCB;
1382
+ cCheckBox smoothfocusCB;
6891383 // JCheckBox speakerMocapCB;
690
- JCheckBox speakerCameraCB;
691
- JCheckBox speakerFocusCB;
692
- JCheckBox debugCB;
693
- JCheckBox oeilCB;
694
- JCheckBox lookAtCB;
1384
+ cCheckBox speakerCameraCB;
1385
+ cCheckBox speakerFocusCB;
1386
+ cCheckBox debugCB;
1387
+
1388
+ cCheckBox oeilCB;
1389
+ cCheckBox shadowCB;
1390
+ cCheckBox autokeepCB;
1391
+ cCheckBox lookAtCB;
6951392
6961393 // static int COLOR = 1;
6971394 // static int MATERIAL = 2;
....@@ -699,9 +1396,9 @@
6991396
7001397 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7011398
702
- JCheckBox colorCB;
703
- JCheckBox materialCB;
704
- JCheckBox textureCB;
1399
+ cCheckBox colorCB;
1400
+ cCheckBox materialCB;
1401
+ cCheckBox textureCB;
7051402
7061403 public void itemStateChanged(ItemEvent e)
7071404 {
....@@ -729,6 +1426,7 @@
7291426 } else if(e.getSource() == liveCB)
7301427 {
7311428 cameraView.ToggleLive();
1429
+ refreshContents(false);
7321430 }
7331431 else if(e.getSource() == supportCB)
7341432 {
....@@ -744,6 +1442,12 @@
7441442 {
7451443 cameraView.ToggleInertia();
7461444 cameraView.repaint();
1445
+ }
1446
+ else if(e.getSource() == minshaderCB)
1447
+ {
1448
+ Globals.MINSHADER ^= true;
1449
+ cameraView.programInitialized = false;
1450
+ cameraView.repaint();
7471451 }
7481452 else if(e.getSource() == localCB)
7491453 {
....@@ -793,6 +1497,18 @@
7931497 {
7941498 cameraView.ToggleOeil();
7951499 }
1500
+ else if(e.getSource() == shadowCB)
1501
+ {
1502
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1503
+ }
1504
+ else if(e.getSource() == freezeCB)
1505
+ {
1506
+ Globals.FREEZEONMOVE ^= true;
1507
+ }
1508
+ else if(e.getSource() == autokeepCB)
1509
+ {
1510
+ Globals.REPLACEONMAKE ^= true;
1511
+ }
7961512 else if(e.getSource() == lookAtCB)
7971513 {
7981514 cameraView.ToggleLookAt();
....@@ -809,7 +1525,8 @@
8091525
8101526 /**/
8111527 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
812
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1528
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1529
+ TreePath path = objEditor.jTree.getSelectionPath();
8131530 if ((path == null) || (path.getPathCount() <= 1)) {
8141531 // We can't move the root node or an empty selection
8151532 return;
....@@ -872,8 +1589,6 @@
8721589 }
8731590 }
8741591
875
- String string = (String) object;
876
-
8771592 System.out.println("Transfer = " + object + "; drop : " + target);
8781593 // if( object instanceof java.io.File[])
8791594 // {
....@@ -881,7 +1596,11 @@
8811596 // objEditor.DropFile((java.io.File[]) object, true);
8821597 // return;
8831598 // }
884
- if (string.charAt(0) == '/')
1599
+
1600
+ String string = object.toString();
1601
+
1602
+ // File path for Mac and Windows
1603
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8851604 {
8861605 // file(s)
8871606 String[] names = string.split("\n");
....@@ -908,7 +1627,7 @@
9081627
9091628 flashIt = false;
9101629 CameraPane pane = (CameraPane) target;
911
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1630
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9121631 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9131632
9141633 if (group.selection.size() == 1)
....@@ -924,23 +1643,33 @@
9241643
9251644 assert target == objEditor.jTree;
9261645 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1646
+ Object3D destinationLeaf;
9271647 try {
928
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1648
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9291649 } catch (Exception e) {
9301650 System.out.println("destinationPath : " + destinationPath);
9311651 return;
9321652 }
9331653
934
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1654
+ for (int i=group.selection.size(); --i>=0;)
9351655 {
1656
+ Object3D child = (Object3D)group.selection.elementAt(i);
1657
+
1658
+ // Cannot move into itself
1659
+ if (child == destinationLeaf)
1660
+ return;
1661
+ }
1662
+
1663
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1664
+// {
9361665 loadClipboard(true);
9371666 objEditor.jTree.setSelectionPath(destinationPath);
938
- pasteInto(false);
939
- } else {
940
- loadClipboard(false);
941
- objEditor.jTree.setSelectionPath(destinationPath);
942
- pasteInto(false); // true); // ???
943
- }
1667
+ pasteInto(false, false);
1668
+// } else {
1669
+// loadClipboard(false);
1670
+// objEditor.jTree.setSelectionPath(destinationPath);
1671
+// pasteInto(false, false); // true); // ???
1672
+// }
9441673 }
9451674 public void dropActionChanged(DropTargetDragEvent dtde)
9461675 // Called if the user has modified the current drop gesture
....@@ -1045,54 +1774,71 @@
10451774 {
10461775 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10471776 //heightFieldItem.addActionListener(this);
1048
- gridItem = menu.add(new MenuItem("Grid"));
1049
- gridItem.addActionListener(this);
1050
- rectoidItem = menu.add(new MenuItem("Box"));
1051
- rectoidItem.addActionListener(this);
1052
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1053
- ellipsoidItem.addActionListener(this);
1054
- coneItem = menu.add(new MenuItem("Cone"));
1055
- coneItem.addActionListener(this);
1056
- torusItem = menu.add(new MenuItem("Torus"));
1057
- torusItem.addActionListener(this);
1058
- superItem = menu.add(new MenuItem("Superellipsoid"));
1059
- superItem.addActionListener(this);
1777
+// gridItem = menu.add(new MenuItem("Grid"));
1778
+// gridItem.addActionListener(this);
1779
+// rectoidItem = menu.add(new MenuItem("Box"));
1780
+// rectoidItem.addActionListener(this);
1781
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1782
+// ellipsoidItem.addActionListener(this);
1783
+// coneItem = menu.add(new MenuItem("Cone"));
1784
+// coneItem.addActionListener(this);
1785
+// torusItem = menu.add(new MenuItem("Torus"));
1786
+// torusItem.addActionListener(this);
1787
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1788
+// superItem.addActionListener(this);
1789
+
1790
+ cameraItem = menu.add(new MenuItem("Camera"));
1791
+ cameraItem.addActionListener(this);
1792
+
1793
+ if (!Globals.ADVANCED)
1794
+ {
10601795 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10611796 kleinItem.addActionListener(this);
1062
- particleItem = menu.add(new MenuItem("Particle system"));
1063
- particleItem.addActionListener(this);
1797
+ }
1798
+
1799
+// particleItem = menu.add(new MenuItem("Particle system"));
1800
+// particleItem.addActionListener(this);
1801
+ if (Globals.ADVANCED)
1802
+ {
10641803 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10651804 ragdollItem.addActionListener(this);
10661805 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10671806 ragdoll2Item.addActionListener(this);
1807
+ }
10681808 menu.add("-");
1069
- meshItem = menu.add(new MenuItem("Mesh"));
1809
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10701810 meshItem.addActionListener(this);
10711811 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10721812 // meshGroupItem.addActionListener(this);
1813
+ if (Globals.ADVANCED)
1814
+ {
10731815 springItem = menu.add(new MenuItem("Spring"));
10741816 springItem.addActionListener(this);
10751817 flagItem = menu.add(new MenuItem("Flag"));
10761818 flagItem.addActionListener(this);
1077
- bezierItem = menu.add(new MenuItem("Patch"));
1078
- bezierItem.addActionListener(this);
1079
- checkerItem = menu.add(new MenuItem("Checker"));
1080
- checkerItem.addActionListener(this);
10811819 blobItem = menu.add(new MenuItem("Blob"));
10821820 blobItem.addActionListener(this);
10831821 latheItem = menu.add(new MenuItem("Lathe"));
10841822 latheItem.addActionListener(this);
1085
- lightItem = menu.add(new MenuItem("Light"));
1086
- lightItem.addActionListener(this);
1823
+ }
1824
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1825
+ bezierItem.addActionListener(this);
1826
+// overlayItem = menu.add(new MenuItem("Overlay"));
1827
+// overlayItem.addActionListener(this);
1828
+// lightItem = menu.add(new MenuItem("Light"));
1829
+// lightItem.addActionListener(this);
10871830 menu.add("-");
10881831 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10891832 //superLoopItem.addActionListener(this);
1090
- loopItem = menu.add(new MenuItem("Loop"));
1091
- loopItem.addActionListener(this);
1833
+// loopItem = menu.add(new MenuItem("Loop"));
1834
+// loopItem.addActionListener(this);
10921835 doubleItem = menu.add(new MenuItem("Fork"));
10931836 doubleItem.addActionListener(this);
1837
+ if (Globals.ADVANCED)
1838
+ {
10941839 tripleItem = menu.add(new MenuItem("Trident"));
10951840 tripleItem.addActionListener(this);
1841
+ }
10961842 }
10971843
10981844 void buildToolsMenu(Menu menu)
....@@ -1101,29 +1847,34 @@
11011847 animationItem.addItemListener(this);
11021848 animationItem.setState(Globals.ANIMATION);
11031849
1850
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1851
+ archiveItem.addActionListener(this);
1852
+
11041853 menu.add("-");
11051854 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11061855 parseverticesItem.addActionListener(this);
11071856 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11081857 textureFieldItem.addActionListener(this);
1109
- alignItem = menu.add(new MenuItem("Align"));
1858
+ alignItem = menu.add(new MenuItem("Align Objects"));
11101859 alignItem.addActionListener(this);
1111
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1112
- mirrorItem.addActionListener(this);
11131860 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11141861 reduceMorphItem.addActionListener(this);
11151862 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11161863 reduce34MorphItem.addActionListener(this);
1117
-
1118
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1119
- computeAOItem.addActionListener(this);
11201864 menu.add("-");
1121
-
11221865 menu.add(memoryItem = new MenuItem("Memory Usage"));
11231866 memoryItem.addActionListener(this);
1867
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1868
+ computeAOItem.addActionListener(this);
1869
+
1870
+ if (Globals.ADVANCED)
1871
+ {
1872
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1873
+ mirrorItem.addActionListener(this);
1874
+ menu.add("-");
11241875 menu.add(analyzeItem = new MenuItem("Analyze"));
11251876 analyzeItem.addActionListener(this);
1126
- menu.add(dumpItem = new MenuItem("Dump"));
1877
+ menu.add(dumpItem = new MenuItem("Print"));
11271878 dumpItem.addActionListener(this);
11281879 // menu.add(pathItem = new MenuItem("From-to path"));
11291880 // pathItem.addActionListener(this);
....@@ -1141,6 +1892,7 @@
11411892 menu.add("-");
11421893 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11431894 editScriptItem.addActionListener(this);
1895
+ }
11441896 }
11451897
11461898 void ScreenFit()
....@@ -1263,9 +2015,34 @@
12632015 shadow.material = new cMaterial(obj.material);
12642016 shadow.material.diffuse = 0.0001f;
12652017 shadow.material.specular = 0.0001f;
2018
+ //shadow.projectedVertices[1].x = 300;
12662019
12672020 makeSomething(shadow);
12682021 }
2022
+
2023
+ private void ClearUnpinned()
2024
+ {
2025
+ //for (Object3D obj : listUI)
2026
+ for (int i=listUI.size(); --i>=0;)
2027
+ {
2028
+ Object3D obj = listUI.elementAt(i);
2029
+ if (!obj.pinned)
2030
+ {
2031
+ obj.CloseUI();
2032
+ listUI.remove(i);
2033
+ }
2034
+ }
2035
+ }
2036
+
2037
+ private void EditElement(Object3D elem, boolean newWindow)
2038
+ {
2039
+ // if (!(elem instanceof Composite))
2040
+ // newWindow = false;
2041
+ listUI.add(elem);
2042
+ elem.openEditWindow(this, newWindow); //, false);
2043
+ System.out.println("edit : " + elem);
2044
+ elem.editWindow.refreshContents(true); // ? new
2045
+ }
12692046
12702047 /**
12712048 * applyExample
....@@ -1469,9 +2246,9 @@
14692246
14702247 void Overwrite(int mask)
14712248 {
1472
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2249
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14732250 {
1474
- Object3D content = GrafreeD.clipboard.get(0);
2251
+ Object3D content = Grafreed.clipboard.get(0);
14752252
14762253 if (content instanceof cGroup && ((cGroup)content).transientlink )
14772254 content = ((cGroup)content).get(0);
....@@ -1510,7 +2287,7 @@
15102287 {
15112288 ScreenFit();
15122289 } else
1513
- if (source == switchItem)
2290
+ if (source == switchViewItem)
15142291 {
15152292 cVector v1 = new cVector();
15162293 cVector v2 = new cVector();
....@@ -1519,11 +2296,11 @@
15192296 objEditor.cameraView.renderCamera.setAim(v2, v1);
15202297 objEditor.cameraView.repaint();
15212298 } else
1522
- if (source == rectoidItem)
2299
+ if (source == rectoidItem || source == boxButton)
15232300 {
15242301 makeSomething(new Box());
15252302 } else
1526
- if (source == particleItem)
2303
+ if (source == particleItem || source == particlesButton)
15272304 {
15282305 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15292306 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1602,27 +2379,27 @@
16022379
16032380 makeSomething(obj);
16042381 } else
1605
- if (source == gridItem)
2382
+ if (source == gridItem || source == gridButton)
16062383 {
16072384 makeSomething(new Grid());
16082385 } else
1609
- if (source == ellipsoidItem)
2386
+ if (source == ellipsoidItem || source == sphereButton)
16102387 {
16112388 makeSomething(new Sphere());
16122389 } else
1613
- if (source == coneItem)
2390
+ if (source == coneItem || source == coneButton)
16142391 {
16152392 makeSomething(new Cone());
16162393 } else
1617
- if (source == torusItem)
2394
+ if (source == torusItem || source == torusButton)
16182395 {
16192396 makeSomething(new Torus());
16202397 } else
1621
- if (source == superItem)
2398
+ if (source == superItem || source == superButton)
16222399 {
16232400 makeSomething(new Superellipsoid());
16242401 } else
1625
- if (source == kleinItem)
2402
+ if (source == kleinItem || source == kleinButton)
16262403 {
16272404 makeSomething(new Klein());
16282405 } else
....@@ -1642,7 +2419,7 @@
16422419 {
16432420 makeSomething(new BezierSurface());
16442421 } else
1645
- if (source == checkerItem)
2422
+ if (source == overlayItem || source == overlayButton)
16462423 {
16472424 /*
16482425 Object3D obj = new BezierSurface(5,8);
....@@ -1690,10 +2467,27 @@
16902467 s.setup();
16912468 makeSomething(s);
16922469 } else
1693
- if (source == lightItem)
2470
+ if (source == lightItem || source == lightButton)
16942471 {
16952472 makeSomething(new Light());
16962473 } else
2474
+// if (source == skybox1Button ||
2475
+// source == skybox2Button ||
2476
+// source == skybox3Button ||
2477
+// source == skybox4Button ||
2478
+// source == skybox5Button ||
2479
+// source == skybox6Button ||
2480
+// source == skybox7Button ||
2481
+// source == skybox11Button ||
2482
+// source == skybox12Button ||
2483
+// source == skybox13Button ||
2484
+// source == skybox14Button ||
2485
+// source == skybox15Button ||
2486
+// source == skybox16Button ||
2487
+// source == skybox17Button)
2488
+// {
2489
+// ChangeSkybox(source);
2490
+// } else
16972491 if (source == csgItem)
16982492 {
16992493 group(new CSG());
....@@ -1740,30 +2534,30 @@
17402534
17412535 group(g);
17422536 } else
1743
- if (source == loopItem)
2537
+ if (source == loopItem || source == loopButton)
17442538 {
17452539 Composite csg = new GroupLeaf();
17462540 csg.count = 5;
17472541 group(csg);
1748
- Composite child = new cGroup();
2542
+ Composite child = new cGroup("Branch");
17492543 csg.addChild(child);
17502544 child.addChild(csg);
17512545 } else
17522546 if (source == doubleItem)
17532547 {
1754
- Composite csg = new GroupLeaf();
2548
+ Composite csg = new GroupLeaf("Fork");
17552549 csg.count = 5;
17562550 group(csg);
1757
- Composite child = new cGroup();
2551
+ Composite child = new cGroup("Branch A");
17582552 csg.addChild(child);
17592553 child.addChild(csg);
1760
- child = new cGroup();
2554
+ child = new cGroup("Branch B");
17612555 csg.addChild(child);
17622556 child.addChild(csg);
17632557 } else
17642558 if (source == tripleItem)
17652559 {
1766
- Composite csg = new GroupLeaf();
2560
+ Composite csg = new GroupLeaf("Trident");
17672561 csg.count = 4;
17682562 group(csg);
17692563 Composite child = new cGroup();
....@@ -1776,27 +2570,10 @@
17762570 csg.addChild(child);
17772571 child.addChild(csg);
17782572 } else
1779
-
1780
- if (source == importGFDItem)
1781
- {
1782
- ImportGFD();
1783
- } else
1784
- if (source == importVRMLX3DItem)
1785
- {
1786
- ImportVRMLX3D();
1787
- } else
1788
- if (source == import3DSItem)
1789
- {
1790
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1791
- } else
1792
- if (source == importOBJItem)
1793
- {
1794
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1795
- } else
17962573 if (source == computeAOItem)
17972574 {
17982575 Globals.drawMode = CameraPane.OCCLUSION;
1799
- Globals.theRenderer.repaint();
2576
+ cameraView.repaint();
18002577 } else
18012578 if (source == recompileItem)
18022579 {
....@@ -1811,7 +2588,7 @@
18112588 if (source == invariantsItem)
18122589 {
18132590 System.out.println("Invariants:");
1814
- GrafreeD.grafreeD.universe.invariants();
2591
+ Grafreed.grafreed.universe.invariants();
18152592 } else
18162593 if (source == memoryItem)
18172594 {
....@@ -1830,19 +2607,68 @@
18302607 {
18312608 DumpObject();
18322609 } else
2610
+ if (source == minButton)
2611
+ {
2612
+ Minimize();
2613
+ } else
2614
+ if (source == maxButton)
2615
+ {
2616
+ Maximize();
2617
+ } else
2618
+ if (source == fullButton)
2619
+ {
2620
+ ToggleFullScreen();
2621
+ } else
2622
+ if (source == previousVersionButton)
2623
+ {
2624
+ // Go to previous version
2625
+ //if (!Undo())
2626
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2627
+ PreviousVersion();
2628
+ } else
2629
+ if (source == restoreButton)
2630
+ {
2631
+ // Restore current version
2632
+ Restore();
2633
+ //restoreButton.setEnabled(false);
2634
+ } else
2635
+ if (source == replaceButton)
2636
+ {
2637
+ // Overwrite current version
2638
+ Replace();
2639
+ //replaceButton.setEnabled(false);
2640
+ } else
2641
+ if (source == nextVersionButton)
2642
+ {
2643
+ // Go to next version
2644
+ NextVersion();
2645
+ } else
2646
+ if (source == saveVersionButton)
2647
+ {
2648
+ // Save a new version
2649
+ if (!Save(true))
2650
+ java.awt.Toolkit.getDefaultToolkit().beep();
2651
+ } else
2652
+ if (source == deleteVersionButton)
2653
+ {
2654
+ // Delete a new version
2655
+ DeleteVersion();
2656
+ } else
2657
+ if (source == oneStepButton)
2658
+ {
2659
+ Globals.ONESTEP = true;
2660
+ cameraView.repaint();
2661
+ } else
18332662 if (source == screenfitButton)
18342663 {
1835
- //Reload(lastConverter, lastFilename, true);
18362664 ScreenFit();
18372665 } else
18382666 if (source == screenfitpointButton)
18392667 {
1840
- //Reload(lastConverter, lastFilename, true);
18412668 ScreenFitPoint();
18422669 } else
18432670 if (source == snapobjectButton)
18442671 {
1845
- //Reload(lastConverter, lastFilename, true);
18462672 SnapObject();
18472673 } else
18482674 // if (event.getSource() == recompileButton)
....@@ -1879,12 +2705,20 @@
18792705 {
18802706 loadClipboard(true);
18812707 } else
2708
+ if (source == undoItem)
2709
+ {
2710
+ PreviousVersion();
2711
+ } else
2712
+ if (source == redoItem)
2713
+ {
2714
+ NextVersion();
2715
+ } else
18822716 if (source == duplicateItem)
18832717 {
1884
- Object3D keep = GrafreeD.clipboard;
2718
+ Object3D keep = Grafreed.clipboard;
18852719 loadClipboard(false);
18862720 paste(false);
1887
- GrafreeD.clipboard = keep;
2721
+ Grafreed.clipboard = keep;
18882722 } else
18892723 if (source == cloneItem)
18902724 {
....@@ -1902,13 +2736,17 @@
19022736 {
19032737 paste(false);
19042738 } else
2739
+ if (source == pasteIntoItem)
2740
+ {
2741
+ pasteInto(true, false);
2742
+ } else
19052743 if (source == pasteLinkItem)
19062744 {
1907
- pasteInto(false);
2745
+ pasteInto(false, false);
19082746 } else
19092747 if (source == pasteCloneItem)
19102748 {
1911
- pasteInto(true);
2749
+ pasteInto(true, true);
19122750 } else
19132751 if (source == pasteExpandItem)
19142752 {
....@@ -2100,9 +2938,9 @@
21002938 // group.selection.get(0).setMasterThis(content); // should be identity
21012939 // refreshContents();
21022940 // }
2103
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2941
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21042942 {
2105
- Object3D content = GrafreeD.clipboard.get(0);
2943
+ Object3D content = Grafreed.clipboard.get(0);
21062944
21072945 if (content instanceof cGroup && ((cGroup)content).transientlink )
21082946 content = ((cGroup)content).get(0);
....@@ -2110,11 +2948,11 @@
21102948 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21112949 for (int i=0; i<group.selection.size(); i++)
21122950 {
2113
- boolean random = CameraPane.RANDOM;
2114
- CameraPane.RANDOM = false; // parse all random nodes
2951
+ boolean random = CameraPane.SWITCH;
2952
+ CameraPane.SWITCH = false; // parse all random nodes
21152953 group.selection.get(i).linkVerticesThis(content);
21162954 // group.selection.get(i).setMasterThis(content); // should be identity
2117
- CameraPane.RANDOM = random;
2955
+ CameraPane.SWITCH = random;
21182956 }
21192957 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21202958 refreshContents();
....@@ -2124,20 +2962,20 @@
21242962 {
21252963 for (int i=0; i<group.selection.size(); i++)
21262964 {
2127
- boolean random = CameraPane.RANDOM;
2128
- CameraPane.RANDOM = false; // parse all random nodes
2965
+ boolean random = CameraPane.SWITCH;
2966
+ CameraPane.SWITCH = false; // parse all random nodes
21292967 group.selection.get(i).linkVerticesThis(null);
2130
- CameraPane.RANDOM = random;
2968
+ CameraPane.SWITCH = random;
21312969 }
21322970
21332971 refreshContents();
21342972 } else
21352973 if (source == relinkverticesItem)
21362974 {
2137
- boolean random = CameraPane.RANDOM;
2138
- CameraPane.RANDOM = false; // parse all random nodes
2975
+ boolean random = CameraPane.SWITCH;
2976
+ CameraPane.SWITCH = false; // parse all random nodes
21392977 group.selection.RelinkToSupport();
2140
- CameraPane.RANDOM = random;
2978
+ CameraPane.SWITCH = random;
21412979
21422980 refreshContents();
21432981 } else
....@@ -2152,9 +2990,9 @@
21522990 } else
21532991 if (source == setMasterItem)
21542992 {
2155
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2993
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21562994 {
2157
- Object3D content = GrafreeD.clipboard.get(0);
2995
+ Object3D content = Grafreed.clipboard.get(0);
21582996
21592997 if (content instanceof cGroup && ((cGroup)content).transientlink )
21602998 content = ((cGroup)content).get(0);
....@@ -2167,9 +3005,9 @@
21673005 {
21683006 if (group.selection.size() == 1)
21693007 {
2170
- if (GrafreeD.clipboard.size() == 1)
3008
+ if (Grafreed.clipboard.size() == 1)
21713009 {
2172
- Object3D content = GrafreeD.clipboard.get(0);
3010
+ Object3D content = Grafreed.clipboard.get(0);
21733011
21743012 if (content instanceof cGroup && ((cGroup)content).transientlink )
21753013 content = ((cGroup)content).get(0);
....@@ -2186,7 +3024,7 @@
21863024 {
21873025 RevertMeshes();
21883026 } else
2189
- if (source == resetMeshItem)
3027
+ if (source == resetAllItem)
21903028 {
21913029 ResetAll();
21923030 } else
....@@ -2194,7 +3032,7 @@
21943032 {
21953033 StepAll();
21963034 } else
2197
- if (source == clearItem) // || event.getSource() == clearButton)
3035
+ if (source == deleteItem) // || event.getSource() == clearButton)
21983036 {
21993037 //int indices[] = jList.getSelectedIndices();
22003038 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2206,9 +3044,9 @@
22063044 {
22073045 ClearSelection(true);
22083046 } else
2209
- if (source == grabItem)
3047
+ if (source == grabItem || source == groupButton)
22103048 {
2211
- group(new cGroup(), true);
3049
+ group(new cGroup(), false); // true);
22123050 } else
22133051 if (source == hideItem)
22143052 {
....@@ -2226,11 +3064,11 @@
22263064 {
22273065 makeSomething(new Camera());
22283066 } else
2229
- if (source == compositeItem)
3067
+ if (source == compositeItem || source == compositeButton)
22303068 {
22313069 group(new Composite());
22323070 } else
2233
- if (source == randomItem)
3071
+ if (source == switchItem || source == switchButton)
22343072 {
22353073 RandomNode random = new RandomNode();
22363074 group(random);
....@@ -2332,7 +3170,7 @@
23323170 {
23333171 group(new cLinker());
23343172 } else
2335
- if (source == textureItem)
3173
+ if (source == textureItem || source == textureButton)
23363174 {
23373175 group(new TextureNode());
23383176 } else
....@@ -2352,17 +3190,30 @@
23523190 {
23533191 CastShadow(2);
23543192 } else
2355
- if (source == ungroupItem)
3193
+ if (source == ungroupItem || source == ungroupButton)
23563194 {
2357
- //ungroup();
3195
+ boolean hasRoot = false;
3196
+
23583197 for (int i=0; i<group.selection.size(); i++)
23593198 {
2360
- Ungroup(group.selection.get(i));
3199
+ if (group.selection.get(i) == group)
3200
+ {
3201
+ hasRoot = true;
3202
+ break;
3203
+ }
23613204 }
23623205
2363
- ClearSelection(false);
2364
-
2365
- refreshContents();
3206
+ if (!hasRoot)
3207
+ {
3208
+ for (int i=0; i<group.selection.size(); i++)
3209
+ {
3210
+ Ungroup(group.selection.get(i));
3211
+ }
3212
+
3213
+ ClearSelection(false);
3214
+
3215
+ refreshContents();
3216
+ }
23663217 } else
23673218 if (source == genUVItem)
23683219 {
....@@ -2374,7 +3225,7 @@
23743225 } else
23753226 if (source == genNormalsMESHItem)
23763227 {
2377
- GenNormals(true); // TODO
3228
+ GenNormalsMESH();
23783229 } else
23793230 if (source == genNormalsORGANItem)
23803231 {
....@@ -2439,6 +3290,22 @@
24393290 if (source == unmarkleavesItem)
24403291 {
24413292 MarkLeaves(false);
3293
+ } else
3294
+ if (source == rewindleavesItem)
3295
+ {
3296
+ RewindLeaves(true);
3297
+ } else
3298
+ if (source == unrewindleavesItem)
3299
+ {
3300
+ RewindLeaves(false);
3301
+ } else
3302
+ if (source == randomleavesItem)
3303
+ {
3304
+ RandomLeaves(true);
3305
+ } else
3306
+ if (source == unrandomleavesItem)
3307
+ {
3308
+ RandomLeaves(false);
24423309 } else
24433310 if (source == flipVItem)
24443311 {
....@@ -2524,9 +3391,13 @@
25243391 {
25253392 SmoothMesh();
25263393 } else
2527
- if (source == transformgeometryItem)
3394
+ if (source == transformGeometryItem)
25283395 {
25293396 TransformGeometry();
3397
+ } else
3398
+ if (source == transformChildrenItem)
3399
+ {
3400
+ TransformChildren();
25303401 } else
25313402 if (source == resetTransformItem)
25323403 {
....@@ -2534,7 +3405,11 @@
25343405 } else
25353406 if (source == resetCentroidItem)
25363407 {
2537
- ResetCentroid();
3408
+ ResetCentroid(true);
3409
+ } else
3410
+ if (source == resetCentroidXZItem)
3411
+ {
3412
+ ResetCentroid(false);
25383413 } else
25393414 if (source == resetParentItem)
25403415 {
....@@ -2639,7 +3514,7 @@
26393514 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26403515 {
26413516 obj = (Object3D)e.nextElement();
2642
- obj.SetBumpTexture(null);
3517
+ obj.ResetBumpTexture();
26433518 }
26443519
26453520 refreshContents();
....@@ -2655,6 +3530,31 @@
26553530
26563531 refreshContents();
26573532 } else
3533
+ if (source == embedTexturesItem)
3534
+ {
3535
+ Object3D obj;
3536
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3537
+ {
3538
+ obj = (Object3D)e.nextElement();
3539
+ obj.EmbedTextures(true);
3540
+ }
3541
+
3542
+ refreshContents();
3543
+ } else
3544
+ if (source == deEmbedTexturesItem)
3545
+ {
3546
+ Object3D obj;
3547
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3548
+ {
3549
+ obj = (Object3D)e.nextElement();
3550
+ obj.EmbedTextures(false);
3551
+ }
3552
+
3553
+ CameraPane.texturepigment.clear();
3554
+ CameraPane.texturebump.clear();
3555
+
3556
+ refreshContents();
3557
+ } else
26583558 if (source == flashSelectionButton)
26593559 {
26603560 CameraPane.flash = true;
....@@ -2666,6 +3566,10 @@
26663566 if (source == twoButton)
26673567 {
26683568 radio.layout = twoButton;
3569
+
3570
+ if (CameraPane.FULLSCREEN)
3571
+ fullscreenLayout = radio.layout;
3572
+
26693573 // bug
26703574 //gridPanel.setDividerLocation(1.0);
26713575 //bigPanel.setDividerLocation(0.0);
....@@ -2698,10 +3602,31 @@
26983602 bigThree.ClearUI();
26993603 bigThree.add(centralPanel);
27003604 bigThree.FlushUI();
3605
+
3606
+ cameraView.requestFocusInWindow();
3607
+
3608
+// refreshContents(true);
3609
+//
3610
+// try
3611
+// {
3612
+// java.awt.Robot bot = new java.awt.Robot();
3613
+// int mask = InputEvent.BUTTON1_MASK;
3614
+// bot.mouseMove(100, 100);
3615
+// bot.mousePress(mask);
3616
+// bot.mouseRelease(mask);
3617
+// }
3618
+// catch (Exception e)
3619
+// {
3620
+//
3621
+// }
3622
+
27013623 } else
27023624 if (source == threeButton)
27033625 {
27043626 radio.layout = threeButton;
3627
+
3628
+ if (CameraPane.FULLSCREEN)
3629
+ fullscreenLayout = radio.layout;
27053630
27063631 // bigThree.remove(scenePanel);
27073632 // bigThree.remove(centralPanel);
....@@ -2731,13 +3656,18 @@
27313656 // centralPanel.setVisible(true);
27323657 // XYZPanel.setVisible(true);
27333658 bigThree.ClearUI();
3659
+ bigThree.add(scenePanel);
27343660 bigThree.add(centralPanel);
2735
- bigThree.add(XYZPanel);
27363661 bigThree.FlushUI();
3662
+
3663
+ cameraView.requestFocusInWindow();
27373664 } else
27383665 if (source == fourButton)
27393666 {
27403667 radio.layout = fourButton;
3668
+
3669
+ if (CameraPane.FULLSCREEN)
3670
+ fullscreenLayout = radio.layout;
27413671
27423672 // bigThree.remove(scenePanel);
27433673 // bigThree.remove(centralPanel);
....@@ -2769,10 +3699,15 @@
27693699 bigThree.ClearUI();
27703700 bigThree.add(scenePanel);
27713701 bigThree.FlushUI();
3702
+
3703
+ cameraView.requestFocusInWindow();
27723704 } else
27733705 if (source == sixButton)
27743706 {
27753707 radio.layout = sixButton;
3708
+
3709
+ if (CameraPane.FULLSCREEN)
3710
+ fullscreenLayout = radio.layout;
27763711
27773712 // bigThree.remove(scenePanel);
27783713 // bigThree.remove(centralPanel);
....@@ -2802,13 +3737,18 @@
28023737 // centralPanel.setVisible(true);
28033738 // XYZPanel.setVisible(false);
28043739 bigThree.ClearUI();
2805
- bigThree.add(scenePanel);
28063740 bigThree.add(centralPanel);
3741
+ bigThree.add(scenePanel);
28073742 bigThree.FlushUI();
3743
+
3744
+ cameraView.requestFocusInWindow();
28083745 } else
28093746 if (source == sevenButton)
28103747 {
28113748 radio.layout = sevenButton;
3749
+
3750
+ if (CameraPane.FULLSCREEN)
3751
+ fullscreenLayout = radio.layout;
28123752
28133753 // bigThree.remove(scenePanel);
28143754 // bigThree.remove(centralPanel);
....@@ -2842,6 +3782,8 @@
28423782 bigThree.add(centralPanel);
28433783 bigThree.add(XYZPanel);
28443784 bigThree.FlushUI();
3785
+
3786
+ cameraView.requestFocusInWindow();
28453787 } else
28463788 if (source == rootButton)
28473789 {
....@@ -2853,6 +3795,7 @@
28533795 EditObject(obj);
28543796 }
28553797
3798
+ cameraView.requestFocusInWindow();
28563799 refreshContents(true);
28573800 } else
28583801 if (source == closeButton)
....@@ -2862,22 +3805,37 @@
28623805 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28633806 {
28643807 ab = (cRadio)e.nextElement();
2865
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3808
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28663809 {
3810
+ // Patch to avoid bug with transparency.
3811
+ if (!ab.hadMaterial)
3812
+ {
3813
+ ab.object.material = null;
3814
+ }
3815
+
28673816 buttonGroup.remove(ab);
28683817 radioPanel.remove(ab);
28693818
2870
- ab.GetObject().editWindow = null;
3819
+ //ab.GetObject().editWindow = null;
3820
+ ab.GetObject().manipWindow = null;
28713821 // ab.GetObject().objectUI = null; // ?????????
28723822
28733823 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28743824 break;
28753825 }
28763826 }
3827
+
3828
+ cameraView.requestFocusInWindow();
28773829 refreshContents(true);
28783830 } else
28793831 if (source == editItem || source == editButton)
28803832 {
3833
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3834
+ {
3835
+ Object3D child = (Object3D)e.nextElement();
3836
+ child.pinned = true;
3837
+ }
3838
+
28813839 EditSelection(false);
28823840 } else
28833841 if (source == uneditButton)
....@@ -2886,13 +3844,14 @@
28863844 {
28873845 Object3D child = (Object3D)e.nextElement();
28883846 if(child.editWindow != null)
2889
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3847
+ child.pinned = false;
28903848 child.CloseUI();
28913849 listUI.remove(child);
3850
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28923851
2893
- child.editWindow = null; // ???????????
3852
+ //child.editWindow = null; // ???????????
28943853 }
2895
- objEditor.ctrlPanel.validate();
3854
+ objEditor.ctrlPanel.FlushUI();
28963855 //objEditor.jTree.clearSelection();
28973856 //objEditor.ResetSliders();
28983857 refreshContents(true);
....@@ -2903,16 +3862,18 @@
29033862 //copy.ClearUI();
29043863 for (Object3D obj : listUI)
29053864 {
3865
+ obj.pinned = false;
29063866 obj.CloseUI();
29073867 }
29083868 listUI.clear();
3869
+ SetPinStates(group.selection.size() > 0);
29093870 refreshContents(true);
29103871 } else
29113872 if (source == allParamsButton)
29123873 {
29133874 assert(copy == group);
29143875
2915
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3876
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29163877
29173878 for (Object3D obj : listUI)
29183879 {
....@@ -2961,6 +3922,9 @@
29613922 }
29623923
29633924 copy = group;
3925
+
3926
+ SetUndoStates();
3927
+
29643928 //Globals.theRenderer.object = group;
29653929 if(!useclient)
29663930 {
....@@ -2976,20 +3940,49 @@
29763940 frontView.object = group;
29773941 sideView.object = group;
29783942 }
2979
- group.editWindow = this;
3943
+
3944
+// fix "+" issue
3945
+ //group.editWindow = this;
3946
+ group.manipWindow = this;
3947
+
29803948 /*
29813949 currentLayout = radio.layout;
29823950 if (currentLayout == null)
29833951 currentLayout = sevenButton;
29843952 */
29853953 radio.layout.doClick();
3954
+
3955
+ ClearUnpinned();
3956
+
3957
+ //Grafreed.Assert(group != null);
3958
+ //Grafreed.Assert(group.selection != null);
3959
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3960
+ if (group.selection == null || group.selection.size() == 1)
3961
+ EditSelection(false);
29863962 keepparent = group.parent;
29873963 // PARENT = NULL or not???
29883964 //group.parent = null; // ROOT
29893965 //group.attributes = -1;
29903966 ResetModel();
3967
+
3968
+ cameraView.requestFocusInWindow();
29913969 refreshContents(true);
2992
- }
3970
+ } else if (event.getSource() == editCameraItem)
3971
+ {
3972
+ cameraView.ProtectCamera();
3973
+ cameraView.requestFocusInWindow();
3974
+ cameraView.repaint();
3975
+ return;
3976
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3977
+ {
3978
+ cameraView.RevertCamera();
3979
+ cameraView.requestFocusInWindow();
3980
+ cameraView.repaint();
3981
+ return;
3982
+ // } else if (event.getSource() == textureButton)
3983
+ // {
3984
+ // return; // true;
3985
+ }
29933986 else
29943987 {
29953988 //return super.action(event, arg);
....@@ -2998,7 +3991,6 @@
29983991 }
29993992
30003993 boolean useclient = false;
3001
- cRadio radio;
30023994
30033995 void ToggleRoot()
30043996 {
....@@ -3050,6 +4042,28 @@
30504042 refreshContents();
30514043 }
30524044
4045
+ void TransformChildren()
4046
+ {
4047
+ Object3D obj;
4048
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
4049
+ {
4050
+ obj = (Object3D)e.nextElement();
4051
+ obj.KeepTextureMatrices();
4052
+ obj.TransformChildren();
4053
+ obj.RestoreTextureMatrices();
4054
+
4055
+// if (obj.parent == null)
4056
+// {
4057
+// System.out.println("NULL PARENT!");
4058
+// new Exception().printStackTrace();
4059
+// }
4060
+// else
4061
+// TouchTransform(obj);
4062
+// //obj.parent.Touch();
4063
+ }
4064
+
4065
+ refreshContents();
4066
+ }
30534067
30544068 void ResetTransform()
30554069 {
....@@ -3162,7 +4176,7 @@
31624176 refreshContents();
31634177 }
31644178
3165
- void ResetCentroid()
4179
+ void ResetCentroid(boolean full)
31664180 {
31674181 Object3D obj;
31684182 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3177,12 +4191,16 @@
31774191 LA.matIdentity(Object3D.mat);
31784192 obj.getBounds(minima, maxima, false);
31794193 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3180
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
4194
+ if (full)
4195
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31814196 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31824197 obj.TransformMesh(Object3D.mat);
4198
+
31834199 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3184
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
4200
+ if (full)
4201
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31854202 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
4203
+
31864204 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31874205 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31884206 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3211,7 +4229,8 @@
32114229
32124230 int size = obj.MemorySize();
32134231
3214
- System.err.println((size/1024) + " KB is the size of " + obj);
4232
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4233
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32154234 }
32164235 }
32174236 catch (Exception e)
....@@ -3248,9 +4267,9 @@
32484267 obj = (Object3D)e.nextElement();
32494268
32504269 System.out.println("Object is: " + obj);
3251
- GrafreeD.AnalyzeObject(obj);
4270
+ Grafreed.AnalyzeObject(obj);
32524271 System.out.println("Boundary rep: " + obj.bRep);
3253
- GrafreeD.AnalyzeObject(obj.bRep);
4272
+ Grafreed.AnalyzeObject(obj.bRep);
32544273
32554274 // System.err.println((size/1024) + " KB is the size of " + obj);
32564275 }
....@@ -3292,6 +4311,13 @@
32924311 void GenNormals(boolean crease)
32934312 {
32944313 group.GenNormalsS(crease);
4314
+
4315
+ refreshContents();
4316
+ }
4317
+
4318
+ void GenNormalsMESH()
4319
+ {
4320
+ group.GenNormalsMeshS();
32954321
32964322 refreshContents();
32974323 }
....@@ -3464,8 +4490,8 @@
34644490
34654491 void ParseVertices()
34664492 {
3467
- boolean epsequal = GrafreeD.epsequal;
3468
- GrafreeD.epsequal = true;
4493
+ boolean epsequal = Grafreed.epsequal;
4494
+ Grafreed.epsequal = true;
34694495
34704496 for (int i=0; i<group.selection.size(); i++)
34714497 {
....@@ -3490,7 +4516,7 @@
34904516 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34914517 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34924518
3493
- g.add(GrafreeD.clipboard);
4519
+ g.add(Grafreed.clipboard);
34944520
34954521 buffer.add(g);
34964522 }
....@@ -3505,7 +4531,7 @@
35054531 makeSomething(buffer, i==group.selection.size()-1);
35064532 }
35074533
3508
- GrafreeD.epsequal = epsequal;
4534
+ Grafreed.epsequal = epsequal;
35094535
35104536 refreshContents();
35114537 }
....@@ -3523,7 +4549,16 @@
35234549 String pigment = Object3D.GetPigment(tex);
35244550 //String bump = Object3D.GetBump(tex);
35254551
3526
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4552
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4553
+
4554
+ try
4555
+ {
4556
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4557
+ }
4558
+ catch (Exception e)
4559
+ {
4560
+ System.err.println("FAIL: " + node);
4561
+ }
35274562
35284563 double s = v.s;
35294564
....@@ -3611,11 +4646,11 @@
36114646
36124647 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
36134648
3614
- boolean random = CameraPane.RANDOM;
3615
- CameraPane.RANDOM = false; // parse all random nodes
4649
+ boolean random = CameraPane.SWITCH;
4650
+ CameraPane.SWITCH = false; // parse all random nodes
36164651 lowres.linkVerticesThis(null);
36174652 lowres.linkVerticesThis(sn);
3618
- CameraPane.RANDOM = random;
4653
+ CameraPane.SWITCH = random;
36194654
36204655 System.err.flush();
36214656
....@@ -3655,7 +4690,7 @@
36554690 return;
36564691
36574692 Object3D poses = group.selection.get(0);
3658
- Object3D ref = GrafreeD.clipboard.get(0);
4693
+ Object3D ref = Grafreed.clipboard.get(0);
36594694
36604695 Object3D newgroup = new Object3D("Po:" + poses.name);
36614696
....@@ -3849,9 +4884,9 @@
38494884
38504885 void ClipMesh()
38514886 {
3852
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4887
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38534888 {
3854
- Object3D content = GrafreeD.clipboard.get(0);
4889
+ Object3D content = Grafreed.clipboard.get(0);
38554890
38564891 if (content instanceof cGroup && ((cGroup)content).transientlink )
38574892 content = ((cGroup)content).get(0);
....@@ -3860,7 +4895,7 @@
38604895 // {
38614896 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38624897 // }
3863
- group.selection.ClipMesh(GrafreeD.clipboard);
4898
+ group.selection.ClipMesh(Grafreed.clipboard);
38644899 }
38654900 // group.selection.ClipMesh(GrafreeD.clipboard);
38664901 System.out.println("DONE.");
....@@ -3907,6 +4942,18 @@
39074942 void MarkLeaves(boolean hide)
39084943 {
39094944 group.selection.MarkLeaves(hide);
4945
+ refreshContents();
4946
+ }
4947
+
4948
+ void RewindLeaves(boolean hide)
4949
+ {
4950
+ group.selection.RewindLeaves(hide);
4951
+ refreshContents();
4952
+ }
4953
+
4954
+ void RandomLeaves(boolean hide)
4955
+ {
4956
+ group.selection.RandomLeaves(hide);
39104957 refreshContents();
39114958 }
39124959
....@@ -3981,28 +5028,25 @@
39815028 // }
39825029 // }
39835030
3984
- static boolean allparams = true;
3985
-
3986
- static Vector<Object3D> listUI = new Vector<Object3D>();
3987
-
39885031 void EditSelection(boolean newWindow)
39895032 {
5033
+ if (group.selection == null)
5034
+ {
5035
+ EditElement(group, newWindow); // ? new
5036
+ return;
5037
+ }
5038
+
39905039 // aConstraints.gridy = 0;
39915040 for (int i=0; i<group.selection.size(); i++)
39925041 {
39935042 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39945043 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3995
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5044
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39965045
39975046 Object3D elem = (Object3D)group.selection.elementAt(i);
3998
- if(elem != group)
5047
+ if(elem != group || !newWindow)
39995048 {
4000
- // if (!(elem instanceof Composite))
4001
- // newWindow = false;
4002
- listUI.add(elem);
4003
- elem.openEditWindow(this, newWindow); //, false);
4004
- System.out.println("edit : " + elem);
4005
- elem.editWindow.refreshContents(true); // ? new
5049
+ EditElement(elem, newWindow); // ? new
40065050 }
40075051 }
40085052 }
....@@ -4065,9 +5109,7 @@
40655109
40665110 freezemodel = false;
40675111 }
4068
-
4069
- boolean flashIt = true;
4070
-
5112
+
40715113 public void valueChanged(TreeSelectionEvent e)
40725114 //public boolean handleEvent(Event event)
40735115 {
....@@ -4077,7 +5119,8 @@
40775119 //new Exception().printStackTrace();
40785120
40795121 freezemodel = true;
4080
-
5122
+ ClearUnpinned();
5123
+
40815124 /**/
40825125 //switch (event.id)
40835126 {
....@@ -4085,7 +5128,6 @@
40855128 //case 702: // Event.LIST_DESELECT
40865129 group.deselectAll();
40875130 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4088
- objEditor.ClearInfo(); // .GetMaterial());
40895131 if (tps != null)
40905132 {
40915133 for (int i=0; i < tps.length; i++)
....@@ -4094,10 +5136,8 @@
40945136
40955137 //if (child.parent != null)
40965138 //child.parent.addSelectee(child);
5139
+ objEditor.SetMaterial(child);
40975140 group.addSelectee(child);
4098
- objEditor.SetMaterial(child); // .GetMaterial());
4099
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4100
- System.err.println("info : " + child.GetPath());
41015141 }
41025142 }
41035143 // else
....@@ -4107,20 +5147,28 @@
41075147 // System.err.println("info : " + group.GetPath());
41085148 // }
41095149
4110
- objEditor.SetText(); // jan 2014
4111
-
4112
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5150
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
41135151 CameraPane.flash = true;
41145152
4115
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5153
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41165154 // a camera
41175155 {
4118
- CameraPane.camerachangeframe = 0; // don't refuse it
4119
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5156
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5157
+ {
5158
+ CameraPane.camerachangeframe = 0; // don't refuse it
5159
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5160
+ }
41205161 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41215162 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41225163 }
41235164
5165
+ if (tps != null && tps.length == 1)
5166
+ {
5167
+ EditSelection(false);
5168
+ }
5169
+
5170
+ SetPinStates(tps != null && tps.length > 0);
5171
+
41245172 refreshContents();
41255173 //return true;
41265174 }
....@@ -4129,6 +5177,37 @@
41295177
41305178 freezemodel = false;
41315179 }
5180
+
5181
+ void SetPinStates(boolean enabled)
5182
+ {
5183
+ editButton.setEnabled(enabled);
5184
+ uneditButton.setEnabled(enabled);
5185
+ //unselectButton.setEnabled(enabled);
5186
+ flashSelectionButton.setEnabled(enabled);
5187
+
5188
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5189
+ }
5190
+
5191
+ void refreshContents(boolean cp)
5192
+ {
5193
+ //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5194
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5195
+ {
5196
+ objEditor.ClearInfo(); // .GetMaterial());
5197
+
5198
+ for (int i=0; i < group.selection.Size(); i++)
5199
+ {
5200
+ Object3D child = (Object3D) group.selection.get(i);
5201
+
5202
+ objEditor.AddInfo(child, this, true);
5203
+ System.err.println("info : " + child.GetPath());
5204
+ }
5205
+
5206
+ objEditor.SetText(); // jan 2014
5207
+ }
5208
+
5209
+ super.refreshContents(cp);
5210
+ }
41325211
41335212 void linkSomething(Object3D thing)
41345213 {
....@@ -4200,16 +5279,19 @@
42005279 {
42015280 if (group.selection.isEmpty())
42025281 return;
4203
- GrafreeD.clipboardIsTempGroup = false;
5282
+
5283
+ Grafreed.clipboardIsTempGroup = false;
42045284 Composite tGroup = null;
42055285 if (group.selection.size() > 0) // 1)
42065286 {
42075287 tGroup = new cGroup();
4208
- GrafreeD.clipboardIsTempGroup = true;
5288
+ Grafreed.clipboardIsTempGroup = true;
42095289 }
42105290
42115291 if (cut)
42125292 {
5293
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5294
+// Save();
42135295 //int indices[] = jList.getSelectedIndices();
42145296 //for (int i = indices.length - 1; i >= 0; i--)
42155297 //jList.remove(indices[i]);
....@@ -4245,16 +5327,16 @@
42455327 //System.out.println("cut " + child);
42465328 //System.out.println("parent = " + child.parent);
42475329 // tmp.addChild(child);
4248
- if (GrafreeD.clipboardIsTempGroup)
5330
+ if (Grafreed.clipboardIsTempGroup)
42495331 tGroup.add/*Child*/(tmp);
42505332 else
4251
- GrafreeD.clipboard = tmp;
5333
+ Grafreed.clipboard = tmp;
42525334 }
42535335 else
4254
- if (GrafreeD.clipboardIsTempGroup)
5336
+ if (Grafreed.clipboardIsTempGroup)
42555337 tGroup.add/*Child*/(child);
42565338 else
4257
- GrafreeD.clipboard = child;
5339
+ Grafreed.clipboard = child;
42585340 }
42595341
42605342 //ResetModel();
....@@ -4286,21 +5368,23 @@
42865368 //System.out.println("cut " + elem);
42875369 //System.out.println("parent = " + elem.parent);
42885370 // tmp.addChild(elem);
4289
- if (GrafreeD.clipboardIsTempGroup)
5371
+ if (Grafreed.clipboardIsTempGroup)
42905372 tGroup.add/*Child*/(tmp);
42915373 else
4292
- GrafreeD.clipboard = tmp;
5374
+ Grafreed.clipboard = tmp;
42935375 }
42945376 else
4295
- if (GrafreeD.clipboardIsTempGroup)
5377
+ if (Grafreed.clipboardIsTempGroup)
42965378 tGroup.add/*Child*/(child);
42975379 else
4298
- GrafreeD.clipboard = child;
5380
+ Grafreed.clipboard = child;
42995381 }
43005382
43015383 }
4302
- if (GrafreeD.clipboardIsTempGroup)
4303
- GrafreeD.clipboard = tGroup;
5384
+
5385
+ if (Grafreed.clipboardIsTempGroup)
5386
+ Grafreed.clipboard = tGroup;
5387
+
43045388 if (cut)
43055389 {
43065390 ResetModel();
....@@ -4310,11 +5394,15 @@
43105394
43115395 void paste(boolean expand)
43125396 {
5397
+ if (Globals.REPLACEONMAKE)
5398
+ Save();
5399
+ boolean keep = Globals.REPLACEONMAKE;
5400
+ Globals.REPLACEONMAKE = false;
43135401 // if (GrafreeD.clipboard == null)
43145402 // return;
43155403 boolean first = true;
43165404
4317
- if (GrafreeD.clipboardIsTempGroup)
5405
+ if (Grafreed.clipboardIsTempGroup)
43185406 {
43195407 Composite temp;
43205408
....@@ -4325,7 +5413,7 @@
43255413 temp = (Composite)Applet3D.clipboard.deepCopy();
43265414 */
43275415 Object3D elem;
4328
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5416
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43295417 {
43305418 Object3D child = (Object3D)e.nextElement();
43315419
....@@ -4359,21 +5447,22 @@
43595447 //Object3D cb = Applet3D.clipboard;
43605448 //temp.addChild(cb);
43615449 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4362
- assert(GrafreeD.clipboard.parent == null);
4363
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4364
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4365
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4366
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5450
+ assert(Grafreed.clipboard.parent == null);
5451
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5452
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5453
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5454
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43675455 else
4368
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4369
- GrafreeD.clipboard.get(0).parent = keepparent;
5456
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5457
+ Grafreed.clipboard.get(0).parent = keepparent;
43705458 }
43715459
5460
+ Globals.REPLACEONMAKE = keep;
43725461 ResetModel();
43735462 refreshContents();
43745463 }
43755464
4376
- void pasteInto(boolean copyit)
5465
+ void pasteInto(boolean copyit, boolean clone)
43775466 {
43785467 // if (GrafreeD.clipboard == null)
43795468 // return;
....@@ -4402,15 +5491,22 @@
44025491 if (copyit)
44035492 {
44045493 // paste(false);
4405
- CloneClipboard(false); // sept 2014
5494
+ if (clone)
5495
+ {
5496
+ CloneClipboard(false); // sept 2014
5497
+ }
5498
+ else
5499
+ {
5500
+ paste(false);
5501
+ }
44065502 }
44075503 else
44085504 {
44095505 boolean first = true;
44105506
4411
- if (GrafreeD.clipboardIsTempGroup)
5507
+ if (Grafreed.clipboardIsTempGroup)
44125508 {
4413
- Composite temp = (Composite)GrafreeD.clipboard;
5509
+ Composite temp = (Composite)Grafreed.clipboard;
44145510 Object3D copy;
44155511 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44165512 {
....@@ -4420,7 +5516,7 @@
44205516 }
44215517 } else
44225518 {
4423
- linkSomething(GrafreeD.clipboard); //.get(0));
5519
+ linkSomething(Grafreed.clipboard); //.get(0));
44245520 }
44255521 }
44265522 }
....@@ -4497,6 +5593,10 @@
44975593
44985594 void group(Object3D csg, boolean grab)
44995595 {
5596
+ if (Globals.REPLACEONMAKE)
5597
+ Save();
5598
+ boolean keep = Globals.REPLACEONMAKE;
5599
+ Globals.REPLACEONMAKE = false;
45005600 if (//false) // why??
45015601 !group.selection.isEmpty())
45025602 {
....@@ -4610,10 +5710,15 @@
46105710 //node.add(csg);
46115711 //makeSomething(node);
46125712 makeSomething(csg);
5713
+ Globals.REPLACEONMAKE = keep;
46135714 }
46145715
46155716 void Ungroup(Object3D g)
46165717 {
5718
+ if (Globals.REPLACEONMAKE)
5719
+ Save();
5720
+ boolean keep = Globals.REPLACEONMAKE;
5721
+ Globals.REPLACEONMAKE = false;
46175722 if (g instanceof HiddenObject)
46185723 {
46195724 HiddenObject h = (HiddenObject) g;
....@@ -4630,6 +5735,7 @@
46305735 objEditor.makeSomething(g.get(i), false);
46315736 }
46325737 }
5738
+ Globals.REPLACEONMAKE = keep;
46335739 }
46345740
46355741 void ungroup()
....@@ -4825,21 +5931,6 @@
48255931 }
48265932 */
48275933
4828
- void ImportGFD()
4829
- {
4830
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4831
- browser.show();
4832
- String filename = browser.getFile();
4833
- if (filename != null && filename.length() > 0)
4834
- {
4835
- String fullname = browser.getDirectory() + filename;
4836
-
4837
- //Object3D readobj =
4838
- objEditor.ReadGFD(fullname, objEditor);
4839
- //makeSomething(readobj);
4840
- }
4841
- }
4842
-
48435934 /*
48445935 public void Callback(Object obj)
48455936 {
....@@ -4863,26 +5954,9 @@
48635954 }
48645955 */
48655956
4866
- void ImportVRMLX3D()
4867
- {
4868
- if (GrafreeD.standAlone)
4869
- {
4870
- /**/
4871
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4872
- browser.show();
4873
- String filename = browser.getFile();
4874
- if (filename != null && filename.length() > 0)
4875
- {
4876
- String fullname = browser.getDirectory() + filename;
4877
- LoadVRMLX3D(fullname);
4878
- }
4879
- /**/
4880
- }
4881
- }
4882
-
48835957 String GetFile(String dialogName)
48845958 {
4885
- if (GrafreeD.standAlone)
5959
+ if (Grafreed.standAlone)
48865960 {
48875961 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48885962 browser.show();
....@@ -4946,10 +6020,48 @@
49466020 cButton flashSelectionButton;
49476021 cButton editButton;
49486022 cButton uneditButton;
6023
+ JCheckBox allParamsButton;
49496024 cButton clearpanelButton;
4950
- cButton allParamsButton;
49516025 cButton unselectButton;
49526026
6027
+ cButton restoreCameraButton;
6028
+
6029
+ cButton oneStepButton;
6030
+
6031
+ cButton groupButton;
6032
+ cButton ungroupButton;
6033
+ cButton compositeButton;
6034
+ cButton switchButton;
6035
+ cButton loopButton;
6036
+ cButton textureButton;
6037
+
6038
+ cButton skybox1Button;
6039
+ cButton skybox2Button;
6040
+ cButton skybox3Button;
6041
+ cButton skybox4Button;
6042
+ cButton skybox5Button;
6043
+ cButton skybox6Button;
6044
+ cButton skybox7Button;
6045
+
6046
+ cButton skybox11Button;
6047
+ cButton skybox12Button;
6048
+ cButton skybox13Button;
6049
+ cButton skybox14Button;
6050
+ cButton skybox15Button;
6051
+ cButton skybox16Button;
6052
+ cButton skybox17Button;
6053
+
6054
+ cButton gridButton;
6055
+ cButton boxButton;
6056
+ cButton sphereButton;
6057
+ cButton coneButton;
6058
+ cButton torusButton;
6059
+ cButton superButton;
6060
+ cButton kleinButton;
6061
+ cButton particlesButton;
6062
+ cButton overlayButton;
6063
+ cButton lightButton;
6064
+
49536065 cButton screenfitButton;
49546066 cButton screenfitpointButton;
49556067 cButton snapobjectButton;
....@@ -4961,14 +6073,6 @@
49616073
49626074 cButton setsupportButton;
49636075
4964
- cButton twoButton;
4965
- cButton sixButton;
4966
- cButton threeButton;
4967
- cButton sevenButton;
4968
- cButton fourButton; // full panel
4969
- cButton oneButton; // full XYZ
4970
- //cButton currentLayout;
4971
-
49726076 //
49736077 //Composite
49746078 Object3D // to do !!
....@@ -4978,9 +6082,11 @@
49786082 //JTree jTree;
49796083 private MenuItem lookAtItem;
49806084 private MenuItem lookFromItem;
4981
- private MenuItem switchItem;
6085
+ private MenuItem switchViewItem;
49826086 private MenuItem cutItem;
4983
- private MenuItem duplicateItem;
6087
+ private MenuItem undoItem;
6088
+ private MenuItem redoItem;
6089
+ private JMenuItem duplicateItem;
49846090 private MenuItem cloneItem;
49856091 private MenuItem cloneSupportItem;
49866092 private MenuItem overwriteGeoItem;
....@@ -4993,7 +6099,7 @@
49936099 private MenuItem linkverticesItem;
49946100 private MenuItem relinkverticesItem;
49956101 private MenuItem setMasterItem;
4996
- private MenuItem resetMeshItem;
6102
+ private MenuItem resetAllItem;
49976103 private MenuItem stepAllItem;
49986104 private MenuItem revertMeshItem;
49996105 private MenuItem poseMeshItem;
....@@ -5004,10 +6110,11 @@
50046110 private MenuItem mergeGeometriesItem;
50056111 private MenuItem copyItem;
50066112 private MenuItem pasteItem;
6113
+ private MenuItem pasteIntoItem;
50076114 private MenuItem pasteLinkItem;
50086115 private MenuItem pasteCloneItem;
50096116 private MenuItem pasteExpandItem;
5010
- private MenuItem clearItem;
6117
+ private MenuItem deleteItem;
50116118 private MenuItem clearAllItem;
50126119 private MenuItem genUVItem;
50136120 private MenuItem genNormalsMESHItem;
....@@ -5042,6 +6149,10 @@
50426149 private MenuItem showleavesItem;
50436150 private MenuItem markleavesItem;
50446151 private MenuItem unmarkleavesItem;
6152
+ private MenuItem rewindleavesItem;
6153
+ private MenuItem unrewindleavesItem;
6154
+ private MenuItem randomleavesItem;
6155
+ private MenuItem unrandomleavesItem;
50456156
50466157 private MenuItem flipVItem;
50476158 private MenuItem unflipVItem;
....@@ -5053,15 +6164,17 @@
50536164 private MenuItem panoTexturesItem;
50546165
50556166 private MenuItem resetCentroidItem;
5056
- private MenuItem transformgeometryItem;
6167
+ private MenuItem resetCentroidXZItem;
50576168 private MenuItem resetTransformItem;
6169
+ private MenuItem transformGeometryItem;
6170
+ private MenuItem transformChildrenItem;
50586171 private MenuItem hideItem;
50596172 private MenuItem grabItem;
50606173 private MenuItem backItem;
50616174 private MenuItem frontItem;
50626175 private MenuItem cameraItem;
50636176 private MenuItem compositeItem;
5064
- private MenuItem randomItem;
6177
+ private MenuItem switchItem;
50656178 private MenuItem physicsItem;
50666179 private MenuItem frameselectorItem;
50676180 private MenuItem scriptNodeItem;
....@@ -5085,6 +6198,8 @@
50856198 private MenuItem attachBumpItem;
50866199 private MenuItem detachBumpItem;
50876200 private MenuItem pigmentBumpItem;
6201
+ private MenuItem embedTexturesItem;
6202
+ private MenuItem deEmbedTexturesItem;
50886203
50896204 private MenuItem particleItem;
50906205 private MenuItem ragdollItem;
....@@ -5101,7 +6216,7 @@
51016216 private MenuItem blobItem;
51026217 private MenuItem latheItem;
51036218 private MenuItem bezierItem;
5104
- private MenuItem checkerItem;
6219
+ private MenuItem overlayItem;
51056220 private MenuItem meshItem;
51066221 // private MenuItem meshGroupItem;
51076222 private MenuItem springItem;
....@@ -5123,11 +6238,6 @@
51236238 private MenuItem doubleItem;
51246239 private MenuItem tripleItem;
51256240
5126
- private MenuItem importGFDItem;
5127
- private MenuItem importVRMLX3DItem;
5128
- private MenuItem import3DSItem;
5129
- private MenuItem importOBJItem;
5130
-
51316241 private MenuItem computeAOItem;
51326242 private MenuItem recompileItem;
51336243 private MenuItem editScriptItem;
....@@ -5137,4 +6247,8 @@
51376247 private MenuItem analyzeItem;
51386248 private MenuItem dumpItem;
51396249 //boolean freezemodel = false;
6250
+
6251
+ Menu cameraMenu;
6252
+ MenuItem editCameraItem;
6253
+ MenuItem restoreCameraItem;
51406254 }