Normand Briere
2019-07-18 d7a17c35c443e2cb6c09eaa3cfeaf590a571faa1
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);
208
+ menu.add("-");
187209 clearItem = menu.add(new MenuItem("Clear"));
188210 clearItem.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);
434
+ if (Globals.ADVANCED)
435
+ {
296436 genNormalsMINEItem = menu.add(new MenuItem("My 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,110 +599,230 @@
433599 oe.radioPanel.add(dummyButton);
434600 oe.buttonGroup.add(dummyButton);
435601 */
436
- aConstraints.gridy += 1;
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
437605
438606 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
439607
440
- oe.aConstraints.gridwidth = 1;
441
- oe.aConstraints.gridx = 0;
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
442611
443
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints);
444
- liveCB.setToolTipText("Enabled animation");
445
- liveCB.addItemListener(this);
446
-
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK), oe.aConstraints);
449
- trackCB.setToolTipText("Enable tracking");
450
- trackCB.addItemListener(this);
451
-
452
- oe.aConstraints.gridx += 1;
453
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
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);
454624 screenfitButton.setToolTipText("Screen fit");
455625 screenfitButton.addActionListener(this);
456
- 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
+
457676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
458677 // screenfitpointButton.addActionListener(this);
459
-// oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
461
- snapobjectButton.addActionListener(this);
462
- snapobjectButton.setToolTipText("Snap Object");
463
- oe.aConstraints.gridx += 1;
464678
465
- //aConstraints.gridx = 0;
466
- //aConstraints.gridy += 1;
467
- oe.aConstraints.weighty = 0;
468
- oe.aConstraints.gridwidth = 1;
469
-
470
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
471
- flashSelectionButton.setToolTipText("Show selection");
472
- 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));
473687
474
- oe.toolbarPanel.add(new cButton(" ", false));
475
-
476
- oe.aConstraints.gridx += 1;
477
- oe.aConstraints.weighty = 0;
478
- oe.aConstraints.gridwidth = 1;
479
-
480
- //
481
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
482689 twoButton.setToolTipText("Show center view only");
483690 twoButton.addActionListener(this);
484
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
691
+ this.fullscreenLayout = twoButton;
692
+
693
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
485694 fourButton.addActionListener(this);
486695 fourButton.setToolTipText("Show left panel only");
487
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
696
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
488697 sixButton.setToolTipText("2-column layout left");
489698 sixButton.addActionListener(this);
490
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
491700 threeButton.setToolTipText("2-column layout right");
492701 threeButton.addActionListener(this);
493
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
702
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
494703 sevenButton.setToolTipText("3-column layout");
495704 sevenButton.addActionListener(this);
496705 //
497706
498
- oe.toolbarPanel.add(rootButton = new cButton(" o o o ")); //, oe.aConstraints);
499
- rootButton.setToolTipText("Edit object in new tab");
707
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ rootButton.setToolTipText("Edit selection in new tab");
500709 rootButton.addActionListener(this);
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
710
+
711
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
503712 closeButton.setToolTipText("Close tab");
504713 closeButton.addActionListener(this);
505714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
506715 //clearButton.addActionListener(this);
507
- oe.aConstraints.gridx += 1;
508
-
509
- oe.aConstraints.gridx = 1; //
510
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
511
- editButton.addActionListener(this);
512
- oe.aConstraints.gridx += 1;
513
- oe.aConstraints.weighty = 0;
514
- oe.aConstraints.gridwidth = 1;
515716
516
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
717
+ // INSERT
718
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
719
+ gridButton.setToolTipText("Create grid");
720
+ gridButton.addActionListener(this);
721
+
722
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
723
+ boxButton.setToolTipText("Create box");
724
+ boxButton.addActionListener(this);
725
+
726
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
727
+ sphereButton.setToolTipText("Create sphere");
728
+ sphereButton.addActionListener(this);
729
+
730
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
731
+ coneButton.setToolTipText("Create cone");
732
+ coneButton.addActionListener(this);
733
+
734
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
735
+ torusButton.setToolTipText("Create torus");
736
+ torusButton.addActionListener(this);
737
+
738
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
739
+ superButton.setToolTipText("Create superellipsoid");
740
+ superButton.addActionListener(this);
741
+
742
+ if (Globals.ADVANCED)
743
+ {
744
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
745
+ kleinButton.setToolTipText("Create Klein bottle");
746
+ kleinButton.addActionListener(this);
747
+ }
748
+
749
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
750
+ particlesButton.setToolTipText("Create particle system");
751
+ particlesButton.addActionListener(this);
752
+
753
+ oe.toolboxPanel.Return();
754
+
755
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
756
+ groupButton.setToolTipText("Create group");
757
+ groupButton.addActionListener(this);
758
+
759
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
760
+ compositeButton.setToolTipText("Create composite");
761
+ compositeButton.addActionListener(this);
762
+
763
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
764
+ switchButton.setToolTipText("Create item switcher");
765
+ switchButton.addActionListener(this);
766
+
767
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
768
+ loopButton.setToolTipText("Create loop");
769
+ loopButton.addActionListener(this);
770
+
771
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
772
+ textureButton.setToolTipText("Create texture");
773
+ textureButton.addActionListener(this);
774
+
775
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
776
+ overlayButton.setToolTipText("Create overlay");
777
+ overlayButton.addActionListener(this);
778
+
779
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
780
+ lightButton.setToolTipText("Create light");
781
+ lightButton.addActionListener(this);
782
+
783
+ for (int i=6; --i>=0;)
784
+ {
785
+ oe.toolboxPanel.Return();
786
+ oe.toolboxPanel.add(new cGridBag());
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
+ }
794
+
795
+ // EDIT panel
796
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
797
+ editButton.setToolTipText("Pin selection controls");
798
+ editButton.addActionListener(this);
799
+
800
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
801
+ uneditButton.setToolTipText("Remove selection controls");
517802 uneditButton.addActionListener(this);
518803
519
- oe.aConstraints.gridx += 1;
520
- oe.aConstraints.weighty = 0;
521
- oe.aConstraints.gridwidth = 1;
522
-
523
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
524
- clearPanelButton.addActionListener(this);
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
804
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
805
+ allParamsButton.setToolTipText("Show all controle");
531806 allParamsButton.addActionListener(this);
532807
533
- oe.aConstraints.gridx += 1;
534
- oe.aConstraints.weighty = 0;
535
- oe.aConstraints.gridwidth = 1;
536
-
537
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
808
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
809
+ clearPanelButton.setToolTipText("Clear edit panel");
810
+ clearPanelButton.addActionListener(this);
811
+
812
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
813
+ unselectButton.setToolTipText("Unselect");
538814 unselectButton.addActionListener(this);
539815
816
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
817
+ flashSelectionButton.setToolTipText("Highlight selection");
818
+ flashSelectionButton.addActionListener(this);
819
+
820
+ editCommandsPanel.preferredHeight = 1;
821
+
822
+ SetPinStates(false);
823
+// oe.treePanel.add(commandsPanel);
824
+// oe.treePanel.Return();
825
+
540826 // oe.aConstraints.gridx += 1;
541827 // oe.aConstraints.weighty = 0;
542828 // oe.aConstraints.gridwidth = 1;
....@@ -548,40 +834,25 @@
548834 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
549835 // gcButton.addActionListener(this);
550836
551
- oe.aConstraints.gridx = 0;
552
- oe.aConstraints.gridy += 1;
553
-
554
- //ctrlPanel.add(objList = new List(5, true));
555
- oe.aConstraints.gridwidth = 100;
556
- // oe.aConstraints.gridheight = 100;
557
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
558
- oe.aConstraints.gridheight = 1;
559
- oe.aConstraints.weighty = 0.5;
560
- oe.aConstraints.gridx = 0;
561
- JScrollPane jSP;
837
+ cGridBag jSPPanel = new cGridBag();
838
+
839
+ JScrollPane jSP;
562840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
563
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
564842 ResetModel();
565
- oe.aConstraints.weighty = 0.5;
566
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
567
- oe.aConstraints.gridy += 1;
568
- oe.aConstraints.gridwidth = 1;
569
-
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 2;
572
-
573
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
574
- colorCB.addItemListener(this);
575
- oe.aConstraints.gridx += 2;
576
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
577
- materialCB.addItemListener(this);
578
- oe.aConstraints.gridx += 2;
579
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
580
- textureCB.addItemListener(this);
581
-
582
- oe.aConstraints.gridx = 0;
583
- oe.aConstraints.gridy += 1;
584843
844
+ oe.treePanel.add(jSPPanel);
845
+ oe.treePanel.Return();
846
+
847
+ oe.treePanel.add(copyOptionsPanel);
848
+ oe.treePanel.Return();
849
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
850
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
851
+ sliderPane.preferredHeight = 1;
852
+
853
+// mainPanel.setDividerLocation(0.5); //1.0);
854
+// mainPanel.setResizeWeight(0.5);
855
+
585856 //jList.addListSelectionListener(this);
586857 oe.jTree.addTreeSelectionListener(this);
587858 //jTree.setRootVisible(false);
....@@ -604,83 +875,143 @@
604875 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
605876 }
606877
607
- void AddOptions(JPanel panel, GridBagConstraints constraints)
878
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
608879 {
609
- constraints.gridx = 0;
610
- constraints.gridy = 0;
611
- panel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), constraints);
612
- fastCB.setToolTipText("Fast mode");
613
- fastCB.addItemListener(this);
614
- constraints.gridy += 1;
615
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), constraints);
616
- supportCB.setToolTipText("Enabled rigging");
617
- supportCB.addItemListener(this);
880
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
881
+ colorCB.setToolTipText("Copy color when dropped");
882
+ colorCB.addItemListener(this);
618883
619
- // constraints.gridy += 1;
884
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
885
+ materialCB.setToolTipText("Copy material when dropped");
886
+ materialCB.addItemListener(this);
887
+
888
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
889
+ textureCB.setToolTipText("Copy texture when dropped");
890
+ textureCB.addItemListener(this);
891
+
892
+ panel.Return();
893
+
894
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
895
+ boxCB.setToolTipText("Display bounding boxes");
896
+ boxCB.addItemListener(this);
897
+
898
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
899
+ zoomBoxCB.setToolTipText("Display only for wheel");
900
+ zoomBoxCB.addItemListener(this);
901
+
902
+ if (true) // Globals.ADVANCED)
903
+ {
904
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
905
+// supportCB.setToolTipText("Enable rigging");
906
+// supportCB.addItemListener(this);
907
+
908
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
909
+ freezeCB.setToolTipText("Fast moving camera");
910
+ freezeCB.addItemListener(this);
911
+
620912 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
621913 // localCB.addItemListener(this);
622914
623
- constraints.gridy += 1;
624
- panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), constraints);
915
+ panel.Return();
916
+
917
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
625918 crowdCB.setToolTipText("Used for crowds");
626919 crowdCB.addItemListener(this);
627920
628
- constraints.gridy += 1;
629
- panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), constraints);
921
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
630922 smoothCB.setToolTipText("Snapping delay");
631923 smoothCB.addItemListener(this);
632924
633
- constraints.gridy += 1;
634
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), constraints);
925
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
635926 slowCB.setToolTipText("Smooth interpolation");
636927 slowCB.addItemListener(this);
637
- constraints.gridy += 1;
638
- panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE), constraints);
639
- boxCB.setToolTipText("Display bounding boxes");
640
- boxCB.addItemListener(this);
641
- constraints.gridy += 1;
642
- panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE), constraints);
643
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
644
- zoomBoxCB.addItemListener(this);
645
-
928
+
646929 // constraints.gridy += 1;
647930 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
648931 // speakerMocapCB.addItemListener(this);
649932
933
+ panel.Return();
934
+
650935 if (false)
651936 {
652937 // handled in scripts
653
- constraints.gridy += 1;
654
- panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), constraints);
938
+ //constraints.gridy += 1;
939
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
655940 speakerCameraCB.addItemListener(this);
656941
657
- constraints.gridy += 1;
658
- panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), constraints);
942
+ //constraints.gridy += 1;
943
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
659944 speakerFocusCB.addItemListener(this);
660945
661
- constraints.gridy += 1;
662
- panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), constraints);
946
+ //constraints.gridy += 1;
947
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
663948 smoothfocusCB.addItemListener(this);
949
+ panel.Return();
664950 }
665951
666952 //constraints.gridx += 1;
667953 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
668954 // debugCB.addItemListener(this);
669955
670
- constraints.gridy += 1;
671
- panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL), constraints);
956
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
957
+ trackCB.setToolTipText("Enable tracking target");
958
+ trackCB.addItemListener(this);
959
+
960
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
961
+ oeilCB.setToolTipText("Move camera when tracking");
672962 oeilCB.addItemListener(this);
673963
674
- constraints.gridy += 1;
675
- panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT), constraints);
964
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
965
+ shadowCB.setToolTipText("When live compute shadows");
966
+ shadowCB.addItemListener(this);
967
+
968
+ panel.Return();
969
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
970
+ toggleTextureCB.setToolTipText("Load textures");
971
+ toggleTextureCB.addItemListener(this);
972
+
973
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
974
+ toggleSwitchCB.setToolTipText("Choose a single item");
975
+ toggleSwitchCB.addItemListener(this);
976
+
977
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
978
+ autokeepCB.setToolTipText("On structure change");
979
+ autokeepCB.addItemListener(this);
980
+
981
+ panel.Return();
982
+ if (Globals.ADVANCED)
983
+ {
984
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
676985 lookAtCB.setToolTipText("Look-at target");
677986 lookAtCB.addItemListener(this);
987
+ }
988
+
989
+ }
990
+
991
+ cGridBag fill = new cGridBag();
992
+ fill.preferredHeight = 200;
993
+ cGridBag fill2 = new cGridBag();
994
+ fill2.preferredHeight = 200;
995
+ cGridBag fill3 = new cGridBag();
996
+ fill3.preferredHeight = 200;
997
+
998
+ panel.add(fill);
999
+ panel.add(fill2);
1000
+ panel.add(fill3);
6781001
6791002 }
6801003
6811004 void EditObject(Object3D obj)
6821005 {
6831006 cRadio radioButton = new cRadio(obj.name);
1007
+
1008
+ // June 2019. Patch to avoid bug with transparency.
1009
+ radioButton.hadMaterial = obj.material != null;
1010
+ if (!radioButton.hadMaterial)
1011
+ {
1012
+ obj.material = new cMaterial();
1013
+ }
1014
+
6841015 radioButton.SetObject(obj);
6851016 radioButton.layout = sevenButton;
6861017 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -689,8 +1020,11 @@
6891020 buttonGroup.add(radioButton);
6901021 radioButton.doClick();
6911022 }
1023
+
6921024 void SetupViews(ObjEditor oe)
6931025 {
1026
+ theFrame = this;
1027
+
6941028 oe.SetupViews();
6951029
6961030 System.out.println("SetupViews");
....@@ -699,23 +1033,28 @@
6991033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7001034 }
7011035
702
- JCheckBox liveCB;
703
- JCheckBox supportCB;
704
- JCheckBox localCB;
705
- JCheckBox crowdCB;
706
- JCheckBox smoothCB;
707
- JCheckBox fastCB;
708
- JCheckBox slowCB;
709
- JCheckBox boxCB;
710
- JCheckBox zoomBoxCB;
711
- JCheckBox trackCB;
712
- JCheckBox smoothfocusCB;
1036
+ cToggleButton liveCB;
1037
+ cCheckBox supportCB;
1038
+ cCheckBox localCB;
1039
+ cCheckBox crowdCB;
1040
+ cCheckBox smoothCB;
1041
+ cToggleButton fastCB;
1042
+ cCheckBox slowCB;
1043
+ cCheckBox boxCB;
1044
+ cCheckBox zoomBoxCB;
1045
+ cCheckBox freezeCB;
1046
+ //cToggleButton trackCB;
1047
+ cCheckBox trackCB;
1048
+ cCheckBox smoothfocusCB;
7131049 // JCheckBox speakerMocapCB;
714
- JCheckBox speakerCameraCB;
715
- JCheckBox speakerFocusCB;
716
- JCheckBox debugCB;
717
- JCheckBox oeilCB;
718
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
7191058
7201059 // static int COLOR = 1;
7211060 // static int MATERIAL = 2;
....@@ -723,9 +1062,9 @@
7231062
7241063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7251064
726
- JCheckBox colorCB;
727
- JCheckBox materialCB;
728
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
7291068
7301069 public void itemStateChanged(ItemEvent e)
7311070 {
....@@ -753,6 +1092,7 @@
7531092 } else if(e.getSource() == liveCB)
7541093 {
7551094 cameraView.ToggleLive();
1095
+ refreshContents(false);
7561096 }
7571097 else if(e.getSource() == supportCB)
7581098 {
....@@ -817,6 +1157,18 @@
8171157 {
8181158 cameraView.ToggleOeil();
8191159 }
1160
+ else if(e.getSource() == shadowCB)
1161
+ {
1162
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1163
+ }
1164
+ else if(e.getSource() == freezeCB)
1165
+ {
1166
+ Globals.FREEZEONMOVE ^= true;
1167
+ }
1168
+ else if(e.getSource() == autokeepCB)
1169
+ {
1170
+ Globals.REPLACEONMAKE ^= true;
1171
+ }
8201172 else if(e.getSource() == lookAtCB)
8211173 {
8221174 cameraView.ToggleLookAt();
....@@ -833,7 +1185,8 @@
8331185
8341186 /**/
8351187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
836
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
8371190 if ((path == null) || (path.getPathCount() <= 1)) {
8381191 // We can't move the root node or an empty selection
8391192 return;
....@@ -896,8 +1249,6 @@
8961249 }
8971250 }
8981251
899
- String string = (String) object;
900
-
9011252 System.out.println("Transfer = " + object + "; drop : " + target);
9021253 // if( object instanceof java.io.File[])
9031254 // {
....@@ -905,7 +1256,11 @@
9051256 // objEditor.DropFile((java.io.File[]) object, true);
9061257 // return;
9071258 // }
908
- if (string.charAt(0) == '/')
1259
+
1260
+ String string = object.toString();
1261
+
1262
+ // File path for Mac and Windows
1263
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9091264 {
9101265 // file(s)
9111266 String[] names = string.split("\n");
....@@ -932,7 +1287,7 @@
9321287
9331288 flashIt = false;
9341289 CameraPane pane = (CameraPane) target;
935
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1290
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9361291 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9371292
9381293 if (group.selection.size() == 1)
....@@ -948,23 +1303,33 @@
9481303
9491304 assert target == objEditor.jTree;
9501305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
9511307 try {
952
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9531309 } catch (Exception e) {
9541310 System.out.println("destinationPath : " + destinationPath);
9551311 return;
9561312 }
9571313
958
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
9591315 {
1316
+ Object3D child = (Object3D)group.selection.elementAt(i);
1317
+
1318
+ // Cannot move into itself
1319
+ if (child == destinationLeaf)
1320
+ return;
1321
+ }
1322
+
1323
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1324
+// {
9601325 loadClipboard(true);
9611326 objEditor.jTree.setSelectionPath(destinationPath);
962
- pasteInto(false);
963
- } else {
964
- loadClipboard(false);
965
- objEditor.jTree.setSelectionPath(destinationPath);
966
- pasteInto(false); // true); // ???
967
- }
1327
+ pasteInto(false, false);
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
9681333 }
9691334 public void dropActionChanged(DropTargetDragEvent dtde)
9701335 // Called if the user has modified the current drop gesture
....@@ -1069,85 +1434,107 @@
10691434 {
10701435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10711436 //heightFieldItem.addActionListener(this);
1072
- gridItem = menu.add(new MenuItem("Grid"));
1073
- gridItem.addActionListener(this);
1074
- rectoidItem = menu.add(new MenuItem("Box"));
1075
- rectoidItem.addActionListener(this);
1076
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1077
- ellipsoidItem.addActionListener(this);
1078
- coneItem = menu.add(new MenuItem("Cone"));
1079
- coneItem.addActionListener(this);
1080
- torusItem = menu.add(new MenuItem("Torus"));
1081
- torusItem.addActionListener(this);
1082
- superItem = menu.add(new MenuItem("Superellipsoid"));
1083
- superItem.addActionListener(this);
1437
+// gridItem = menu.add(new MenuItem("Grid"));
1438
+// gridItem.addActionListener(this);
1439
+// rectoidItem = menu.add(new MenuItem("Box"));
1440
+// rectoidItem.addActionListener(this);
1441
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1442
+// ellipsoidItem.addActionListener(this);
1443
+// coneItem = menu.add(new MenuItem("Cone"));
1444
+// coneItem.addActionListener(this);
1445
+// torusItem = menu.add(new MenuItem("Torus"));
1446
+// torusItem.addActionListener(this);
1447
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1448
+// superItem.addActionListener(this);
1449
+
1450
+ cameraItem = menu.add(new MenuItem("Camera"));
1451
+ cameraItem.addActionListener(this);
1452
+
1453
+ if (!Globals.ADVANCED)
1454
+ {
10841455 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10851456 kleinItem.addActionListener(this);
1086
- particleItem = menu.add(new MenuItem("Particle system"));
1087
- particleItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10881463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10891464 ragdollItem.addActionListener(this);
10901465 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10911466 ragdoll2Item.addActionListener(this);
1467
+ }
10921468 menu.add("-");
1093
- meshItem = menu.add(new MenuItem("Mesh"));
1469
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10941470 meshItem.addActionListener(this);
10951471 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10961472 // meshGroupItem.addActionListener(this);
1473
+ if (Globals.ADVANCED)
1474
+ {
10971475 springItem = menu.add(new MenuItem("Spring"));
10981476 springItem.addActionListener(this);
10991477 flagItem = menu.add(new MenuItem("Flag"));
11001478 flagItem.addActionListener(this);
1101
- bezierItem = menu.add(new MenuItem("Patch"));
1102
- bezierItem.addActionListener(this);
1103
- checkerItem = menu.add(new MenuItem("Checker"));
1104
- checkerItem.addActionListener(this);
11051479 blobItem = menu.add(new MenuItem("Blob"));
11061480 blobItem.addActionListener(this);
11071481 latheItem = menu.add(new MenuItem("Lathe"));
11081482 latheItem.addActionListener(this);
1109
- lightItem = menu.add(new MenuItem("Light"));
1110
- lightItem.addActionListener(this);
1483
+ }
1484
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1485
+ bezierItem.addActionListener(this);
1486
+// overlayItem = menu.add(new MenuItem("Overlay"));
1487
+// overlayItem.addActionListener(this);
1488
+// lightItem = menu.add(new MenuItem("Light"));
1489
+// lightItem.addActionListener(this);
11111490 menu.add("-");
11121491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11131492 //superLoopItem.addActionListener(this);
1114
- loopItem = menu.add(new MenuItem("Loop"));
1115
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
11161495 doubleItem = menu.add(new MenuItem("Fork"));
11171496 doubleItem.addActionListener(this);
1497
+ if (Globals.ADVANCED)
1498
+ {
11181499 tripleItem = menu.add(new MenuItem("Trident"));
11191500 tripleItem.addActionListener(this);
1501
+ }
11201502 }
11211503
11221504 void buildToolsMenu(Menu menu)
11231505 {
11241506 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
11251507 animationItem.addItemListener(this);
1126
- animationItem.setState(CameraPane.ANIMATION);
1508
+ animationItem.setState(Globals.ANIMATION);
1509
+
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
11271512
11281513 menu.add("-");
11291514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11301515 parseverticesItem.addActionListener(this);
11311516 textureFieldItem = menu.add(new MenuItem("Texture Field"));
11321517 textureFieldItem.addActionListener(this);
1133
- alignItem = menu.add(new MenuItem("Align"));
1518
+ alignItem = menu.add(new MenuItem("Align Objects"));
11341519 alignItem.addActionListener(this);
1135
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1136
- mirrorItem.addActionListener(this);
11371520 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11381521 reduceMorphItem.addActionListener(this);
11391522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11401523 reduce34MorphItem.addActionListener(this);
1141
-
1142
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1143
- computeAOItem.addActionListener(this);
11441524 menu.add("-");
1145
-
11461525 menu.add(memoryItem = new MenuItem("Memory Usage"));
11471526 memoryItem.addActionListener(this);
1527
+ menu.add(computeAOItem = new MenuItem("Compute AO"));
1528
+ computeAOItem.addActionListener(this);
1529
+
1530
+ if (Globals.ADVANCED)
1531
+ {
1532
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1533
+ mirrorItem.addActionListener(this);
1534
+ menu.add("-");
11481535 menu.add(analyzeItem = new MenuItem("Analyze"));
11491536 analyzeItem.addActionListener(this);
1150
- menu.add(dumpItem = new MenuItem("Dump"));
1537
+ menu.add(dumpItem = new MenuItem("Print"));
11511538 dumpItem.addActionListener(this);
11521539 // menu.add(pathItem = new MenuItem("From-to path"));
11531540 // pathItem.addActionListener(this);
....@@ -1165,6 +1552,7 @@
11651552 menu.add("-");
11661553 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11671554 editScriptItem.addActionListener(this);
1555
+ }
11681556 }
11691557
11701558 void ScreenFit()
....@@ -1287,9 +1675,24 @@
12871675 shadow.material = new cMaterial(obj.material);
12881676 shadow.material.diffuse = 0.0001f;
12891677 shadow.material.specular = 0.0001f;
1678
+ //shadow.projectedVertices[1].x = 300;
12901679
12911680 makeSomething(shadow);
12921681 }
1682
+
1683
+ private void ClearUnpinned()
1684
+ {
1685
+ //for (Object3D obj : listUI)
1686
+ for (int i=listUI.size(); --i>=0;)
1687
+ {
1688
+ Object3D obj = listUI.elementAt(i);
1689
+ if (!obj.pinned)
1690
+ {
1691
+ obj.CloseUI();
1692
+ listUI.remove(i);
1693
+ }
1694
+ }
1695
+ }
12931696
12941697 /**
12951698 * applyExample
....@@ -1493,9 +1896,9 @@
14931896
14941897 void Overwrite(int mask)
14951898 {
1496
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1899
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14971900 {
1498
- Object3D content = GrafreeD.clipboard.get(0);
1901
+ Object3D content = Grafreed.clipboard.get(0);
14991902
15001903 if (content instanceof cGroup && ((cGroup)content).transientlink )
15011904 content = ((cGroup)content).get(0);
....@@ -1518,6 +1921,7 @@
15181921 //
15191922 public void actionPerformed(ActionEvent event) // , Object arg)
15201923 {
1924
+ Object source = event.getSource();
15211925 /*
15221926 if (event.getSource() == nameField)
15231927 {
....@@ -1529,11 +1933,11 @@
15291933 }
15301934 else
15311935 */
1532
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1936
+ if (source == lookAtItem || source == lookFromItem)
15331937 {
15341938 ScreenFit();
15351939 } else
1536
- if (event.getSource() == switchItem)
1940
+ if (source == switchViewItem)
15371941 {
15381942 cVector v1 = new cVector();
15391943 cVector v2 = new cVector();
....@@ -1542,11 +1946,11 @@
15421946 objEditor.cameraView.renderCamera.setAim(v2, v1);
15431947 objEditor.cameraView.repaint();
15441948 } else
1545
- if (event.getSource() == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
15461950 {
15471951 makeSomething(new Box());
15481952 } else
1549
- if (event.getSource() == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
15501954 {
15511955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15521956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1567,9 +1971,9 @@
15671971 applyExample(particleGeom, "SMOKE");
15681972 makeSomething(particleGeom);
15691973 } else
1570
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1974
+ if (source == ragdollItem || source == ragdoll2Item)
15711975 {
1572
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1976
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15731977
15741978 ragdoll.toParent = LA.newMatrix();
15751979 ragdoll.fromParent = LA.newMatrix();
....@@ -1587,7 +1991,7 @@
15871991 } else
15881992 /*
15891993 */
1590
- if (event.getSource() == heightFieldItem)
1994
+ if (source == heightFieldItem)
15911995 {
15921996 Object3D obj = new Object3D();
15931997
....@@ -1625,31 +2029,31 @@
16252029
16262030 makeSomething(obj);
16272031 } else
1628
- if (event.getSource() == gridItem)
2032
+ if (source == gridItem || source == gridButton)
16292033 {
16302034 makeSomething(new Grid());
16312035 } else
1632
- if (event.getSource() == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
16332037 {
16342038 makeSomething(new Sphere());
16352039 } else
1636
- if (event.getSource() == coneItem)
2040
+ if (source == coneItem || source == coneButton)
16372041 {
16382042 makeSomething(new Cone());
16392043 } else
1640
- if (event.getSource() == torusItem)
2044
+ if (source == torusItem || source == torusButton)
16412045 {
16422046 makeSomething(new Torus());
16432047 } else
1644
- if (event.getSource() == superItem)
2048
+ if (source == superItem || source == superButton)
16452049 {
16462050 makeSomething(new Superellipsoid());
16472051 } else
1648
- if (event.getSource() == kleinItem)
2052
+ if (source == kleinItem || source == kleinButton)
16492053 {
16502054 makeSomething(new Klein());
16512055 } else
1652
- if (event.getSource() == blobItem)
2056
+ if (source == blobItem)
16532057 {
16542058 Blob blob = new Blob();
16552059 BlobComponent comp = new BlobComponent();
....@@ -1657,15 +2061,15 @@
16572061 //blob.retile();
16582062 makeSomething(blob);
16592063 } else
1660
- if (event.getSource() == latheItem)
2064
+ if (source == latheItem)
16612065 {
16622066 makeSomething(new Lathe());
16632067 } else
1664
- if (event.getSource() == bezierItem)
2068
+ if (source == bezierItem)
16652069 {
16662070 makeSomething(new BezierSurface());
16672071 } else
1668
- if (event.getSource() == checkerItem)
2072
+ if (source == overlayItem || source == overlayButton)
16692073 {
16702074 /*
16712075 Object3D obj = new BezierSurface(5,8);
....@@ -1680,7 +2084,7 @@
16802084 */
16812085 makeSomething(new Checker());
16822086 } else
1683
- if (event.getSource() == meshItem)
2087
+ if (source == meshItem)
16842088 {
16852089 Object3D itemtomake = new Object3D();
16862090 Object3D child;
....@@ -1701,35 +2105,35 @@
17012105 makeSomething(child);
17022106 }
17032107 } else
1704
- if (event.getSource() == springItem)
2108
+ if (source == springItem)
17052109 {
17062110 cSpring s = new cSpring();
17072111 s.setup();
17082112 makeSomething(s);
17092113 } else
1710
- if (event.getSource() == flagItem)
2114
+ if (source == flagItem)
17112115 {
17122116 cSpring s = new cFlag();
17132117 s.setup();
17142118 makeSomething(s);
17152119 } else
1716
- if (event.getSource() == lightItem)
2120
+ if (source == lightItem || source == lightButton)
17172121 {
17182122 makeSomething(new Light());
17192123 } else
1720
- if (event.getSource() == csgItem)
2124
+ if (source == csgItem)
17212125 {
17222126 group(new CSG());
17232127 } else
1724
- if (event.getSource() == templateItem)
2128
+ if (source == templateItem)
17252129 {
17262130 group(new cTemplate());
17272131 } else
1728
- if (event.getSource() == attributeItem)
2132
+ if (source == attributeItem)
17292133 {
17302134 makeSomething(new Attribute());
17312135 } else
1732
- if (event.getSource() == pointflowItem)
2136
+ if (source == pointflowItem)
17332137 {
17342138 makeSomething(new PointFlow());
17352139 } else
....@@ -1741,7 +2145,7 @@
17412145 } else
17422146 */
17432147
1744
- if (event.getSource() == superLoopItem)
2148
+ if (source == superLoopItem)
17452149 {
17462150 Composite g = new cGroup();
17472151 for (int i=0; i<15; i++)
....@@ -1763,30 +2167,30 @@
17632167
17642168 group(g);
17652169 } else
1766
- if (event.getSource() == loopItem)
2170
+ if (source == loopItem || source == loopButton)
17672171 {
17682172 Composite csg = new GroupLeaf();
17692173 csg.count = 5;
17702174 group(csg);
1771
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
17722176 csg.addChild(child);
17732177 child.addChild(csg);
17742178 } else
1775
- if (event.getSource() == doubleItem)
2179
+ if (source == doubleItem)
17762180 {
1777
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
17782182 csg.count = 5;
17792183 group(csg);
1780
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
17812185 csg.addChild(child);
17822186 child.addChild(csg);
1783
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
17842188 csg.addChild(child);
17852189 child.addChild(csg);
17862190 } else
1787
- if (event.getSource() == tripleItem)
2191
+ if (source == tripleItem)
17882192 {
1789
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
17902194 csg.count = 4;
17912195 group(csg);
17922196 Composite child = new cGroup();
....@@ -1799,73 +2203,98 @@
17992203 csg.addChild(child);
18002204 child.addChild(csg);
18012205 } else
1802
-
1803
- if (event.getSource() == importGFDItem)
1804
- {
1805
- ImportGFD();
1806
- } else
1807
- if (event.getSource() == importVRMLX3DItem)
1808
- {
1809
- ImportVRMLX3D();
1810
- } else
1811
- if (event.getSource() == import3DSItem)
1812
- {
1813
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1814
- } else
1815
- if (event.getSource() == importOBJItem)
1816
- {
1817
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1818
- } else
1819
- if (event.getSource() == computeAOItem)
2206
+ if (source == computeAOItem)
18202207 {
18212208 Globals.drawMode = CameraPane.OCCLUSION;
18222209 Globals.theRenderer.repaint();
18232210 } else
1824
- if (event.getSource() == recompileItem)
2211
+ if (source == recompileItem)
18252212 {
18262213 Recompile();
18272214 refreshContents();
18282215 } else
1829
- if (event.getSource() == editScriptItem)
2216
+ if (source == editScriptItem)
18302217 {
18312218 OpenDialog();
18322219 refreshContents();
18332220 } else
1834
- if (event.getSource() == invariantsItem)
2221
+ if (source == invariantsItem)
18352222 {
18362223 System.out.println("Invariants:");
1837
- GrafreeD.grafreeD.universe.invariants();
2224
+ Grafreed.grafreeD.universe.invariants();
18382225 } else
1839
- if (event.getSource() == memoryItem)
2226
+ if (source == memoryItem)
18402227 {
18412228 //System.out.println("Invariants:");
18422229 PrintMemory();
18432230 } else
1844
- if (event.getSource() == pathItem)
2231
+ if (source == pathItem)
18452232 {
18462233 PrintPath();
18472234 } else
1848
- if (event.getSource() == analyzeItem)
2235
+ if (source == analyzeItem)
18492236 {
18502237 AnalyzeObject();
18512238 } else
1852
- if (event.getSource() == dumpItem)
2239
+ if (source == dumpItem)
18532240 {
18542241 DumpObject();
18552242 } else
1856
- if (event.getSource() == screenfitButton)
2243
+ if (source == minButton)
18572244 {
1858
- //Reload(lastConverter, lastFilename, true);
2245
+ Minimize();
2246
+ } else
2247
+ if (source == maxButton)
2248
+ {
2249
+ Maximize();
2250
+ } else
2251
+ if (source == fullButton)
2252
+ {
2253
+ ToggleFullScreen();
2254
+ } else
2255
+ if (source == undoButton)
2256
+ {
2257
+ // Go to previous version
2258
+ //if (!Undo())
2259
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2260
+ Undo();
2261
+ } else
2262
+ if (source == restoreButton)
2263
+ {
2264
+ // Restore current version
2265
+ Restore();
2266
+ } else
2267
+ if (source == replaceButton)
2268
+ {
2269
+ // Overwrite current version
2270
+ Replace();
2271
+ } else
2272
+ if (source == redoButton)
2273
+ {
2274
+ // Go to next version
2275
+ Redo();
2276
+ } else
2277
+ if (source == saveButton)
2278
+ {
2279
+ // Save a new version
2280
+ if (!Save(true))
2281
+ java.awt.Toolkit.getDefaultToolkit().beep();
2282
+ } else
2283
+ if (source == oneStepButton)
2284
+ {
2285
+ Globals.ONESTEP = true;
2286
+ cameraView.repaint();
2287
+ } else
2288
+ if (source == screenfitButton)
2289
+ {
18592290 ScreenFit();
18602291 } else
1861
- if (event.getSource() == screenfitpointButton)
2292
+ if (source == screenfitpointButton)
18622293 {
1863
- //Reload(lastConverter, lastFilename, true);
18642294 ScreenFitPoint();
18652295 } else
1866
- if (event.getSource() == snapobjectButton)
2296
+ if (source == snapobjectButton)
18672297 {
1868
- //Reload(lastConverter, lastFilename, true);
18692298 SnapObject();
18702299 } else
18712300 // if (event.getSource() == recompileButton)
....@@ -1874,13 +2303,13 @@
18742303 // Recompile();
18752304 // refreshContents();
18762305 // } else
1877
- if (event.getSource() == gcButton)
2306
+ if (source == gcButton)
18782307 {
18792308 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18802309 System.gc();
18812310 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18822311 } else
1883
- if (event.getSource() == editLeafItem)
2312
+ if (source == editLeafItem)
18842313 {
18852314 Object3D obj;
18862315 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1894,62 +2323,74 @@
18942323 }
18952324 refreshContents(true);
18962325 } else
1897
- if (event.getSource() == openWindowItem)
2326
+ if (source == openWindowItem)
18982327 {
18992328 EditSelection(true);
19002329 } else
1901
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2330
+ if (source == cutItem || source == clearButton)
19022331 {
19032332 loadClipboard(true);
19042333 } else
1905
- if (event.getSource() == duplicateItem)
2334
+ if (source == undoItem)
19062335 {
1907
- Object3D keep = GrafreeD.clipboard;
2336
+ Undo();
2337
+ } else
2338
+ if (source == redoItem)
2339
+ {
2340
+ Redo();
2341
+ } else
2342
+ if (source == duplicateItem)
2343
+ {
2344
+ Object3D keep = Grafreed.clipboard;
19082345 loadClipboard(false);
19092346 paste(false);
1910
- GrafreeD.clipboard = keep;
2347
+ Grafreed.clipboard = keep;
19112348 } else
1912
- if (event.getSource() == cloneItem)
2349
+ if (source == cloneItem)
19132350 {
19142351 CloneSelection(false);
19152352 } else
1916
- if (event.getSource() == cloneSupportItem)
2353
+ if (source == cloneSupportItem)
19172354 {
19182355 CloneSelection(true);
19192356 } else
1920
- if (event.getSource() == copyItem)
2357
+ if (source == copyItem)
19212358 {
19222359 loadClipboard(false);
19232360 } else
1924
- if (event.getSource() == pasteItem)
2361
+ if (source == pasteItem)
19252362 {
19262363 paste(false);
19272364 } else
1928
- if (event.getSource() == pasteLinkItem)
2365
+ if (source == pasteIntoItem)
19292366 {
1930
- pasteInto(false);
2367
+ pasteInto(true, false);
19312368 } else
1932
- if (event.getSource() == pasteCloneItem)
2369
+ if (source == pasteLinkItem)
19332370 {
1934
- pasteInto(true);
2371
+ pasteInto(false, false);
19352372 } else
1936
- if (event.getSource() == pasteExpandItem)
2373
+ if (source == pasteCloneItem)
2374
+ {
2375
+ pasteInto(true, true);
2376
+ } else
2377
+ if (source == pasteExpandItem)
19372378 {
19382379 paste(true);
19392380 } else
1940
- if (event.getSource() == synchronizeItem)
2381
+ if (source == synchronizeItem)
19412382 {
19422383 Overwrite(Object3D.TRANSFORM);
19432384 } else
1944
- if (event.getSource() == overwriteNameItem)
2385
+ if (source == overwriteNameItem)
19452386 {
19462387 Overwrite(Object3D.NAME);
19472388 } else
1948
- if (event.getSource() == overwriteUVItem)
2389
+ if (source == overwriteUVItem)
19492390 {
19502391 Overwrite(Object3D.UV);
19512392 } else
1952
- if (event.getSource() == overwriteMatItem)
2393
+ if (source == overwriteMatItem)
19532394 {
19542395 /* july 2015
19552396 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1969,7 +2410,7 @@
19692410
19702411 Overwrite(dropAttributes);
19712412 }
1972
- if (event.getSource() == overwriteGeoItem)
2413
+ if (source == overwriteGeoItem)
19732414 {
19742415 Overwrite(Object3D.GEOMETRY);
19752416 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1986,7 +2427,7 @@
19862427 // refreshContents();
19872428 // }
19882429 } else
1989
- if (event.getSource() == generateMeshItem)
2430
+ if (source == generateMeshItem)
19902431 {
19912432 //if (group.selection.size() == 1)
19922433 // for (int i=0; i<group.selection.size(); i++)
....@@ -1997,7 +2438,7 @@
19972438 ResetModel();
19982439 refreshContents();
19992440 } else
2000
- if (event.getSource() == extractGeometriesItem)
2441
+ if (source == extractGeometriesItem)
20012442 {
20022443 boolean one = false;
20032444
....@@ -2024,7 +2465,7 @@
20242465 ResetModel();
20252466 refreshContents();
20262467 } else
2027
- if (event.getSource() == cloneGeometriesItem)
2468
+ if (source == cloneGeometriesItem)
20282469 {
20292470 boolean one = false;
20302471
....@@ -2050,7 +2491,7 @@
20502491 ResetModel();
20512492 refreshContents();
20522493 } else
2053
- if (event.getSource() == shareGeometriesItem)
2494
+ if (source == shareGeometriesItem)
20542495 {
20552496 boolean one = false;
20562497
....@@ -2080,7 +2521,7 @@
20802521 refreshContents();
20812522 }
20822523 } else
2083
- if (event.getSource() == mergeGeometriesItem)
2524
+ if (source == mergeGeometriesItem)
20842525 {
20852526 boolean one = false;
20862527
....@@ -2110,7 +2551,7 @@
21102551 ResetModel();
21112552 refreshContents();
21122553 } else
2113
- if (event.getSource() == linkverticesItem)
2554
+ if (source == linkverticesItem)
21142555 {
21152556 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
21162557 // {
....@@ -2123,9 +2564,9 @@
21232564 // group.selection.get(0).setMasterThis(content); // should be identity
21242565 // refreshContents();
21252566 // }
2126
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2567
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21272568 {
2128
- Object3D content = GrafreeD.clipboard.get(0);
2569
+ Object3D content = Grafreed.clipboard.get(0);
21292570
21302571 if (content instanceof cGroup && ((cGroup)content).transientlink )
21312572 content = ((cGroup)content).get(0);
....@@ -2133,38 +2574,38 @@
21332574 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
21342575 for (int i=0; i<group.selection.size(); i++)
21352576 {
2136
- boolean random = CameraPane.RANDOM;
2137
- CameraPane.RANDOM = false; // parse all random nodes
2577
+ boolean random = CameraPane.SWITCH;
2578
+ CameraPane.SWITCH = false; // parse all random nodes
21382579 group.selection.get(i).linkVerticesThis(content);
21392580 // group.selection.get(i).setMasterThis(content); // should be identity
2140
- CameraPane.RANDOM = random;
2581
+ CameraPane.SWITCH = random;
21412582 }
21422583 Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21432584 refreshContents();
21442585 }
21452586 } else
2146
- if (event.getSource() == resetsupportItem)
2587
+ if (source == resetsupportItem)
21472588 {
21482589 for (int i=0; i<group.selection.size(); i++)
21492590 {
2150
- boolean random = CameraPane.RANDOM;
2151
- CameraPane.RANDOM = false; // parse all random nodes
2591
+ boolean random = CameraPane.SWITCH;
2592
+ CameraPane.SWITCH = false; // parse all random nodes
21522593 group.selection.get(i).linkVerticesThis(null);
2153
- CameraPane.RANDOM = random;
2594
+ CameraPane.SWITCH = random;
21542595 }
21552596
21562597 refreshContents();
21572598 } else
2158
- if (event.getSource() == relinkverticesItem)
2599
+ if (source == relinkverticesItem)
21592600 {
2160
- boolean random = CameraPane.RANDOM;
2161
- CameraPane.RANDOM = false; // parse all random nodes
2601
+ boolean random = CameraPane.SWITCH;
2602
+ CameraPane.SWITCH = false; // parse all random nodes
21622603 group.selection.RelinkToSupport();
2163
- CameraPane.RANDOM = random;
2604
+ CameraPane.SWITCH = random;
21642605
21652606 refreshContents();
21662607 } else
2167
- if (event.getSource() == resetreferencesItem)
2608
+ if (source == resetreferencesItem)
21682609 {
21692610 for (int i=0; i<group.selection.size(); i++)
21702611 {
....@@ -2173,11 +2614,11 @@
21732614
21742615 refreshContents();
21752616 } else
2176
- if (event.getSource() == setMasterItem)
2617
+ if (source == setMasterItem)
21772618 {
2178
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2619
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21792620 {
2180
- Object3D content = GrafreeD.clipboard.get(0);
2621
+ Object3D content = Grafreed.clipboard.get(0);
21812622
21822623 if (content instanceof cGroup && ((cGroup)content).transientlink )
21832624 content = ((cGroup)content).get(0);
....@@ -2186,13 +2627,13 @@
21862627 refreshContents();
21872628 }
21882629 } else
2189
- if (event.getSource() == poseMeshItem)
2630
+ if (source == poseMeshItem)
21902631 {
21912632 if (group.selection.size() == 1)
21922633 {
2193
- if (GrafreeD.clipboard.size() == 1)
2634
+ if (Grafreed.clipboard.size() == 1)
21942635 {
2195
- Object3D content = GrafreeD.clipboard.get(0);
2636
+ Object3D content = Grafreed.clipboard.get(0);
21962637
21972638 if (content instanceof cGroup && ((cGroup)content).transientlink )
21982639 content = ((cGroup)content).get(0);
....@@ -2205,19 +2646,19 @@
22052646 }
22062647
22072648 } else
2208
- if (event.getSource() == revertMeshItem)
2649
+ if (source == revertMeshItem)
22092650 {
22102651 RevertMeshes();
22112652 } else
2212
- if (event.getSource() == resetMeshItem)
2653
+ if (source == resetAllItem)
22132654 {
22142655 ResetAll();
22152656 } else
2216
- if (event.getSource() == stepAllItem)
2657
+ if (source == stepAllItem)
22172658 {
22182659 StepAll();
22192660 } else
2220
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2661
+ if (source == clearItem) // || event.getSource() == clearButton)
22212662 {
22222663 //int indices[] = jList.getSelectedIndices();
22232664 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2225,46 +2666,46 @@
22252666
22262667 ClearSelection(false);
22272668 } else
2228
- if (event.getSource() == clearAllItem)
2669
+ if (source == clearAllItem)
22292670 {
22302671 ClearSelection(true);
22312672 } else
2232
- if (event.getSource() == grabItem)
2673
+ if (source == grabItem || source == groupButton)
22332674 {
2234
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
22352676 } else
2236
- if (event.getSource() == hideItem)
2677
+ if (source == hideItem)
22372678 {
22382679 group(new HiddenObject());
22392680 } else
2240
- if (event.getSource() == frontItem)
2681
+ if (source == frontItem)
22412682 {
22422683 front();
22432684 } else
2244
- if (event.getSource() == backItem)
2685
+ if (source == backItem)
22452686 {
22462687 back();
22472688 } else
2248
- if (event.getSource() == cameraItem)
2689
+ if (source == cameraItem)
22492690 {
22502691 makeSomething(new Camera());
22512692 } else
2252
- if (event.getSource() == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
22532694 {
22542695 group(new Composite());
22552696 } else
2256
- if (event.getSource() == randomItem)
2697
+ if (source == switchItem || source == switchButton)
22572698 {
22582699 RandomNode random = new RandomNode();
22592700 group(random);
22602701 if (random.size() > 0)
2261
- random.name = random.get(0).name + "Rnd";
2702
+ random.name = random.get(0).name + "Switch";
22622703 } else
2263
- if (event.getSource() == physicsItem)
2704
+ if (source == physicsItem)
22642705 {
22652706 group(new PhysicsNode());
22662707 } else
2267
- if (event.getSource() == frameselectorItem)
2708
+ if (source == frameselectorItem)
22682709 {
22692710 for (int i=0; i<group.selection.size(); i++)
22702711 {
....@@ -2276,7 +2717,7 @@
22762717 ResetModel();
22772718 refreshContents();
22782719 } else
2279
- if (event.getSource() == switchGeoItem)
2720
+ if (source == switchGeoItem)
22802721 {
22812722 for (int i=0; i<group.selection.size(); i++)
22822723 {
....@@ -2288,7 +2729,7 @@
22882729 ResetModel();
22892730 refreshContents();
22902731 } else
2291
- if (event.getSource() == switchTransfoItem)
2732
+ if (source == switchTransfoItem)
22922733 {
22932734 for (int i=0; i<group.selection.size(); i++)
22942735 {
....@@ -2300,7 +2741,7 @@
23002741 ResetModel();
23012742 refreshContents();
23022743 } else
2303
- if (event.getSource() == morphItem)
2744
+ if (source == morphItem)
23042745 {
23052746 for (int i=0; i<group.selection.size(); i++)
23062747 {
....@@ -2312,7 +2753,7 @@
23122753 ResetModel();
23132754 refreshContents();
23142755 } else
2315
- if (event.getSource() == scriptNodeItem)
2756
+ if (source == scriptNodeItem)
23162757 {
23172758 boolean atleastone = false;
23182759
....@@ -2351,215 +2792,252 @@
23512792 }
23522793 }
23532794 } else
2354
- if (event.getSource() == linkerItem)
2795
+ if (source == linkerItem)
23552796 {
23562797 group(new cLinker());
23572798 } else
2358
- if (event.getSource() == textureItem)
2799
+ if (source == textureItem || source == textureButton)
23592800 {
23602801 group(new TextureNode());
23612802 } else
2362
- if (event.getSource() == billboardItem)
2803
+ if (source == billboardItem)
23632804 {
23642805 group(new BillboardNode());
23652806 } else
2366
- if (event.getSource() == shadowXItem)
2807
+ if (source == shadowXItem)
23672808 {
23682809 CastShadow(0);
23692810 } else
2370
- if (event.getSource() == shadowYItem)
2811
+ if (source == shadowYItem)
23712812 {
23722813 CastShadow(1);
23732814 } else
2374
- if (event.getSource() == shadowZItem)
2815
+ if (source == shadowZItem)
23752816 {
23762817 CastShadow(2);
23772818 } else
2378
- if (event.getSource() == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
23792820 {
2380
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
23812823 for (int i=0; i<group.selection.size(); i++)
23822824 {
2383
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
23842830 }
23852831
2386
- ClearSelection(false);
2387
-
2388
- refreshContents();
2832
+ if (!hasRoot)
2833
+ {
2834
+ for (int i=0; i<group.selection.size(); i++)
2835
+ {
2836
+ Ungroup(group.selection.get(i));
2837
+ }
2838
+
2839
+ ClearSelection(false);
2840
+
2841
+ refreshContents();
2842
+ }
23892843 } else
2390
- if (event.getSource() == genUVItem)
2844
+ if (source == genUVItem)
23912845 {
23922846 GenUV();
23932847 } else
2394
- if (event.getSource() == genNormalsCADItem)
2848
+ if (source == genNormalsCADItem)
23952849 {
23962850 GenNormals(true);
23972851 } else
2398
- if (event.getSource() == genNormalsMESHItem)
2852
+ if (source == genNormalsMESHItem)
23992853 {
2400
- GenNormals(true); // TODO
2854
+ GenNormalsMESH();
24012855 } else
2402
- if (event.getSource() == genNormalsORGANItem)
2856
+ if (source == genNormalsORGANItem)
24032857 {
24042858 GenNormals(false);
24052859 } else
2406
- if (event.getSource() == genNormalsMINEItem)
2860
+ if (source == genNormalsMINEItem)
24072861 {
24082862 GenNormalsMINE();
24092863 } else
2410
- if (event.getSource() == stripifyItem)
2864
+ if (source == stripifyItem)
24112865 {
24122866 Stripify();
24132867 } else
2414
- if (event.getSource() == unstripifyItem)
2868
+ if (source == unstripifyItem)
24152869 {
24162870 Unstripify();
24172871 } else
2418
- if (event.getSource() == trimItem)
2872
+ if (source == trimItem)
24192873 {
24202874 Trim();
24212875 } else
2422
- if (event.getSource() == untrimItem)
2876
+ if (source == untrimItem)
24232877 {
24242878 Untrim();
24252879 } else
2426
- if (event.getSource() == clearColorsItem)
2880
+ if (source == clearColorsItem)
24272881 {
24282882 ClearColors();
24292883 } else
2430
- if (event.getSource() == clearMaterialsItem)
2884
+ if (source == clearMaterialsItem)
24312885 {
24322886 ClearMaterials();
24332887 } else
2434
- if (event.getSource() == liveleavesItem)
2888
+ if (source == liveleavesItem)
24352889 {
24362890 LiveLeaves(true);
24372891 } else
2438
- if (event.getSource() == unliveleavesItem)
2892
+ if (source == unliveleavesItem)
24392893 {
24402894 LiveLeaves(false);
24412895 } else
2442
- if (event.getSource() == supportleavesItem)
2896
+ if (source == supportleavesItem)
24432897 {
24442898 SupportLeaves(true);
24452899 } else
2446
- if (event.getSource() == unsupportleavesItem)
2900
+ if (source == unsupportleavesItem)
24472901 {
24482902 SupportLeaves(false);
24492903 } else
2450
- if (event.getSource() == hideleavesItem)
2904
+ if (source == hideleavesItem)
24512905 {
24522906 HideLeaves(true);
24532907 } else
2454
- if (event.getSource() == showleavesItem)
2908
+ if (source == showleavesItem)
24552909 {
24562910 HideLeaves(false);
24572911 } else
2458
- if (event.getSource() == markleavesItem)
2912
+ if (source == markleavesItem)
24592913 {
24602914 MarkLeaves(true);
24612915 } else
2462
- if (event.getSource() == unmarkleavesItem)
2916
+ if (source == unmarkleavesItem)
24632917 {
24642918 MarkLeaves(false);
24652919 } else
2466
- if (event.getSource() == flipVItem)
2920
+ if (source == rewindleavesItem)
2921
+ {
2922
+ RewindLeaves(true);
2923
+ } else
2924
+ if (source == unrewindleavesItem)
2925
+ {
2926
+ RewindLeaves(false);
2927
+ } else
2928
+ if (source == randomleavesItem)
2929
+ {
2930
+ RandomLeaves(true);
2931
+ } else
2932
+ if (source == unrandomleavesItem)
2933
+ {
2934
+ RandomLeaves(false);
2935
+ } else
2936
+ if (source == flipVItem)
24672937 {
24682938 FlipV(true);
24692939 } else
2470
- if (event.getSource() == unflipVItem)
2940
+ if (source == unflipVItem)
24712941 {
24722942 FlipV(false);
24732943 } else
2474
- if (event.getSource() == lowTexturesItem)
2944
+ if (source == lowTexturesItem)
24752945 {
24762946 SetTexRes(0);
24772947 } else
2478
- if (event.getSource() == normalTexturesItem)
2948
+ if (source == normalTexturesItem)
24792949 {
24802950 SetTexRes(1);
24812951 } else
2482
- if (event.getSource() == highTexturesItem)
2952
+ if (source == highTexturesItem)
24832953 {
24842954 SetTexRes(2);
24852955 } else
2486
- if (event.getSource() == veryhighTexturesItem)
2956
+ if (source == veryhighTexturesItem)
24872957 {
24882958 SetTexRes(3);
24892959 } else
2490
- if (event.getSource() == maxTexturesItem)
2960
+ if (source == maxTexturesItem)
24912961 {
24922962 SetTexRes(4);
24932963 } else
2494
- if (event.getSource() == panoTexturesItem)
2964
+ if (source == panoTexturesItem)
24952965 {
24962966 SetTexRes(5);
24972967 } else
2498
- if (event.getSource() == reverseNormalsItem)
2968
+ if (source == reverseNormalsItem)
24992969 {
25002970 ReverseNormals();
25012971 } else
2502
- if (event.getSource() == parseverticesItem)
2972
+ if (source == parseverticesItem)
25032973 {
25042974 ParseVertices();
25052975 } else
2506
- if (event.getSource() == textureFieldItem)
2976
+ if (source == textureFieldItem)
25072977 {
25082978 TextureVertices();
25092979 } else
2510
- if (event.getSource() == alignItem)
2980
+ if (source == alignItem)
25112981 {
25122982 Align();
25132983 } else
2514
- if (event.getSource() == mirrorItem)
2984
+ if (source == mirrorItem)
25152985 {
25162986 MirrorPoses();
25172987 } else
2518
- if (event.getSource() == reduceMorphItem)
2988
+ if (source == reduceMorphItem)
25192989 {
25202990 MeshReduction(false);
25212991 } else
2522
- if (event.getSource() == reduce34MorphItem)
2992
+ if (source == reduce34MorphItem)
25232993 {
25242994 MeshReduction(true);
25252995 } else
2526
- if (event.getSource() == reverseTrianglesItem)
2996
+ if (source == reverseTrianglesItem)
25272997 {
25282998 ReverseTriangles();
25292999 } else
2530
- if (event.getSource() == reduceMeshItem)
3000
+ if (source == reduceMeshItem)
25313001 {
25323002 ReduceMesh(false);
25333003 } else
2534
- if (event.getSource() == reduce34MeshItem)
3004
+ if (source == reduce34MeshItem)
25353005 {
25363006 ReduceMesh(true);
25373007 } else
2538
- if (event.getSource() == increaseMeshItem)
3008
+ if (source == increaseMeshItem)
25393009 {
25403010 IncreaseMesh();
25413011 } else
2542
- if (event.getSource() == clipMeshItem)
3012
+ if (source == clipMeshItem)
25433013 {
25443014 ClipMesh();
25453015 } else
2546
- if (event.getSource() == smoothMeshItem)
3016
+ if (source == smoothMeshItem)
25473017 {
25483018 SmoothMesh();
25493019 } else
2550
- if (event.getSource() == transformgeometryItem)
3020
+ if (source == transformGeometryItem)
25513021 {
25523022 TransformGeometry();
25533023 } else
2554
- if (event.getSource() == resetTransformItem)
3024
+ if (source == transformChildrenItem)
3025
+ {
3026
+ TransformChildren();
3027
+ } else
3028
+ if (source == resetTransformItem)
25553029 {
25563030 ResetTransform();
25573031 } else
2558
- if (event.getSource() == resetCentroidItem)
3032
+ if (source == resetCentroidItem)
25593033 {
2560
- ResetCentroid();
3034
+ ResetCentroid(true);
25613035 } else
2562
- if (event.getSource() == resetParentItem)
3036
+ if (source == resetCentroidXZItem)
3037
+ {
3038
+ ResetCentroid(false);
3039
+ } else
3040
+ if (source == resetParentItem)
25633041 {
25643042 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25653043 {
....@@ -2569,7 +3047,7 @@
25693047
25703048 refreshContents();
25713049 } else
2572
- if (event.getSource() == repairParentItem)
3050
+ if (source == repairParentItem)
25733051 {
25743052 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25753053 {
....@@ -2583,7 +3061,7 @@
25833061
25843062 refreshContents();
25853063 } else
2586
- if (event.getSource() == repairShadowItem)
3064
+ if (source == repairShadowItem)
25873065 {
25883066 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25893067 {
....@@ -2597,7 +3075,7 @@
25973075
25983076 refreshContents();
25993077 } else
2600
- if (event.getSource() == sortbysizeItem)
3078
+ if (source == sortbysizeItem)
26013079 {
26023080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26033081 {
....@@ -2609,7 +3087,7 @@
26093087 ResetModel();
26103088 refreshContents();
26113089 } else
2612
- if (event.getSource() == sortbynameItem)
3090
+ if (source == sortbynameItem)
26133091 {
26143092 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
26153093 {
....@@ -2621,7 +3099,7 @@
26213099 ResetModel();
26223100 refreshContents();
26233101 } else
2624
- if (event.getSource() == attachPigmentItem)
3102
+ if (source == attachPigmentItem)
26253103 {
26263104 String texture = GetFile("Attach pigment");
26273105 Object3D obj;
....@@ -2633,7 +3111,7 @@
26333111
26343112 refreshContents();
26353113 } else
2636
- if (event.getSource() == detachPigmentItem)
3114
+ if (source == detachPigmentItem)
26373115 {
26383116 Object3D obj;
26393117 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2644,7 +3122,7 @@
26443122
26453123 refreshContents();
26463124 } else
2647
- if (event.getSource() == attachBumpItem)
3125
+ if (source == attachBumpItem)
26483126 {
26493127 String texture = GetFile("Attach bump");
26503128 Object3D obj;
....@@ -2656,7 +3134,7 @@
26563134
26573135 refreshContents();
26583136 } else
2659
- if (event.getSource() == detachBumpItem)
3137
+ if (source == detachBumpItem)
26603138 {
26613139 Object3D obj;
26623140 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2667,7 +3145,7 @@
26673145
26683146 refreshContents();
26693147 } else
2670
- if (event.getSource() == pigmentBumpItem)
3148
+ if (source == pigmentBumpItem)
26713149 {
26723150 Object3D obj;
26733151 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2678,158 +3156,237 @@
26783156
26793157 refreshContents();
26803158 } else
2681
- if (event.getSource() == flashSelectionButton)
3159
+ if (source == flashSelectionButton)
26823160 {
26833161 CameraPane.flash = true;
26843162 refreshContents();
26853163 } else
2686
- if (event.getSource() == oneButton)
3164
+ if (source == oneButton)
26873165 {
26883166 } else
2689
- if (event.getSource() == twoButton)
3167
+ if (source == twoButton)
26903168 {
26913169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
26923174 // bug
26933175 //gridPanel.setDividerLocation(1.0);
26943176 //bigPanel.setDividerLocation(0.0);
2695
- bigThree.remove(scenePanel);
2696
- bigThree.remove(centralPanel);
2697
- bigThree.remove(XYZPanel);
2698
- aWindowConstraints.gridx = 0;
2699
- aWindowConstraints.gridy = 0;
2700
- aWindowConstraints.gridwidth = 1;
2701
- // aConstraints.gridheight = 3;
2702
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2703
- aWindowConstraints.weightx = 0;
2704
- aWindowConstraints.weighty = 1;
2705
- //bigThree.add(jtp, aWindowConstraints);
2706
- aWindowConstraints.weightx = 1;
2707
- aWindowConstraints.gridwidth = 3;
2708
- // aConstraints.gridheight = 3;
2709
- aWindowConstraints.gridx = 1;
2710
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2711
- bigThree.add(centralPanel, aWindowConstraints);
2712
- aWindowConstraints.weightx = 0;
2713
- aWindowConstraints.gridx = 4;
2714
- aWindowConstraints.gridwidth = 1;
2715
- // aConstraints.gridheight = 3;
2716
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2717
- //bigThree.add(XYZPanel, aWindowConstraints);
2718
- bigThree.revalidate();
3177
+// bigThree.remove(scenePanel);
3178
+// bigThree.remove(centralPanel);
3179
+// bigThree.remove(XYZPanel);
3180
+// aWindowConstraints.gridx = 0;
3181
+// aWindowConstraints.gridy = 0;
3182
+// aWindowConstraints.gridwidth = 1;
3183
+// // aConstraints.gridheight = 3;
3184
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3185
+// aWindowConstraints.weightx = 0;
3186
+// aWindowConstraints.weighty = 1;
3187
+// //bigThree.add(jtp, aWindowConstraints);
3188
+// aWindowConstraints.weightx = 1;
3189
+// aWindowConstraints.gridwidth = 3;
3190
+// // aConstraints.gridheight = 3;
3191
+// aWindowConstraints.gridx = 1;
3192
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3193
+// bigThree.add(centralPanel, aWindowConstraints);
3194
+// aWindowConstraints.weightx = 0;
3195
+// aWindowConstraints.gridx = 4;
3196
+// aWindowConstraints.gridwidth = 1;
3197
+// // aConstraints.gridheight = 3;
3198
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3199
+// //bigThree.add(XYZPanel, aWindowConstraints);
3200
+// scenePanel.setVisible(false);
3201
+// centralPanel.setVisible(true);
3202
+// XYZPanel.setVisible(false);
3203
+ bigThree.ClearUI();
3204
+ bigThree.add(centralPanel);
3205
+ bigThree.FlushUI();
3206
+
3207
+ cameraView.requestFocusInWindow();
3208
+
3209
+// refreshContents(true);
3210
+//
3211
+// try
3212
+// {
3213
+// java.awt.Robot bot = new java.awt.Robot();
3214
+// int mask = InputEvent.BUTTON1_MASK;
3215
+// bot.mouseMove(100, 100);
3216
+// bot.mousePress(mask);
3217
+// bot.mouseRelease(mask);
3218
+// }
3219
+// catch (Exception e)
3220
+// {
3221
+//
3222
+// }
3223
+
27193224 } else
2720
- if (event.getSource() == threeButton)
3225
+ if (source == threeButton)
27213226 {
27223227 radio.layout = threeButton;
2723
- bigThree.remove(scenePanel);
2724
- bigThree.remove(centralPanel);
2725
- bigThree.remove(XYZPanel);
2726
- aWindowConstraints.gridx = 0;
2727
- aWindowConstraints.gridy = 0;
2728
- aWindowConstraints.gridwidth = 1;
2729
- // aConstraints.gridheight = 3;
2730
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2731
- aWindowConstraints.weightx = 0;
2732
- aWindowConstraints.weighty = 1;
2733
- //bigThree.add(jtp, aWindowConstraints);
2734
- aWindowConstraints.weightx = 1;
2735
- aWindowConstraints.gridwidth = 3;
2736
- // aConstraints.gridheight = 3;
2737
- aWindowConstraints.gridx = 1;
2738
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2739
- bigThree.add(centralPanel, aWindowConstraints);
2740
- aWindowConstraints.weightx = 0;
2741
- aWindowConstraints.gridx = 4;
2742
- aWindowConstraints.gridwidth = 1;
2743
- // aConstraints.gridheight = 3;
2744
- aConstraints.fill = GridBagConstraints.VERTICAL;
2745
- bigThree.add(XYZPanel, aWindowConstraints);
2746
- bigThree.revalidate();
3228
+
3229
+ if (CameraPane.FULLSCREEN)
3230
+ fullscreenLayout = radio.layout;
3231
+
3232
+// bigThree.remove(scenePanel);
3233
+// bigThree.remove(centralPanel);
3234
+// bigThree.remove(XYZPanel);
3235
+// aWindowConstraints.gridx = 0;
3236
+// aWindowConstraints.gridy = 0;
3237
+// aWindowConstraints.gridwidth = 1;
3238
+// // aConstraints.gridheight = 3;
3239
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3240
+// aWindowConstraints.weightx = 0;
3241
+// aWindowConstraints.weighty = 1;
3242
+// //bigThree.add(jtp, aWindowConstraints);
3243
+// aWindowConstraints.weightx = 1;
3244
+// aWindowConstraints.gridwidth = 3;
3245
+// // aConstraints.gridheight = 3;
3246
+// aWindowConstraints.gridx = 1;
3247
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3248
+// bigThree.add(centralPanel, aWindowConstraints);
3249
+// aWindowConstraints.weightx = 0;
3250
+// aWindowConstraints.gridx = 4;
3251
+// aWindowConstraints.gridwidth = 1;
3252
+// // aConstraints.gridheight = 3;
3253
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3254
+// bigThree.add(XYZPanel, aWindowConstraints);
3255
+// bigThree.validate();
3256
+// scenePanel.setVisible(false);
3257
+// centralPanel.setVisible(true);
3258
+// XYZPanel.setVisible(true);
3259
+ bigThree.ClearUI();
3260
+ bigThree.add(centralPanel);
3261
+ bigThree.add(XYZPanel);
3262
+ bigThree.FlushUI();
3263
+
3264
+ cameraView.requestFocusInWindow();
27473265 } else
2748
- if (event.getSource() == fourButton)
3266
+ if (source == fourButton)
27493267 {
27503268 radio.layout = fourButton;
2751
- bigThree.remove(scenePanel);
2752
- bigThree.remove(centralPanel);
2753
- bigThree.remove(XYZPanel);
2754
- aWindowConstraints.gridx = 0;
2755
- aWindowConstraints.gridy = 0;
2756
- aWindowConstraints.gridwidth = 1;
2757
- // aWindowConstraints.gridheight = 3;
2758
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2759
- aWindowConstraints.weightx = 1;
2760
- aWindowConstraints.weighty = 1;
2761
- bigThree.add(scenePanel, aWindowConstraints);
2762
- aWindowConstraints.weightx = 1;
2763
- aWindowConstraints.gridwidth = 3;
2764
- // aConstraints.gridheight = 3;
2765
- aWindowConstraints.gridx = 1;
2766
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2767
- //bigThree.add(cameraPanel, aWindowConstraints);
2768
- aWindowConstraints.weightx = 0;
2769
- aWindowConstraints.gridx = 4;
2770
- aWindowConstraints.gridwidth = 1;
2771
- // aWindowConstraints.gridheight = 3;
2772
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2773
- //bigThree.add(XYZPanel, aWindowConstraints);
2774
- bigThree.revalidate();
3269
+
3270
+ if (CameraPane.FULLSCREEN)
3271
+ fullscreenLayout = radio.layout;
3272
+
3273
+// bigThree.remove(scenePanel);
3274
+// bigThree.remove(centralPanel);
3275
+// bigThree.remove(XYZPanel);
3276
+// aWindowConstraints.gridx = 0;
3277
+// aWindowConstraints.gridy = 0;
3278
+// aWindowConstraints.gridwidth = 1;
3279
+// // aWindowConstraints.gridheight = 3;
3280
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3281
+// aWindowConstraints.weightx = 1;
3282
+// aWindowConstraints.weighty = 1;
3283
+// bigThree.add(scenePanel, aWindowConstraints);
3284
+// aWindowConstraints.weightx = 1;
3285
+// aWindowConstraints.gridwidth = 3;
3286
+// // aConstraints.gridheight = 3;
3287
+// aWindowConstraints.gridx = 1;
3288
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3289
+// //bigThree.add(cameraPanel, aWindowConstraints);
3290
+// aWindowConstraints.weightx = 0;
3291
+// aWindowConstraints.gridx = 4;
3292
+// aWindowConstraints.gridwidth = 1;
3293
+// // aWindowConstraints.gridheight = 3;
3294
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3295
+// //bigThree.add(XYZPanel, aWindowConstraints);
3296
+// bigThree.validate();
3297
+// scenePanel.setVisible(true);
3298
+// centralPanel.setVisible(false);
3299
+// XYZPanel.setVisible(false);
3300
+ bigThree.ClearUI();
3301
+ bigThree.add(scenePanel);
3302
+ bigThree.FlushUI();
3303
+
3304
+ cameraView.requestFocusInWindow();
27753305 } else
2776
- if (event.getSource() == sixButton)
3306
+ if (source == sixButton)
27773307 {
27783308 radio.layout = sixButton;
2779
- bigThree.remove(scenePanel);
2780
- bigThree.remove(centralPanel);
2781
- bigThree.remove(XYZPanel);
2782
- aWindowConstraints.gridx = 0;
2783
- aWindowConstraints.gridy = 0;
2784
- aWindowConstraints.gridwidth = 1;
2785
- // aConstraints.gridheight = 3;
2786
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2787
- aWindowConstraints.weightx = 0;
2788
- aWindowConstraints.weighty = 1;
2789
- bigThree.add(scenePanel, aWindowConstraints);
2790
- aWindowConstraints.weightx = 1;
2791
- aWindowConstraints.gridwidth = 3;
2792
- // aWindowConstraints.gridheight = 3;
2793
- aWindowConstraints.gridx = 1;
2794
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2795
- bigThree.add(centralPanel, aWindowConstraints);
2796
- aWindowConstraints.weightx = 0;
2797
- aWindowConstraints.gridx = 4;
2798
- aWindowConstraints.gridwidth = 1;
2799
- // aWindowConstraints.gridheight = 3;
2800
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2801
- //bigThree.add(XYZPanel, aConstraints);
2802
- bigThree.revalidate();
3309
+
3310
+ if (CameraPane.FULLSCREEN)
3311
+ fullscreenLayout = radio.layout;
3312
+
3313
+// bigThree.remove(scenePanel);
3314
+// bigThree.remove(centralPanel);
3315
+// bigThree.remove(XYZPanel);
3316
+// aWindowConstraints.gridx = 0;
3317
+// aWindowConstraints.gridy = 0;
3318
+// aWindowConstraints.gridwidth = 1;
3319
+// // aConstraints.gridheight = 3;
3320
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3321
+// aWindowConstraints.weightx = 0;
3322
+// aWindowConstraints.weighty = 1;
3323
+// bigThree.add(scenePanel, aWindowConstraints);
3324
+// aWindowConstraints.weightx = 1;
3325
+// aWindowConstraints.gridwidth = 3;
3326
+// // aWindowConstraints.gridheight = 3;
3327
+// aWindowConstraints.gridx = 1;
3328
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3329
+// bigThree.add(centralPanel, aWindowConstraints);
3330
+// aWindowConstraints.weightx = 0;
3331
+// aWindowConstraints.gridx = 4;
3332
+// aWindowConstraints.gridwidth = 1;
3333
+// // aWindowConstraints.gridheight = 3;
3334
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3335
+// //bigThree.add(XYZPanel, aConstraints);
3336
+// bigThree.validate();
3337
+// scenePanel.setVisible(true);
3338
+// centralPanel.setVisible(true);
3339
+// XYZPanel.setVisible(false);
3340
+ bigThree.ClearUI();
3341
+ bigThree.add(scenePanel);
3342
+ bigThree.add(centralPanel);
3343
+ bigThree.FlushUI();
3344
+
3345
+ cameraView.requestFocusInWindow();
28033346 } else
2804
- if (event.getSource() == sevenButton)
3347
+ if (source == sevenButton)
28053348 {
28063349 radio.layout = sevenButton;
2807
- bigThree.remove(scenePanel);
2808
- bigThree.remove(centralPanel);
2809
- bigThree.remove(XYZPanel);
2810
- aWindowConstraints.gridx = 0;
2811
- aWindowConstraints.gridy = 0;
2812
- aWindowConstraints.gridwidth = 1;
2813
- // aWindowConstraints.gridheight = 3;
2814
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2815
- aWindowConstraints.weightx = 0;
2816
- aWindowConstraints.weighty = 1;
2817
- bigThree.add(scenePanel, aWindowConstraints);
2818
- aWindowConstraints.weightx = 1;
2819
- aWindowConstraints.gridwidth = 3;
2820
- // aWindowConstraints.gridheight = 3;
2821
- aWindowConstraints.gridx = 1;
2822
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2823
- bigThree.add(centralPanel, aWindowConstraints);
2824
- aWindowConstraints.weightx = 0;
2825
- aWindowConstraints.gridx = 4;
2826
- aWindowConstraints.gridwidth = 1;
2827
- // aConstraints.gridheight = 3;
2828
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2829
- bigThree.add(XYZPanel, aWindowConstraints);
2830
- bigThree.revalidate();
3350
+
3351
+ if (CameraPane.FULLSCREEN)
3352
+ fullscreenLayout = radio.layout;
3353
+
3354
+// bigThree.remove(scenePanel);
3355
+// bigThree.remove(centralPanel);
3356
+// bigThree.remove(XYZPanel);
3357
+// aWindowConstraints.gridx = 0;
3358
+// aWindowConstraints.gridy = 0;
3359
+// aWindowConstraints.gridwidth = 1;
3360
+// // aWindowConstraints.gridheight = 3;
3361
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3362
+// aWindowConstraints.weightx = 0;
3363
+// aWindowConstraints.weighty = 1;
3364
+// bigThree.add(scenePanel, aWindowConstraints);
3365
+// aWindowConstraints.weightx = 1;
3366
+// aWindowConstraints.gridwidth = 3;
3367
+// // aWindowConstraints.gridheight = 3;
3368
+// aWindowConstraints.gridx = 1;
3369
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3370
+// bigThree.add(centralPanel, aWindowConstraints);
3371
+// aWindowConstraints.weightx = 0;
3372
+// aWindowConstraints.gridx = 4;
3373
+// aWindowConstraints.gridwidth = 1;
3374
+// // aConstraints.gridheight = 3;
3375
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3376
+// bigThree.add(XYZPanel, aWindowConstraints);
3377
+// bigThree.validate();
3378
+// scenePanel.setVisible(true);
3379
+// centralPanel.setVisible(true);
3380
+// XYZPanel.setVisible(true);
3381
+ bigThree.ClearUI();
3382
+ bigThree.add(scenePanel);
3383
+ bigThree.add(centralPanel);
3384
+ bigThree.add(XYZPanel);
3385
+ bigThree.FlushUI();
3386
+
3387
+ cameraView.requestFocusInWindow();
28313388 } else
2832
- if (event.getSource() == rootButton)
3389
+ if (source == rootButton)
28333390 {
28343391 Object3D obj;
28353392 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2839,66 +3396,84 @@
28393396 EditObject(obj);
28403397 }
28413398
3399
+ cameraView.requestFocusInWindow();
28423400 refreshContents(true);
28433401 } else
2844
- if (event.getSource() == closeButton)
3402
+ if (source == closeButton)
28453403 {
28463404 //System.out.println("CLOSE: " + buttonGroup.getSelection());
28473405 cRadio ab;
28483406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28493407 {
28503408 ab = (cRadio)e.nextElement();
2851
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28523410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
28533417 buttonGroup.remove(ab);
28543418 radioPanel.remove(ab);
28553419
2856
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
28573422 // ab.GetObject().objectUI = null; // ?????????
28583423
28593424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28603425 break;
28613426 }
28623427 }
3428
+
3429
+ cameraView.requestFocusInWindow();
28633430 refreshContents(true);
28643431 } else
2865
- if (event.getSource() == editItem || event.getSource() == editButton)
3432
+ if (source == editItem || source == editButton)
28663433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
28673440 EditSelection(false);
28683441 } else
2869
- if (event.getSource() == uneditButton)
3442
+ if (source == uneditButton)
28703443 {
28713444 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28723445 {
28733446 Object3D child = (Object3D)e.nextElement();
28743447 if(child.editWindow != null)
28753448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
28763450 child.CloseUI();
28773451 listUI.remove(child);
28783452
2879
- child.editWindow = null; // ???????????
3453
+ //child.editWindow = null; // ???????????
28803454 }
2881
- objEditor.ctrlPanel.revalidate();
3455
+ objEditor.ctrlPanel.FlushUI();
28823456 //objEditor.jTree.clearSelection();
28833457 //objEditor.ResetSliders();
28843458 refreshContents(true);
28853459 } else
2886
- if (event.getSource() == clearPanelButton)
3460
+ if (source == clearPanelButton)
28873461 {
28883462 assert(copy == group);
28893463 //copy.ClearUI();
28903464 for (Object3D obj : listUI)
28913465 {
3466
+ obj.pinned = false;
28923467 obj.CloseUI();
28933468 }
28943469 listUI.clear();
28953470 refreshContents(true);
28963471 } else
2897
- if (event.getSource() == allParamsButton)
3472
+ if (source == allParamsButton)
28983473 {
28993474 assert(copy == group);
29003475
2901
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29023477
29033478 for (Object3D obj : listUI)
29043479 {
....@@ -2915,19 +3490,19 @@
29153490
29163491 refreshContents(true);
29173492 } else
2918
- if (event.getSource() == unselectButton)
3493
+ if (source == unselectButton)
29193494 {
29203495 objEditor.jTree.clearSelection();
29213496 // ?? oct 2012 GrafreeD.clipboard.clear();
29223497 objEditor.ResetSliders();
29233498 refreshContents(true);
29243499 } else
2925
- if(event.getSource() instanceof cRadio)
3500
+ if(source instanceof cRadio)
29263501 {
29273502 group.parent = keepparent;
29283503 group.attributes = 0;
29293504 //group.editWindow = null;
2930
- /*cRadio*/ radio = (cRadio)event.getSource();
3505
+ /*cRadio*/ radio = (cRadio)source;
29313506 Object3D obj = radio.GetObject();
29323507 System.out.println("Edit " + obj);
29333508 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2947,6 +3522,9 @@
29473522 }
29483523
29493524 copy = group;
3525
+
3526
+ SetUndoStates();
3527
+
29503528 //Globals.theRenderer.object = group;
29513529 if(!useclient)
29523530 {
....@@ -2962,20 +3540,46 @@
29623540 frontView.object = group;
29633541 sideView.object = group;
29643542 }
2965
- group.editWindow = this;
3543
+
3544
+// fix "+" issue
3545
+ //group.editWindow = this;
3546
+ group.manipWindow = this;
3547
+
29663548 /*
29673549 currentLayout = radio.layout;
29683550 if (currentLayout == null)
29693551 currentLayout = sevenButton;
29703552 */
29713553 radio.layout.doClick();
3554
+
3555
+ ClearUnpinned();
3556
+ Grafreed.Assert(group != null);
3557
+ Grafreed.Assert(group.selection != null);
3558
+ SetPinStates(group.selection.size() > 0);
3559
+ if (group.selection.size() == 1)
3560
+ EditSelection(false);
29723561 keepparent = group.parent;
29733562 // PARENT = NULL or not???
29743563 //group.parent = null; // ROOT
29753564 //group.attributes = -1;
29763565 ResetModel();
3566
+
3567
+ cameraView.requestFocusInWindow();
29773568 refreshContents(true);
2978
- }
3569
+ } else if (event.getSource() == editCameraItem)
3570
+ {
3571
+ cameraView.ProtectCamera();
3572
+ cameraView.repaint();
3573
+ return;
3574
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3575
+ {
3576
+ cameraView.RevertCamera();
3577
+ cameraView.repaint();
3578
+ return;
3579
+ // } else if (event.getSource() == textureButton)
3580
+ // {
3581
+ // return; // true;
3582
+ }
29793583 else
29803584 {
29813585 //return super.action(event, arg);
....@@ -2984,7 +3588,6 @@
29843588 }
29853589
29863590 boolean useclient = false;
2987
- cRadio radio;
29883591
29893592 void ToggleRoot()
29903593 {
....@@ -3036,6 +3639,28 @@
30363639 refreshContents();
30373640 }
30383641
3642
+ void TransformChildren()
3643
+ {
3644
+ Object3D obj;
3645
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3646
+ {
3647
+ obj = (Object3D)e.nextElement();
3648
+ obj.KeepTextureMatrices();
3649
+ obj.TransformChildren();
3650
+ obj.RestoreTextureMatrices();
3651
+
3652
+// if (obj.parent == null)
3653
+// {
3654
+// System.out.println("NULL PARENT!");
3655
+// new Exception().printStackTrace();
3656
+// }
3657
+// else
3658
+// TouchTransform(obj);
3659
+// //obj.parent.Touch();
3660
+ }
3661
+
3662
+ refreshContents();
3663
+ }
30393664
30403665 void ResetTransform()
30413666 {
....@@ -3148,7 +3773,7 @@
31483773 refreshContents();
31493774 }
31503775
3151
- void ResetCentroid()
3776
+ void ResetCentroid(boolean full)
31523777 {
31533778 Object3D obj;
31543779 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3163,12 +3788,16 @@
31633788 LA.matIdentity(Object3D.mat);
31643789 obj.getBounds(minima, maxima, false);
31653790 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3166
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3791
+ if (full)
3792
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31673793 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31683794 obj.TransformMesh(Object3D.mat);
3795
+
31693796 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3170
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3797
+ if (full)
3798
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31713799 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3800
+
31723801 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31733802 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31743803 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3197,7 +3826,8 @@
31973826
31983827 int size = obj.MemorySize();
31993828
3200
- System.err.println((size/1024) + " KB is the size of " + obj);
3829
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3830
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
32013831 }
32023832 }
32033833 catch (Exception e)
....@@ -3234,9 +3864,9 @@
32343864 obj = (Object3D)e.nextElement();
32353865
32363866 System.out.println("Object is: " + obj);
3237
- GrafreeD.AnalyzeObject(obj);
3867
+ Grafreed.AnalyzeObject(obj);
32383868 System.out.println("Boundary rep: " + obj.bRep);
3239
- GrafreeD.AnalyzeObject(obj.bRep);
3869
+ Grafreed.AnalyzeObject(obj.bRep);
32403870
32413871 // System.err.println((size/1024) + " KB is the size of " + obj);
32423872 }
....@@ -3278,6 +3908,13 @@
32783908 void GenNormals(boolean crease)
32793909 {
32803910 group.GenNormalsS(crease);
3911
+
3912
+ refreshContents();
3913
+ }
3914
+
3915
+ void GenNormalsMESH()
3916
+ {
3917
+ group.GenNormalsMeshS();
32813918
32823919 refreshContents();
32833920 }
....@@ -3450,8 +4087,8 @@
34504087
34514088 void ParseVertices()
34524089 {
3453
- boolean epsequal = GrafreeD.epsequal;
3454
- GrafreeD.epsequal = true;
4090
+ boolean epsequal = Grafreed.epsequal;
4091
+ Grafreed.epsequal = true;
34554092
34564093 for (int i=0; i<group.selection.size(); i++)
34574094 {
....@@ -3476,7 +4113,7 @@
34764113 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34774114 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34784115
3479
- g.add(GrafreeD.clipboard);
4116
+ g.add(Grafreed.clipboard);
34804117
34814118 buffer.add(g);
34824119 }
....@@ -3491,7 +4128,7 @@
34914128 makeSomething(buffer, i==group.selection.size()-1);
34924129 }
34934130
3494
- GrafreeD.epsequal = epsequal;
4131
+ Grafreed.epsequal = epsequal;
34954132
34964133 refreshContents();
34974134 }
....@@ -3509,7 +4146,16 @@
35094146 String pigment = Object3D.GetPigment(tex);
35104147 //String bump = Object3D.GetBump(tex);
35114148
3512
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4149
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4150
+
4151
+ try
4152
+ {
4153
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4154
+ }
4155
+ catch (Exception e)
4156
+ {
4157
+ System.err.println("FAIL: " + node);
4158
+ }
35134159
35144160 double s = v.s;
35154161
....@@ -3597,11 +4243,11 @@
35974243
35984244 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35994245
3600
- boolean random = CameraPane.RANDOM;
3601
- CameraPane.RANDOM = false; // parse all random nodes
4246
+ boolean random = CameraPane.SWITCH;
4247
+ CameraPane.SWITCH = false; // parse all random nodes
36024248 lowres.linkVerticesThis(null);
36034249 lowres.linkVerticesThis(sn);
3604
- CameraPane.RANDOM = random;
4250
+ CameraPane.SWITCH = random;
36054251
36064252 System.err.flush();
36074253
....@@ -3641,7 +4287,7 @@
36414287 return;
36424288
36434289 Object3D poses = group.selection.get(0);
3644
- Object3D ref = GrafreeD.clipboard.get(0);
4290
+ Object3D ref = Grafreed.clipboard.get(0);
36454291
36464292 Object3D newgroup = new Object3D("Po:" + poses.name);
36474293
....@@ -3835,9 +4481,9 @@
38354481
38364482 void ClipMesh()
38374483 {
3838
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4484
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38394485 {
3840
- Object3D content = GrafreeD.clipboard.get(0);
4486
+ Object3D content = Grafreed.clipboard.get(0);
38414487
38424488 if (content instanceof cGroup && ((cGroup)content).transientlink )
38434489 content = ((cGroup)content).get(0);
....@@ -3846,7 +4492,7 @@
38464492 // {
38474493 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38484494 // }
3849
- group.selection.ClipMesh(GrafreeD.clipboard);
4495
+ group.selection.ClipMesh(Grafreed.clipboard);
38504496 }
38514497 // group.selection.ClipMesh(GrafreeD.clipboard);
38524498 System.out.println("DONE.");
....@@ -3893,6 +4539,18 @@
38934539 void MarkLeaves(boolean hide)
38944540 {
38954541 group.selection.MarkLeaves(hide);
4542
+ refreshContents();
4543
+ }
4544
+
4545
+ void RewindLeaves(boolean hide)
4546
+ {
4547
+ group.selection.RewindLeaves(hide);
4548
+ refreshContents();
4549
+ }
4550
+
4551
+ void RandomLeaves(boolean hide)
4552
+ {
4553
+ group.selection.RandomLeaves(hide);
38964554 refreshContents();
38974555 }
38984556
....@@ -3967,10 +4625,6 @@
39674625 // }
39684626 // }
39694627
3970
- static boolean allparams = true;
3971
-
3972
- static Vector<Object3D> listUI = new Vector<Object3D>();
3973
-
39744628 void EditSelection(boolean newWindow)
39754629 {
39764630 // aConstraints.gridy = 0;
....@@ -3978,10 +4632,10 @@
39784632 {
39794633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39804634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3981
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39824636
39834637 Object3D elem = (Object3D)group.selection.elementAt(i);
3984
- if(elem != group)
4638
+ if(elem != group || !newWindow)
39854639 {
39864640 // if (!(elem instanceof Composite))
39874641 // newWindow = false;
....@@ -4063,7 +4717,8 @@
40634717 //new Exception().printStackTrace();
40644718
40654719 freezemodel = true;
4066
-
4720
+ ClearUnpinned();
4721
+
40674722 /**/
40684723 //switch (event.id)
40694724 {
....@@ -4071,7 +4726,6 @@
40714726 //case 702: // Event.LIST_DESELECT
40724727 group.deselectAll();
40734728 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4074
- objEditor.ClearInfo(); // .GetMaterial());
40754729 if (tps != null)
40764730 {
40774731 for (int i=0; i < tps.length; i++)
....@@ -4080,33 +4734,39 @@
40804734
40814735 //if (child.parent != null)
40824736 //child.parent.addSelectee(child);
4737
+ objEditor.SetMaterial(child);
40834738 group.addSelectee(child);
4084
- objEditor.SetMaterial(child); // .GetMaterial());
4085
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4086
- System.err.println("info : " + child.GetPath());
40874739 }
40884740 }
4089
- else
4090
- {
4091
- objEditor.SetMaterial(group); // .GetMaterial());
4092
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4093
- System.err.println("info : " + group.GetPath());
4094
- }
4741
+// else
4742
+// {
4743
+// objEditor.SetMaterial(group); // .GetMaterial());
4744
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4745
+// System.err.println("info : " + group.GetPath());
4746
+// }
40954747
4096
- objEditor.SetText(); // jan 2014
4097
-
4098
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4748
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
40994749 CameraPane.flash = true;
41004750
4101
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4751
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
41024752 // a camera
41034753 {
4104
- CameraPane.camerachangeframe = 0; // don't refuse it
4105
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4754
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4755
+ {
4756
+ CameraPane.camerachangeframe = 0; // don't refuse it
4757
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4758
+ }
41064759 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
41074760 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
41084761 }
41094762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
41104770 refreshContents();
41114771 //return true;
41124772 }
....@@ -4115,6 +4775,35 @@
41154775
41164776 freezemodel = false;
41174777 }
4778
+
4779
+ void SetPinStates(boolean enabled)
4780
+ {
4781
+ editButton.setEnabled(enabled);
4782
+ uneditButton.setEnabled(enabled);
4783
+ unselectButton.setEnabled(enabled);
4784
+ flashSelectionButton.setEnabled(enabled);
4785
+ }
4786
+
4787
+ void refreshContents(boolean cp)
4788
+ {
4789
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4790
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
4791
+ {
4792
+ objEditor.ClearInfo(); // .GetMaterial());
4793
+
4794
+ for (int i=0; i < group.selection.Size(); i++)
4795
+ {
4796
+ Object3D child = (Object3D) group.selection.get(i);
4797
+
4798
+ objEditor.AddInfo(child, this, true);
4799
+ System.err.println("info : " + child.GetPath());
4800
+ }
4801
+
4802
+ objEditor.SetText(); // jan 2014
4803
+ }
4804
+
4805
+ super.refreshContents(cp);
4806
+ }
41184807
41194808 void linkSomething(Object3D thing)
41204809 {
....@@ -4186,16 +4875,19 @@
41864875 {
41874876 if (group.selection.isEmpty())
41884877 return;
4189
- GrafreeD.clipboardIsTempGroup = false;
4878
+
4879
+ Grafreed.clipboardIsTempGroup = false;
41904880 Composite tGroup = null;
41914881 if (group.selection.size() > 0) // 1)
41924882 {
41934883 tGroup = new cGroup();
4194
- GrafreeD.clipboardIsTempGroup = true;
4884
+ Grafreed.clipboardIsTempGroup = true;
41954885 }
41964886
41974887 if (cut)
41984888 {
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
41994891 //int indices[] = jList.getSelectedIndices();
42004892 //for (int i = indices.length - 1; i >= 0; i--)
42014893 //jList.remove(indices[i]);
....@@ -4231,16 +4923,16 @@
42314923 //System.out.println("cut " + child);
42324924 //System.out.println("parent = " + child.parent);
42334925 // tmp.addChild(child);
4234
- if (GrafreeD.clipboardIsTempGroup)
4926
+ if (Grafreed.clipboardIsTempGroup)
42354927 tGroup.add/*Child*/(tmp);
42364928 else
4237
- GrafreeD.clipboard = tmp;
4929
+ Grafreed.clipboard = tmp;
42384930 }
42394931 else
4240
- if (GrafreeD.clipboardIsTempGroup)
4932
+ if (Grafreed.clipboardIsTempGroup)
42414933 tGroup.add/*Child*/(child);
42424934 else
4243
- GrafreeD.clipboard = child;
4935
+ Grafreed.clipboard = child;
42444936 }
42454937
42464938 //ResetModel();
....@@ -4272,21 +4964,23 @@
42724964 //System.out.println("cut " + elem);
42734965 //System.out.println("parent = " + elem.parent);
42744966 // tmp.addChild(elem);
4275
- if (GrafreeD.clipboardIsTempGroup)
4967
+ if (Grafreed.clipboardIsTempGroup)
42764968 tGroup.add/*Child*/(tmp);
42774969 else
4278
- GrafreeD.clipboard = tmp;
4970
+ Grafreed.clipboard = tmp;
42794971 }
42804972 else
4281
- if (GrafreeD.clipboardIsTempGroup)
4973
+ if (Grafreed.clipboardIsTempGroup)
42824974 tGroup.add/*Child*/(child);
42834975 else
4284
- GrafreeD.clipboard = child;
4976
+ Grafreed.clipboard = child;
42854977 }
42864978
42874979 }
4288
- if (GrafreeD.clipboardIsTempGroup)
4289
- GrafreeD.clipboard = tGroup;
4980
+
4981
+ if (Grafreed.clipboardIsTempGroup)
4982
+ Grafreed.clipboard = tGroup;
4983
+
42904984 if (cut)
42914985 {
42924986 ResetModel();
....@@ -4296,11 +4990,15 @@
42964990
42974991 void paste(boolean expand)
42984992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
42994997 // if (GrafreeD.clipboard == null)
43004998 // return;
43014999 boolean first = true;
43025000
4303
- if (GrafreeD.clipboardIsTempGroup)
5001
+ if (Grafreed.clipboardIsTempGroup)
43045002 {
43055003 Composite temp;
43065004
....@@ -4311,7 +5009,7 @@
43115009 temp = (Composite)Applet3D.clipboard.deepCopy();
43125010 */
43135011 Object3D elem;
4314
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
5012
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
43155013 {
43165014 Object3D child = (Object3D)e.nextElement();
43175015
....@@ -4345,21 +5043,22 @@
43455043 //Object3D cb = Applet3D.clipboard;
43465044 //temp.addChild(cb);
43475045 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4348
- assert(GrafreeD.clipboard.parent == null);
4349
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4350
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4351
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4352
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
5046
+ assert(Grafreed.clipboard.parent == null);
5047
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
5048
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
5049
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
5050
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
43535051 else
4354
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4355
- GrafreeD.clipboard.get(0).parent = keepparent;
5052
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5053
+ Grafreed.clipboard.get(0).parent = keepparent;
43565054 }
43575055
5056
+ Globals.REPLACEONMAKE = keep;
43585057 ResetModel();
43595058 refreshContents();
43605059 }
43615060
4362
- void pasteInto(boolean copyit)
5061
+ void pasteInto(boolean copyit, boolean clone)
43635062 {
43645063 // if (GrafreeD.clipboard == null)
43655064 // return;
....@@ -4388,15 +5087,22 @@
43885087 if (copyit)
43895088 {
43905089 // paste(false);
4391
- CloneClipboard(false); // sept 2014
5090
+ if (clone)
5091
+ {
5092
+ CloneClipboard(false); // sept 2014
5093
+ }
5094
+ else
5095
+ {
5096
+ paste(false);
5097
+ }
43925098 }
43935099 else
43945100 {
43955101 boolean first = true;
43965102
4397
- if (GrafreeD.clipboardIsTempGroup)
5103
+ if (Grafreed.clipboardIsTempGroup)
43985104 {
4399
- Composite temp = (Composite)GrafreeD.clipboard;
5105
+ Composite temp = (Composite)Grafreed.clipboard;
44005106 Object3D copy;
44015107 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
44025108 {
....@@ -4406,7 +5112,7 @@
44065112 }
44075113 } else
44085114 {
4409
- linkSomething(GrafreeD.clipboard); //.get(0));
5115
+ linkSomething(Grafreed.clipboard); //.get(0));
44105116 }
44115117 }
44125118 }
....@@ -4483,6 +5189,10 @@
44835189
44845190 void group(Object3D csg, boolean grab)
44855191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
44865196 if (//false) // why??
44875197 !group.selection.isEmpty())
44885198 {
....@@ -4596,10 +5306,15 @@
45965306 //node.add(csg);
45975307 //makeSomething(node);
45985308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
45995310 }
46005311
46015312 void Ungroup(Object3D g)
46025313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
46035318 if (g instanceof HiddenObject)
46045319 {
46055320 HiddenObject h = (HiddenObject) g;
....@@ -4616,6 +5331,7 @@
46165331 objEditor.makeSomething(g.get(i), false);
46175332 }
46185333 }
5334
+ Globals.REPLACEONMAKE = keep;
46195335 }
46205336
46215337 void ungroup()
....@@ -4811,21 +5527,6 @@
48115527 }
48125528 */
48135529
4814
- void ImportGFD()
4815
- {
4816
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4817
- browser.show();
4818
- String filename = browser.getFile();
4819
- if (filename != null && filename.length() > 0)
4820
- {
4821
- String fullname = browser.getDirectory() + filename;
4822
-
4823
- //Object3D readobj =
4824
- objEditor.ReadGFD(fullname, objEditor);
4825
- //makeSomething(readobj);
4826
- }
4827
- }
4828
-
48295530 /*
48305531 public void Callback(Object obj)
48315532 {
....@@ -4849,26 +5550,9 @@
48495550 }
48505551 */
48515552
4852
- void ImportVRMLX3D()
4853
- {
4854
- if (GrafreeD.standAlone)
4855
- {
4856
- /**/
4857
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4858
- browser.show();
4859
- String filename = browser.getFile();
4860
- if (filename != null && filename.length() > 0)
4861
- {
4862
- String fullname = browser.getDirectory() + filename;
4863
- LoadVRMLX3D(fullname);
4864
- }
4865
- /**/
4866
- }
4867
- }
4868
-
48695553 String GetFile(String dialogName)
48705554 {
4871
- if (GrafreeD.standAlone)
5555
+ if (Grafreed.standAlone)
48725556 {
48735557 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48745558 browser.show();
....@@ -4932,10 +5616,33 @@
49325616 cButton flashSelectionButton;
49335617 cButton editButton;
49345618 cButton uneditButton;
5619
+ JCheckBox allParamsButton;
49355620 cButton clearpanelButton;
4936
- cButton allParamsButton;
49375621 cButton unselectButton;
49385622
5623
+ cButton restoreCameraButton;
5624
+
5625
+ cButton saveButton;
5626
+ cButton oneStepButton;
5627
+
5628
+ cButton groupButton;
5629
+ cButton ungroupButton;
5630
+ cButton compositeButton;
5631
+ cButton switchButton;
5632
+ cButton loopButton;
5633
+ cButton textureButton;
5634
+
5635
+ cButton gridButton;
5636
+ cButton boxButton;
5637
+ cButton sphereButton;
5638
+ cButton coneButton;
5639
+ cButton torusButton;
5640
+ cButton superButton;
5641
+ cButton kleinButton;
5642
+ cButton particlesButton;
5643
+ cButton overlayButton;
5644
+ cButton lightButton;
5645
+
49395646 cButton screenfitButton;
49405647 cButton screenfitpointButton;
49415648 cButton snapobjectButton;
....@@ -4947,14 +5654,6 @@
49475654
49485655 cButton setsupportButton;
49495656
4950
- cButton twoButton;
4951
- cButton sixButton;
4952
- cButton threeButton;
4953
- cButton sevenButton;
4954
- cButton fourButton; // full panel
4955
- cButton oneButton; // full XYZ
4956
- //cButton currentLayout;
4957
-
49585657 //
49595658 //Composite
49605659 Object3D // to do !!
....@@ -4964,9 +5663,11 @@
49645663 //JTree jTree;
49655664 private MenuItem lookAtItem;
49665665 private MenuItem lookFromItem;
4967
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
49685667 private MenuItem cutItem;
4969
- private MenuItem duplicateItem;
5668
+ private MenuItem undoItem;
5669
+ private MenuItem redoItem;
5670
+ private JMenuItem duplicateItem;
49705671 private MenuItem cloneItem;
49715672 private MenuItem cloneSupportItem;
49725673 private MenuItem overwriteGeoItem;
....@@ -4979,7 +5680,7 @@
49795680 private MenuItem linkverticesItem;
49805681 private MenuItem relinkverticesItem;
49815682 private MenuItem setMasterItem;
4982
- private MenuItem resetMeshItem;
5683
+ private MenuItem resetAllItem;
49835684 private MenuItem stepAllItem;
49845685 private MenuItem revertMeshItem;
49855686 private MenuItem poseMeshItem;
....@@ -4990,6 +5691,7 @@
49905691 private MenuItem mergeGeometriesItem;
49915692 private MenuItem copyItem;
49925693 private MenuItem pasteItem;
5694
+ private MenuItem pasteIntoItem;
49935695 private MenuItem pasteLinkItem;
49945696 private MenuItem pasteCloneItem;
49955697 private MenuItem pasteExpandItem;
....@@ -5028,6 +5730,10 @@
50285730 private MenuItem showleavesItem;
50295731 private MenuItem markleavesItem;
50305732 private MenuItem unmarkleavesItem;
5733
+ private MenuItem rewindleavesItem;
5734
+ private MenuItem unrewindleavesItem;
5735
+ private MenuItem randomleavesItem;
5736
+ private MenuItem unrandomleavesItem;
50315737
50325738 private MenuItem flipVItem;
50335739 private MenuItem unflipVItem;
....@@ -5039,15 +5745,17 @@
50395745 private MenuItem panoTexturesItem;
50405746
50415747 private MenuItem resetCentroidItem;
5042
- private MenuItem transformgeometryItem;
5748
+ private MenuItem resetCentroidXZItem;
50435749 private MenuItem resetTransformItem;
5750
+ private MenuItem transformGeometryItem;
5751
+ private MenuItem transformChildrenItem;
50445752 private MenuItem hideItem;
50455753 private MenuItem grabItem;
50465754 private MenuItem backItem;
50475755 private MenuItem frontItem;
50485756 private MenuItem cameraItem;
50495757 private MenuItem compositeItem;
5050
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
50515759 private MenuItem physicsItem;
50525760 private MenuItem frameselectorItem;
50535761 private MenuItem scriptNodeItem;
....@@ -5087,7 +5795,7 @@
50875795 private MenuItem blobItem;
50885796 private MenuItem latheItem;
50895797 private MenuItem bezierItem;
5090
- private MenuItem checkerItem;
5798
+ private MenuItem overlayItem;
50915799 private MenuItem meshItem;
50925800 // private MenuItem meshGroupItem;
50935801 private MenuItem springItem;
....@@ -5109,11 +5817,6 @@
51095817 private MenuItem doubleItem;
51105818 private MenuItem tripleItem;
51115819
5112
- private MenuItem importGFDItem;
5113
- private MenuItem importVRMLX3DItem;
5114
- private MenuItem import3DSItem;
5115
- private MenuItem importOBJItem;
5116
-
51175820 private MenuItem computeAOItem;
51185821 private MenuItem recompileItem;
51195822 private MenuItem editScriptItem;
....@@ -5123,4 +5826,8 @@
51235826 private MenuItem analyzeItem;
51245827 private MenuItem dumpItem;
51255828 //boolean freezemodel = false;
5829
+
5830
+ Menu cameraMenu;
5831
+ MenuItem editCameraItem;
5832
+ MenuItem restoreCameraItem;
51265833 }