Normand Briere
2019-07-19 e79247ef52a0bbb3864d46bb1e2c716005b3ecf3
GroupEditor.java
....@@ -12,6 +12,7 @@
1212 import com.jme.math.Vector3f;
1313 import com.jme.renderer.ColorRGBA;
1414
15
+import grafeme.ui.*;
1516 //import buoy.widget.BFileChooser;
1617
1718 class GroupEditor extends ObjEditor implements //iParse, //iCallBack,
....@@ -59,6 +60,12 @@
5960 this.copy = this.group = group;
6061 //selectees = this.group.selectees;
6162
63
+ if (copy.versions == null)
64
+ {
65
+ copy.versions = new byte[100][];
66
+ copy.versionindex = -1;
67
+ }
68
+
6269 if(ui)
6370 SetupUI(objEditor);
6471 }
....@@ -73,7 +80,13 @@
7380 this.copy = this.group = copy;
7481 //selectees = this.group.selectees;
7582
76
- SetupMenu2(objEditor);
83
+ if (copy.versions == null)
84
+ {
85
+ copy.versions = new byte[100][];
86
+ copy.versionindex = -1;
87
+ }
88
+
89
+ SetupMenu2(this); //objEditor);
7790 SetupUI2(objEditor);
7891 objEditor.SetupUI(true);
7992 SetupViews(objEditor);
....@@ -83,6 +96,10 @@
8396
8497 void CloneSelection(boolean supports)
8598 {
99
+ if (Globals.REPLACEONMAKE)
100
+ Save();
101
+ boolean keep = Globals.REPLACEONMAKE;
102
+ Globals.REPLACEONMAKE = false;
86103 // Object3D keep = GrafreeD.clipboard;
87104 //Object3D obj;
88105 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -93,18 +110,19 @@
93110
94111 makeSomething(clone, i==group.selection.size()-1);
95112 }
113
+ Globals.REPLACEONMAKE = keep;
96114 }
97115
98116 void CloneClipboard(boolean supports)
99117 {
100
- assert(GrafreeD.clipboard.parent == null);
101
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
102
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
103
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
104
- makeSomething(CloneObject(GrafreeD.clipboard.get(0), false));
118
+ assert(Grafreed.clipboard.parent == null);
119
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
120
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
121
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
122
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105123 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
124
+ makeSomething(CloneObject(Grafreed.clipboard, false));
125
+ Grafreed.clipboard.get(0).parent = keepparent;
108126 }
109127
110128 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +136,7 @@
118136 // obj.support = null;
119137 if (!supports)
120138 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
139
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122140 obj.parent = parent;
123141 // obj.support = support;
124142 // clone.support = support; // aout 2013
....@@ -147,30 +165,29 @@
147165
148166 //JTextField nameField;
149167
150
- void SetupMenu2(ObjEditor oe)
168
+ void SetupMenu2(GroupEditor oe)
151169 {
152
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
153
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
154
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
155
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
156
- oe.cameraMenu.add("-");
157
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
158
- openWindowItem.addActionListener(this);
159
- editLeafItem.addActionListener(this);
160
- lookAtItem.addActionListener(this);
161
- //lookFromItem.addActinoListener(this);
162
- //switchItem.addActionListener(this);
170
+ oe.jTree = new cTree();
171
+
163172 Menu menu;
164173 oe.menuBar.add(menu = new Menu("Edit"));
165174 //editItem = menu.add(new MenuItem("Edit"));
166175 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
176
+
177
+// undoItem = menu.add(new MenuItem("Undo"));
178
+// undoItem.addActionListener(this);
179
+// redoItem = menu.add(new MenuItem("Redo"));
180
+// redoItem.addActionListener(this);
181
+// menu.add("-");
182
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168183 duplicateItem.addActionListener(this);
169
- menu.add("-");
170184 cloneItem = menu.add(new MenuItem("Clone"));
171185 cloneItem.addActionListener(this);
186
+ if (Globals.ADVANCED)
187
+ {
172188 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173189 cloneSupportItem.addActionListener(this);
190
+ }
174191 menu.add("-");
175192 cutItem = menu.add(new MenuItem("Cut"));
176193 cutItem.addActionListener(this);
....@@ -178,27 +195,123 @@
178195 copyItem.addActionListener(this);
179196 pasteItem = menu.add(new MenuItem("Paste"));
180197 pasteItem.addActionListener(this);
198
+
199
+ menu.add("-");
200
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
201
+ pasteIntoItem.addActionListener(this);
181202 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182203 pasteLinkItem.addActionListener(this);
183204 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184205 pasteCloneItem.addActionListener(this);
185206 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186207 // pasteExpandItem.addActionListener(this);
187
- clearItem = menu.add(new MenuItem("Clear"));
188
- clearItem.addActionListener(this);
208
+ menu.add("-");
209
+ deleteItem = menu.add(new MenuItem("Delete"));
210
+ deleteItem.addActionListener(this);
211
+
212
+ if (Globals.ADVANCED)
213
+ {
214
+ // Deletes the cameras...
189215 clearAllItem = menu.add(new MenuItem("Clear All"));
190216 clearAllItem.addActionListener(this);
217
+ }
218
+
219
+ menuBar.add(cameraMenu = new Menu("View"));
220
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
221
+ //zBufferItem.addActionListener(this);
222
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
223
+ //normalLensItem.addActionListener(this);
224
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
225
+ restoreCameraItem.addActionListener(this);
226
+
227
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
228
+// toggleFullScreenItem.addItemListener(this);
229
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
230
+// cameraMenu.add("-");
231
+//
232
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
233
+// toggleTextureItem.addItemListener(this);
234
+// toggleTextureItem.setState(CameraPane.textureon);
235
+//
236
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
237
+// toggleSwitchItem.addItemListener(this);
238
+// toggleSwitchItem.setState(CameraPane.SWITCH);
239
+
240
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
241
+ toggleHandleItem.addItemListener(this);
242
+ toggleHandleItem.setState(CameraPane.HANDLES);
243
+
244
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
245
+ togglePaintItem.addItemListener(this);
246
+ togglePaintItem.setState(CameraPane.PAINTMODE);
247
+
248
+ if (Globals.ADVANCED)
249
+ {
250
+ cameraMenu.add("-");
251
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
252
+ toggleLiveItem.addItemListener(this);
253
+ toggleLiveItem.setState(Globals.isLIVE());
191254
255
+ cameraMenu.add(stepItem = new MenuItem("Step"));
256
+ stepItem.addActionListener(this);
257
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
258
+ // toggleDLItem.addItemListener(this);
259
+ // toggleDLItem.setState(false);
260
+
261
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
262
+ toggleRenderItem.addItemListener(this);
263
+ toggleRenderItem.setState(!CameraPane.frozen);
264
+
265
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
266
+ toggleDebugItem.addItemListener(this);
267
+ toggleDebugItem.setState(Globals.DEBUG);
268
+
269
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
270
+ toggleFrustumItem.addItemListener(this);
271
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
272
+
273
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
274
+ toggleFootContactItem.addItemListener(this);
275
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
276
+
277
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
278
+ toggleTimelineItem.addItemListener(this);
279
+ }
280
+
281
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
282
+// toggleRootItem.addItemListener(this);
283
+// toggleRootItem.setState(false);
284
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
285
+// animationItem.addItemListener(this);
286
+// animationItem.setState(CameraPane.ANIMATION);
287
+ cameraMenu.add("-");
288
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
289
+ editCameraItem.addActionListener(this);
290
+
291
+ if (Globals.ADVANCED)
292
+ {
293
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
294
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
295
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
296
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
297
+ oe.cameraMenu.add("-");
298
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
299
+ openWindowItem.addActionListener(this);
300
+ editLeafItem.addActionListener(this);
301
+ lookAtItem.addActionListener(this);
302
+ //lookFromItem.addActinoListener(this);
303
+ //switchViewItem.addActionListener(this);
304
+ }
305
+
192306 oe.menuBar.add(menu = new Menu("Setting"));
193
- resetMeshItem = menu.add(new MenuItem("Reset All"));
194
- resetMeshItem.addActionListener(this);
195
- stepAllItem = menu.add(new MenuItem("Step All"));
196
- stepAllItem.addActionListener(this);
307
+ if (Globals.ADVANCED)
308
+ {
197309 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198310 revertMeshItem.addActionListener(this);
199311 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200312 resetreferencesItem.addActionListener(this);
201313 menu.add("-");
314
+ }
202315 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203316 overwriteGeoItem.addActionListener(this);
204317 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,79 +323,104 @@
210323 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211324 overwriteUVItem.addActionListener(this);
212325 menu.add("-");
326
+ if (Globals.ADVANCED)
327
+ {
213328 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214329 generateMeshItem.addActionListener(this);
215330 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216331 poseMeshItem.addActionListener(this);
217332 menu.add("-");
333
+ }
218334 resetsupportItem = menu.add(new MenuItem("Reset support"));
219335 resetsupportItem.addActionListener(this);
220336 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221337 linkverticesItem.addActionListener(this);
222338 relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
223339 relinkverticesItem.addActionListener(this);
340
+
341
+ if (Globals.ADVANCED)
342
+ {
224343 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
225344 setMasterItem.addActionListener(this);
345
+ }
226346
227347 oe.menuBar.add(menu = new Menu("Group"));
228
- grabItem = menu.add(new MenuItem("Grab"));
229
- grabItem.addActionListener(this);
348
+// grabItem = menu.add(new MenuItem("Grab"));
349
+// grabItem.addActionListener(this);
230350 backItem = menu.add(new MenuItem("Back"));
231351 backItem.addActionListener(this);
232352 frontItem = menu.add(new MenuItem("Front"));
233353 frontItem.addActionListener(this);
234
- compositeItem = menu.add(new MenuItem("Composite"));
235
- compositeItem.addActionListener(this);
236
- hideItem = menu.add(new MenuItem("Hide"));
354
+// compositeItem = menu.add(new MenuItem("Composite"));
355
+// compositeItem.addActionListener(this);
356
+
357
+ if (Globals.ADVANCED)
358
+ {
359
+ hideItem = menu.add(new MenuItem("Hidden Group"));
237360 hideItem.addActionListener(this);
361
+ }
238362 ungroupItem = menu.add(new MenuItem("Ungroup"));
239363 ungroupItem.addActionListener(this);
240
- menu.add("-");
241
- randomItem = menu.add(new MenuItem("Random"));
242
- randomItem.addActionListener(this);
243
- physicsItem = menu.add(new MenuItem("Physics"));
244
- physicsItem.addActionListener(this);
245
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
246
- frameselectorItem.addActionListener(this);
364
+
365
+// menu.add("-");
366
+//
367
+// switchItem = menu.add(new MenuItem("Switch node"));
368
+// switchItem.addActionListener(this);
369
+ if (Globals.ADVANCED)
370
+ {
247371 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
248372 switchGeoItem.addActionListener(this);
249373 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
250374 switchTransfoItem.addActionListener(this);
251
- morphItem = menu.add(new MenuItem("Morph"));
375
+ morphItem = menu.add(new MenuItem("Morph Group"));
252376 morphItem.addActionListener(this);
377
+
378
+ menu.add("-");
379
+ physicsItem = menu.add(new MenuItem("Physics"));
380
+ physicsItem.addActionListener(this);
381
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
382
+ frameselectorItem.addActionListener(this);
253383 scriptNodeItem = menu.add(new MenuItem("Script Node"));
254384 scriptNodeItem.addActionListener(this);
255
- cameraItem = menu.add(new MenuItem("Camera"));
256
- cameraItem.addActionListener(this);
385
+ }
257386
258387 oe.menuBar.add(menu = new Menu("Object"));
259
- textureItem = menu.add(new MenuItem("Texture"));
260
- textureItem.addActionListener(this);
388
+// textureItem = menu.add(new MenuItem("Texture"));
389
+// textureItem.addActionListener(this);
261390 billboardItem = menu.add(new MenuItem("Billboard"));
262391 billboardItem.addActionListener(this);
263392 csgItem = menu.add(new MenuItem("CSG"));
264393 csgItem.addActionListener(this);
265
- shadowXItem = menu.add(new MenuItem("Shadow X"));
394
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
266395 shadowXItem.addActionListener(this);
267
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
396
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
268397 shadowYItem.addActionListener(this);
269
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
398
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
270399 shadowZItem.addActionListener(this);
400
+ attributeItem = menu.add(new MenuItem("Attribute"));
401
+ attributeItem.addActionListener(this);
402
+
403
+ if (Globals.ADVANCED)
404
+ {
405
+ menu.add("-");
271406 linkerItem = menu.add(new MenuItem("Linker"));
272407 linkerItem.addActionListener(this);
273408 templateItem = menu.add(new MenuItem("Template"));
274409 templateItem.addActionListener(this);
275
- attributeItem = menu.add(new MenuItem("Attribute"));
276
- attributeItem.addActionListener(this);
277410 pointflowItem = menu.add(new MenuItem("Point Flow"));
278411 pointflowItem.addActionListener(this);
412
+ }
279413 menu.add("-");
280414 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
281415 resetTransformItem.addActionListener(this);
282416 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
283417 resetCentroidItem.addActionListener(this);
284
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
285
- transformgeometryItem.addActionListener(this);
418
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
419
+ resetCentroidXZItem.addActionListener(this);
420
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
421
+ transformGeometryItem.addActionListener(this);
422
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
423
+ transformChildrenItem.addActionListener(this);
286424
287425 oe.menuBar.add(menu = new Menu("Geometry"));
288426 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -293,8 +431,11 @@
293431 genNormalsCADItem.addActionListener(this);
294432 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
295433 genNormalsMESHItem.addActionListener(this);
296
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
434
+ if (Globals.ADVANCED)
435
+ {
436
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
297437 genNormalsMINEItem.addActionListener(this);
438
+ }
298439 stripifyItem = menu.add(new MenuItem("Stripify"));
299440 stripifyItem.addActionListener(this);
300441 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -316,23 +457,34 @@
316457 reduce34MeshItem.addActionListener(this);
317458 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
318459 increaseMeshItem.addActionListener(this);
319
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
320
- smoothMeshItem.addActionListener(this);
321460 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
322461 clipMeshItem.addActionListener(this);
462
+
463
+ if (Globals.ADVANCED)
464
+ {
465
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
466
+ smoothMeshItem.addActionListener(this);
467
+ }
323468
324469 oe.menuBar.add(menu = new Menu("Attributes"));
325470 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
326471 clearMaterialsItem.addActionListener(this);
472
+ resetAllItem = menu.add(new MenuItem("Reset All"));
473
+ resetAllItem.addActionListener(this);
474
+ stepAllItem = menu.add(new MenuItem("Step All"));
475
+ stepAllItem.addActionListener(this);
327476 menu.add("-");
328477 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
329478 liveleavesItem.addActionListener(this);
330479 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
331480 unliveleavesItem.addActionListener(this);
481
+ if (Globals.ADVANCED)
482
+ {
332483 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
333484 supportleavesItem.addActionListener(this);
334485 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
335486 unsupportleavesItem.addActionListener(this);
487
+ }
336488 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
337489 hideleavesItem.addActionListener(this);
338490 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -341,6 +493,14 @@
341493 markleavesItem.addActionListener(this);
342494 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
343495 unmarkleavesItem.addActionListener(this);
496
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
497
+ rewindleavesItem.addActionListener(this);
498
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
499
+ unrewindleavesItem.addActionListener(this);
500
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
501
+ randomleavesItem.addActionListener(this);
502
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
503
+ unrandomleavesItem.addActionListener(this);
344504 menu.add("-");
345505 flipVItem = menu.add(new MenuItem("Flip V"));
346506 flipVItem.addActionListener(this);
....@@ -376,35 +536,41 @@
376536 sortbynameItem = menu.add(new MenuItem("Sort by name"));
377537 sortbynameItem.addActionListener(this);
378538 menu.add("-");
539
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
540
+ shareGeometriesItem.addActionListener(this);
541
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
542
+ mergeGeometriesItem.addActionListener(this);
543
+ if (Globals.ADVANCED)
544
+ {
545
+ // Pretty much the same as duplicate and clone.
379546 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
380547 extractGeometriesItem.addActionListener(this);
381548 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
382549 cloneGeometriesItem.addActionListener(this);
383
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
384
- shareGeometriesItem.addActionListener(this);
385
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
386
- mergeGeometriesItem.addActionListener(this);
550
+ }
387551
388552 oe.menuBar.add(menu = new Menu("Insert"));
389553 buildCreateMenu(menu);
390554
391
-
392
- oe.menuBar.add(menu = new Menu("Include"));
393
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
394
- importGFDItem.addActionListener(this);
395
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
396
- importVRMLX3DItem.addActionListener(this);
397
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
398
- importOBJItem.addActionListener(this);
399
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
400
- import3DSItem.addActionListener(this);
401
-
402555 oe.menuBar.add(menu = new Menu("Tools"));
403556 buildToolsMenu(menu);
404557 }
405558
559
+
406560 void SetupUI2(ObjEditor oe)
407561 {
562
+ // June 2019
563
+ if (oe == null)
564
+ {
565
+ //super.SetupUI2(this);
566
+ //return;
567
+ }
568
+
569
+ if (copy != group)
570
+ {
571
+ //super.SetupUI2(this);
572
+ }
573
+
408574 //new Exception().printStackTrace();
409575
410576 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -433,176 +599,231 @@
433599 oe.radioPanel.add(dummyButton);
434600 oe.buttonGroup.add(dummyButton);
435601 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
439605
440
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
441
- liveCB.setToolTipText("Enabled animation");
442
- liveCB.addItemListener(this);
443
-
444
- oe.aConstraints.gridx += 1;
445
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
446
- fastCB.setToolTipText("Fast mode");
447
- fastCB.addItemListener(this);
448
- oe.aConstraints.gridx += 1;
449
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
450
- supportCB.setToolTipText("Enabled rigging");
451
- supportCB.addItemListener(this);
452
-
453
- // oe.aConstraints.gridx += 1;
454
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
455
- // localCB.addItemListener(this);
456
-
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), oe.aConstraints);
459
- crowdCB.setToolTipText("Used for crowds");
460
- crowdCB.addItemListener(this);
461
-
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
464
- smoothCB.setToolTipText("Snapping delay");
465
- smoothCB.addItemListener(this);
466
-
467
- oe.aConstraints.gridx += 1;
468
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
469
- slowCB.setToolTipText("Smooth interpolation");
470
- slowCB.addItemListener(this);
471
- oe.aConstraints.gridx += 1;
472
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), oe.aConstraints);
473
- boxCB.setToolTipText("Display bounding boxes");
474
- boxCB.addItemListener(this);
475
- oe.aConstraints.gridx += 1;
476
- oe.toolbarPanel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), oe.aConstraints);
477
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
478
- zoomBoxCB.addItemListener(this);
479
-
480
-// oe.aConstraints.gridx += 1;
481
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
482
-// speakerMocapCB.addItemListener(this);
483
-
484
- if (false)
485
- {
486
- // handled in scripts
487
- oe.aConstraints.gridx += 1;
488
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
489
- speakerCameraCB.addItemListener(this);
490
-
491
- oe.aConstraints.gridx += 1;
492
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
493
- speakerFocusCB.addItemListener(this);
494
-
495
- oe.aConstraints.gridx += 1;
496
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
497
- smoothfocusCB.addItemListener(this);
498
- }
499
-
500
-//oe.aConstraints.gridx += 1;
501
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
502
-// debugCB.addItemListener(this);
503
-
504
- oe.aConstraints.gridx += 1;
505
- oe.toolbarPanel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), oe.aConstraints);
506
- oeilCB.addItemListener(this);
507
-
508
- oe.aConstraints.gridx += 1;
509
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), oe.aConstraints);
510
- lookAtCB.setToolTipText("Look-at target");
511
- lookAtCB.addItemListener(this);
512
-
513
- oe.aConstraints.gridx += 1;
514
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
515
- trackCB.setToolTipText("Enable tracking");
516
- trackCB.addItemListener(this);
517
-
518
- oe.aConstraints.gridx += 1;
519
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
606
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
607
+
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
611
+
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
618
+
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ fullButton.setToolTipText("Full-screen window");
621
+ fullButton.addActionListener(this);
622
+
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
520624 screenfitButton.setToolTipText("Screen fit");
521625 screenfitButton.addActionListener(this);
522
- oe.aConstraints.gridx += 1;
626
+
627
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
628
+ restoreCameraButton.setToolTipText("Restore viewpoint");
629
+ restoreCameraButton.addActionListener(this);
630
+
631
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
632
+ saveButton.setToolTipText("New version");
633
+ saveButton.addActionListener(this);
634
+
635
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
636
+ undoButton.setToolTipText("Previous version");
637
+ undoButton.addActionListener(this);
638
+ undoButton.setEnabled(false);
639
+
640
+ cGridBag updown = new cGridBag().setVertical(true);
641
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
+ restoreButton.setToolTipText("Restore current");
643
+ restoreButton.addActionListener(this);
644
+ restoreButton.setEnabled(false);
645
+
646
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
647
+ replaceButton.setToolTipText("Replace current");
648
+ replaceButton.addActionListener(this);
649
+ replaceButton.setEnabled(false);
650
+
651
+ copyOptionsPanel.add(updown);
652
+
653
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
654
+ redoButton.setToolTipText("Next version");
655
+ redoButton.addActionListener(this);
656
+ redoButton.setEnabled(false);
657
+
658
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
659
+ liveCB.setToolTipText("Enable animation");
660
+ liveCB.addItemListener(this);
661
+
662
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ oneStepButton.setToolTipText("Animate one step forward");
664
+ oneStepButton.addActionListener(this);
665
+
666
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
667
+ fastCB.setToolTipText("Fast mode");
668
+ fastCB.addItemListener(this);
669
+
670
+ //oe.toolboxPanel.Return();
671
+
672
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
673
+// trackCB.setToolTipText("Enable tracking");
674
+// trackCB.addItemListener(this);
675
+
523676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
524677 // screenfitpointButton.addActionListener(this);
525
-// oe.aConstraints.gridx += 1;
526
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
527
- snapobjectButton.addActionListener(this);
528
- snapobjectButton.setToolTipText("Snap Object");
529
- oe.aConstraints.gridx += 1;
530678
531
- //aConstraints.gridx = 0;
532
- //aConstraints.gridy += 1;
533
- oe.aConstraints.weighty = 0;
534
- oe.aConstraints.gridwidth = 1;
535
-
536
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
537
- flashSelectionButton.setToolTipText("Show selection");
538
- flashSelectionButton.addActionListener(this);
679
+ if (Globals.ADVANCED)
680
+ {
681
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
+ snapobjectButton.addActionListener(this);
683
+ snapobjectButton.setToolTipText("Snap Object");
684
+ }
685
+
686
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
539687
540
- oe.toolbarPanel.add(new cButton(" ", false));
541
-
542
- oe.aConstraints.gridx += 1;
543
- oe.aConstraints.weighty = 0;
544
- oe.aConstraints.gridwidth = 1;
545
-
546
- //
547
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
548
- twoButton.setToolTipText("Show center view only");
549
- twoButton.addActionListener(this);
550
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
551689 fourButton.addActionListener(this);
552690 fourButton.setToolTipText("Show left panel only");
553
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
554
- sixButton.setToolTipText("2-column layout left");
691
+
692
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ twoButton.setToolTipText("Show right view only");
694
+ twoButton.addActionListener(this);
695
+ this.fullscreenLayout = twoButton;
696
+
697
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ sixButton.setToolTipText("Show left and right");
555699 sixButton.addActionListener(this);
556
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
557
- threeButton.setToolTipText("2-column layout right");
558
- threeButton.addActionListener(this);
559
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
560
- sevenButton.setToolTipText("3-column layout");
561
- sevenButton.addActionListener(this);
700
+// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701
+// threeButton.setToolTipText("2-column layout right");
702
+// threeButton.addActionListener(this);
703
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
704
+// sevenButton.setToolTipText("3-column layout");
705
+// sevenButton.addActionListener(this);
562706 //
563707
564
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
565
- rootButton.setToolTipText("Edit object in new tab");
708
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709
+ rootButton.setToolTipText("Open selection in new tab");
566710 rootButton.addActionListener(this);
567
- oe.aConstraints.gridx += 1;
568
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
711
+
712
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569713 closeButton.setToolTipText("Close tab");
570714 closeButton.addActionListener(this);
571715 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
572716 //clearButton.addActionListener(this);
573
- oe.aConstraints.gridx += 1;
574
-
575
- oe.aConstraints.gridx = 1; //
576
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
577
- editButton.addActionListener(this);
578
- oe.aConstraints.gridx += 1;
579
- oe.aConstraints.weighty = 0;
580
- oe.aConstraints.gridwidth = 1;
581717
582
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
718
+ // INSERT
719
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
720
+ gridButton.setToolTipText("Create grid");
721
+ gridButton.addActionListener(this);
722
+
723
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ boxButton.setToolTipText("Create box");
725
+ boxButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ sphereButton.setToolTipText("Create sphere");
729
+ sphereButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ coneButton.setToolTipText("Create cone");
733
+ coneButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ torusButton.setToolTipText("Create torus");
737
+ torusButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ superButton.setToolTipText("Create superellipsoid");
741
+ superButton.addActionListener(this);
742
+
743
+ if (Globals.ADVANCED)
744
+ {
745
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
746
+ kleinButton.setToolTipText("Create Klein bottle");
747
+ kleinButton.addActionListener(this);
748
+ }
749
+
750
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
751
+ particlesButton.setToolTipText("Create particle system");
752
+ particlesButton.addActionListener(this);
753
+
754
+ oe.toolboxPanel.Return();
755
+
756
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
757
+ groupButton.setToolTipText("Create group");
758
+ groupButton.addActionListener(this);
759
+
760
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
761
+ compositeButton.setToolTipText("Create composite");
762
+ compositeButton.addActionListener(this);
763
+
764
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ switchButton.setToolTipText("Create item switcher");
766
+ switchButton.addActionListener(this);
767
+
768
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ loopButton.setToolTipText("Create loop");
770
+ loopButton.addActionListener(this);
771
+
772
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
773
+ textureButton.setToolTipText("Create texture");
774
+ textureButton.addActionListener(this);
775
+
776
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ overlayButton.setToolTipText("Create overlay");
778
+ overlayButton.addActionListener(this);
779
+
780
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ lightButton.setToolTipText("Create light");
782
+ lightButton.addActionListener(this);
783
+
784
+ for (int i=6; --i>=0;)
785
+ {
786
+ oe.toolboxPanel.Return();
787
+ oe.toolboxPanel.add(new cGridBag());
788
+ oe.toolboxPanel.add(new cGridBag());
789
+ oe.toolboxPanel.add(new cGridBag());
790
+ oe.toolboxPanel.add(new cGridBag());
791
+ oe.toolboxPanel.add(new cGridBag());
792
+ oe.toolboxPanel.add(new cGridBag());
793
+ oe.toolboxPanel.add(new cGridBag());
794
+ }
795
+
796
+ // EDIT panel
797
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
798
+ editButton.setToolTipText("Pin selection controls");
799
+ editButton.addActionListener(this);
800
+
801
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
802
+ uneditButton.setToolTipText("Remove selection controls");
583803 uneditButton.addActionListener(this);
584804
585
- oe.aConstraints.gridx += 1;
586
- oe.aConstraints.weighty = 0;
587
- oe.aConstraints.gridwidth = 1;
588
-
589
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
590
- clearPanelButton.addActionListener(this);
591
-
592
- oe.aConstraints.gridx += 1;
593
- oe.aConstraints.weighty = 0;
594
- oe.aConstraints.gridwidth = 1;
595
-
596
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
805
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
806
+ allParamsButton.setToolTipText("Show all controle");
597807 allParamsButton.addActionListener(this);
598808
599
- oe.aConstraints.gridx += 1;
600
- oe.aConstraints.weighty = 0;
601
- oe.aConstraints.gridwidth = 1;
602
-
603
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
809
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
810
+ clearPanelButton.setToolTipText("Clear edit panel");
811
+ clearPanelButton.addActionListener(this);
812
+
813
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
814
+ unselectButton.setToolTipText("Unselect");
604815 unselectButton.addActionListener(this);
605816
817
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
818
+ flashSelectionButton.setToolTipText("Highlight selection");
819
+ flashSelectionButton.addActionListener(this);
820
+
821
+ editCommandsPanel.preferredHeight = 1;
822
+
823
+ SetPinStates(false);
824
+// oe.treePanel.add(commandsPanel);
825
+// oe.treePanel.Return();
826
+
606827 // oe.aConstraints.gridx += 1;
607828 // oe.aConstraints.weighty = 0;
608829 // oe.aConstraints.gridwidth = 1;
....@@ -614,40 +835,25 @@
614835 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
615836 // gcButton.addActionListener(this);
616837
617
- oe.aConstraints.gridx = 0;
618
- oe.aConstraints.gridy += 1;
619
-
620
- //ctrlPanel.add(objList = new List(5, true));
621
- oe.aConstraints.gridwidth = 100;
622
- // oe.aConstraints.gridheight = 100;
623
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
624
- oe.aConstraints.gridheight = 1;
625
- oe.aConstraints.weighty = 0.5;
626
- oe.aConstraints.gridx = 0;
627
- JScrollPane jSP;
838
+ cGridBag jSPPanel = new cGridBag();
839
+
840
+ JScrollPane jSP;
628841 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
629
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
842
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
630843 ResetModel();
631
- oe.aConstraints.weighty = 0.5;
632
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
633
- oe.aConstraints.gridy += 1;
634
- oe.aConstraints.gridwidth = 1;
635
-
636
- oe.aConstraints.weighty = 0;
637
- oe.aConstraints.gridwidth = 2;
638
-
639
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
640
- colorCB.addItemListener(this);
641
- oe.aConstraints.gridx += 2;
642
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
643
- materialCB.addItemListener(this);
644
- oe.aConstraints.gridx += 2;
645
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
646
- textureCB.addItemListener(this);
647
-
648
- oe.aConstraints.gridx = 0;
649
- oe.aConstraints.gridy += 1;
650844
845
+ oe.treePanel.add(jSPPanel);
846
+ oe.treePanel.Return();
847
+
848
+ oe.treePanel.add(copyOptionsPanel);
849
+ oe.treePanel.Return();
850
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
851
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
852
+ sliderPane.preferredHeight = 1;
853
+
854
+// mainPanel.setDividerLocation(0.5); //1.0);
855
+// mainPanel.setResizeWeight(0.5);
856
+
651857 //jList.addListSelectionListener(this);
652858 oe.jTree.addTreeSelectionListener(this);
653859 //jTree.setRootVisible(false);
....@@ -666,23 +872,160 @@
666872 dgr.addDragGestureListener(this);
667873 }catch(Exception e) {}
668874 */
669
- radio.layout = sevenButton;
875
+ radio.layout = sixButton; // sevenButton;
670876 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
671877 }
878
+
879
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
880
+ {
881
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
882
+ colorCB.setToolTipText("Copy color when dropped");
883
+ colorCB.addItemListener(this);
884
+
885
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
886
+ materialCB.setToolTipText("Copy material when dropped");
887
+ materialCB.addItemListener(this);
888
+
889
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
890
+ textureCB.setToolTipText("Copy texture when dropped");
891
+ textureCB.addItemListener(this);
892
+
893
+ panel.Return();
894
+
895
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
896
+ boxCB.setToolTipText("Display bounding boxes");
897
+ boxCB.addItemListener(this);
898
+
899
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
900
+ zoomBoxCB.setToolTipText("Display only for wheel");
901
+ zoomBoxCB.addItemListener(this);
902
+
903
+ if (true) // Globals.ADVANCED)
904
+ {
905
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
906
+// supportCB.setToolTipText("Enable rigging");
907
+// supportCB.addItemListener(this);
908
+
909
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
910
+ freezeCB.setToolTipText("Fast moving camera");
911
+ freezeCB.addItemListener(this);
912
+
913
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
914
+ // localCB.addItemListener(this);
915
+
916
+ panel.Return();
917
+
918
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
919
+ crowdCB.setToolTipText("Used for crowds");
920
+ crowdCB.addItemListener(this);
921
+
922
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
923
+ smoothCB.setToolTipText("Snapping delay");
924
+ smoothCB.addItemListener(this);
925
+
926
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
927
+ slowCB.setToolTipText("Smooth interpolation");
928
+ slowCB.addItemListener(this);
929
+
930
+// constraints.gridy += 1;
931
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
932
+// speakerMocapCB.addItemListener(this);
933
+
934
+ panel.Return();
935
+
936
+ if (false)
937
+ {
938
+ // handled in scripts
939
+ //constraints.gridy += 1;
940
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
941
+ speakerCameraCB.addItemListener(this);
942
+
943
+ //constraints.gridy += 1;
944
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
945
+ speakerFocusCB.addItemListener(this);
946
+
947
+ //constraints.gridy += 1;
948
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
949
+ smoothfocusCB.addItemListener(this);
950
+ panel.Return();
951
+ }
952
+
953
+//constraints.gridx += 1;
954
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
955
+// debugCB.addItemListener(this);
956
+
957
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
958
+ trackCB.setToolTipText("Enable tracking target");
959
+ trackCB.addItemListener(this);
960
+
961
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
962
+ oeilCB.setToolTipText("Move camera when tracking");
963
+ oeilCB.addItemListener(this);
964
+
965
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
966
+ shadowCB.setToolTipText("When live compute shadows");
967
+ shadowCB.addItemListener(this);
968
+
969
+ panel.Return();
970
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
971
+ toggleTextureCB.setToolTipText("Load textures");
972
+ toggleTextureCB.addItemListener(this);
973
+
974
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
975
+ toggleSwitchCB.setToolTipText("Choose a single item");
976
+ toggleSwitchCB.addItemListener(this);
977
+
978
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
979
+ autokeepCB.setToolTipText("On structure change");
980
+ autokeepCB.addItemListener(this);
981
+
982
+ panel.Return();
983
+ if (Globals.ADVANCED)
984
+ {
985
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
986
+ lookAtCB.setToolTipText("Look-at target");
987
+ lookAtCB.addItemListener(this);
988
+ }
989
+
990
+ }
991
+
992
+ cGridBag fill = new cGridBag();
993
+ fill.preferredHeight = 200;
994
+ cGridBag fill2 = new cGridBag();
995
+ fill2.preferredHeight = 200;
996
+ cGridBag fill3 = new cGridBag();
997
+ fill3.preferredHeight = 200;
998
+
999
+ panel.add(fill);
1000
+ panel.add(fill2);
1001
+ panel.add(fill3);
1002
+
1003
+ }
6721004
6731005 void EditObject(Object3D obj)
6741006 {
6751007 cRadio radioButton = new cRadio(obj.name);
1008
+
1009
+ // June 2019. Patch to avoid bug with transparency.
1010
+ radioButton.hadMaterial = obj.material != null;
1011
+ if (!radioButton.hadMaterial)
1012
+ {
1013
+ obj.material = new cMaterial();
1014
+ }
1015
+
6761016 radioButton.SetObject(obj);
677
- radioButton.layout = sevenButton;
1017
+ radioButton.layout = sixButton; // sevenButton;
6781018 radioButton.SetCamera(cameraView.renderCamera, false);
6791019 radioButton.addActionListener(this);
6801020 radioPanel.add(radioButton);
6811021 buttonGroup.add(radioButton);
6821022 radioButton.doClick();
6831023 }
1024
+
6841025 void SetupViews(ObjEditor oe)
6851026 {
1027
+ theFrame = this;
1028
+
6861029 oe.SetupViews();
6871030
6881031 System.out.println("SetupViews");
....@@ -691,23 +1034,28 @@
6911034 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6921035 }
6931036
694
- JCheckBox liveCB;
695
- JCheckBox supportCB;
696
- JCheckBox localCB;
697
- JCheckBox crowdCB;
698
- JCheckBox smoothCB;
699
- JCheckBox fastCB;
700
- JCheckBox slowCB;
701
- JCheckBox boxCB;
702
- JCheckBox zoomBoxCB;
703
- JCheckBox trackCB;
704
- JCheckBox smoothfocusCB;
1037
+ cToggleButton liveCB;
1038
+ cCheckBox supportCB;
1039
+ cCheckBox localCB;
1040
+ cCheckBox crowdCB;
1041
+ cCheckBox smoothCB;
1042
+ cToggleButton fastCB;
1043
+ cCheckBox slowCB;
1044
+ cCheckBox boxCB;
1045
+ cCheckBox zoomBoxCB;
1046
+ cCheckBox freezeCB;
1047
+ //cToggleButton trackCB;
1048
+ cCheckBox trackCB;
1049
+ cCheckBox smoothfocusCB;
7051050 // JCheckBox speakerMocapCB;
706
- JCheckBox speakerCameraCB;
707
- JCheckBox speakerFocusCB;
708
- JCheckBox debugCB;
709
- JCheckBox oeilCB;
710
- JCheckBox lookAtCB;
1051
+ cCheckBox speakerCameraCB;
1052
+ cCheckBox speakerFocusCB;
1053
+ cCheckBox debugCB;
1054
+
1055
+ cCheckBox oeilCB;
1056
+ cCheckBox shadowCB;
1057
+ cCheckBox autokeepCB;
1058
+ cCheckBox lookAtCB;
7111059
7121060 // static int COLOR = 1;
7131061 // static int MATERIAL = 2;
....@@ -715,9 +1063,9 @@
7151063
7161064 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7171065
718
- JCheckBox colorCB;
719
- JCheckBox materialCB;
720
- JCheckBox textureCB;
1066
+ cCheckBox colorCB;
1067
+ cCheckBox materialCB;
1068
+ cCheckBox textureCB;
7211069
7221070 public void itemStateChanged(ItemEvent e)
7231071 {
....@@ -745,6 +1093,7 @@
7451093 } else if(e.getSource() == liveCB)
7461094 {
7471095 cameraView.ToggleLive();
1096
+ refreshContents(false);
7481097 }
7491098 else if(e.getSource() == supportCB)
7501099 {
....@@ -809,6 +1158,18 @@
8091158 {
8101159 cameraView.ToggleOeil();
8111160 }
1161
+ else if(e.getSource() == shadowCB)
1162
+ {
1163
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1164
+ }
1165
+ else if(e.getSource() == freezeCB)
1166
+ {
1167
+ Globals.FREEZEONMOVE ^= true;
1168
+ }
1169
+ else if(e.getSource() == autokeepCB)
1170
+ {
1171
+ Globals.REPLACEONMAKE ^= true;
1172
+ }
8121173 else if(e.getSource() == lookAtCB)
8131174 {
8141175 cameraView.ToggleLookAt();
....@@ -825,7 +1186,8 @@
8251186
8261187 /**/
8271188 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
828
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1190
+ TreePath path = objEditor.jTree.getSelectionPath();
8291191 if ((path == null) || (path.getPathCount() <= 1)) {
8301192 // We can't move the root node or an empty selection
8311193 return;
....@@ -888,8 +1250,6 @@
8881250 }
8891251 }
8901252
891
- String string = (String) object;
892
-
8931253 System.out.println("Transfer = " + object + "; drop : " + target);
8941254 // if( object instanceof java.io.File[])
8951255 // {
....@@ -897,7 +1257,11 @@
8971257 // objEditor.DropFile((java.io.File[]) object, true);
8981258 // return;
8991259 // }
900
- if (string.charAt(0) == '/')
1260
+
1261
+ String string = object.toString();
1262
+
1263
+ // File path for Mac and Windows
1264
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9011265 {
9021266 // file(s)
9031267 String[] names = string.split("\n");
....@@ -924,7 +1288,7 @@
9241288
9251289 flashIt = false;
9261290 CameraPane pane = (CameraPane) target;
927
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1291
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9281292 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9291293
9301294 if (group.selection.size() == 1)
....@@ -940,23 +1304,33 @@
9401304
9411305 assert target == objEditor.jTree;
9421306 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1307
+ Object3D destinationLeaf;
9431308 try {
944
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1309
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9451310 } catch (Exception e) {
9461311 System.out.println("destinationPath : " + destinationPath);
9471312 return;
9481313 }
9491314
950
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1315
+ for (int i=group.selection.size(); --i>=0;)
9511316 {
1317
+ Object3D child = (Object3D)group.selection.elementAt(i);
1318
+
1319
+ // Cannot move into itself
1320
+ if (child == destinationLeaf)
1321
+ return;
1322
+ }
1323
+
1324
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1325
+// {
9521326 loadClipboard(true);
9531327 objEditor.jTree.setSelectionPath(destinationPath);
954
- pasteInto(false);
955
- } else {
956
- loadClipboard(false);
957
- objEditor.jTree.setSelectionPath(destinationPath);
958
- pasteInto(false); // true); // ???
959
- }
1328
+ pasteInto(false, false);
1329
+// } else {
1330
+// loadClipboard(false);
1331
+// objEditor.jTree.setSelectionPath(destinationPath);
1332
+// pasteInto(false, false); // true); // ???
1333
+// }
9601334 }
9611335 public void dropActionChanged(DropTargetDragEvent dtde)
9621336 // Called if the user has modified the current drop gesture
....@@ -1061,85 +1435,107 @@
10611435 {
10621436 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10631437 //heightFieldItem.addActionListener(this);
1064
- gridItem = menu.add(new MenuItem("Grid"));
1065
- gridItem.addActionListener(this);
1066
- rectoidItem = menu.add(new MenuItem("Box"));
1067
- rectoidItem.addActionListener(this);
1068
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1069
- ellipsoidItem.addActionListener(this);
1070
- coneItem = menu.add(new MenuItem("Cone"));
1071
- coneItem.addActionListener(this);
1072
- torusItem = menu.add(new MenuItem("Torus"));
1073
- torusItem.addActionListener(this);
1074
- superItem = menu.add(new MenuItem("Superellipsoid"));
1075
- superItem.addActionListener(this);
1438
+// gridItem = menu.add(new MenuItem("Grid"));
1439
+// gridItem.addActionListener(this);
1440
+// rectoidItem = menu.add(new MenuItem("Box"));
1441
+// rectoidItem.addActionListener(this);
1442
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1443
+// ellipsoidItem.addActionListener(this);
1444
+// coneItem = menu.add(new MenuItem("Cone"));
1445
+// coneItem.addActionListener(this);
1446
+// torusItem = menu.add(new MenuItem("Torus"));
1447
+// torusItem.addActionListener(this);
1448
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1449
+// superItem.addActionListener(this);
1450
+
1451
+ cameraItem = menu.add(new MenuItem("Camera"));
1452
+ cameraItem.addActionListener(this);
1453
+
1454
+ if (!Globals.ADVANCED)
1455
+ {
10761456 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10771457 kleinItem.addActionListener(this);
1078
- particleItem = menu.add(new MenuItem("Particle system"));
1079
- particleItem.addActionListener(this);
1458
+ }
1459
+
1460
+// particleItem = menu.add(new MenuItem("Particle system"));
1461
+// particleItem.addActionListener(this);
1462
+ if (Globals.ADVANCED)
1463
+ {
10801464 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10811465 ragdollItem.addActionListener(this);
10821466 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10831467 ragdoll2Item.addActionListener(this);
1468
+ }
10841469 menu.add("-");
1085
- meshItem = menu.add(new MenuItem("Mesh"));
1470
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10861471 meshItem.addActionListener(this);
10871472 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10881473 // meshGroupItem.addActionListener(this);
1474
+ if (Globals.ADVANCED)
1475
+ {
10891476 springItem = menu.add(new MenuItem("Spring"));
10901477 springItem.addActionListener(this);
10911478 flagItem = menu.add(new MenuItem("Flag"));
10921479 flagItem.addActionListener(this);
1093
- bezierItem = menu.add(new MenuItem("Patch"));
1094
- bezierItem.addActionListener(this);
1095
- checkerItem = menu.add(new MenuItem("Checker"));
1096
- checkerItem.addActionListener(this);
10971480 blobItem = menu.add(new MenuItem("Blob"));
10981481 blobItem.addActionListener(this);
10991482 latheItem = menu.add(new MenuItem("Lathe"));
11001483 latheItem.addActionListener(this);
1101
- lightItem = menu.add(new MenuItem("Light"));
1102
- lightItem.addActionListener(this);
1484
+ }
1485
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1486
+ bezierItem.addActionListener(this);
1487
+// overlayItem = menu.add(new MenuItem("Overlay"));
1488
+// overlayItem.addActionListener(this);
1489
+// lightItem = menu.add(new MenuItem("Light"));
1490
+// lightItem.addActionListener(this);
11031491 menu.add("-");
11041492 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11051493 //superLoopItem.addActionListener(this);
1106
- loopItem = menu.add(new MenuItem("Loop"));
1107
- loopItem.addActionListener(this);
1494
+// loopItem = menu.add(new MenuItem("Loop"));
1495
+// loopItem.addActionListener(this);
11081496 doubleItem = menu.add(new MenuItem("Fork"));
11091497 doubleItem.addActionListener(this);
1498
+ if (Globals.ADVANCED)
1499
+ {
11101500 tripleItem = menu.add(new MenuItem("Trident"));
11111501 tripleItem.addActionListener(this);
1502
+ }
11121503 }
11131504
11141505 void buildToolsMenu(Menu menu)
11151506 {
11161507 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11171508 animationItem.addItemListener(this);
1118
- animationItem.setState(CameraPane.ANIMATION);
1509
+ animationItem.setState(Globals.ANIMATION);
1510
+
1511
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1512
+ archiveItem.addActionListener(this);
11191513
11201514 menu.add("-");
11211515 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11221516 parseverticesItem.addActionListener(this);
11231517 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11241518 textureFieldItem.addActionListener(this);
1125
- alignItem = menu.add(new MenuItem("Align"));
1519
+ alignItem = menu.add(new MenuItem("Align Objects"));
11261520 alignItem.addActionListener(this);
1127
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1128
- mirrorItem.addActionListener(this);
11291521 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11301522 reduceMorphItem.addActionListener(this);
11311523 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11321524 reduce34MorphItem.addActionListener(this);
1133
-
1134
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1135
- computeAOItem.addActionListener(this);
11361525 menu.add("-");
1137
-
11381526 menu.add(memoryItem = new MenuItem("Memory Usage"));
11391527 memoryItem.addActionListener(this);
1528
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1529
+ computeAOItem.addActionListener(this);
1530
+
1531
+ if (Globals.ADVANCED)
1532
+ {
1533
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1534
+ mirrorItem.addActionListener(this);
1535
+ menu.add("-");
11401536 menu.add(analyzeItem = new MenuItem("Analyze"));
11411537 analyzeItem.addActionListener(this);
1142
- menu.add(dumpItem = new MenuItem("Dump"));
1538
+ menu.add(dumpItem = new MenuItem("Print"));
11431539 dumpItem.addActionListener(this);
11441540 // menu.add(pathItem = new MenuItem("From-to path"));
11451541 // pathItem.addActionListener(this);
....@@ -1157,6 +1553,7 @@
11571553 menu.add("-");
11581554 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11591555 editScriptItem.addActionListener(this);
1556
+ }
11601557 }
11611558
11621559 void ScreenFit()
....@@ -1279,9 +1676,34 @@
12791676 shadow.material = new cMaterial(obj.material);
12801677 shadow.material.diffuse = 0.0001f;
12811678 shadow.material.specular = 0.0001f;
1679
+ //shadow.projectedVertices[1].x = 300;
12821680
12831681 makeSomething(shadow);
12841682 }
1683
+
1684
+ private void ClearUnpinned()
1685
+ {
1686
+ //for (Object3D obj : listUI)
1687
+ for (int i=listUI.size(); --i>=0;)
1688
+ {
1689
+ Object3D obj = listUI.elementAt(i);
1690
+ if (!obj.pinned)
1691
+ {
1692
+ obj.CloseUI();
1693
+ listUI.remove(i);
1694
+ }
1695
+ }
1696
+ }
1697
+
1698
+ private void EditElement(Object3D elem, boolean newWindow)
1699
+ {
1700
+ // if (!(elem instanceof Composite))
1701
+ // newWindow = false;
1702
+ listUI.add(elem);
1703
+ elem.openEditWindow(this, newWindow); //, false);
1704
+ System.out.println("edit : " + elem);
1705
+ elem.editWindow.refreshContents(true); // ? new
1706
+ }
12851707
12861708 /**
12871709 * applyExample
....@@ -1485,9 +1907,9 @@
14851907
14861908 void Overwrite(int mask)
14871909 {
1488
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1910
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14891911 {
1490
- Object3D content = GrafreeD.clipboard.get(0);
1912
+ Object3D content = Grafreed.clipboard.get(0);
14911913
14921914 if (content instanceof cGroup && ((cGroup)content).transientlink )
14931915 content = ((cGroup)content).get(0);
....@@ -1510,6 +1932,7 @@
15101932 //
15111933 public void actionPerformed(ActionEvent event) // , Object arg)
15121934 {
1935
+ Object source = event.getSource();
15131936 /*
15141937 if (event.getSource() == nameField)
15151938 {
....@@ -1521,11 +1944,11 @@
15211944 }
15221945 else
15231946 */
1524
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1947
+ if (source == lookAtItem || source == lookFromItem)
15251948 {
15261949 ScreenFit();
15271950 } else
1528
- if (event.getSource() == switchItem)
1951
+ if (source == switchViewItem)
15291952 {
15301953 cVector v1 = new cVector();
15311954 cVector v2 = new cVector();
....@@ -1534,11 +1957,11 @@
15341957 objEditor.cameraView.renderCamera.setAim(v2, v1);
15351958 objEditor.cameraView.repaint();
15361959 } else
1537
- if (event.getSource() == rectoidItem)
1960
+ if (source == rectoidItem || source == boxButton)
15381961 {
15391962 makeSomething(new Box());
15401963 } else
1541
- if (event.getSource() == particleItem)
1964
+ if (source == particleItem || source == particlesButton)
15421965 {
15431966 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15441967 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1559,9 +1982,9 @@
15591982 applyExample(particleGeom, "SMOKE");
15601983 makeSomething(particleGeom);
15611984 } else
1562
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1985
+ if (source == ragdollItem || source == ragdoll2Item)
15631986 {
1564
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1987
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15651988
15661989 ragdoll.toParent = LA.newMatrix();
15671990 ragdoll.fromParent = LA.newMatrix();
....@@ -1579,7 +2002,7 @@
15792002 } else
15802003 /*
15812004 */
1582
- if (event.getSource() == heightFieldItem)
2005
+ if (source == heightFieldItem)
15832006 {
15842007 Object3D obj = new Object3D();
15852008
....@@ -1617,31 +2040,31 @@
16172040
16182041 makeSomething(obj);
16192042 } else
1620
- if (event.getSource() == gridItem)
2043
+ if (source == gridItem || source == gridButton)
16212044 {
16222045 makeSomething(new Grid());
16232046 } else
1624
- if (event.getSource() == ellipsoidItem)
2047
+ if (source == ellipsoidItem || source == sphereButton)
16252048 {
16262049 makeSomething(new Sphere());
16272050 } else
1628
- if (event.getSource() == coneItem)
2051
+ if (source == coneItem || source == coneButton)
16292052 {
16302053 makeSomething(new Cone());
16312054 } else
1632
- if (event.getSource() == torusItem)
2055
+ if (source == torusItem || source == torusButton)
16332056 {
16342057 makeSomething(new Torus());
16352058 } else
1636
- if (event.getSource() == superItem)
2059
+ if (source == superItem || source == superButton)
16372060 {
16382061 makeSomething(new Superellipsoid());
16392062 } else
1640
- if (event.getSource() == kleinItem)
2063
+ if (source == kleinItem || source == kleinButton)
16412064 {
16422065 makeSomething(new Klein());
16432066 } else
1644
- if (event.getSource() == blobItem)
2067
+ if (source == blobItem)
16452068 {
16462069 Blob blob = new Blob();
16472070 BlobComponent comp = new BlobComponent();
....@@ -1649,15 +2072,15 @@
16492072 //blob.retile();
16502073 makeSomething(blob);
16512074 } else
1652
- if (event.getSource() == latheItem)
2075
+ if (source == latheItem)
16532076 {
16542077 makeSomething(new Lathe());
16552078 } else
1656
- if (event.getSource() == bezierItem)
2079
+ if (source == bezierItem)
16572080 {
16582081 makeSomething(new BezierSurface());
16592082 } else
1660
- if (event.getSource() == checkerItem)
2083
+ if (source == overlayItem || source == overlayButton)
16612084 {
16622085 /*
16632086 Object3D obj = new BezierSurface(5,8);
....@@ -1672,7 +2095,7 @@
16722095 */
16732096 makeSomething(new Checker());
16742097 } else
1675
- if (event.getSource() == meshItem)
2098
+ if (source == meshItem)
16762099 {
16772100 Object3D itemtomake = new Object3D();
16782101 Object3D child;
....@@ -1693,35 +2116,35 @@
16932116 makeSomething(child);
16942117 }
16952118 } else
1696
- if (event.getSource() == springItem)
2119
+ if (source == springItem)
16972120 {
16982121 cSpring s = new cSpring();
16992122 s.setup();
17002123 makeSomething(s);
17012124 } else
1702
- if (event.getSource() == flagItem)
2125
+ if (source == flagItem)
17032126 {
17042127 cSpring s = new cFlag();
17052128 s.setup();
17062129 makeSomething(s);
17072130 } else
1708
- if (event.getSource() == lightItem)
2131
+ if (source == lightItem || source == lightButton)
17092132 {
17102133 makeSomething(new Light());
17112134 } else
1712
- if (event.getSource() == csgItem)
2135
+ if (source == csgItem)
17132136 {
17142137 group(new CSG());
17152138 } else
1716
- if (event.getSource() == templateItem)
2139
+ if (source == templateItem)
17172140 {
17182141 group(new cTemplate());
17192142 } else
1720
- if (event.getSource() == attributeItem)
2143
+ if (source == attributeItem)
17212144 {
17222145 makeSomething(new Attribute());
17232146 } else
1724
- if (event.getSource() == pointflowItem)
2147
+ if (source == pointflowItem)
17252148 {
17262149 makeSomething(new PointFlow());
17272150 } else
....@@ -1733,7 +2156,7 @@
17332156 } else
17342157 */
17352158
1736
- if (event.getSource() == superLoopItem)
2159
+ if (source == superLoopItem)
17372160 {
17382161 Composite g = new cGroup();
17392162 for (int i=0; i<15; i++)
....@@ -1755,30 +2178,30 @@
17552178
17562179 group(g);
17572180 } else
1758
- if (event.getSource() == loopItem)
2181
+ if (source == loopItem || source == loopButton)
17592182 {
17602183 Composite csg = new GroupLeaf();
17612184 csg.count = 5;
17622185 group(csg);
1763
- Composite child = new cGroup();
2186
+ Composite child = new cGroup("Branch");
17642187 csg.addChild(child);
17652188 child.addChild(csg);
17662189 } else
1767
- if (event.getSource() == doubleItem)
2190
+ if (source == doubleItem)
17682191 {
1769
- Composite csg = new GroupLeaf();
2192
+ Composite csg = new GroupLeaf("Fork");
17702193 csg.count = 5;
17712194 group(csg);
1772
- Composite child = new cGroup();
2195
+ Composite child = new cGroup("Branch A");
17732196 csg.addChild(child);
17742197 child.addChild(csg);
1775
- child = new cGroup();
2198
+ child = new cGroup("Branch B");
17762199 csg.addChild(child);
17772200 child.addChild(csg);
17782201 } else
1779
- if (event.getSource() == tripleItem)
2202
+ if (source == tripleItem)
17802203 {
1781
- Composite csg = new GroupLeaf();
2204
+ Composite csg = new GroupLeaf("Trident");
17822205 csg.count = 4;
17832206 group(csg);
17842207 Composite child = new cGroup();
....@@ -1791,73 +2214,98 @@
17912214 csg.addChild(child);
17922215 child.addChild(csg);
17932216 } else
1794
-
1795
- if (event.getSource() == importGFDItem)
1796
- {
1797
- ImportGFD();
1798
- } else
1799
- if (event.getSource() == importVRMLX3DItem)
1800
- {
1801
- ImportVRMLX3D();
1802
- } else
1803
- if (event.getSource() == import3DSItem)
1804
- {
1805
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1806
- } else
1807
- if (event.getSource() == importOBJItem)
1808
- {
1809
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1810
- } else
1811
- if (event.getSource() == computeAOItem)
2217
+ if (source == computeAOItem)
18122218 {
18132219 Globals.drawMode = CameraPane.OCCLUSION;
18142220 Globals.theRenderer.repaint();
18152221 } else
1816
- if (event.getSource() == recompileItem)
2222
+ if (source == recompileItem)
18172223 {
18182224 Recompile();
18192225 refreshContents();
18202226 } else
1821
- if (event.getSource() == editScriptItem)
2227
+ if (source == editScriptItem)
18222228 {
18232229 OpenDialog();
18242230 refreshContents();
18252231 } else
1826
- if (event.getSource() == invariantsItem)
2232
+ if (source == invariantsItem)
18272233 {
18282234 System.out.println("Invariants:");
1829
- GrafreeD.grafreeD.universe.invariants();
2235
+ Grafreed.grafreeD.universe.invariants();
18302236 } else
1831
- if (event.getSource() == memoryItem)
2237
+ if (source == memoryItem)
18322238 {
18332239 //System.out.println("Invariants:");
18342240 PrintMemory();
18352241 } else
1836
- if (event.getSource() == pathItem)
2242
+ if (source == pathItem)
18372243 {
18382244 PrintPath();
18392245 } else
1840
- if (event.getSource() == analyzeItem)
2246
+ if (source == analyzeItem)
18412247 {
18422248 AnalyzeObject();
18432249 } else
1844
- if (event.getSource() == dumpItem)
2250
+ if (source == dumpItem)
18452251 {
18462252 DumpObject();
18472253 } else
1848
- if (event.getSource() == screenfitButton)
2254
+ if (source == minButton)
18492255 {
1850
- //Reload(lastConverter, lastFilename, true);
2256
+ Minimize();
2257
+ } else
2258
+ if (source == maxButton)
2259
+ {
2260
+ Maximize();
2261
+ } else
2262
+ if (source == fullButton)
2263
+ {
2264
+ ToggleFullScreen();
2265
+ } else
2266
+ if (source == undoButton)
2267
+ {
2268
+ // Go to previous version
2269
+ //if (!Undo())
2270
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2271
+ Undo();
2272
+ } else
2273
+ if (source == restoreButton)
2274
+ {
2275
+ // Restore current version
2276
+ Restore();
2277
+ } else
2278
+ if (source == replaceButton)
2279
+ {
2280
+ // Overwrite current version
2281
+ Replace();
2282
+ } else
2283
+ if (source == redoButton)
2284
+ {
2285
+ // Go to next version
2286
+ Redo();
2287
+ } else
2288
+ if (source == saveButton)
2289
+ {
2290
+ // Save a new version
2291
+ if (!Save(true))
2292
+ java.awt.Toolkit.getDefaultToolkit().beep();
2293
+ } else
2294
+ if (source == oneStepButton)
2295
+ {
2296
+ Globals.ONESTEP = true;
2297
+ cameraView.repaint();
2298
+ } else
2299
+ if (source == screenfitButton)
2300
+ {
18512301 ScreenFit();
18522302 } else
1853
- if (event.getSource() == screenfitpointButton)
2303
+ if (source == screenfitpointButton)
18542304 {
1855
- //Reload(lastConverter, lastFilename, true);
18562305 ScreenFitPoint();
18572306 } else
1858
- if (event.getSource() == snapobjectButton)
2307
+ if (source == snapobjectButton)
18592308 {
1860
- //Reload(lastConverter, lastFilename, true);
18612309 SnapObject();
18622310 } else
18632311 // if (event.getSource() == recompileButton)
....@@ -1866,13 +2314,13 @@
18662314 // Recompile();
18672315 // refreshContents();
18682316 // } else
1869
- if (event.getSource() == gcButton)
2317
+ if (source == gcButton)
18702318 {
18712319 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18722320 System.gc();
18732321 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18742322 } else
1875
- if (event.getSource() == editLeafItem)
2323
+ if (source == editLeafItem)
18762324 {
18772325 Object3D obj;
18782326 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1886,62 +2334,74 @@
18862334 }
18872335 refreshContents(true);
18882336 } else
1889
- if (event.getSource() == openWindowItem)
2337
+ if (source == openWindowItem)
18902338 {
18912339 EditSelection(true);
18922340 } else
1893
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2341
+ if (source == cutItem || source == clearButton)
18942342 {
18952343 loadClipboard(true);
18962344 } else
1897
- if (event.getSource() == duplicateItem)
2345
+ if (source == undoItem)
18982346 {
1899
- Object3D keep = GrafreeD.clipboard;
2347
+ Undo();
2348
+ } else
2349
+ if (source == redoItem)
2350
+ {
2351
+ Redo();
2352
+ } else
2353
+ if (source == duplicateItem)
2354
+ {
2355
+ Object3D keep = Grafreed.clipboard;
19002356 loadClipboard(false);
19012357 paste(false);
1902
- GrafreeD.clipboard = keep;
2358
+ Grafreed.clipboard = keep;
19032359 } else
1904
- if (event.getSource() == cloneItem)
2360
+ if (source == cloneItem)
19052361 {
19062362 CloneSelection(false);
19072363 } else
1908
- if (event.getSource() == cloneSupportItem)
2364
+ if (source == cloneSupportItem)
19092365 {
19102366 CloneSelection(true);
19112367 } else
1912
- if (event.getSource() == copyItem)
2368
+ if (source == copyItem)
19132369 {
19142370 loadClipboard(false);
19152371 } else
1916
- if (event.getSource() == pasteItem)
2372
+ if (source == pasteItem)
19172373 {
19182374 paste(false);
19192375 } else
1920
- if (event.getSource() == pasteLinkItem)
2376
+ if (source == pasteIntoItem)
19212377 {
1922
- pasteInto(false);
2378
+ pasteInto(true, false);
19232379 } else
1924
- if (event.getSource() == pasteCloneItem)
2380
+ if (source == pasteLinkItem)
19252381 {
1926
- pasteInto(true);
2382
+ pasteInto(false, false);
19272383 } else
1928
- if (event.getSource() == pasteExpandItem)
2384
+ if (source == pasteCloneItem)
2385
+ {
2386
+ pasteInto(true, true);
2387
+ } else
2388
+ if (source == pasteExpandItem)
19292389 {
19302390 paste(true);
19312391 } else
1932
- if (event.getSource() == synchronizeItem)
2392
+ if (source == synchronizeItem)
19332393 {
19342394 Overwrite(Object3D.TRANSFORM);
19352395 } else
1936
- if (event.getSource() == overwriteNameItem)
2396
+ if (source == overwriteNameItem)
19372397 {
19382398 Overwrite(Object3D.NAME);
19392399 } else
1940
- if (event.getSource() == overwriteUVItem)
2400
+ if (source == overwriteUVItem)
19412401 {
19422402 Overwrite(Object3D.UV);
19432403 } else
1944
- if (event.getSource() == overwriteMatItem)
2404
+ if (source == overwriteMatItem)
19452405 {
19462406 /* july 2015
19472407 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1961,7 +2421,7 @@
19612421
19622422 Overwrite(dropAttributes);
19632423 }
1964
- if (event.getSource() == overwriteGeoItem)
2424
+ if (source == overwriteGeoItem)
19652425 {
19662426 Overwrite(Object3D.GEOMETRY);
19672427 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1978,7 +2438,7 @@
19782438 // refreshContents();
19792439 // }
19802440 } else
1981
- if (event.getSource() == generateMeshItem)
2441
+ if (source == generateMeshItem)
19822442 {
19832443 //if (group.selection.size() == 1)
19842444 // for (int i=0; i<group.selection.size(); i++)
....@@ -1989,7 +2449,7 @@
19892449 ResetModel();
19902450 refreshContents();
19912451 } else
1992
- if (event.getSource() == extractGeometriesItem)
2452
+ if (source == extractGeometriesItem)
19932453 {
19942454 boolean one = false;
19952455
....@@ -2016,7 +2476,7 @@
20162476 ResetModel();
20172477 refreshContents();
20182478 } else
2019
- if (event.getSource() == cloneGeometriesItem)
2479
+ if (source == cloneGeometriesItem)
20202480 {
20212481 boolean one = false;
20222482
....@@ -2042,7 +2502,7 @@
20422502 ResetModel();
20432503 refreshContents();
20442504 } else
2045
- if (event.getSource() == shareGeometriesItem)
2505
+ if (source == shareGeometriesItem)
20462506 {
20472507 boolean one = false;
20482508
....@@ -2072,7 +2532,7 @@
20722532 refreshContents();
20732533 }
20742534 } else
2075
- if (event.getSource() == mergeGeometriesItem)
2535
+ if (source == mergeGeometriesItem)
20762536 {
20772537 boolean one = false;
20782538
....@@ -2102,7 +2562,7 @@
21022562 ResetModel();
21032563 refreshContents();
21042564 } else
2105
- if (event.getSource() == linkverticesItem)
2565
+ if (source == linkverticesItem)
21062566 {
21072567 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
21082568 // {
....@@ -2115,9 +2575,9 @@
21152575 // group.selection.get(0).setMasterThis(content); // should be identity
21162576 // refreshContents();
21172577 // }
2118
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2578
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21192579 {
2120
- Object3D content = GrafreeD.clipboard.get(0);
2580
+ Object3D content = Grafreed.clipboard.get(0);
21212581
21222582 if (content instanceof cGroup && ((cGroup)content).transientlink )
21232583 content = ((cGroup)content).get(0);
....@@ -2125,38 +2585,38 @@
21252585 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21262586 for (int i=0; i<group.selection.size(); i++)
21272587 {
2128
- boolean random = CameraPane.RANDOM;
2129
- CameraPane.RANDOM = false; // parse all random nodes
2588
+ boolean random = CameraPane.SWITCH;
2589
+ CameraPane.SWITCH = false; // parse all random nodes
21302590 group.selection.get(i).linkVerticesThis(content);
21312591 // group.selection.get(i).setMasterThis(content); // should be identity
2132
- CameraPane.RANDOM = random;
2592
+ CameraPane.SWITCH = random;
21332593 }
21342594 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21352595 refreshContents();
21362596 }
21372597 } else
2138
- if (event.getSource() == resetsupportItem)
2598
+ if (source == resetsupportItem)
21392599 {
21402600 for (int i=0; i<group.selection.size(); i++)
21412601 {
2142
- boolean random = CameraPane.RANDOM;
2143
- CameraPane.RANDOM = false; // parse all random nodes
2602
+ boolean random = CameraPane.SWITCH;
2603
+ CameraPane.SWITCH = false; // parse all random nodes
21442604 group.selection.get(i).linkVerticesThis(null);
2145
- CameraPane.RANDOM = random;
2605
+ CameraPane.SWITCH = random;
21462606 }
21472607
21482608 refreshContents();
21492609 } else
2150
- if (event.getSource() == relinkverticesItem)
2610
+ if (source == relinkverticesItem)
21512611 {
2152
- boolean random = CameraPane.RANDOM;
2153
- CameraPane.RANDOM = false; // parse all random nodes
2612
+ boolean random = CameraPane.SWITCH;
2613
+ CameraPane.SWITCH = false; // parse all random nodes
21542614 group.selection.RelinkToSupport();
2155
- CameraPane.RANDOM = random;
2615
+ CameraPane.SWITCH = random;
21562616
21572617 refreshContents();
21582618 } else
2159
- if (event.getSource() == resetreferencesItem)
2619
+ if (source == resetreferencesItem)
21602620 {
21612621 for (int i=0; i<group.selection.size(); i++)
21622622 {
....@@ -2165,11 +2625,11 @@
21652625
21662626 refreshContents();
21672627 } else
2168
- if (event.getSource() == setMasterItem)
2628
+ if (source == setMasterItem)
21692629 {
2170
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2630
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21712631 {
2172
- Object3D content = GrafreeD.clipboard.get(0);
2632
+ Object3D content = Grafreed.clipboard.get(0);
21732633
21742634 if (content instanceof cGroup && ((cGroup)content).transientlink )
21752635 content = ((cGroup)content).get(0);
....@@ -2178,13 +2638,13 @@
21782638 refreshContents();
21792639 }
21802640 } else
2181
- if (event.getSource() == poseMeshItem)
2641
+ if (source == poseMeshItem)
21822642 {
21832643 if (group.selection.size() == 1)
21842644 {
2185
- if (GrafreeD.clipboard.size() == 1)
2645
+ if (Grafreed.clipboard.size() == 1)
21862646 {
2187
- Object3D content = GrafreeD.clipboard.get(0);
2647
+ Object3D content = Grafreed.clipboard.get(0);
21882648
21892649 if (content instanceof cGroup && ((cGroup)content).transientlink )
21902650 content = ((cGroup)content).get(0);
....@@ -2197,19 +2657,19 @@
21972657 }
21982658
21992659 } else
2200
- if (event.getSource() == revertMeshItem)
2660
+ if (source == revertMeshItem)
22012661 {
22022662 RevertMeshes();
22032663 } else
2204
- if (event.getSource() == resetMeshItem)
2664
+ if (source == resetAllItem)
22052665 {
22062666 ResetAll();
22072667 } else
2208
- if (event.getSource() == stepAllItem)
2668
+ if (source == stepAllItem)
22092669 {
22102670 StepAll();
22112671 } else
2212
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2672
+ if (source == deleteItem) // || event.getSource() == clearButton)
22132673 {
22142674 //int indices[] = jList.getSelectedIndices();
22152675 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2217,46 +2677,46 @@
22172677
22182678 ClearSelection(false);
22192679 } else
2220
- if (event.getSource() == clearAllItem)
2680
+ if (source == clearAllItem)
22212681 {
22222682 ClearSelection(true);
22232683 } else
2224
- if (event.getSource() == grabItem)
2684
+ if (source == grabItem || source == groupButton)
22252685 {
2226
- group(new cGroup(), true);
2686
+ group(new cGroup(), false); // true);
22272687 } else
2228
- if (event.getSource() == hideItem)
2688
+ if (source == hideItem)
22292689 {
22302690 group(new HiddenObject());
22312691 } else
2232
- if (event.getSource() == frontItem)
2692
+ if (source == frontItem)
22332693 {
22342694 front();
22352695 } else
2236
- if (event.getSource() == backItem)
2696
+ if (source == backItem)
22372697 {
22382698 back();
22392699 } else
2240
- if (event.getSource() == cameraItem)
2700
+ if (source == cameraItem)
22412701 {
22422702 makeSomething(new Camera());
22432703 } else
2244
- if (event.getSource() == compositeItem)
2704
+ if (source == compositeItem || source == compositeButton)
22452705 {
22462706 group(new Composite());
22472707 } else
2248
- if (event.getSource() == randomItem)
2708
+ if (source == switchItem || source == switchButton)
22492709 {
22502710 RandomNode random = new RandomNode();
22512711 group(random);
22522712 if (random.size() > 0)
2253
- random.name = random.get(0).name + "Rnd";
2713
+ random.name = random.get(0).name + "Switch";
22542714 } else
2255
- if (event.getSource() == physicsItem)
2715
+ if (source == physicsItem)
22562716 {
22572717 group(new PhysicsNode());
22582718 } else
2259
- if (event.getSource() == frameselectorItem)
2719
+ if (source == frameselectorItem)
22602720 {
22612721 for (int i=0; i<group.selection.size(); i++)
22622722 {
....@@ -2268,7 +2728,7 @@
22682728 ResetModel();
22692729 refreshContents();
22702730 } else
2271
- if (event.getSource() == switchGeoItem)
2731
+ if (source == switchGeoItem)
22722732 {
22732733 for (int i=0; i<group.selection.size(); i++)
22742734 {
....@@ -2280,7 +2740,7 @@
22802740 ResetModel();
22812741 refreshContents();
22822742 } else
2283
- if (event.getSource() == switchTransfoItem)
2743
+ if (source == switchTransfoItem)
22842744 {
22852745 for (int i=0; i<group.selection.size(); i++)
22862746 {
....@@ -2292,7 +2752,7 @@
22922752 ResetModel();
22932753 refreshContents();
22942754 } else
2295
- if (event.getSource() == morphItem)
2755
+ if (source == morphItem)
22962756 {
22972757 for (int i=0; i<group.selection.size(); i++)
22982758 {
....@@ -2304,7 +2764,7 @@
23042764 ResetModel();
23052765 refreshContents();
23062766 } else
2307
- if (event.getSource() == scriptNodeItem)
2767
+ if (source == scriptNodeItem)
23082768 {
23092769 boolean atleastone = false;
23102770
....@@ -2343,215 +2803,252 @@
23432803 }
23442804 }
23452805 } else
2346
- if (event.getSource() == linkerItem)
2806
+ if (source == linkerItem)
23472807 {
23482808 group(new cLinker());
23492809 } else
2350
- if (event.getSource() == textureItem)
2810
+ if (source == textureItem || source == textureButton)
23512811 {
23522812 group(new TextureNode());
23532813 } else
2354
- if (event.getSource() == billboardItem)
2814
+ if (source == billboardItem)
23552815 {
23562816 group(new BillboardNode());
23572817 } else
2358
- if (event.getSource() == shadowXItem)
2818
+ if (source == shadowXItem)
23592819 {
23602820 CastShadow(0);
23612821 } else
2362
- if (event.getSource() == shadowYItem)
2822
+ if (source == shadowYItem)
23632823 {
23642824 CastShadow(1);
23652825 } else
2366
- if (event.getSource() == shadowZItem)
2826
+ if (source == shadowZItem)
23672827 {
23682828 CastShadow(2);
23692829 } else
2370
- if (event.getSource() == ungroupItem)
2830
+ if (source == ungroupItem || source == ungroupButton)
23712831 {
2372
- //ungroup();
2832
+ boolean hasRoot = false;
2833
+
23732834 for (int i=0; i<group.selection.size(); i++)
23742835 {
2375
- Ungroup(group.selection.get(i));
2836
+ if (group.selection.get(i) == group)
2837
+ {
2838
+ hasRoot = true;
2839
+ break;
2840
+ }
23762841 }
23772842
2378
- ClearSelection(false);
2379
-
2380
- refreshContents();
2843
+ if (!hasRoot)
2844
+ {
2845
+ for (int i=0; i<group.selection.size(); i++)
2846
+ {
2847
+ Ungroup(group.selection.get(i));
2848
+ }
2849
+
2850
+ ClearSelection(false);
2851
+
2852
+ refreshContents();
2853
+ }
23812854 } else
2382
- if (event.getSource() == genUVItem)
2855
+ if (source == genUVItem)
23832856 {
23842857 GenUV();
23852858 } else
2386
- if (event.getSource() == genNormalsCADItem)
2859
+ if (source == genNormalsCADItem)
23872860 {
23882861 GenNormals(true);
23892862 } else
2390
- if (event.getSource() == genNormalsMESHItem)
2863
+ if (source == genNormalsMESHItem)
23912864 {
2392
- GenNormals(true); // TODO
2865
+ GenNormalsMESH();
23932866 } else
2394
- if (event.getSource() == genNormalsORGANItem)
2867
+ if (source == genNormalsORGANItem)
23952868 {
23962869 GenNormals(false);
23972870 } else
2398
- if (event.getSource() == genNormalsMINEItem)
2871
+ if (source == genNormalsMINEItem)
23992872 {
24002873 GenNormalsMINE();
24012874 } else
2402
- if (event.getSource() == stripifyItem)
2875
+ if (source == stripifyItem)
24032876 {
24042877 Stripify();
24052878 } else
2406
- if (event.getSource() == unstripifyItem)
2879
+ if (source == unstripifyItem)
24072880 {
24082881 Unstripify();
24092882 } else
2410
- if (event.getSource() == trimItem)
2883
+ if (source == trimItem)
24112884 {
24122885 Trim();
24132886 } else
2414
- if (event.getSource() == untrimItem)
2887
+ if (source == untrimItem)
24152888 {
24162889 Untrim();
24172890 } else
2418
- if (event.getSource() == clearColorsItem)
2891
+ if (source == clearColorsItem)
24192892 {
24202893 ClearColors();
24212894 } else
2422
- if (event.getSource() == clearMaterialsItem)
2895
+ if (source == clearMaterialsItem)
24232896 {
24242897 ClearMaterials();
24252898 } else
2426
- if (event.getSource() == liveleavesItem)
2899
+ if (source == liveleavesItem)
24272900 {
24282901 LiveLeaves(true);
24292902 } else
2430
- if (event.getSource() == unliveleavesItem)
2903
+ if (source == unliveleavesItem)
24312904 {
24322905 LiveLeaves(false);
24332906 } else
2434
- if (event.getSource() == supportleavesItem)
2907
+ if (source == supportleavesItem)
24352908 {
24362909 SupportLeaves(true);
24372910 } else
2438
- if (event.getSource() == unsupportleavesItem)
2911
+ if (source == unsupportleavesItem)
24392912 {
24402913 SupportLeaves(false);
24412914 } else
2442
- if (event.getSource() == hideleavesItem)
2915
+ if (source == hideleavesItem)
24432916 {
24442917 HideLeaves(true);
24452918 } else
2446
- if (event.getSource() == showleavesItem)
2919
+ if (source == showleavesItem)
24472920 {
24482921 HideLeaves(false);
24492922 } else
2450
- if (event.getSource() == markleavesItem)
2923
+ if (source == markleavesItem)
24512924 {
24522925 MarkLeaves(true);
24532926 } else
2454
- if (event.getSource() == unmarkleavesItem)
2927
+ if (source == unmarkleavesItem)
24552928 {
24562929 MarkLeaves(false);
24572930 } else
2458
- if (event.getSource() == flipVItem)
2931
+ if (source == rewindleavesItem)
2932
+ {
2933
+ RewindLeaves(true);
2934
+ } else
2935
+ if (source == unrewindleavesItem)
2936
+ {
2937
+ RewindLeaves(false);
2938
+ } else
2939
+ if (source == randomleavesItem)
2940
+ {
2941
+ RandomLeaves(true);
2942
+ } else
2943
+ if (source == unrandomleavesItem)
2944
+ {
2945
+ RandomLeaves(false);
2946
+ } else
2947
+ if (source == flipVItem)
24592948 {
24602949 FlipV(true);
24612950 } else
2462
- if (event.getSource() == unflipVItem)
2951
+ if (source == unflipVItem)
24632952 {
24642953 FlipV(false);
24652954 } else
2466
- if (event.getSource() == lowTexturesItem)
2955
+ if (source == lowTexturesItem)
24672956 {
24682957 SetTexRes(0);
24692958 } else
2470
- if (event.getSource() == normalTexturesItem)
2959
+ if (source == normalTexturesItem)
24712960 {
24722961 SetTexRes(1);
24732962 } else
2474
- if (event.getSource() == highTexturesItem)
2963
+ if (source == highTexturesItem)
24752964 {
24762965 SetTexRes(2);
24772966 } else
2478
- if (event.getSource() == veryhighTexturesItem)
2967
+ if (source == veryhighTexturesItem)
24792968 {
24802969 SetTexRes(3);
24812970 } else
2482
- if (event.getSource() == maxTexturesItem)
2971
+ if (source == maxTexturesItem)
24832972 {
24842973 SetTexRes(4);
24852974 } else
2486
- if (event.getSource() == panoTexturesItem)
2975
+ if (source == panoTexturesItem)
24872976 {
24882977 SetTexRes(5);
24892978 } else
2490
- if (event.getSource() == reverseNormalsItem)
2979
+ if (source == reverseNormalsItem)
24912980 {
24922981 ReverseNormals();
24932982 } else
2494
- if (event.getSource() == parseverticesItem)
2983
+ if (source == parseverticesItem)
24952984 {
24962985 ParseVertices();
24972986 } else
2498
- if (event.getSource() == textureFieldItem)
2987
+ if (source == textureFieldItem)
24992988 {
25002989 TextureVertices();
25012990 } else
2502
- if (event.getSource() == alignItem)
2991
+ if (source == alignItem)
25032992 {
25042993 Align();
25052994 } else
2506
- if (event.getSource() == mirrorItem)
2995
+ if (source == mirrorItem)
25072996 {
25082997 MirrorPoses();
25092998 } else
2510
- if (event.getSource() == reduceMorphItem)
2999
+ if (source == reduceMorphItem)
25113000 {
25123001 MeshReduction(false);
25133002 } else
2514
- if (event.getSource() == reduce34MorphItem)
3003
+ if (source == reduce34MorphItem)
25153004 {
25163005 MeshReduction(true);
25173006 } else
2518
- if (event.getSource() == reverseTrianglesItem)
3007
+ if (source == reverseTrianglesItem)
25193008 {
25203009 ReverseTriangles();
25213010 } else
2522
- if (event.getSource() == reduceMeshItem)
3011
+ if (source == reduceMeshItem)
25233012 {
25243013 ReduceMesh(false);
25253014 } else
2526
- if (event.getSource() == reduce34MeshItem)
3015
+ if (source == reduce34MeshItem)
25273016 {
25283017 ReduceMesh(true);
25293018 } else
2530
- if (event.getSource() == increaseMeshItem)
3019
+ if (source == increaseMeshItem)
25313020 {
25323021 IncreaseMesh();
25333022 } else
2534
- if (event.getSource() == clipMeshItem)
3023
+ if (source == clipMeshItem)
25353024 {
25363025 ClipMesh();
25373026 } else
2538
- if (event.getSource() == smoothMeshItem)
3027
+ if (source == smoothMeshItem)
25393028 {
25403029 SmoothMesh();
25413030 } else
2542
- if (event.getSource() == transformgeometryItem)
3031
+ if (source == transformGeometryItem)
25433032 {
25443033 TransformGeometry();
25453034 } else
2546
- if (event.getSource() == resetTransformItem)
3035
+ if (source == transformChildrenItem)
3036
+ {
3037
+ TransformChildren();
3038
+ } else
3039
+ if (source == resetTransformItem)
25473040 {
25483041 ResetTransform();
25493042 } else
2550
- if (event.getSource() == resetCentroidItem)
3043
+ if (source == resetCentroidItem)
25513044 {
2552
- ResetCentroid();
3045
+ ResetCentroid(true);
25533046 } else
2554
- if (event.getSource() == resetParentItem)
3047
+ if (source == resetCentroidXZItem)
3048
+ {
3049
+ ResetCentroid(false);
3050
+ } else
3051
+ if (source == resetParentItem)
25553052 {
25563053 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25573054 {
....@@ -2561,7 +3058,7 @@
25613058
25623059 refreshContents();
25633060 } else
2564
- if (event.getSource() == repairParentItem)
3061
+ if (source == repairParentItem)
25653062 {
25663063 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25673064 {
....@@ -2575,7 +3072,7 @@
25753072
25763073 refreshContents();
25773074 } else
2578
- if (event.getSource() == repairShadowItem)
3075
+ if (source == repairShadowItem)
25793076 {
25803077 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25813078 {
....@@ -2589,7 +3086,7 @@
25893086
25903087 refreshContents();
25913088 } else
2592
- if (event.getSource() == sortbysizeItem)
3089
+ if (source == sortbysizeItem)
25933090 {
25943091 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25953092 {
....@@ -2601,7 +3098,7 @@
26013098 ResetModel();
26023099 refreshContents();
26033100 } else
2604
- if (event.getSource() == sortbynameItem)
3101
+ if (source == sortbynameItem)
26053102 {
26063103 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26073104 {
....@@ -2613,7 +3110,7 @@
26133110 ResetModel();
26143111 refreshContents();
26153112 } else
2616
- if (event.getSource() == attachPigmentItem)
3113
+ if (source == attachPigmentItem)
26173114 {
26183115 String texture = GetFile("Attach pigment");
26193116 Object3D obj;
....@@ -2625,7 +3122,7 @@
26253122
26263123 refreshContents();
26273124 } else
2628
- if (event.getSource() == detachPigmentItem)
3125
+ if (source == detachPigmentItem)
26293126 {
26303127 Object3D obj;
26313128 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2636,7 +3133,7 @@
26363133
26373134 refreshContents();
26383135 } else
2639
- if (event.getSource() == attachBumpItem)
3136
+ if (source == attachBumpItem)
26403137 {
26413138 String texture = GetFile("Attach bump");
26423139 Object3D obj;
....@@ -2648,7 +3145,7 @@
26483145
26493146 refreshContents();
26503147 } else
2651
- if (event.getSource() == detachBumpItem)
3148
+ if (source == detachBumpItem)
26523149 {
26533150 Object3D obj;
26543151 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2659,7 +3156,7 @@
26593156
26603157 refreshContents();
26613158 } else
2662
- if (event.getSource() == pigmentBumpItem)
3159
+ if (source == pigmentBumpItem)
26633160 {
26643161 Object3D obj;
26653162 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2670,158 +3167,237 @@
26703167
26713168 refreshContents();
26723169 } else
2673
- if (event.getSource() == flashSelectionButton)
3170
+ if (source == flashSelectionButton)
26743171 {
26753172 CameraPane.flash = true;
26763173 refreshContents();
26773174 } else
2678
- if (event.getSource() == oneButton)
3175
+ if (source == oneButton)
26793176 {
26803177 } else
2681
- if (event.getSource() == twoButton)
3178
+ if (source == twoButton)
26823179 {
26833180 radio.layout = twoButton;
3181
+
3182
+ if (CameraPane.FULLSCREEN)
3183
+ fullscreenLayout = radio.layout;
3184
+
26843185 // bug
26853186 //gridPanel.setDividerLocation(1.0);
26863187 //bigPanel.setDividerLocation(0.0);
2687
- bigThree.remove(scenePanel);
2688
- bigThree.remove(centralPanel);
2689
- bigThree.remove(XYZPanel);
2690
- aWindowConstraints.gridx = 0;
2691
- aWindowConstraints.gridy = 0;
2692
- aWindowConstraints.gridwidth = 1;
2693
- // aConstraints.gridheight = 3;
2694
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2695
- aWindowConstraints.weightx = 0;
2696
- aWindowConstraints.weighty = 1;
2697
- //bigThree.add(jtp, aWindowConstraints);
2698
- aWindowConstraints.weightx = 1;
2699
- aWindowConstraints.gridwidth = 3;
2700
- // aConstraints.gridheight = 3;
2701
- aWindowConstraints.gridx = 1;
2702
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2703
- bigThree.add(centralPanel, aWindowConstraints);
2704
- aWindowConstraints.weightx = 0;
2705
- aWindowConstraints.gridx = 4;
2706
- aWindowConstraints.gridwidth = 1;
2707
- // aConstraints.gridheight = 3;
2708
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2709
- //bigThree.add(XYZPanel, aWindowConstraints);
2710
- bigThree.revalidate();
3188
+// bigThree.remove(scenePanel);
3189
+// bigThree.remove(centralPanel);
3190
+// bigThree.remove(XYZPanel);
3191
+// aWindowConstraints.gridx = 0;
3192
+// aWindowConstraints.gridy = 0;
3193
+// aWindowConstraints.gridwidth = 1;
3194
+// // aConstraints.gridheight = 3;
3195
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3196
+// aWindowConstraints.weightx = 0;
3197
+// aWindowConstraints.weighty = 1;
3198
+// //bigThree.add(jtp, aWindowConstraints);
3199
+// aWindowConstraints.weightx = 1;
3200
+// aWindowConstraints.gridwidth = 3;
3201
+// // aConstraints.gridheight = 3;
3202
+// aWindowConstraints.gridx = 1;
3203
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3204
+// bigThree.add(centralPanel, aWindowConstraints);
3205
+// aWindowConstraints.weightx = 0;
3206
+// aWindowConstraints.gridx = 4;
3207
+// aWindowConstraints.gridwidth = 1;
3208
+// // aConstraints.gridheight = 3;
3209
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3210
+// //bigThree.add(XYZPanel, aWindowConstraints);
3211
+// scenePanel.setVisible(false);
3212
+// centralPanel.setVisible(true);
3213
+// XYZPanel.setVisible(false);
3214
+ bigThree.ClearUI();
3215
+ bigThree.add(centralPanel);
3216
+ bigThree.FlushUI();
3217
+
3218
+ cameraView.requestFocusInWindow();
3219
+
3220
+// refreshContents(true);
3221
+//
3222
+// try
3223
+// {
3224
+// java.awt.Robot bot = new java.awt.Robot();
3225
+// int mask = InputEvent.BUTTON1_MASK;
3226
+// bot.mouseMove(100, 100);
3227
+// bot.mousePress(mask);
3228
+// bot.mouseRelease(mask);
3229
+// }
3230
+// catch (Exception e)
3231
+// {
3232
+//
3233
+// }
3234
+
27113235 } else
2712
- if (event.getSource() == threeButton)
3236
+ if (source == threeButton)
27133237 {
27143238 radio.layout = threeButton;
2715
- bigThree.remove(scenePanel);
2716
- bigThree.remove(centralPanel);
2717
- bigThree.remove(XYZPanel);
2718
- aWindowConstraints.gridx = 0;
2719
- aWindowConstraints.gridy = 0;
2720
- aWindowConstraints.gridwidth = 1;
2721
- // aConstraints.gridheight = 3;
2722
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2723
- aWindowConstraints.weightx = 0;
2724
- aWindowConstraints.weighty = 1;
2725
- //bigThree.add(jtp, aWindowConstraints);
2726
- aWindowConstraints.weightx = 1;
2727
- aWindowConstraints.gridwidth = 3;
2728
- // aConstraints.gridheight = 3;
2729
- aWindowConstraints.gridx = 1;
2730
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2731
- bigThree.add(centralPanel, aWindowConstraints);
2732
- aWindowConstraints.weightx = 0;
2733
- aWindowConstraints.gridx = 4;
2734
- aWindowConstraints.gridwidth = 1;
2735
- // aConstraints.gridheight = 3;
2736
- aConstraints.fill = GridBagConstraints.VERTICAL;
2737
- bigThree.add(XYZPanel, aWindowConstraints);
2738
- bigThree.revalidate();
3239
+
3240
+ if (CameraPane.FULLSCREEN)
3241
+ fullscreenLayout = radio.layout;
3242
+
3243
+// bigThree.remove(scenePanel);
3244
+// bigThree.remove(centralPanel);
3245
+// bigThree.remove(XYZPanel);
3246
+// aWindowConstraints.gridx = 0;
3247
+// aWindowConstraints.gridy = 0;
3248
+// aWindowConstraints.gridwidth = 1;
3249
+// // aConstraints.gridheight = 3;
3250
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3251
+// aWindowConstraints.weightx = 0;
3252
+// aWindowConstraints.weighty = 1;
3253
+// //bigThree.add(jtp, aWindowConstraints);
3254
+// aWindowConstraints.weightx = 1;
3255
+// aWindowConstraints.gridwidth = 3;
3256
+// // aConstraints.gridheight = 3;
3257
+// aWindowConstraints.gridx = 1;
3258
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3259
+// bigThree.add(centralPanel, aWindowConstraints);
3260
+// aWindowConstraints.weightx = 0;
3261
+// aWindowConstraints.gridx = 4;
3262
+// aWindowConstraints.gridwidth = 1;
3263
+// // aConstraints.gridheight = 3;
3264
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3265
+// bigThree.add(XYZPanel, aWindowConstraints);
3266
+// bigThree.validate();
3267
+// scenePanel.setVisible(false);
3268
+// centralPanel.setVisible(true);
3269
+// XYZPanel.setVisible(true);
3270
+ bigThree.ClearUI();
3271
+ bigThree.add(centralPanel);
3272
+ bigThree.add(XYZPanel);
3273
+ bigThree.FlushUI();
3274
+
3275
+ cameraView.requestFocusInWindow();
27393276 } else
2740
- if (event.getSource() == fourButton)
3277
+ if (source == fourButton)
27413278 {
27423279 radio.layout = fourButton;
2743
- bigThree.remove(scenePanel);
2744
- bigThree.remove(centralPanel);
2745
- bigThree.remove(XYZPanel);
2746
- aWindowConstraints.gridx = 0;
2747
- aWindowConstraints.gridy = 0;
2748
- aWindowConstraints.gridwidth = 1;
2749
- // aWindowConstraints.gridheight = 3;
2750
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2751
- aWindowConstraints.weightx = 1;
2752
- aWindowConstraints.weighty = 1;
2753
- bigThree.add(scenePanel, aWindowConstraints);
2754
- aWindowConstraints.weightx = 1;
2755
- aWindowConstraints.gridwidth = 3;
2756
- // aConstraints.gridheight = 3;
2757
- aWindowConstraints.gridx = 1;
2758
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2759
- //bigThree.add(cameraPanel, aWindowConstraints);
2760
- aWindowConstraints.weightx = 0;
2761
- aWindowConstraints.gridx = 4;
2762
- aWindowConstraints.gridwidth = 1;
2763
- // aWindowConstraints.gridheight = 3;
2764
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2765
- //bigThree.add(XYZPanel, aWindowConstraints);
2766
- bigThree.revalidate();
3280
+
3281
+ if (CameraPane.FULLSCREEN)
3282
+ fullscreenLayout = radio.layout;
3283
+
3284
+// bigThree.remove(scenePanel);
3285
+// bigThree.remove(centralPanel);
3286
+// bigThree.remove(XYZPanel);
3287
+// aWindowConstraints.gridx = 0;
3288
+// aWindowConstraints.gridy = 0;
3289
+// aWindowConstraints.gridwidth = 1;
3290
+// // aWindowConstraints.gridheight = 3;
3291
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3292
+// aWindowConstraints.weightx = 1;
3293
+// aWindowConstraints.weighty = 1;
3294
+// bigThree.add(scenePanel, aWindowConstraints);
3295
+// aWindowConstraints.weightx = 1;
3296
+// aWindowConstraints.gridwidth = 3;
3297
+// // aConstraints.gridheight = 3;
3298
+// aWindowConstraints.gridx = 1;
3299
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3300
+// //bigThree.add(cameraPanel, aWindowConstraints);
3301
+// aWindowConstraints.weightx = 0;
3302
+// aWindowConstraints.gridx = 4;
3303
+// aWindowConstraints.gridwidth = 1;
3304
+// // aWindowConstraints.gridheight = 3;
3305
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3306
+// //bigThree.add(XYZPanel, aWindowConstraints);
3307
+// bigThree.validate();
3308
+// scenePanel.setVisible(true);
3309
+// centralPanel.setVisible(false);
3310
+// XYZPanel.setVisible(false);
3311
+ bigThree.ClearUI();
3312
+ bigThree.add(scenePanel);
3313
+ bigThree.FlushUI();
3314
+
3315
+ cameraView.requestFocusInWindow();
27673316 } else
2768
- if (event.getSource() == sixButton)
3317
+ if (source == sixButton)
27693318 {
27703319 radio.layout = sixButton;
2771
- bigThree.remove(scenePanel);
2772
- bigThree.remove(centralPanel);
2773
- bigThree.remove(XYZPanel);
2774
- aWindowConstraints.gridx = 0;
2775
- aWindowConstraints.gridy = 0;
2776
- aWindowConstraints.gridwidth = 1;
2777
- // aConstraints.gridheight = 3;
2778
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2779
- aWindowConstraints.weightx = 0;
2780
- aWindowConstraints.weighty = 1;
2781
- bigThree.add(scenePanel, aWindowConstraints);
2782
- aWindowConstraints.weightx = 1;
2783
- aWindowConstraints.gridwidth = 3;
2784
- // aWindowConstraints.gridheight = 3;
2785
- aWindowConstraints.gridx = 1;
2786
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2787
- bigThree.add(centralPanel, aWindowConstraints);
2788
- aWindowConstraints.weightx = 0;
2789
- aWindowConstraints.gridx = 4;
2790
- aWindowConstraints.gridwidth = 1;
2791
- // aWindowConstraints.gridheight = 3;
2792
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2793
- //bigThree.add(XYZPanel, aConstraints);
2794
- bigThree.revalidate();
3320
+
3321
+ if (CameraPane.FULLSCREEN)
3322
+ fullscreenLayout = radio.layout;
3323
+
3324
+// bigThree.remove(scenePanel);
3325
+// bigThree.remove(centralPanel);
3326
+// bigThree.remove(XYZPanel);
3327
+// aWindowConstraints.gridx = 0;
3328
+// aWindowConstraints.gridy = 0;
3329
+// aWindowConstraints.gridwidth = 1;
3330
+// // aConstraints.gridheight = 3;
3331
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3332
+// aWindowConstraints.weightx = 0;
3333
+// aWindowConstraints.weighty = 1;
3334
+// bigThree.add(scenePanel, aWindowConstraints);
3335
+// aWindowConstraints.weightx = 1;
3336
+// aWindowConstraints.gridwidth = 3;
3337
+// // aWindowConstraints.gridheight = 3;
3338
+// aWindowConstraints.gridx = 1;
3339
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3340
+// bigThree.add(centralPanel, aWindowConstraints);
3341
+// aWindowConstraints.weightx = 0;
3342
+// aWindowConstraints.gridx = 4;
3343
+// aWindowConstraints.gridwidth = 1;
3344
+// // aWindowConstraints.gridheight = 3;
3345
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3346
+// //bigThree.add(XYZPanel, aConstraints);
3347
+// bigThree.validate();
3348
+// scenePanel.setVisible(true);
3349
+// centralPanel.setVisible(true);
3350
+// XYZPanel.setVisible(false);
3351
+ bigThree.ClearUI();
3352
+ bigThree.add(scenePanel);
3353
+ bigThree.add(centralPanel);
3354
+ bigThree.FlushUI();
3355
+
3356
+ cameraView.requestFocusInWindow();
27953357 } else
2796
- if (event.getSource() == sevenButton)
3358
+ if (source == sevenButton)
27973359 {
27983360 radio.layout = sevenButton;
2799
- bigThree.remove(scenePanel);
2800
- bigThree.remove(centralPanel);
2801
- bigThree.remove(XYZPanel);
2802
- aWindowConstraints.gridx = 0;
2803
- aWindowConstraints.gridy = 0;
2804
- aWindowConstraints.gridwidth = 1;
2805
- // aWindowConstraints.gridheight = 3;
2806
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2807
- aWindowConstraints.weightx = 0;
2808
- aWindowConstraints.weighty = 1;
2809
- bigThree.add(scenePanel, aWindowConstraints);
2810
- aWindowConstraints.weightx = 1;
2811
- aWindowConstraints.gridwidth = 3;
2812
- // aWindowConstraints.gridheight = 3;
2813
- aWindowConstraints.gridx = 1;
2814
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2815
- bigThree.add(centralPanel, aWindowConstraints);
2816
- aWindowConstraints.weightx = 0;
2817
- aWindowConstraints.gridx = 4;
2818
- aWindowConstraints.gridwidth = 1;
2819
- // aConstraints.gridheight = 3;
2820
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2821
- bigThree.add(XYZPanel, aWindowConstraints);
2822
- bigThree.revalidate();
3361
+
3362
+ if (CameraPane.FULLSCREEN)
3363
+ fullscreenLayout = radio.layout;
3364
+
3365
+// bigThree.remove(scenePanel);
3366
+// bigThree.remove(centralPanel);
3367
+// bigThree.remove(XYZPanel);
3368
+// aWindowConstraints.gridx = 0;
3369
+// aWindowConstraints.gridy = 0;
3370
+// aWindowConstraints.gridwidth = 1;
3371
+// // aWindowConstraints.gridheight = 3;
3372
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3373
+// aWindowConstraints.weightx = 0;
3374
+// aWindowConstraints.weighty = 1;
3375
+// bigThree.add(scenePanel, aWindowConstraints);
3376
+// aWindowConstraints.weightx = 1;
3377
+// aWindowConstraints.gridwidth = 3;
3378
+// // aWindowConstraints.gridheight = 3;
3379
+// aWindowConstraints.gridx = 1;
3380
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3381
+// bigThree.add(centralPanel, aWindowConstraints);
3382
+// aWindowConstraints.weightx = 0;
3383
+// aWindowConstraints.gridx = 4;
3384
+// aWindowConstraints.gridwidth = 1;
3385
+// // aConstraints.gridheight = 3;
3386
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3387
+// bigThree.add(XYZPanel, aWindowConstraints);
3388
+// bigThree.validate();
3389
+// scenePanel.setVisible(true);
3390
+// centralPanel.setVisible(true);
3391
+// XYZPanel.setVisible(true);
3392
+ bigThree.ClearUI();
3393
+ bigThree.add(scenePanel);
3394
+ bigThree.add(centralPanel);
3395
+ bigThree.add(XYZPanel);
3396
+ bigThree.FlushUI();
3397
+
3398
+ cameraView.requestFocusInWindow();
28233399 } else
2824
- if (event.getSource() == rootButton)
3400
+ if (source == rootButton)
28253401 {
28263402 Object3D obj;
28273403 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2831,66 +3407,84 @@
28313407 EditObject(obj);
28323408 }
28333409
3410
+ cameraView.requestFocusInWindow();
28343411 refreshContents(true);
28353412 } else
2836
- if (event.getSource() == closeButton)
3413
+ if (source == closeButton)
28373414 {
28383415 //System.out.println("CLOSE: " + buttonGroup.getSelection());
28393416 cRadio ab;
28403417 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28413418 {
28423419 ab = (cRadio)e.nextElement();
2843
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3420
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28443421 {
3422
+ // Patch to avoid bug with transparency.
3423
+ if (!ab.hadMaterial)
3424
+ {
3425
+ ab.object.material = null;
3426
+ }
3427
+
28453428 buttonGroup.remove(ab);
28463429 radioPanel.remove(ab);
28473430
2848
- ab.GetObject().editWindow = null;
3431
+ //ab.GetObject().editWindow = null;
3432
+ ab.GetObject().manipWindow = null;
28493433 // ab.GetObject().objectUI = null; // ?????????
28503434
28513435 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28523436 break;
28533437 }
28543438 }
3439
+
3440
+ cameraView.requestFocusInWindow();
28553441 refreshContents(true);
28563442 } else
2857
- if (event.getSource() == editItem || event.getSource() == editButton)
3443
+ if (source == editItem || source == editButton)
28583444 {
3445
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3446
+ {
3447
+ Object3D child = (Object3D)e.nextElement();
3448
+ child.pinned = true;
3449
+ }
3450
+
28593451 EditSelection(false);
28603452 } else
2861
- if (event.getSource() == uneditButton)
3453
+ if (source == uneditButton)
28623454 {
28633455 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28643456 {
28653457 Object3D child = (Object3D)e.nextElement();
28663458 if(child.editWindow != null)
28673459 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3460
+ child.pinned = false;
28683461 child.CloseUI();
28693462 listUI.remove(child);
28703463
2871
- child.editWindow = null; // ???????????
3464
+ //child.editWindow = null; // ???????????
28723465 }
2873
- objEditor.ctrlPanel.revalidate();
3466
+ objEditor.ctrlPanel.FlushUI();
28743467 //objEditor.jTree.clearSelection();
28753468 //objEditor.ResetSliders();
28763469 refreshContents(true);
28773470 } else
2878
- if (event.getSource() == clearPanelButton)
3471
+ if (source == clearPanelButton)
28793472 {
28803473 assert(copy == group);
28813474 //copy.ClearUI();
28823475 for (Object3D obj : listUI)
28833476 {
3477
+ obj.pinned = false;
28843478 obj.CloseUI();
28853479 }
28863480 listUI.clear();
28873481 refreshContents(true);
28883482 } else
2889
- if (event.getSource() == allParamsButton)
3483
+ if (source == allParamsButton)
28903484 {
28913485 assert(copy == group);
28923486
2893
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3487
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28943488
28953489 for (Object3D obj : listUI)
28963490 {
....@@ -2907,19 +3501,19 @@
29073501
29083502 refreshContents(true);
29093503 } else
2910
- if (event.getSource() == unselectButton)
3504
+ if (source == unselectButton)
29113505 {
29123506 objEditor.jTree.clearSelection();
29133507 // ?? oct 2012 GrafreeD.clipboard.clear();
29143508 objEditor.ResetSliders();
29153509 refreshContents(true);
29163510 } else
2917
- if(event.getSource() instanceof cRadio)
3511
+ if(source instanceof cRadio)
29183512 {
29193513 group.parent = keepparent;
29203514 group.attributes = 0;
29213515 //group.editWindow = null;
2922
- /*cRadio*/ radio = (cRadio)event.getSource();
3516
+ /*cRadio*/ radio = (cRadio)source;
29233517 Object3D obj = radio.GetObject();
29243518 System.out.println("Edit " + obj);
29253519 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2939,6 +3533,9 @@
29393533 }
29403534
29413535 copy = group;
3536
+
3537
+ SetUndoStates();
3538
+
29423539 //Globals.theRenderer.object = group;
29433540 if(!useclient)
29443541 {
....@@ -2954,20 +3551,46 @@
29543551 frontView.object = group;
29553552 sideView.object = group;
29563553 }
2957
- group.editWindow = this;
3554
+
3555
+// fix "+" issue
3556
+ //group.editWindow = this;
3557
+ group.manipWindow = this;
3558
+
29583559 /*
29593560 currentLayout = radio.layout;
29603561 if (currentLayout == null)
29613562 currentLayout = sevenButton;
29623563 */
29633564 radio.layout.doClick();
3565
+
3566
+ ClearUnpinned();
3567
+ //Grafreed.Assert(group != null);
3568
+ //Grafreed.Assert(group.selection != null);
3569
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3570
+ if (group.selection == null || group.selection.size() == 1)
3571
+ EditSelection(false);
29643572 keepparent = group.parent;
29653573 // PARENT = NULL or not???
29663574 //group.parent = null; // ROOT
29673575 //group.attributes = -1;
29683576 ResetModel();
3577
+
3578
+ cameraView.requestFocusInWindow();
29693579 refreshContents(true);
2970
- }
3580
+ } else if (event.getSource() == editCameraItem)
3581
+ {
3582
+ cameraView.ProtectCamera();
3583
+ cameraView.repaint();
3584
+ return;
3585
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3586
+ {
3587
+ cameraView.RevertCamera();
3588
+ cameraView.repaint();
3589
+ return;
3590
+ // } else if (event.getSource() == textureButton)
3591
+ // {
3592
+ // return; // true;
3593
+ }
29713594 else
29723595 {
29733596 //return super.action(event, arg);
....@@ -2976,7 +3599,6 @@
29763599 }
29773600
29783601 boolean useclient = false;
2979
- cRadio radio;
29803602
29813603 void ToggleRoot()
29823604 {
....@@ -3028,6 +3650,28 @@
30283650 refreshContents();
30293651 }
30303652
3653
+ void TransformChildren()
3654
+ {
3655
+ Object3D obj;
3656
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3657
+ {
3658
+ obj = (Object3D)e.nextElement();
3659
+ obj.KeepTextureMatrices();
3660
+ obj.TransformChildren();
3661
+ obj.RestoreTextureMatrices();
3662
+
3663
+// if (obj.parent == null)
3664
+// {
3665
+// System.out.println("NULL PARENT!");
3666
+// new Exception().printStackTrace();
3667
+// }
3668
+// else
3669
+// TouchTransform(obj);
3670
+// //obj.parent.Touch();
3671
+ }
3672
+
3673
+ refreshContents();
3674
+ }
30313675
30323676 void ResetTransform()
30333677 {
....@@ -3140,7 +3784,7 @@
31403784 refreshContents();
31413785 }
31423786
3143
- void ResetCentroid()
3787
+ void ResetCentroid(boolean full)
31443788 {
31453789 Object3D obj;
31463790 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3155,12 +3799,16 @@
31553799 LA.matIdentity(Object3D.mat);
31563800 obj.getBounds(minima, maxima, false);
31573801 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3158
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3802
+ if (full)
3803
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31593804 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31603805 obj.TransformMesh(Object3D.mat);
3806
+
31613807 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3162
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3808
+ if (full)
3809
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31633810 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3811
+
31643812 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31653813 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31663814 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3189,7 +3837,8 @@
31893837
31903838 int size = obj.MemorySize();
31913839
3192
- System.err.println((size/1024) + " KB is the size of " + obj);
3840
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3841
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
31933842 }
31943843 }
31953844 catch (Exception e)
....@@ -3226,9 +3875,9 @@
32263875 obj = (Object3D)e.nextElement();
32273876
32283877 System.out.println("Object is: " + obj);
3229
- GrafreeD.AnalyzeObject(obj);
3878
+ Grafreed.AnalyzeObject(obj);
32303879 System.out.println("Boundary rep: " + obj.bRep);
3231
- GrafreeD.AnalyzeObject(obj.bRep);
3880
+ Grafreed.AnalyzeObject(obj.bRep);
32323881
32333882 // System.err.println((size/1024) + " KB is the size of " + obj);
32343883 }
....@@ -3270,6 +3919,13 @@
32703919 void GenNormals(boolean crease)
32713920 {
32723921 group.GenNormalsS(crease);
3922
+
3923
+ refreshContents();
3924
+ }
3925
+
3926
+ void GenNormalsMESH()
3927
+ {
3928
+ group.GenNormalsMeshS();
32733929
32743930 refreshContents();
32753931 }
....@@ -3442,8 +4098,8 @@
34424098
34434099 void ParseVertices()
34444100 {
3445
- boolean epsequal = GrafreeD.epsequal;
3446
- GrafreeD.epsequal = true;
4101
+ boolean epsequal = Grafreed.epsequal;
4102
+ Grafreed.epsequal = true;
34474103
34484104 for (int i=0; i<group.selection.size(); i++)
34494105 {
....@@ -3468,7 +4124,7 @@
34684124 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34694125 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34704126
3471
- g.add(GrafreeD.clipboard);
4127
+ g.add(Grafreed.clipboard);
34724128
34734129 buffer.add(g);
34744130 }
....@@ -3483,7 +4139,7 @@
34834139 makeSomething(buffer, i==group.selection.size()-1);
34844140 }
34854141
3486
- GrafreeD.epsequal = epsequal;
4142
+ Grafreed.epsequal = epsequal;
34874143
34884144 refreshContents();
34894145 }
....@@ -3501,7 +4157,16 @@
35014157 String pigment = Object3D.GetPigment(tex);
35024158 //String bump = Object3D.GetBump(tex);
35034159
3504
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4160
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4161
+
4162
+ try
4163
+ {
4164
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4165
+ }
4166
+ catch (Exception e)
4167
+ {
4168
+ System.err.println("FAIL: " + node);
4169
+ }
35054170
35064171 double s = v.s;
35074172
....@@ -3589,11 +4254,11 @@
35894254
35904255 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35914256
3592
- boolean random = CameraPane.RANDOM;
3593
- CameraPane.RANDOM = false; // parse all random nodes
4257
+ boolean random = CameraPane.SWITCH;
4258
+ CameraPane.SWITCH = false; // parse all random nodes
35944259 lowres.linkVerticesThis(null);
35954260 lowres.linkVerticesThis(sn);
3596
- CameraPane.RANDOM = random;
4261
+ CameraPane.SWITCH = random;
35974262
35984263 System.err.flush();
35994264
....@@ -3633,7 +4298,7 @@
36334298 return;
36344299
36354300 Object3D poses = group.selection.get(0);
3636
- Object3D ref = GrafreeD.clipboard.get(0);
4301
+ Object3D ref = Grafreed.clipboard.get(0);
36374302
36384303 Object3D newgroup = new Object3D("Po:" + poses.name);
36394304
....@@ -3827,9 +4492,9 @@
38274492
38284493 void ClipMesh()
38294494 {
3830
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4495
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38314496 {
3832
- Object3D content = GrafreeD.clipboard.get(0);
4497
+ Object3D content = Grafreed.clipboard.get(0);
38334498
38344499 if (content instanceof cGroup && ((cGroup)content).transientlink )
38354500 content = ((cGroup)content).get(0);
....@@ -3838,7 +4503,7 @@
38384503 // {
38394504 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38404505 // }
3841
- group.selection.ClipMesh(GrafreeD.clipboard);
4506
+ group.selection.ClipMesh(Grafreed.clipboard);
38424507 }
38434508 // group.selection.ClipMesh(GrafreeD.clipboard);
38444509 System.out.println("DONE.");
....@@ -3885,6 +4550,18 @@
38854550 void MarkLeaves(boolean hide)
38864551 {
38874552 group.selection.MarkLeaves(hide);
4553
+ refreshContents();
4554
+ }
4555
+
4556
+ void RewindLeaves(boolean hide)
4557
+ {
4558
+ group.selection.RewindLeaves(hide);
4559
+ refreshContents();
4560
+ }
4561
+
4562
+ void RandomLeaves(boolean hide)
4563
+ {
4564
+ group.selection.RandomLeaves(hide);
38884565 refreshContents();
38894566 }
38904567
....@@ -3959,28 +4636,25 @@
39594636 // }
39604637 // }
39614638
3962
- static boolean allparams = true;
3963
-
3964
- static Vector<Object3D> listUI = new Vector<Object3D>();
3965
-
39664639 void EditSelection(boolean newWindow)
39674640 {
4641
+ if (group.selection == null)
4642
+ {
4643
+ EditElement(group, newWindow); // ? new
4644
+ return;
4645
+ }
4646
+
39684647 // aConstraints.gridy = 0;
39694648 for (int i=0; i<group.selection.size(); i++)
39704649 {
39714650 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39724651 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3973
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4652
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39744653
39754654 Object3D elem = (Object3D)group.selection.elementAt(i);
3976
- if(elem != group)
4655
+ if(elem != group || !newWindow)
39774656 {
3978
- // if (!(elem instanceof Composite))
3979
- // newWindow = false;
3980
- listUI.add(elem);
3981
- elem.openEditWindow(this, newWindow); //, false);
3982
- System.out.println("edit : " + elem);
3983
- elem.editWindow.refreshContents(true); // ? new
4657
+ EditElement(elem, newWindow); // ? new
39844658 }
39854659 }
39864660 }
....@@ -4055,7 +4729,8 @@
40554729 //new Exception().printStackTrace();
40564730
40574731 freezemodel = true;
4058
-
4732
+ ClearUnpinned();
4733
+
40594734 /**/
40604735 //switch (event.id)
40614736 {
....@@ -4063,7 +4738,6 @@
40634738 //case 702: // Event.LIST_DESELECT
40644739 group.deselectAll();
40654740 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4066
- objEditor.ClearInfo(); // .GetMaterial());
40674741 if (tps != null)
40684742 {
40694743 for (int i=0; i < tps.length; i++)
....@@ -4072,33 +4746,39 @@
40724746
40734747 //if (child.parent != null)
40744748 //child.parent.addSelectee(child);
4749
+ objEditor.SetMaterial(child);
40754750 group.addSelectee(child);
4076
- objEditor.SetMaterial(child); // .GetMaterial());
4077
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4078
- System.err.println("info : " + child.GetPath());
40794751 }
40804752 }
4081
- else
4082
- {
4083
- objEditor.SetMaterial(group); // .GetMaterial());
4084
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4085
- System.err.println("info : " + group.GetPath());
4086
- }
4753
+// else
4754
+// {
4755
+// objEditor.SetMaterial(group); // .GetMaterial());
4756
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4757
+// System.err.println("info : " + group.GetPath());
4758
+// }
40874759
4088
- objEditor.SetText(); // jan 2014
4089
-
4090
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4760
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
40914761 CameraPane.flash = true;
40924762
4093
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4763
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40944764 // a camera
40954765 {
4096
- CameraPane.camerachangeframe = 0; // don't refuse it
4097
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4766
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4767
+ {
4768
+ CameraPane.camerachangeframe = 0; // don't refuse it
4769
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4770
+ }
40984771 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
40994772 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41004773 }
41014774
4775
+ if (tps != null && tps.length == 1)
4776
+ {
4777
+ EditSelection(false);
4778
+ }
4779
+
4780
+ SetPinStates(tps != null && tps.length > 0);
4781
+
41024782 refreshContents();
41034783 //return true;
41044784 }
....@@ -4107,6 +4787,35 @@
41074787
41084788 freezemodel = false;
41094789 }
4790
+
4791
+ void SetPinStates(boolean enabled)
4792
+ {
4793
+ editButton.setEnabled(enabled);
4794
+ uneditButton.setEnabled(enabled);
4795
+ unselectButton.setEnabled(enabled);
4796
+ flashSelectionButton.setEnabled(enabled);
4797
+ }
4798
+
4799
+ void refreshContents(boolean cp)
4800
+ {
4801
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4802
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4803
+ {
4804
+ objEditor.ClearInfo(); // .GetMaterial());
4805
+
4806
+ for (int i=0; i < group.selection.Size(); i++)
4807
+ {
4808
+ Object3D child = (Object3D) group.selection.get(i);
4809
+
4810
+ objEditor.AddInfo(child, this, true);
4811
+ System.err.println("info : " + child.GetPath());
4812
+ }
4813
+
4814
+ objEditor.SetText(); // jan 2014
4815
+ }
4816
+
4817
+ super.refreshContents(cp);
4818
+ }
41104819
41114820 void linkSomething(Object3D thing)
41124821 {
....@@ -4178,16 +4887,19 @@
41784887 {
41794888 if (group.selection.isEmpty())
41804889 return;
4181
- GrafreeD.clipboardIsTempGroup = false;
4890
+
4891
+ Grafreed.clipboardIsTempGroup = false;
41824892 Composite tGroup = null;
41834893 if (group.selection.size() > 0) // 1)
41844894 {
41854895 tGroup = new cGroup();
4186
- GrafreeD.clipboardIsTempGroup = true;
4896
+ Grafreed.clipboardIsTempGroup = true;
41874897 }
41884898
41894899 if (cut)
41904900 {
4901
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4902
+// Save();
41914903 //int indices[] = jList.getSelectedIndices();
41924904 //for (int i = indices.length - 1; i >= 0; i--)
41934905 //jList.remove(indices[i]);
....@@ -4223,16 +4935,16 @@
42234935 //System.out.println("cut " + child);
42244936 //System.out.println("parent = " + child.parent);
42254937 // tmp.addChild(child);
4226
- if (GrafreeD.clipboardIsTempGroup)
4938
+ if (Grafreed.clipboardIsTempGroup)
42274939 tGroup.add/*Child*/(tmp);
42284940 else
4229
- GrafreeD.clipboard = tmp;
4941
+ Grafreed.clipboard = tmp;
42304942 }
42314943 else
4232
- if (GrafreeD.clipboardIsTempGroup)
4944
+ if (Grafreed.clipboardIsTempGroup)
42334945 tGroup.add/*Child*/(child);
42344946 else
4235
- GrafreeD.clipboard = child;
4947
+ Grafreed.clipboard = child;
42364948 }
42374949
42384950 //ResetModel();
....@@ -4264,21 +4976,23 @@
42644976 //System.out.println("cut " + elem);
42654977 //System.out.println("parent = " + elem.parent);
42664978 // tmp.addChild(elem);
4267
- if (GrafreeD.clipboardIsTempGroup)
4979
+ if (Grafreed.clipboardIsTempGroup)
42684980 tGroup.add/*Child*/(tmp);
42694981 else
4270
- GrafreeD.clipboard = tmp;
4982
+ Grafreed.clipboard = tmp;
42714983 }
42724984 else
4273
- if (GrafreeD.clipboardIsTempGroup)
4985
+ if (Grafreed.clipboardIsTempGroup)
42744986 tGroup.add/*Child*/(child);
42754987 else
4276
- GrafreeD.clipboard = child;
4988
+ Grafreed.clipboard = child;
42774989 }
42784990
42794991 }
4280
- if (GrafreeD.clipboardIsTempGroup)
4281
- GrafreeD.clipboard = tGroup;
4992
+
4993
+ if (Grafreed.clipboardIsTempGroup)
4994
+ Grafreed.clipboard = tGroup;
4995
+
42824996 if (cut)
42834997 {
42844998 ResetModel();
....@@ -4288,11 +5002,15 @@
42885002
42895003 void paste(boolean expand)
42905004 {
5005
+ if (Globals.REPLACEONMAKE)
5006
+ Save();
5007
+ boolean keep = Globals.REPLACEONMAKE;
5008
+ Globals.REPLACEONMAKE = false;
42915009 // if (GrafreeD.clipboard == null)
42925010 // return;
42935011 boolean first = true;
42945012
4295
- if (GrafreeD.clipboardIsTempGroup)
5013
+ if (Grafreed.clipboardIsTempGroup)
42965014 {
42975015 Composite temp;
42985016
....@@ -4303,7 +5021,7 @@
43035021 temp = (Composite)Applet3D.clipboard.deepCopy();
43045022 */
43055023 Object3D elem;
4306
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5024
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43075025 {
43085026 Object3D child = (Object3D)e.nextElement();
43095027
....@@ -4337,21 +5055,22 @@
43375055 //Object3D cb = Applet3D.clipboard;
43385056 //temp.addChild(cb);
43395057 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4340
- assert(GrafreeD.clipboard.parent == null);
4341
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4342
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4343
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4344
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5058
+ assert(Grafreed.clipboard.parent == null);
5059
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5060
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5061
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5062
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43455063 else
4346
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4347
- GrafreeD.clipboard.get(0).parent = keepparent;
5064
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5065
+ Grafreed.clipboard.get(0).parent = keepparent;
43485066 }
43495067
5068
+ Globals.REPLACEONMAKE = keep;
43505069 ResetModel();
43515070 refreshContents();
43525071 }
43535072
4354
- void pasteInto(boolean copyit)
5073
+ void pasteInto(boolean copyit, boolean clone)
43555074 {
43565075 // if (GrafreeD.clipboard == null)
43575076 // return;
....@@ -4380,15 +5099,22 @@
43805099 if (copyit)
43815100 {
43825101 // paste(false);
4383
- CloneClipboard(false); // sept 2014
5102
+ if (clone)
5103
+ {
5104
+ CloneClipboard(false); // sept 2014
5105
+ }
5106
+ else
5107
+ {
5108
+ paste(false);
5109
+ }
43845110 }
43855111 else
43865112 {
43875113 boolean first = true;
43885114
4389
- if (GrafreeD.clipboardIsTempGroup)
5115
+ if (Grafreed.clipboardIsTempGroup)
43905116 {
4391
- Composite temp = (Composite)GrafreeD.clipboard;
5117
+ Composite temp = (Composite)Grafreed.clipboard;
43925118 Object3D copy;
43935119 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43945120 {
....@@ -4398,7 +5124,7 @@
43985124 }
43995125 } else
44005126 {
4401
- linkSomething(GrafreeD.clipboard); //.get(0));
5127
+ linkSomething(Grafreed.clipboard); //.get(0));
44025128 }
44035129 }
44045130 }
....@@ -4475,6 +5201,10 @@
44755201
44765202 void group(Object3D csg, boolean grab)
44775203 {
5204
+ if (Globals.REPLACEONMAKE)
5205
+ Save();
5206
+ boolean keep = Globals.REPLACEONMAKE;
5207
+ Globals.REPLACEONMAKE = false;
44785208 if (//false) // why??
44795209 !group.selection.isEmpty())
44805210 {
....@@ -4588,10 +5318,15 @@
45885318 //node.add(csg);
45895319 //makeSomething(node);
45905320 makeSomething(csg);
5321
+ Globals.REPLACEONMAKE = keep;
45915322 }
45925323
45935324 void Ungroup(Object3D g)
45945325 {
5326
+ if (Globals.REPLACEONMAKE)
5327
+ Save();
5328
+ boolean keep = Globals.REPLACEONMAKE;
5329
+ Globals.REPLACEONMAKE = false;
45955330 if (g instanceof HiddenObject)
45965331 {
45975332 HiddenObject h = (HiddenObject) g;
....@@ -4608,6 +5343,7 @@
46085343 objEditor.makeSomething(g.get(i), false);
46095344 }
46105345 }
5346
+ Globals.REPLACEONMAKE = keep;
46115347 }
46125348
46135349 void ungroup()
....@@ -4803,21 +5539,6 @@
48035539 }
48045540 */
48055541
4806
- void ImportGFD()
4807
- {
4808
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4809
- browser.show();
4810
- String filename = browser.getFile();
4811
- if (filename != null && filename.length() > 0)
4812
- {
4813
- String fullname = browser.getDirectory() + filename;
4814
-
4815
- //Object3D readobj =
4816
- objEditor.ReadGFD(fullname, objEditor);
4817
- //makeSomething(readobj);
4818
- }
4819
- }
4820
-
48215542 /*
48225543 public void Callback(Object obj)
48235544 {
....@@ -4841,26 +5562,9 @@
48415562 }
48425563 */
48435564
4844
- void ImportVRMLX3D()
4845
- {
4846
- if (GrafreeD.standAlone)
4847
- {
4848
- /**/
4849
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4850
- browser.show();
4851
- String filename = browser.getFile();
4852
- if (filename != null && filename.length() > 0)
4853
- {
4854
- String fullname = browser.getDirectory() + filename;
4855
- LoadVRMLX3D(fullname);
4856
- }
4857
- /**/
4858
- }
4859
- }
4860
-
48615565 String GetFile(String dialogName)
48625566 {
4863
- if (GrafreeD.standAlone)
5567
+ if (Grafreed.standAlone)
48645568 {
48655569 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48665570 browser.show();
....@@ -4924,10 +5628,33 @@
49245628 cButton flashSelectionButton;
49255629 cButton editButton;
49265630 cButton uneditButton;
5631
+ JCheckBox allParamsButton;
49275632 cButton clearpanelButton;
4928
- cButton allParamsButton;
49295633 cButton unselectButton;
49305634
5635
+ cButton restoreCameraButton;
5636
+
5637
+ cButton saveButton;
5638
+ cButton oneStepButton;
5639
+
5640
+ cButton groupButton;
5641
+ cButton ungroupButton;
5642
+ cButton compositeButton;
5643
+ cButton switchButton;
5644
+ cButton loopButton;
5645
+ cButton textureButton;
5646
+
5647
+ cButton gridButton;
5648
+ cButton boxButton;
5649
+ cButton sphereButton;
5650
+ cButton coneButton;
5651
+ cButton torusButton;
5652
+ cButton superButton;
5653
+ cButton kleinButton;
5654
+ cButton particlesButton;
5655
+ cButton overlayButton;
5656
+ cButton lightButton;
5657
+
49315658 cButton screenfitButton;
49325659 cButton screenfitpointButton;
49335660 cButton snapobjectButton;
....@@ -4939,14 +5666,6 @@
49395666
49405667 cButton setsupportButton;
49415668
4942
- cButton twoButton;
4943
- cButton sixButton;
4944
- cButton threeButton;
4945
- cButton sevenButton;
4946
- cButton fourButton; // full panel
4947
- cButton oneButton; // full XYZ
4948
- //cButton currentLayout;
4949
-
49505669 //
49515670 //Composite
49525671 Object3D // to do !!
....@@ -4956,9 +5675,11 @@
49565675 //JTree jTree;
49575676 private MenuItem lookAtItem;
49585677 private MenuItem lookFromItem;
4959
- private MenuItem switchItem;
5678
+ private MenuItem switchViewItem;
49605679 private MenuItem cutItem;
4961
- private MenuItem duplicateItem;
5680
+ private MenuItem undoItem;
5681
+ private MenuItem redoItem;
5682
+ private JMenuItem duplicateItem;
49625683 private MenuItem cloneItem;
49635684 private MenuItem cloneSupportItem;
49645685 private MenuItem overwriteGeoItem;
....@@ -4971,7 +5692,7 @@
49715692 private MenuItem linkverticesItem;
49725693 private MenuItem relinkverticesItem;
49735694 private MenuItem setMasterItem;
4974
- private MenuItem resetMeshItem;
5695
+ private MenuItem resetAllItem;
49755696 private MenuItem stepAllItem;
49765697 private MenuItem revertMeshItem;
49775698 private MenuItem poseMeshItem;
....@@ -4982,10 +5703,11 @@
49825703 private MenuItem mergeGeometriesItem;
49835704 private MenuItem copyItem;
49845705 private MenuItem pasteItem;
5706
+ private MenuItem pasteIntoItem;
49855707 private MenuItem pasteLinkItem;
49865708 private MenuItem pasteCloneItem;
49875709 private MenuItem pasteExpandItem;
4988
- private MenuItem clearItem;
5710
+ private MenuItem deleteItem;
49895711 private MenuItem clearAllItem;
49905712 private MenuItem genUVItem;
49915713 private MenuItem genNormalsMESHItem;
....@@ -5020,6 +5742,10 @@
50205742 private MenuItem showleavesItem;
50215743 private MenuItem markleavesItem;
50225744 private MenuItem unmarkleavesItem;
5745
+ private MenuItem rewindleavesItem;
5746
+ private MenuItem unrewindleavesItem;
5747
+ private MenuItem randomleavesItem;
5748
+ private MenuItem unrandomleavesItem;
50235749
50245750 private MenuItem flipVItem;
50255751 private MenuItem unflipVItem;
....@@ -5031,15 +5757,17 @@
50315757 private MenuItem panoTexturesItem;
50325758
50335759 private MenuItem resetCentroidItem;
5034
- private MenuItem transformgeometryItem;
5760
+ private MenuItem resetCentroidXZItem;
50355761 private MenuItem resetTransformItem;
5762
+ private MenuItem transformGeometryItem;
5763
+ private MenuItem transformChildrenItem;
50365764 private MenuItem hideItem;
50375765 private MenuItem grabItem;
50385766 private MenuItem backItem;
50395767 private MenuItem frontItem;
50405768 private MenuItem cameraItem;
50415769 private MenuItem compositeItem;
5042
- private MenuItem randomItem;
5770
+ private MenuItem switchItem;
50435771 private MenuItem physicsItem;
50445772 private MenuItem frameselectorItem;
50455773 private MenuItem scriptNodeItem;
....@@ -5079,7 +5807,7 @@
50795807 private MenuItem blobItem;
50805808 private MenuItem latheItem;
50815809 private MenuItem bezierItem;
5082
- private MenuItem checkerItem;
5810
+ private MenuItem overlayItem;
50835811 private MenuItem meshItem;
50845812 // private MenuItem meshGroupItem;
50855813 private MenuItem springItem;
....@@ -5101,11 +5829,6 @@
51015829 private MenuItem doubleItem;
51025830 private MenuItem tripleItem;
51035831
5104
- private MenuItem importGFDItem;
5105
- private MenuItem importVRMLX3DItem;
5106
- private MenuItem import3DSItem;
5107
- private MenuItem importOBJItem;
5108
-
51095832 private MenuItem computeAOItem;
51105833 private MenuItem recompileItem;
51115834 private MenuItem editScriptItem;
....@@ -5115,4 +5838,8 @@
51155838 private MenuItem analyzeItem;
51165839 private MenuItem dumpItem;
51175840 //boolean freezemodel = false;
5841
+
5842
+ Menu cameraMenu;
5843
+ MenuItem editCameraItem;
5844
+ MenuItem restoreCameraItem;
51185845 }