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,153 +599,230 @@
433599 oe.radioPanel.add(dummyButton);
434600 oe.buttonGroup.add(dummyButton);
435601 */
436
- aConstraints.gridy += 1;
437
- oe.aConstraints.gridwidth = 1;
438
- oe.aConstraints.gridx = 0;
602
+ cGridBag copyOptionsPanel = new cGridBag();
603
+
604
+ copyOptionsPanel.preferredHeight = 1;
439605
440
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
606
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
607
+
608
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ //minButton.setToolTipText("Minimize window");
610
+ //minButton.addActionListener(this);
611
+
612
+ if (Globals.ADVANCED)
613
+ {
614
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ maxButton.setToolTipText("Maximize window");
616
+ maxButton.addActionListener(this);
617
+ }
618
+
619
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
+ fullButton.setToolTipText("Full-screen window");
621
+ fullButton.addActionListener(this);
622
+
623
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
+ screenfitButton.setToolTipText("Screen fit");
625
+ screenfitButton.addActionListener(this);
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");
441660 liveCB.addItemListener(this);
442661
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
445
- supportCB.addItemListener(this);
446
-
447
- // oe.aConstraints.gridx += 1;
448
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
449
- // localCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
453
- crowdCB.addItemListener(this);
454
-
455
- oe.aConstraints.gridx += 1;
456
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
457
- smoothCB.addItemListener(this);
458
-
459
- oe.aConstraints.gridx += 1;
460
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
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");
461668 fastCB.addItemListener(this);
462
- oe.aConstraints.gridx += 1;
463
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
464
- slowCB.addItemListener(this);
465
- oe.aConstraints.gridx += 1;
466
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
467
- boxCB.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);
468675
469
-// oe.aConstraints.gridx += 1;
470
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
471
-// speakerMocapCB.addItemListener(this);
472
-
473
- if (false)
474
- {
475
- // handled in scripts
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
478
- speakerCameraCB.addItemListener(this);
479
-
480
- oe.aConstraints.gridx += 1;
481
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
482
- speakerFocusCB.addItemListener(this);
483
-
484
- oe.aConstraints.gridx += 1;
485
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
486
- smoothfocusCB.addItemListener(this);
487
- }
488
-
489
-//oe.aConstraints.gridx += 1;
490
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
491
-// debugCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
495
- oeilCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
499
- lookAtCB.addItemListener(this);
500
-
501
- oe.aConstraints.gridx += 1;
502
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
503
- trackCB.addItemListener(this);
504
-
505
- oe.aConstraints.gridx += 1;
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
507
- screenfitButton.addActionListener(this);
508
- oe.aConstraints.gridx += 1;
509676 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
510677 // screenfitpointButton.addActionListener(this);
511
-// oe.aConstraints.gridx += 1;
512
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
513
- snapobjectButton.addActionListener(this);
514
- oe.aConstraints.gridx += 1;
515678
516
- //aConstraints.gridx = 0;
517
- //aConstraints.gridy += 1;
518
- oe.aConstraints.weighty = 0;
519
- oe.aConstraints.gridwidth = 1;
520
-
521
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
522
- 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));
523687
524
- oe.toolbarPanel.add(new cButton(" ", false));
525
-
526
- oe.aConstraints.gridx += 1;
527
- oe.aConstraints.weighty = 0;
528
- oe.aConstraints.gridwidth = 1;
529
-
530
- //
531
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
688
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
689
+ twoButton.setToolTipText("Show center view only");
532690 twoButton.addActionListener(this);
533
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
691
+ this.fullscreenLayout = twoButton;
692
+
693
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
534694 fourButton.addActionListener(this);
535
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
695
+ fourButton.setToolTipText("Show left panel only");
696
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697
+ sixButton.setToolTipText("2-column layout left");
536698 sixButton.addActionListener(this);
537
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
699
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
700
+ threeButton.setToolTipText("2-column layout right");
538701 threeButton.addActionListener(this);
539
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
702
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+ sevenButton.setToolTipText("3-column layout");
540704 sevenButton.addActionListener(this);
541705 //
542706
543
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
707
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ rootButton.setToolTipText("Edit selection in new tab");
544709 rootButton.addActionListener(this);
545
- oe.aConstraints.gridx += 1;
546
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
710
+
711
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
712
+ closeButton.setToolTipText("Close tab");
547713 closeButton.addActionListener(this);
548714 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
549715 //clearButton.addActionListener(this);
550
- oe.aConstraints.gridx += 1;
551
-
552
- oe.aConstraints.gridx = 1; //
553
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
554
- editButton.addActionListener(this);
555
- oe.aConstraints.gridx += 1;
556
- oe.aConstraints.weighty = 0;
557
- oe.aConstraints.gridwidth = 1;
558716
559
- 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");
560802 uneditButton.addActionListener(this);
561803
562
- oe.aConstraints.gridx += 1;
563
- oe.aConstraints.weighty = 0;
564
- oe.aConstraints.gridwidth = 1;
565
-
566
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
567
- clearPanelButton.addActionListener(this);
568
-
569
- oe.aConstraints.gridx += 1;
570
- oe.aConstraints.weighty = 0;
571
- oe.aConstraints.gridwidth = 1;
572
-
573
- 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");
574806 allParamsButton.addActionListener(this);
575807
576
- oe.aConstraints.gridx += 1;
577
- oe.aConstraints.weighty = 0;
578
- oe.aConstraints.gridwidth = 1;
579
-
580
- 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");
581814 unselectButton.addActionListener(this);
582815
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
+
583826 // oe.aConstraints.gridx += 1;
584827 // oe.aConstraints.weighty = 0;
585828 // oe.aConstraints.gridwidth = 1;
....@@ -591,40 +834,25 @@
591834 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
592835 // gcButton.addActionListener(this);
593836
594
- oe.aConstraints.gridx = 0;
595
- oe.aConstraints.gridy += 1;
596
-
597
- //ctrlPanel.add(objList = new List(5, true));
598
- oe.aConstraints.gridwidth = 100;
599
- // oe.aConstraints.gridheight = 100;
600
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
601
- oe.aConstraints.gridheight = 1;
602
- oe.aConstraints.weighty = 0.5;
603
- oe.aConstraints.gridx = 0;
604
- JScrollPane jSP;
837
+ cGridBag jSPPanel = new cGridBag();
838
+
839
+ JScrollPane jSP;
605840 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
606
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
841
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
607842 ResetModel();
608
- oe.aConstraints.weighty = 0.5;
609
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
610
- oe.aConstraints.gridy += 1;
611
- oe.aConstraints.gridwidth = 1;
612
-
613
- oe.aConstraints.weighty = 0;
614
- oe.aConstraints.gridwidth = 2;
615
-
616
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
617
- colorCB.addItemListener(this);
618
- oe.aConstraints.gridx += 2;
619
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
620
- materialCB.addItemListener(this);
621
- oe.aConstraints.gridx += 2;
622
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
623
- textureCB.addItemListener(this);
624
-
625
- oe.aConstraints.gridx = 0;
626
- oe.aConstraints.gridy += 1;
627843
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
+
628856 //jList.addListSelectionListener(this);
629857 oe.jTree.addTreeSelectionListener(this);
630858 //jTree.setRootVisible(false);
....@@ -646,10 +874,144 @@
646874 radio.layout = sevenButton;
647875 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
648876 }
877
+
878
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
879
+ {
880
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
881
+ colorCB.setToolTipText("Copy color when dropped");
882
+ colorCB.addItemListener(this);
883
+
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
+
912
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
913
+ // localCB.addItemListener(this);
914
+
915
+ panel.Return();
916
+
917
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
918
+ crowdCB.setToolTipText("Used for crowds");
919
+ crowdCB.addItemListener(this);
920
+
921
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
922
+ smoothCB.setToolTipText("Snapping delay");
923
+ smoothCB.addItemListener(this);
924
+
925
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
926
+ slowCB.setToolTipText("Smooth interpolation");
927
+ slowCB.addItemListener(this);
928
+
929
+// constraints.gridy += 1;
930
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
931
+// speakerMocapCB.addItemListener(this);
932
+
933
+ panel.Return();
934
+
935
+ if (false)
936
+ {
937
+ // handled in scripts
938
+ //constraints.gridy += 1;
939
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
940
+ speakerCameraCB.addItemListener(this);
941
+
942
+ //constraints.gridy += 1;
943
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
944
+ speakerFocusCB.addItemListener(this);
945
+
946
+ //constraints.gridy += 1;
947
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
948
+ smoothfocusCB.addItemListener(this);
949
+ panel.Return();
950
+ }
951
+
952
+//constraints.gridx += 1;
953
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
954
+// debugCB.addItemListener(this);
955
+
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");
962
+ oeilCB.addItemListener(this);
963
+
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);
985
+ lookAtCB.setToolTipText("Look-at target");
986
+ 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);
1001
+
1002
+ }
6491003
6501004 void EditObject(Object3D obj)
6511005 {
6521006 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
+
6531015 radioButton.SetObject(obj);
6541016 radioButton.layout = sevenButton;
6551017 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -658,8 +1020,11 @@
6581020 buttonGroup.add(radioButton);
6591021 radioButton.doClick();
6601022 }
1023
+
6611024 void SetupViews(ObjEditor oe)
6621025 {
1026
+ theFrame = this;
1027
+
6631028 oe.SetupViews();
6641029
6651030 System.out.println("SetupViews");
....@@ -668,22 +1033,28 @@
6681033 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
6691034 }
6701035
671
- JCheckBox liveCB;
672
- JCheckBox supportCB;
673
- JCheckBox localCB;
674
- JCheckBox crowdCB;
675
- JCheckBox smoothCB;
676
- JCheckBox fastCB;
677
- JCheckBox slowCB;
678
- JCheckBox boxCB;
679
- JCheckBox trackCB;
680
- 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;
6811049 // JCheckBox speakerMocapCB;
682
- JCheckBox speakerCameraCB;
683
- JCheckBox speakerFocusCB;
684
- JCheckBox debugCB;
685
- JCheckBox oeilCB;
686
- JCheckBox lookAtCB;
1050
+ cCheckBox speakerCameraCB;
1051
+ cCheckBox speakerFocusCB;
1052
+ cCheckBox debugCB;
1053
+
1054
+ cCheckBox oeilCB;
1055
+ cCheckBox shadowCB;
1056
+ cCheckBox autokeepCB;
1057
+ cCheckBox lookAtCB;
6871058
6881059 // static int COLOR = 1;
6891060 // static int MATERIAL = 2;
....@@ -691,9 +1062,9 @@
6911062
6921063 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6931064
694
- JCheckBox colorCB;
695
- JCheckBox materialCB;
696
- JCheckBox textureCB;
1065
+ cCheckBox colorCB;
1066
+ cCheckBox materialCB;
1067
+ cCheckBox textureCB;
6971068
6981069 public void itemStateChanged(ItemEvent e)
6991070 {
....@@ -721,6 +1092,7 @@
7211092 } else if(e.getSource() == liveCB)
7221093 {
7231094 cameraView.ToggleLive();
1095
+ refreshContents(false);
7241096 }
7251097 else if(e.getSource() == supportCB)
7261098 {
....@@ -756,6 +1128,10 @@
7561128 cameraView.repaint();
7571129 // refreshContents();
7581130 }
1131
+ else if(e.getSource() == zoomBoxCB)
1132
+ {
1133
+ cameraView.ToggleZoomBoxMode();
1134
+ }
7591135 else if(e.getSource() == smoothfocusCB)
7601136 {
7611137 cameraView.ToggleSmoothFocus();
....@@ -781,6 +1157,18 @@
7811157 {
7821158 cameraView.ToggleOeil();
7831159 }
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
+ }
7841172 else if(e.getSource() == lookAtCB)
7851173 {
7861174 cameraView.ToggleLookAt();
....@@ -797,7 +1185,8 @@
7971185
7981186 /**/
7991187 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
800
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1188
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1189
+ TreePath path = objEditor.jTree.getSelectionPath();
8011190 if ((path == null) || (path.getPathCount() <= 1)) {
8021191 // We can't move the root node or an empty selection
8031192 return;
....@@ -860,8 +1249,6 @@
8601249 }
8611250 }
8621251
863
- String string = (String) object;
864
-
8651252 System.out.println("Transfer = " + object + "; drop : " + target);
8661253 // if( object instanceof java.io.File[])
8671254 // {
....@@ -869,7 +1256,11 @@
8691256 // objEditor.DropFile((java.io.File[]) object, true);
8701257 // return;
8711258 // }
872
- 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) == ':')
8731264 {
8741265 // file(s)
8751266 String[] names = string.split("\n");
....@@ -896,7 +1287,7 @@
8961287
8971288 flashIt = false;
8981289 CameraPane pane = (CameraPane) target;
899
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1290
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9001291 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9011292
9021293 if (group.selection.size() == 1)
....@@ -912,23 +1303,33 @@
9121303
9131304 assert target == objEditor.jTree;
9141305 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1306
+ Object3D destinationLeaf;
9151307 try {
916
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1308
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9171309 } catch (Exception e) {
9181310 System.out.println("destinationPath : " + destinationPath);
9191311 return;
9201312 }
9211313
922
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1314
+ for (int i=group.selection.size(); --i>=0;)
9231315 {
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
+// {
9241325 loadClipboard(true);
9251326 objEditor.jTree.setSelectionPath(destinationPath);
926
- pasteInto(false);
927
- } else {
928
- loadClipboard(false);
929
- objEditor.jTree.setSelectionPath(destinationPath);
930
- pasteInto(false); // true); // ???
931
- }
1327
+ pasteInto(false, false);
1328
+// } else {
1329
+// loadClipboard(false);
1330
+// objEditor.jTree.setSelectionPath(destinationPath);
1331
+// pasteInto(false, false); // true); // ???
1332
+// }
9321333 }
9331334 public void dropActionChanged(DropTargetDragEvent dtde)
9341335 // Called if the user has modified the current drop gesture
....@@ -1033,85 +1434,107 @@
10331434 {
10341435 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10351436 //heightFieldItem.addActionListener(this);
1036
- gridItem = menu.add(new MenuItem("Grid"));
1037
- gridItem.addActionListener(this);
1038
- rectoidItem = menu.add(new MenuItem("Box"));
1039
- rectoidItem.addActionListener(this);
1040
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1041
- ellipsoidItem.addActionListener(this);
1042
- coneItem = menu.add(new MenuItem("Cone"));
1043
- coneItem.addActionListener(this);
1044
- torusItem = menu.add(new MenuItem("Torus"));
1045
- torusItem.addActionListener(this);
1046
- superItem = menu.add(new MenuItem("Superellipsoid"));
1047
- 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
+ {
10481455 kleinItem = menu.add(new MenuItem("Klein Bottle"));
10491456 kleinItem.addActionListener(this);
1050
- particleItem = menu.add(new MenuItem("Particle system"));
1051
- particleItem.addActionListener(this);
1457
+ }
1458
+
1459
+// particleItem = menu.add(new MenuItem("Particle system"));
1460
+// particleItem.addActionListener(this);
1461
+ if (Globals.ADVANCED)
1462
+ {
10521463 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10531464 ragdollItem.addActionListener(this);
10541465 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10551466 ragdoll2Item.addActionListener(this);
1467
+ }
10561468 menu.add("-");
1057
- meshItem = menu.add(new MenuItem("Mesh"));
1469
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10581470 meshItem.addActionListener(this);
10591471 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10601472 // meshGroupItem.addActionListener(this);
1473
+ if (Globals.ADVANCED)
1474
+ {
10611475 springItem = menu.add(new MenuItem("Spring"));
10621476 springItem.addActionListener(this);
10631477 flagItem = menu.add(new MenuItem("Flag"));
10641478 flagItem.addActionListener(this);
1065
- bezierItem = menu.add(new MenuItem("Patch"));
1066
- bezierItem.addActionListener(this);
1067
- checkerItem = menu.add(new MenuItem("Checker"));
1068
- checkerItem.addActionListener(this);
10691479 blobItem = menu.add(new MenuItem("Blob"));
10701480 blobItem.addActionListener(this);
10711481 latheItem = menu.add(new MenuItem("Lathe"));
10721482 latheItem.addActionListener(this);
1073
- lightItem = menu.add(new MenuItem("Light"));
1074
- 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);
10751490 menu.add("-");
10761491 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10771492 //superLoopItem.addActionListener(this);
1078
- loopItem = menu.add(new MenuItem("Loop"));
1079
- loopItem.addActionListener(this);
1493
+// loopItem = menu.add(new MenuItem("Loop"));
1494
+// loopItem.addActionListener(this);
10801495 doubleItem = menu.add(new MenuItem("Fork"));
10811496 doubleItem.addActionListener(this);
1497
+ if (Globals.ADVANCED)
1498
+ {
10821499 tripleItem = menu.add(new MenuItem("Trident"));
10831500 tripleItem.addActionListener(this);
1501
+ }
10841502 }
10851503
10861504 void buildToolsMenu(Menu menu)
10871505 {
10881506 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10891507 animationItem.addItemListener(this);
1090
- animationItem.setState(CameraPane.ANIMATION);
1508
+ animationItem.setState(Globals.ANIMATION);
1509
+
1510
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1511
+ archiveItem.addActionListener(this);
10911512
10921513 menu.add("-");
10931514 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10941515 parseverticesItem.addActionListener(this);
10951516 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10961517 textureFieldItem.addActionListener(this);
1097
- alignItem = menu.add(new MenuItem("Align"));
1518
+ alignItem = menu.add(new MenuItem("Align Objects"));
10981519 alignItem.addActionListener(this);
1099
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1100
- mirrorItem.addActionListener(this);
11011520 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
11021521 reduceMorphItem.addActionListener(this);
11031522 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11041523 reduce34MorphItem.addActionListener(this);
1105
-
1106
- menu.add(computeAOItem = new MenuItem("Compute AO"));
1107
- computeAOItem.addActionListener(this);
11081524 menu.add("-");
1109
-
11101525 menu.add(memoryItem = new MenuItem("Memory Usage"));
11111526 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("-");
11121535 menu.add(analyzeItem = new MenuItem("Analyze"));
11131536 analyzeItem.addActionListener(this);
1114
- menu.add(dumpItem = new MenuItem("Dump"));
1537
+ menu.add(dumpItem = new MenuItem("Print"));
11151538 dumpItem.addActionListener(this);
11161539 // menu.add(pathItem = new MenuItem("From-to path"));
11171540 // pathItem.addActionListener(this);
....@@ -1129,6 +1552,7 @@
11291552 menu.add("-");
11301553 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11311554 editScriptItem.addActionListener(this);
1555
+ }
11321556 }
11331557
11341558 void ScreenFit()
....@@ -1251,9 +1675,24 @@
12511675 shadow.material = new cMaterial(obj.material);
12521676 shadow.material.diffuse = 0.0001f;
12531677 shadow.material.specular = 0.0001f;
1678
+ //shadow.projectedVertices[1].x = 300;
12541679
12551680 makeSomething(shadow);
12561681 }
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
+ }
12571696
12581697 /**
12591698 * applyExample
....@@ -1457,9 +1896,9 @@
14571896
14581897 void Overwrite(int mask)
14591898 {
1460
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1899
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14611900 {
1462
- Object3D content = GrafreeD.clipboard.get(0);
1901
+ Object3D content = Grafreed.clipboard.get(0);
14631902
14641903 if (content instanceof cGroup && ((cGroup)content).transientlink )
14651904 content = ((cGroup)content).get(0);
....@@ -1482,6 +1921,7 @@
14821921 //
14831922 public void actionPerformed(ActionEvent event) // , Object arg)
14841923 {
1924
+ Object source = event.getSource();
14851925 /*
14861926 if (event.getSource() == nameField)
14871927 {
....@@ -1493,11 +1933,11 @@
14931933 }
14941934 else
14951935 */
1496
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1936
+ if (source == lookAtItem || source == lookFromItem)
14971937 {
14981938 ScreenFit();
14991939 } else
1500
- if (event.getSource() == switchItem)
1940
+ if (source == switchViewItem)
15011941 {
15021942 cVector v1 = new cVector();
15031943 cVector v2 = new cVector();
....@@ -1506,11 +1946,11 @@
15061946 objEditor.cameraView.renderCamera.setAim(v2, v1);
15071947 objEditor.cameraView.repaint();
15081948 } else
1509
- if (event.getSource() == rectoidItem)
1949
+ if (source == rectoidItem || source == boxButton)
15101950 {
15111951 makeSomething(new Box());
15121952 } else
1513
- if (event.getSource() == particleItem)
1953
+ if (source == particleItem || source == particlesButton)
15141954 {
15151955 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15161956 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1531,9 +1971,9 @@
15311971 applyExample(particleGeom, "SMOKE");
15321972 makeSomething(particleGeom);
15331973 } else
1534
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1974
+ if (source == ragdollItem || source == ragdoll2Item)
15351975 {
1536
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1976
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15371977
15381978 ragdoll.toParent = LA.newMatrix();
15391979 ragdoll.fromParent = LA.newMatrix();
....@@ -1551,7 +1991,7 @@
15511991 } else
15521992 /*
15531993 */
1554
- if (event.getSource() == heightFieldItem)
1994
+ if (source == heightFieldItem)
15551995 {
15561996 Object3D obj = new Object3D();
15571997
....@@ -1589,31 +2029,31 @@
15892029
15902030 makeSomething(obj);
15912031 } else
1592
- if (event.getSource() == gridItem)
2032
+ if (source == gridItem || source == gridButton)
15932033 {
15942034 makeSomething(new Grid());
15952035 } else
1596
- if (event.getSource() == ellipsoidItem)
2036
+ if (source == ellipsoidItem || source == sphereButton)
15972037 {
15982038 makeSomething(new Sphere());
15992039 } else
1600
- if (event.getSource() == coneItem)
2040
+ if (source == coneItem || source == coneButton)
16012041 {
16022042 makeSomething(new Cone());
16032043 } else
1604
- if (event.getSource() == torusItem)
2044
+ if (source == torusItem || source == torusButton)
16052045 {
16062046 makeSomething(new Torus());
16072047 } else
1608
- if (event.getSource() == superItem)
2048
+ if (source == superItem || source == superButton)
16092049 {
16102050 makeSomething(new Superellipsoid());
16112051 } else
1612
- if (event.getSource() == kleinItem)
2052
+ if (source == kleinItem || source == kleinButton)
16132053 {
16142054 makeSomething(new Klein());
16152055 } else
1616
- if (event.getSource() == blobItem)
2056
+ if (source == blobItem)
16172057 {
16182058 Blob blob = new Blob();
16192059 BlobComponent comp = new BlobComponent();
....@@ -1621,15 +2061,15 @@
16212061 //blob.retile();
16222062 makeSomething(blob);
16232063 } else
1624
- if (event.getSource() == latheItem)
2064
+ if (source == latheItem)
16252065 {
16262066 makeSomething(new Lathe());
16272067 } else
1628
- if (event.getSource() == bezierItem)
2068
+ if (source == bezierItem)
16292069 {
16302070 makeSomething(new BezierSurface());
16312071 } else
1632
- if (event.getSource() == checkerItem)
2072
+ if (source == overlayItem || source == overlayButton)
16332073 {
16342074 /*
16352075 Object3D obj = new BezierSurface(5,8);
....@@ -1644,7 +2084,7 @@
16442084 */
16452085 makeSomething(new Checker());
16462086 } else
1647
- if (event.getSource() == meshItem)
2087
+ if (source == meshItem)
16482088 {
16492089 Object3D itemtomake = new Object3D();
16502090 Object3D child;
....@@ -1665,35 +2105,35 @@
16652105 makeSomething(child);
16662106 }
16672107 } else
1668
- if (event.getSource() == springItem)
2108
+ if (source == springItem)
16692109 {
16702110 cSpring s = new cSpring();
16712111 s.setup();
16722112 makeSomething(s);
16732113 } else
1674
- if (event.getSource() == flagItem)
2114
+ if (source == flagItem)
16752115 {
16762116 cSpring s = new cFlag();
16772117 s.setup();
16782118 makeSomething(s);
16792119 } else
1680
- if (event.getSource() == lightItem)
2120
+ if (source == lightItem || source == lightButton)
16812121 {
16822122 makeSomething(new Light());
16832123 } else
1684
- if (event.getSource() == csgItem)
2124
+ if (source == csgItem)
16852125 {
16862126 group(new CSG());
16872127 } else
1688
- if (event.getSource() == templateItem)
2128
+ if (source == templateItem)
16892129 {
16902130 group(new cTemplate());
16912131 } else
1692
- if (event.getSource() == attributeItem)
2132
+ if (source == attributeItem)
16932133 {
16942134 makeSomething(new Attribute());
16952135 } else
1696
- if (event.getSource() == pointflowItem)
2136
+ if (source == pointflowItem)
16972137 {
16982138 makeSomething(new PointFlow());
16992139 } else
....@@ -1705,7 +2145,7 @@
17052145 } else
17062146 */
17072147
1708
- if (event.getSource() == superLoopItem)
2148
+ if (source == superLoopItem)
17092149 {
17102150 Composite g = new cGroup();
17112151 for (int i=0; i<15; i++)
....@@ -1727,30 +2167,30 @@
17272167
17282168 group(g);
17292169 } else
1730
- if (event.getSource() == loopItem)
2170
+ if (source == loopItem || source == loopButton)
17312171 {
17322172 Composite csg = new GroupLeaf();
17332173 csg.count = 5;
17342174 group(csg);
1735
- Composite child = new cGroup();
2175
+ Composite child = new cGroup("Branch");
17362176 csg.addChild(child);
17372177 child.addChild(csg);
17382178 } else
1739
- if (event.getSource() == doubleItem)
2179
+ if (source == doubleItem)
17402180 {
1741
- Composite csg = new GroupLeaf();
2181
+ Composite csg = new GroupLeaf("Fork");
17422182 csg.count = 5;
17432183 group(csg);
1744
- Composite child = new cGroup();
2184
+ Composite child = new cGroup("Branch A");
17452185 csg.addChild(child);
17462186 child.addChild(csg);
1747
- child = new cGroup();
2187
+ child = new cGroup("Branch B");
17482188 csg.addChild(child);
17492189 child.addChild(csg);
17502190 } else
1751
- if (event.getSource() == tripleItem)
2191
+ if (source == tripleItem)
17522192 {
1753
- Composite csg = new GroupLeaf();
2193
+ Composite csg = new GroupLeaf("Trident");
17542194 csg.count = 4;
17552195 group(csg);
17562196 Composite child = new cGroup();
....@@ -1763,73 +2203,98 @@
17632203 csg.addChild(child);
17642204 child.addChild(csg);
17652205 } else
1766
-
1767
- if (event.getSource() == importGFDItem)
2206
+ if (source == computeAOItem)
17682207 {
1769
- ImportGFD();
2208
+ Globals.drawMode = CameraPane.OCCLUSION;
2209
+ Globals.theRenderer.repaint();
17702210 } else
1771
- if (event.getSource() == importVRMLX3DItem)
1772
- {
1773
- ImportVRMLX3D();
1774
- } else
1775
- if (event.getSource() == import3DSItem)
1776
- {
1777
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1778
- } else
1779
- if (event.getSource() == importOBJItem)
1780
- {
1781
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1782
- } else
1783
- if (event.getSource() == computeAOItem)
1784
- {
1785
- CameraPane.drawMode = CameraPane.OCCLUSION;
1786
- CameraPane.theRenderer.repaint();
1787
- } else
1788
- if (event.getSource() == recompileItem)
2211
+ if (source == recompileItem)
17892212 {
17902213 Recompile();
17912214 refreshContents();
17922215 } else
1793
- if (event.getSource() == editScriptItem)
2216
+ if (source == editScriptItem)
17942217 {
17952218 OpenDialog();
17962219 refreshContents();
17972220 } else
1798
- if (event.getSource() == invariantsItem)
2221
+ if (source == invariantsItem)
17992222 {
18002223 System.out.println("Invariants:");
1801
- GrafreeD.grafreeD.universe.invariants();
2224
+ Grafreed.grafreeD.universe.invariants();
18022225 } else
1803
- if (event.getSource() == memoryItem)
2226
+ if (source == memoryItem)
18042227 {
18052228 //System.out.println("Invariants:");
18062229 PrintMemory();
18072230 } else
1808
- if (event.getSource() == pathItem)
2231
+ if (source == pathItem)
18092232 {
18102233 PrintPath();
18112234 } else
1812
- if (event.getSource() == analyzeItem)
2235
+ if (source == analyzeItem)
18132236 {
18142237 AnalyzeObject();
18152238 } else
1816
- if (event.getSource() == dumpItem)
2239
+ if (source == dumpItem)
18172240 {
18182241 DumpObject();
18192242 } else
1820
- if (event.getSource() == screenfitButton)
2243
+ if (source == minButton)
18212244 {
1822
- //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
+ {
18232290 ScreenFit();
18242291 } else
1825
- if (event.getSource() == screenfitpointButton)
2292
+ if (source == screenfitpointButton)
18262293 {
1827
- //Reload(lastConverter, lastFilename, true);
18282294 ScreenFitPoint();
18292295 } else
1830
- if (event.getSource() == snapobjectButton)
2296
+ if (source == snapobjectButton)
18312297 {
1832
- //Reload(lastConverter, lastFilename, true);
18332298 SnapObject();
18342299 } else
18352300 // if (event.getSource() == recompileButton)
....@@ -1838,13 +2303,13 @@
18382303 // Recompile();
18392304 // refreshContents();
18402305 // } else
1841
- if (event.getSource() == gcButton)
2306
+ if (source == gcButton)
18422307 {
18432308 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18442309 System.gc();
18452310 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18462311 } else
1847
- if (event.getSource() == editLeafItem)
2312
+ if (source == editLeafItem)
18482313 {
18492314 Object3D obj;
18502315 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1858,62 +2323,74 @@
18582323 }
18592324 refreshContents(true);
18602325 } else
1861
- if (event.getSource() == openWindowItem)
2326
+ if (source == openWindowItem)
18622327 {
18632328 EditSelection(true);
18642329 } else
1865
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2330
+ if (source == cutItem || source == clearButton)
18662331 {
18672332 loadClipboard(true);
18682333 } else
1869
- if (event.getSource() == duplicateItem)
2334
+ if (source == undoItem)
18702335 {
1871
- 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;
18722345 loadClipboard(false);
18732346 paste(false);
1874
- GrafreeD.clipboard = keep;
2347
+ Grafreed.clipboard = keep;
18752348 } else
1876
- if (event.getSource() == cloneItem)
2349
+ if (source == cloneItem)
18772350 {
18782351 CloneSelection(false);
18792352 } else
1880
- if (event.getSource() == cloneSupportItem)
2353
+ if (source == cloneSupportItem)
18812354 {
18822355 CloneSelection(true);
18832356 } else
1884
- if (event.getSource() == copyItem)
2357
+ if (source == copyItem)
18852358 {
18862359 loadClipboard(false);
18872360 } else
1888
- if (event.getSource() == pasteItem)
2361
+ if (source == pasteItem)
18892362 {
18902363 paste(false);
18912364 } else
1892
- if (event.getSource() == pasteLinkItem)
2365
+ if (source == pasteIntoItem)
18932366 {
1894
- pasteInto(false);
2367
+ pasteInto(true, false);
18952368 } else
1896
- if (event.getSource() == pasteCloneItem)
2369
+ if (source == pasteLinkItem)
18972370 {
1898
- pasteInto(true);
2371
+ pasteInto(false, false);
18992372 } else
1900
- if (event.getSource() == pasteExpandItem)
2373
+ if (source == pasteCloneItem)
2374
+ {
2375
+ pasteInto(true, true);
2376
+ } else
2377
+ if (source == pasteExpandItem)
19012378 {
19022379 paste(true);
19032380 } else
1904
- if (event.getSource() == synchronizeItem)
2381
+ if (source == synchronizeItem)
19052382 {
19062383 Overwrite(Object3D.TRANSFORM);
19072384 } else
1908
- if (event.getSource() == overwriteNameItem)
2385
+ if (source == overwriteNameItem)
19092386 {
19102387 Overwrite(Object3D.NAME);
19112388 } else
1912
- if (event.getSource() == overwriteUVItem)
2389
+ if (source == overwriteUVItem)
19132390 {
19142391 Overwrite(Object3D.UV);
19152392 } else
1916
- if (event.getSource() == overwriteMatItem)
2393
+ if (source == overwriteMatItem)
19172394 {
19182395 /* july 2015
19192396 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1933,7 +2410,7 @@
19332410
19342411 Overwrite(dropAttributes);
19352412 }
1936
- if (event.getSource() == overwriteGeoItem)
2413
+ if (source == overwriteGeoItem)
19372414 {
19382415 Overwrite(Object3D.GEOMETRY);
19392416 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1950,7 +2427,7 @@
19502427 // refreshContents();
19512428 // }
19522429 } else
1953
- if (event.getSource() == generateMeshItem)
2430
+ if (source == generateMeshItem)
19542431 {
19552432 //if (group.selection.size() == 1)
19562433 // for (int i=0; i<group.selection.size(); i++)
....@@ -1961,7 +2438,7 @@
19612438 ResetModel();
19622439 refreshContents();
19632440 } else
1964
- if (event.getSource() == extractGeometriesItem)
2441
+ if (source == extractGeometriesItem)
19652442 {
19662443 boolean one = false;
19672444
....@@ -1988,7 +2465,7 @@
19882465 ResetModel();
19892466 refreshContents();
19902467 } else
1991
- if (event.getSource() == cloneGeometriesItem)
2468
+ if (source == cloneGeometriesItem)
19922469 {
19932470 boolean one = false;
19942471
....@@ -2014,7 +2491,7 @@
20142491 ResetModel();
20152492 refreshContents();
20162493 } else
2017
- if (event.getSource() == shareGeometriesItem)
2494
+ if (source == shareGeometriesItem)
20182495 {
20192496 boolean one = false;
20202497
....@@ -2044,7 +2521,7 @@
20442521 refreshContents();
20452522 }
20462523 } else
2047
- if (event.getSource() == mergeGeometriesItem)
2524
+ if (source == mergeGeometriesItem)
20482525 {
20492526 boolean one = false;
20502527
....@@ -2074,7 +2551,7 @@
20742551 ResetModel();
20752552 refreshContents();
20762553 } else
2077
- if (event.getSource() == linkverticesItem)
2554
+ if (source == linkverticesItem)
20782555 {
20792556 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20802557 // {
....@@ -2087,48 +2564,48 @@
20872564 // group.selection.get(0).setMasterThis(content); // should be identity
20882565 // refreshContents();
20892566 // }
2090
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2567
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20912568 {
2092
- Object3D content = GrafreeD.clipboard.get(0);
2569
+ Object3D content = Grafreed.clipboard.get(0);
20932570
20942571 if (content instanceof cGroup && ((cGroup)content).transientlink )
20952572 content = ((cGroup)content).get(0);
20962573
2097
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2574
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20982575 for (int i=0; i<group.selection.size(); i++)
20992576 {
2100
- boolean random = CameraPane.RANDOM;
2101
- CameraPane.RANDOM = false; // parse all random nodes
2577
+ boolean random = CameraPane.SWITCH;
2578
+ CameraPane.SWITCH = false; // parse all random nodes
21022579 group.selection.get(i).linkVerticesThis(content);
21032580 // group.selection.get(i).setMasterThis(content); // should be identity
2104
- CameraPane.RANDOM = random;
2581
+ CameraPane.SWITCH = random;
21052582 }
2106
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2583
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
21072584 refreshContents();
21082585 }
21092586 } else
2110
- if (event.getSource() == resetsupportItem)
2587
+ if (source == resetsupportItem)
21112588 {
21122589 for (int i=0; i<group.selection.size(); i++)
21132590 {
2114
- boolean random = CameraPane.RANDOM;
2115
- CameraPane.RANDOM = false; // parse all random nodes
2591
+ boolean random = CameraPane.SWITCH;
2592
+ CameraPane.SWITCH = false; // parse all random nodes
21162593 group.selection.get(i).linkVerticesThis(null);
2117
- CameraPane.RANDOM = random;
2594
+ CameraPane.SWITCH = random;
21182595 }
21192596
21202597 refreshContents();
21212598 } else
2122
- if (event.getSource() == relinkverticesItem)
2599
+ if (source == relinkverticesItem)
21232600 {
2124
- boolean random = CameraPane.RANDOM;
2125
- CameraPane.RANDOM = false; // parse all random nodes
2601
+ boolean random = CameraPane.SWITCH;
2602
+ CameraPane.SWITCH = false; // parse all random nodes
21262603 group.selection.RelinkToSupport();
2127
- CameraPane.RANDOM = random;
2604
+ CameraPane.SWITCH = random;
21282605
21292606 refreshContents();
21302607 } else
2131
- if (event.getSource() == resetreferencesItem)
2608
+ if (source == resetreferencesItem)
21322609 {
21332610 for (int i=0; i<group.selection.size(); i++)
21342611 {
....@@ -2137,11 +2614,11 @@
21372614
21382615 refreshContents();
21392616 } else
2140
- if (event.getSource() == setMasterItem)
2617
+ if (source == setMasterItem)
21412618 {
2142
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2619
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21432620 {
2144
- Object3D content = GrafreeD.clipboard.get(0);
2621
+ Object3D content = Grafreed.clipboard.get(0);
21452622
21462623 if (content instanceof cGroup && ((cGroup)content).transientlink )
21472624 content = ((cGroup)content).get(0);
....@@ -2150,13 +2627,13 @@
21502627 refreshContents();
21512628 }
21522629 } else
2153
- if (event.getSource() == poseMeshItem)
2630
+ if (source == poseMeshItem)
21542631 {
21552632 if (group.selection.size() == 1)
21562633 {
2157
- if (GrafreeD.clipboard.size() == 1)
2634
+ if (Grafreed.clipboard.size() == 1)
21582635 {
2159
- Object3D content = GrafreeD.clipboard.get(0);
2636
+ Object3D content = Grafreed.clipboard.get(0);
21602637
21612638 if (content instanceof cGroup && ((cGroup)content).transientlink )
21622639 content = ((cGroup)content).get(0);
....@@ -2169,19 +2646,19 @@
21692646 }
21702647
21712648 } else
2172
- if (event.getSource() == revertMeshItem)
2649
+ if (source == revertMeshItem)
21732650 {
21742651 RevertMeshes();
21752652 } else
2176
- if (event.getSource() == resetMeshItem)
2653
+ if (source == resetAllItem)
21772654 {
21782655 ResetAll();
21792656 } else
2180
- if (event.getSource() == stepAllItem)
2657
+ if (source == stepAllItem)
21812658 {
21822659 StepAll();
21832660 } else
2184
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2661
+ if (source == clearItem) // || event.getSource() == clearButton)
21852662 {
21862663 //int indices[] = jList.getSelectedIndices();
21872664 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2189,46 +2666,46 @@
21892666
21902667 ClearSelection(false);
21912668 } else
2192
- if (event.getSource() == clearAllItem)
2669
+ if (source == clearAllItem)
21932670 {
21942671 ClearSelection(true);
21952672 } else
2196
- if (event.getSource() == grabItem)
2673
+ if (source == grabItem || source == groupButton)
21972674 {
2198
- group(new cGroup(), true);
2675
+ group(new cGroup(), false); // true);
21992676 } else
2200
- if (event.getSource() == hideItem)
2677
+ if (source == hideItem)
22012678 {
22022679 group(new HiddenObject());
22032680 } else
2204
- if (event.getSource() == frontItem)
2681
+ if (source == frontItem)
22052682 {
22062683 front();
22072684 } else
2208
- if (event.getSource() == backItem)
2685
+ if (source == backItem)
22092686 {
22102687 back();
22112688 } else
2212
- if (event.getSource() == cameraItem)
2689
+ if (source == cameraItem)
22132690 {
22142691 makeSomething(new Camera());
22152692 } else
2216
- if (event.getSource() == compositeItem)
2693
+ if (source == compositeItem || source == compositeButton)
22172694 {
22182695 group(new Composite());
22192696 } else
2220
- if (event.getSource() == randomItem)
2697
+ if (source == switchItem || source == switchButton)
22212698 {
22222699 RandomNode random = new RandomNode();
22232700 group(random);
22242701 if (random.size() > 0)
2225
- random.name = random.get(0).name + "Rnd";
2702
+ random.name = random.get(0).name + "Switch";
22262703 } else
2227
- if (event.getSource() == physicsItem)
2704
+ if (source == physicsItem)
22282705 {
22292706 group(new PhysicsNode());
22302707 } else
2231
- if (event.getSource() == frameselectorItem)
2708
+ if (source == frameselectorItem)
22322709 {
22332710 for (int i=0; i<group.selection.size(); i++)
22342711 {
....@@ -2240,7 +2717,7 @@
22402717 ResetModel();
22412718 refreshContents();
22422719 } else
2243
- if (event.getSource() == switchGeoItem)
2720
+ if (source == switchGeoItem)
22442721 {
22452722 for (int i=0; i<group.selection.size(); i++)
22462723 {
....@@ -2252,7 +2729,7 @@
22522729 ResetModel();
22532730 refreshContents();
22542731 } else
2255
- if (event.getSource() == switchTransfoItem)
2732
+ if (source == switchTransfoItem)
22562733 {
22572734 for (int i=0; i<group.selection.size(); i++)
22582735 {
....@@ -2264,7 +2741,7 @@
22642741 ResetModel();
22652742 refreshContents();
22662743 } else
2267
- if (event.getSource() == morphItem)
2744
+ if (source == morphItem)
22682745 {
22692746 for (int i=0; i<group.selection.size(); i++)
22702747 {
....@@ -2276,7 +2753,7 @@
22762753 ResetModel();
22772754 refreshContents();
22782755 } else
2279
- if (event.getSource() == scriptNodeItem)
2756
+ if (source == scriptNodeItem)
22802757 {
22812758 boolean atleastone = false;
22822759
....@@ -2315,215 +2792,252 @@
23152792 }
23162793 }
23172794 } else
2318
- if (event.getSource() == linkerItem)
2795
+ if (source == linkerItem)
23192796 {
23202797 group(new cLinker());
23212798 } else
2322
- if (event.getSource() == textureItem)
2799
+ if (source == textureItem || source == textureButton)
23232800 {
23242801 group(new TextureNode());
23252802 } else
2326
- if (event.getSource() == billboardItem)
2803
+ if (source == billboardItem)
23272804 {
23282805 group(new BillboardNode());
23292806 } else
2330
- if (event.getSource() == shadowXItem)
2807
+ if (source == shadowXItem)
23312808 {
23322809 CastShadow(0);
23332810 } else
2334
- if (event.getSource() == shadowYItem)
2811
+ if (source == shadowYItem)
23352812 {
23362813 CastShadow(1);
23372814 } else
2338
- if (event.getSource() == shadowZItem)
2815
+ if (source == shadowZItem)
23392816 {
23402817 CastShadow(2);
23412818 } else
2342
- if (event.getSource() == ungroupItem)
2819
+ if (source == ungroupItem || source == ungroupButton)
23432820 {
2344
- //ungroup();
2821
+ boolean hasRoot = false;
2822
+
23452823 for (int i=0; i<group.selection.size(); i++)
23462824 {
2347
- Ungroup(group.selection.get(i));
2825
+ if (group.selection.get(i) == group)
2826
+ {
2827
+ hasRoot = true;
2828
+ break;
2829
+ }
23482830 }
23492831
2350
- ClearSelection(false);
2351
-
2352
- 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
+ }
23532843 } else
2354
- if (event.getSource() == genUVItem)
2844
+ if (source == genUVItem)
23552845 {
23562846 GenUV();
23572847 } else
2358
- if (event.getSource() == genNormalsCADItem)
2848
+ if (source == genNormalsCADItem)
23592849 {
23602850 GenNormals(true);
23612851 } else
2362
- if (event.getSource() == genNormalsMESHItem)
2852
+ if (source == genNormalsMESHItem)
23632853 {
2364
- GenNormals(true); // TODO
2854
+ GenNormalsMESH();
23652855 } else
2366
- if (event.getSource() == genNormalsORGANItem)
2856
+ if (source == genNormalsORGANItem)
23672857 {
23682858 GenNormals(false);
23692859 } else
2370
- if (event.getSource() == genNormalsMINEItem)
2860
+ if (source == genNormalsMINEItem)
23712861 {
23722862 GenNormalsMINE();
23732863 } else
2374
- if (event.getSource() == stripifyItem)
2864
+ if (source == stripifyItem)
23752865 {
23762866 Stripify();
23772867 } else
2378
- if (event.getSource() == unstripifyItem)
2868
+ if (source == unstripifyItem)
23792869 {
23802870 Unstripify();
23812871 } else
2382
- if (event.getSource() == trimItem)
2872
+ if (source == trimItem)
23832873 {
23842874 Trim();
23852875 } else
2386
- if (event.getSource() == untrimItem)
2876
+ if (source == untrimItem)
23872877 {
23882878 Untrim();
23892879 } else
2390
- if (event.getSource() == clearColorsItem)
2880
+ if (source == clearColorsItem)
23912881 {
23922882 ClearColors();
23932883 } else
2394
- if (event.getSource() == clearMaterialsItem)
2884
+ if (source == clearMaterialsItem)
23952885 {
23962886 ClearMaterials();
23972887 } else
2398
- if (event.getSource() == liveleavesItem)
2888
+ if (source == liveleavesItem)
23992889 {
24002890 LiveLeaves(true);
24012891 } else
2402
- if (event.getSource() == unliveleavesItem)
2892
+ if (source == unliveleavesItem)
24032893 {
24042894 LiveLeaves(false);
24052895 } else
2406
- if (event.getSource() == supportleavesItem)
2896
+ if (source == supportleavesItem)
24072897 {
24082898 SupportLeaves(true);
24092899 } else
2410
- if (event.getSource() == unsupportleavesItem)
2900
+ if (source == unsupportleavesItem)
24112901 {
24122902 SupportLeaves(false);
24132903 } else
2414
- if (event.getSource() == hideleavesItem)
2904
+ if (source == hideleavesItem)
24152905 {
24162906 HideLeaves(true);
24172907 } else
2418
- if (event.getSource() == showleavesItem)
2908
+ if (source == showleavesItem)
24192909 {
24202910 HideLeaves(false);
24212911 } else
2422
- if (event.getSource() == markleavesItem)
2912
+ if (source == markleavesItem)
24232913 {
24242914 MarkLeaves(true);
24252915 } else
2426
- if (event.getSource() == unmarkleavesItem)
2916
+ if (source == unmarkleavesItem)
24272917 {
24282918 MarkLeaves(false);
24292919 } else
2430
- 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)
24312937 {
24322938 FlipV(true);
24332939 } else
2434
- if (event.getSource() == unflipVItem)
2940
+ if (source == unflipVItem)
24352941 {
24362942 FlipV(false);
24372943 } else
2438
- if (event.getSource() == lowTexturesItem)
2944
+ if (source == lowTexturesItem)
24392945 {
24402946 SetTexRes(0);
24412947 } else
2442
- if (event.getSource() == normalTexturesItem)
2948
+ if (source == normalTexturesItem)
24432949 {
24442950 SetTexRes(1);
24452951 } else
2446
- if (event.getSource() == highTexturesItem)
2952
+ if (source == highTexturesItem)
24472953 {
24482954 SetTexRes(2);
24492955 } else
2450
- if (event.getSource() == veryhighTexturesItem)
2956
+ if (source == veryhighTexturesItem)
24512957 {
24522958 SetTexRes(3);
24532959 } else
2454
- if (event.getSource() == maxTexturesItem)
2960
+ if (source == maxTexturesItem)
24552961 {
24562962 SetTexRes(4);
24572963 } else
2458
- if (event.getSource() == panoTexturesItem)
2964
+ if (source == panoTexturesItem)
24592965 {
24602966 SetTexRes(5);
24612967 } else
2462
- if (event.getSource() == reverseNormalsItem)
2968
+ if (source == reverseNormalsItem)
24632969 {
24642970 ReverseNormals();
24652971 } else
2466
- if (event.getSource() == parseverticesItem)
2972
+ if (source == parseverticesItem)
24672973 {
24682974 ParseVertices();
24692975 } else
2470
- if (event.getSource() == textureFieldItem)
2976
+ if (source == textureFieldItem)
24712977 {
24722978 TextureVertices();
24732979 } else
2474
- if (event.getSource() == alignItem)
2980
+ if (source == alignItem)
24752981 {
24762982 Align();
24772983 } else
2478
- if (event.getSource() == mirrorItem)
2984
+ if (source == mirrorItem)
24792985 {
24802986 MirrorPoses();
24812987 } else
2482
- if (event.getSource() == reduceMorphItem)
2988
+ if (source == reduceMorphItem)
24832989 {
24842990 MeshReduction(false);
24852991 } else
2486
- if (event.getSource() == reduce34MorphItem)
2992
+ if (source == reduce34MorphItem)
24872993 {
24882994 MeshReduction(true);
24892995 } else
2490
- if (event.getSource() == reverseTrianglesItem)
2996
+ if (source == reverseTrianglesItem)
24912997 {
24922998 ReverseTriangles();
24932999 } else
2494
- if (event.getSource() == reduceMeshItem)
3000
+ if (source == reduceMeshItem)
24953001 {
24963002 ReduceMesh(false);
24973003 } else
2498
- if (event.getSource() == reduce34MeshItem)
3004
+ if (source == reduce34MeshItem)
24993005 {
25003006 ReduceMesh(true);
25013007 } else
2502
- if (event.getSource() == increaseMeshItem)
3008
+ if (source == increaseMeshItem)
25033009 {
25043010 IncreaseMesh();
25053011 } else
2506
- if (event.getSource() == clipMeshItem)
3012
+ if (source == clipMeshItem)
25073013 {
25083014 ClipMesh();
25093015 } else
2510
- if (event.getSource() == smoothMeshItem)
3016
+ if (source == smoothMeshItem)
25113017 {
25123018 SmoothMesh();
25133019 } else
2514
- if (event.getSource() == transformgeometryItem)
3020
+ if (source == transformGeometryItem)
25153021 {
25163022 TransformGeometry();
25173023 } else
2518
- if (event.getSource() == resetTransformItem)
3024
+ if (source == transformChildrenItem)
3025
+ {
3026
+ TransformChildren();
3027
+ } else
3028
+ if (source == resetTransformItem)
25193029 {
25203030 ResetTransform();
25213031 } else
2522
- if (event.getSource() == resetCentroidItem)
3032
+ if (source == resetCentroidItem)
25233033 {
2524
- ResetCentroid();
3034
+ ResetCentroid(true);
25253035 } else
2526
- if (event.getSource() == resetParentItem)
3036
+ if (source == resetCentroidXZItem)
3037
+ {
3038
+ ResetCentroid(false);
3039
+ } else
3040
+ if (source == resetParentItem)
25273041 {
25283042 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25293043 {
....@@ -2533,7 +3047,7 @@
25333047
25343048 refreshContents();
25353049 } else
2536
- if (event.getSource() == repairParentItem)
3050
+ if (source == repairParentItem)
25373051 {
25383052 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25393053 {
....@@ -2547,7 +3061,7 @@
25473061
25483062 refreshContents();
25493063 } else
2550
- if (event.getSource() == repairShadowItem)
3064
+ if (source == repairShadowItem)
25513065 {
25523066 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25533067 {
....@@ -2561,7 +3075,7 @@
25613075
25623076 refreshContents();
25633077 } else
2564
- if (event.getSource() == sortbysizeItem)
3078
+ if (source == sortbysizeItem)
25653079 {
25663080 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25673081 {
....@@ -2573,7 +3087,7 @@
25733087 ResetModel();
25743088 refreshContents();
25753089 } else
2576
- if (event.getSource() == sortbynameItem)
3090
+ if (source == sortbynameItem)
25773091 {
25783092 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25793093 {
....@@ -2585,7 +3099,7 @@
25853099 ResetModel();
25863100 refreshContents();
25873101 } else
2588
- if (event.getSource() == attachPigmentItem)
3102
+ if (source == attachPigmentItem)
25893103 {
25903104 String texture = GetFile("Attach pigment");
25913105 Object3D obj;
....@@ -2597,7 +3111,7 @@
25973111
25983112 refreshContents();
25993113 } else
2600
- if (event.getSource() == detachPigmentItem)
3114
+ if (source == detachPigmentItem)
26013115 {
26023116 Object3D obj;
26033117 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2608,7 +3122,7 @@
26083122
26093123 refreshContents();
26103124 } else
2611
- if (event.getSource() == attachBumpItem)
3125
+ if (source == attachBumpItem)
26123126 {
26133127 String texture = GetFile("Attach bump");
26143128 Object3D obj;
....@@ -2620,7 +3134,7 @@
26203134
26213135 refreshContents();
26223136 } else
2623
- if (event.getSource() == detachBumpItem)
3137
+ if (source == detachBumpItem)
26243138 {
26253139 Object3D obj;
26263140 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2631,7 +3145,7 @@
26313145
26323146 refreshContents();
26333147 } else
2634
- if (event.getSource() == pigmentBumpItem)
3148
+ if (source == pigmentBumpItem)
26353149 {
26363150 Object3D obj;
26373151 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2642,158 +3156,237 @@
26423156
26433157 refreshContents();
26443158 } else
2645
- if (event.getSource() == flashSelectionButton)
3159
+ if (source == flashSelectionButton)
26463160 {
26473161 CameraPane.flash = true;
26483162 refreshContents();
26493163 } else
2650
- if (event.getSource() == oneButton)
3164
+ if (source == oneButton)
26513165 {
26523166 } else
2653
- if (event.getSource() == twoButton)
3167
+ if (source == twoButton)
26543168 {
26553169 radio.layout = twoButton;
3170
+
3171
+ if (CameraPane.FULLSCREEN)
3172
+ fullscreenLayout = radio.layout;
3173
+
26563174 // bug
26573175 //gridPanel.setDividerLocation(1.0);
26583176 //bigPanel.setDividerLocation(0.0);
2659
- bigThree.remove(scenePanel);
2660
- bigThree.remove(centralPanel);
2661
- bigThree.remove(XYZPanel);
2662
- aWindowConstraints.gridx = 0;
2663
- aWindowConstraints.gridy = 0;
2664
- aWindowConstraints.gridwidth = 1;
2665
- // aConstraints.gridheight = 3;
2666
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2667
- aWindowConstraints.weightx = 0;
2668
- aWindowConstraints.weighty = 1;
2669
- //bigThree.add(jtp, aWindowConstraints);
2670
- aWindowConstraints.weightx = 1;
2671
- aWindowConstraints.gridwidth = 3;
2672
- // aConstraints.gridheight = 3;
2673
- aWindowConstraints.gridx = 1;
2674
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2675
- bigThree.add(centralPanel, aWindowConstraints);
2676
- aWindowConstraints.weightx = 0;
2677
- aWindowConstraints.gridx = 4;
2678
- aWindowConstraints.gridwidth = 1;
2679
- // aConstraints.gridheight = 3;
2680
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2681
- //bigThree.add(XYZPanel, aWindowConstraints);
2682
- 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
+
26833224 } else
2684
- if (event.getSource() == threeButton)
3225
+ if (source == threeButton)
26853226 {
26863227 radio.layout = threeButton;
2687
- bigThree.remove(scenePanel);
2688
- bigThree.remove(centralPanel);
2689
- bigThree.remove(XYZPanel);
2690
- aWindowConstraints.gridx = 0;
2691
- aWindowConstraints.gridy = 0;
2692
- aWindowConstraints.gridwidth = 1;
2693
- // aConstraints.gridheight = 3;
2694
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2695
- aWindowConstraints.weightx = 0;
2696
- aWindowConstraints.weighty = 1;
2697
- //bigThree.add(jtp, aWindowConstraints);
2698
- aWindowConstraints.weightx = 1;
2699
- aWindowConstraints.gridwidth = 3;
2700
- // aConstraints.gridheight = 3;
2701
- aWindowConstraints.gridx = 1;
2702
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2703
- bigThree.add(centralPanel, aWindowConstraints);
2704
- aWindowConstraints.weightx = 0;
2705
- aWindowConstraints.gridx = 4;
2706
- aWindowConstraints.gridwidth = 1;
2707
- // aConstraints.gridheight = 3;
2708
- aConstraints.fill = GridBagConstraints.VERTICAL;
2709
- bigThree.add(XYZPanel, aWindowConstraints);
2710
- 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();
27113265 } else
2712
- if (event.getSource() == fourButton)
3266
+ if (source == fourButton)
27133267 {
27143268 radio.layout = fourButton;
2715
- bigThree.remove(scenePanel);
2716
- bigThree.remove(centralPanel);
2717
- bigThree.remove(XYZPanel);
2718
- aWindowConstraints.gridx = 0;
2719
- aWindowConstraints.gridy = 0;
2720
- aWindowConstraints.gridwidth = 1;
2721
- // aWindowConstraints.gridheight = 3;
2722
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2723
- aWindowConstraints.weightx = 1;
2724
- aWindowConstraints.weighty = 1;
2725
- bigThree.add(scenePanel, aWindowConstraints);
2726
- aWindowConstraints.weightx = 1;
2727
- aWindowConstraints.gridwidth = 3;
2728
- // aConstraints.gridheight = 3;
2729
- aWindowConstraints.gridx = 1;
2730
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2731
- //bigThree.add(cameraPanel, aWindowConstraints);
2732
- aWindowConstraints.weightx = 0;
2733
- aWindowConstraints.gridx = 4;
2734
- aWindowConstraints.gridwidth = 1;
2735
- // aWindowConstraints.gridheight = 3;
2736
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2737
- //bigThree.add(XYZPanel, aWindowConstraints);
2738
- 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();
27393305 } else
2740
- if (event.getSource() == sixButton)
3306
+ if (source == sixButton)
27413307 {
27423308 radio.layout = sixButton;
2743
- bigThree.remove(scenePanel);
2744
- bigThree.remove(centralPanel);
2745
- bigThree.remove(XYZPanel);
2746
- aWindowConstraints.gridx = 0;
2747
- aWindowConstraints.gridy = 0;
2748
- aWindowConstraints.gridwidth = 1;
2749
- // aConstraints.gridheight = 3;
2750
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2751
- aWindowConstraints.weightx = 0;
2752
- aWindowConstraints.weighty = 1;
2753
- bigThree.add(scenePanel, aWindowConstraints);
2754
- aWindowConstraints.weightx = 1;
2755
- aWindowConstraints.gridwidth = 3;
2756
- // aWindowConstraints.gridheight = 3;
2757
- aWindowConstraints.gridx = 1;
2758
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2759
- bigThree.add(centralPanel, aWindowConstraints);
2760
- aWindowConstraints.weightx = 0;
2761
- aWindowConstraints.gridx = 4;
2762
- aWindowConstraints.gridwidth = 1;
2763
- // aWindowConstraints.gridheight = 3;
2764
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2765
- //bigThree.add(XYZPanel, aConstraints);
2766
- 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();
27673346 } else
2768
- if (event.getSource() == sevenButton)
3347
+ if (source == sevenButton)
27693348 {
27703349 radio.layout = sevenButton;
2771
- bigThree.remove(scenePanel);
2772
- bigThree.remove(centralPanel);
2773
- bigThree.remove(XYZPanel);
2774
- aWindowConstraints.gridx = 0;
2775
- aWindowConstraints.gridy = 0;
2776
- aWindowConstraints.gridwidth = 1;
2777
- // aWindowConstraints.gridheight = 3;
2778
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2779
- aWindowConstraints.weightx = 0;
2780
- aWindowConstraints.weighty = 1;
2781
- bigThree.add(scenePanel, aWindowConstraints);
2782
- aWindowConstraints.weightx = 1;
2783
- aWindowConstraints.gridwidth = 3;
2784
- // aWindowConstraints.gridheight = 3;
2785
- aWindowConstraints.gridx = 1;
2786
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2787
- bigThree.add(centralPanel, aWindowConstraints);
2788
- aWindowConstraints.weightx = 0;
2789
- aWindowConstraints.gridx = 4;
2790
- aWindowConstraints.gridwidth = 1;
2791
- // aConstraints.gridheight = 3;
2792
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2793
- bigThree.add(XYZPanel, aWindowConstraints);
2794
- 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();
27953388 } else
2796
- if (event.getSource() == rootButton)
3389
+ if (source == rootButton)
27973390 {
27983391 Object3D obj;
27993392 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2803,66 +3396,84 @@
28033396 EditObject(obj);
28043397 }
28053398
3399
+ cameraView.requestFocusInWindow();
28063400 refreshContents(true);
28073401 } else
2808
- if (event.getSource() == closeButton)
3402
+ if (source == closeButton)
28093403 {
28103404 //System.out.println("CLOSE: " + buttonGroup.getSelection());
28113405 cRadio ab;
28123406 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
28133407 {
28143408 ab = (cRadio)e.nextElement();
2815
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3409
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
28163410 {
3411
+ // Patch to avoid bug with transparency.
3412
+ if (!ab.hadMaterial)
3413
+ {
3414
+ ab.object.material = null;
3415
+ }
3416
+
28173417 buttonGroup.remove(ab);
28183418 radioPanel.remove(ab);
28193419
2820
- ab.GetObject().editWindow = null;
3420
+ //ab.GetObject().editWindow = null;
3421
+ ab.GetObject().manipWindow = null;
28213422 // ab.GetObject().objectUI = null; // ?????????
28223423
28233424 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
28243425 break;
28253426 }
28263427 }
3428
+
3429
+ cameraView.requestFocusInWindow();
28273430 refreshContents(true);
28283431 } else
2829
- if (event.getSource() == editItem || event.getSource() == editButton)
3432
+ if (source == editItem || source == editButton)
28303433 {
3434
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3435
+ {
3436
+ Object3D child = (Object3D)e.nextElement();
3437
+ child.pinned = true;
3438
+ }
3439
+
28313440 EditSelection(false);
28323441 } else
2833
- if (event.getSource() == uneditButton)
3442
+ if (source == uneditButton)
28343443 {
28353444 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28363445 {
28373446 Object3D child = (Object3D)e.nextElement();
28383447 if(child.editWindow != null)
28393448 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3449
+ child.pinned = false;
28403450 child.CloseUI();
28413451 listUI.remove(child);
28423452
2843
- child.editWindow = null; // ???????????
3453
+ //child.editWindow = null; // ???????????
28443454 }
2845
- objEditor.ctrlPanel.revalidate();
3455
+ objEditor.ctrlPanel.FlushUI();
28463456 //objEditor.jTree.clearSelection();
28473457 //objEditor.ResetSliders();
28483458 refreshContents(true);
28493459 } else
2850
- if (event.getSource() == clearPanelButton)
3460
+ if (source == clearPanelButton)
28513461 {
28523462 assert(copy == group);
28533463 //copy.ClearUI();
28543464 for (Object3D obj : listUI)
28553465 {
3466
+ obj.pinned = false;
28563467 obj.CloseUI();
28573468 }
28583469 listUI.clear();
28593470 refreshContents(true);
28603471 } else
2861
- if (event.getSource() == allParamsButton)
3472
+ if (source == allParamsButton)
28623473 {
28633474 assert(copy == group);
28643475
2865
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3476
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28663477
28673478 for (Object3D obj : listUI)
28683479 {
....@@ -2879,19 +3490,19 @@
28793490
28803491 refreshContents(true);
28813492 } else
2882
- if (event.getSource() == unselectButton)
3493
+ if (source == unselectButton)
28833494 {
28843495 objEditor.jTree.clearSelection();
28853496 // ?? oct 2012 GrafreeD.clipboard.clear();
28863497 objEditor.ResetSliders();
28873498 refreshContents(true);
28883499 } else
2889
- if(event.getSource() instanceof cRadio)
3500
+ if(source instanceof cRadio)
28903501 {
28913502 group.parent = keepparent;
28923503 group.attributes = 0;
28933504 //group.editWindow = null;
2894
- /*cRadio*/ radio = (cRadio)event.getSource();
3505
+ /*cRadio*/ radio = (cRadio)source;
28953506 Object3D obj = radio.GetObject();
28963507 System.out.println("Edit " + obj);
28973508 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2911,7 +3522,10 @@
29113522 }
29123523
29133524 copy = group;
2914
- //CameraPane.theRenderer.object = group;
3525
+
3526
+ SetUndoStates();
3527
+
3528
+ //Globals.theRenderer.object = group;
29153529 if(!useclient)
29163530 {
29173531 cameraView.renderCamera = radio.camera;
....@@ -2920,25 +3534,52 @@
29203534 cameraView.cameras[cameraView.cameracount] = radio.camera;
29213535 cameraView.targetLookAt.set(radio.camera.lookAt);
29223536 cameraView.object = group;
2923
- cameraView.lighttouched = true;
3537
+ //cameraView.lighttouched = true;
3538
+ Globals.lighttouched = true;
29243539 topView.object = group;
29253540 frontView.object = group;
29263541 sideView.object = group;
29273542 }
2928
- group.editWindow = this;
3543
+
3544
+// fix "+" issue
3545
+ //group.editWindow = this;
3546
+ group.manipWindow = this;
3547
+
29293548 /*
29303549 currentLayout = radio.layout;
29313550 if (currentLayout == null)
29323551 currentLayout = sevenButton;
29333552 */
29343553 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);
29353561 keepparent = group.parent;
29363562 // PARENT = NULL or not???
29373563 //group.parent = null; // ROOT
29383564 //group.attributes = -1;
29393565 ResetModel();
3566
+
3567
+ cameraView.requestFocusInWindow();
29403568 refreshContents(true);
2941
- }
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
+ }
29423583 else
29433584 {
29443585 //return super.action(event, arg);
....@@ -2947,7 +3588,6 @@
29473588 }
29483589
29493590 boolean useclient = false;
2950
- cRadio radio;
29513591
29523592 void ToggleRoot()
29533593 {
....@@ -2956,7 +3596,7 @@
29563596 if (useclient)
29573597 {
29583598 cameraView.object = client;
2959
- cameraView.lighttouched = true;
3599
+ Globals.lighttouched = true;
29603600 //topView.object = client;
29613601 //frontView.object = client;
29623602 //sideView.object = client;
....@@ -2964,7 +3604,7 @@
29643604 else
29653605 {
29663606 cameraView.object = group;
2967
- cameraView.lighttouched = true;
3607
+ Globals.lighttouched = true;
29683608 //topView.object = group;
29693609 //frontView.object = group;
29703610 //sideView.object = group;
....@@ -2999,6 +3639,28 @@
29993639 refreshContents();
30003640 }
30013641
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
+ }
30023664
30033665 void ResetTransform()
30043666 {
....@@ -3111,7 +3773,7 @@
31113773 refreshContents();
31123774 }
31133775
3114
- void ResetCentroid()
3776
+ void ResetCentroid(boolean full)
31153777 {
31163778 Object3D obj;
31173779 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3126,12 +3788,16 @@
31263788 LA.matIdentity(Object3D.mat);
31273789 obj.getBounds(minima, maxima, false);
31283790 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3129
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3791
+ if (full)
3792
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
31303793 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
31313794 obj.TransformMesh(Object3D.mat);
3795
+
31323796 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3133
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3797
+ if (full)
3798
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
31343799 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3800
+
31353801 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
31363802 //Object3D.mat[3][0] = -Object3D.mat[3][0];
31373803 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3160,7 +3826,8 @@
31603826
31613827 int size = obj.MemorySize();
31623828
3163
- 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)");
31643831 }
31653832 }
31663833 catch (Exception e)
....@@ -3197,9 +3864,9 @@
31973864 obj = (Object3D)e.nextElement();
31983865
31993866 System.out.println("Object is: " + obj);
3200
- GrafreeD.AnalyzeObject(obj);
3867
+ Grafreed.AnalyzeObject(obj);
32013868 System.out.println("Boundary rep: " + obj.bRep);
3202
- GrafreeD.AnalyzeObject(obj.bRep);
3869
+ Grafreed.AnalyzeObject(obj.bRep);
32033870
32043871 // System.err.println((size/1024) + " KB is the size of " + obj);
32053872 }
....@@ -3241,6 +3908,13 @@
32413908 void GenNormals(boolean crease)
32423909 {
32433910 group.GenNormalsS(crease);
3911
+
3912
+ refreshContents();
3913
+ }
3914
+
3915
+ void GenNormalsMESH()
3916
+ {
3917
+ group.GenNormalsMeshS();
32443918
32453919 refreshContents();
32463920 }
....@@ -3413,8 +4087,8 @@
34134087
34144088 void ParseVertices()
34154089 {
3416
- boolean epsequal = GrafreeD.epsequal;
3417
- GrafreeD.epsequal = true;
4090
+ boolean epsequal = Grafreed.epsequal;
4091
+ Grafreed.epsequal = true;
34184092
34194093 for (int i=0; i<group.selection.size(); i++)
34204094 {
....@@ -3439,7 +4113,7 @@
34394113 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
34404114 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
34414115
3442
- g.add(GrafreeD.clipboard);
4116
+ g.add(Grafreed.clipboard);
34434117
34444118 buffer.add(g);
34454119 }
....@@ -3454,7 +4128,7 @@
34544128 makeSomething(buffer, i==group.selection.size()-1);
34554129 }
34564130
3457
- GrafreeD.epsequal = epsequal;
4131
+ Grafreed.epsequal = epsequal;
34584132
34594133 refreshContents();
34604134 }
....@@ -3472,7 +4146,16 @@
34724146 String pigment = Object3D.GetPigment(tex);
34734147 //String bump = Object3D.GetBump(tex);
34744148
3475
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.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
+ }
34764159
34774160 double s = v.s;
34784161
....@@ -3560,11 +4243,11 @@
35604243
35614244 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
35624245
3563
- boolean random = CameraPane.RANDOM;
3564
- CameraPane.RANDOM = false; // parse all random nodes
4246
+ boolean random = CameraPane.SWITCH;
4247
+ CameraPane.SWITCH = false; // parse all random nodes
35654248 lowres.linkVerticesThis(null);
35664249 lowres.linkVerticesThis(sn);
3567
- CameraPane.RANDOM = random;
4250
+ CameraPane.SWITCH = random;
35684251
35694252 System.err.flush();
35704253
....@@ -3604,7 +4287,7 @@
36044287 return;
36054288
36064289 Object3D poses = group.selection.get(0);
3607
- Object3D ref = GrafreeD.clipboard.get(0);
4290
+ Object3D ref = Grafreed.clipboard.get(0);
36084291
36094292 Object3D newgroup = new Object3D("Po:" + poses.name);
36104293
....@@ -3773,7 +4456,7 @@
37734456 group.selection.RelinkToSupport(); // july 2014
37744457 System.out.println("DONE.");
37754458 refreshContents();
3776
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4459
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
37774460 }
37784461
37794462 void ReduceMesh(boolean reduction34)
....@@ -3798,9 +4481,9 @@
37984481
37994482 void ClipMesh()
38004483 {
3801
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4484
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
38024485 {
3803
- Object3D content = GrafreeD.clipboard.get(0);
4486
+ Object3D content = Grafreed.clipboard.get(0);
38044487
38054488 if (content instanceof cGroup && ((cGroup)content).transientlink )
38064489 content = ((cGroup)content).get(0);
....@@ -3809,7 +4492,7 @@
38094492 // {
38104493 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
38114494 // }
3812
- group.selection.ClipMesh(GrafreeD.clipboard);
4495
+ group.selection.ClipMesh(Grafreed.clipboard);
38134496 }
38144497 // group.selection.ClipMesh(GrafreeD.clipboard);
38154498 System.out.println("DONE.");
....@@ -3856,6 +4539,18 @@
38564539 void MarkLeaves(boolean hide)
38574540 {
38584541 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);
38594554 refreshContents();
38604555 }
38614556
....@@ -3930,10 +4625,6 @@
39304625 // }
39314626 // }
39324627
3933
- static boolean allparams = true;
3934
-
3935
- static Vector<Object3D> listUI = new Vector<Object3D>();
3936
-
39374628 void EditSelection(boolean newWindow)
39384629 {
39394630 // aConstraints.gridy = 0;
....@@ -3941,10 +4632,10 @@
39414632 {
39424633 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
39434634 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3944
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4635
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
39454636
39464637 Object3D elem = (Object3D)group.selection.elementAt(i);
3947
- if(elem != group)
4638
+ if(elem != group || !newWindow)
39484639 {
39494640 // if (!(elem instanceof Composite))
39504641 // newWindow = false;
....@@ -4026,7 +4717,8 @@
40264717 //new Exception().printStackTrace();
40274718
40284719 freezemodel = true;
4029
-
4720
+ ClearUnpinned();
4721
+
40304722 /**/
40314723 //switch (event.id)
40324724 {
....@@ -4034,7 +4726,6 @@
40344726 //case 702: // Event.LIST_DESELECT
40354727 group.deselectAll();
40364728 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4037
- objEditor.ClearInfo(); // .GetMaterial());
40384729 if (tps != null)
40394730 {
40404731 for (int i=0; i < tps.length; i++)
....@@ -4043,33 +4734,39 @@
40434734
40444735 //if (child.parent != null)
40454736 //child.parent.addSelectee(child);
4737
+ objEditor.SetMaterial(child);
40464738 group.addSelectee(child);
4047
- objEditor.SetMaterial(child); // .GetMaterial());
4048
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4049
- System.err.println("info : " + child.GetPath());
40504739 }
40514740 }
4052
- else
4053
- {
4054
- objEditor.SetMaterial(group); // .GetMaterial());
4055
- objEditor.AddInfo(group, this, true); // .GetMaterial());
4056
- System.err.println("info : " + group.GetPath());
4057
- }
4741
+// else
4742
+// {
4743
+// objEditor.SetMaterial(group); // .GetMaterial());
4744
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4745
+// System.err.println("info : " + group.GetPath());
4746
+// }
40584747
4059
- objEditor.SetText(); // jan 2014
4060
-
4061
- if (flashIt && !CameraPane.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))
40624749 CameraPane.flash = true;
40634750
4064
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4751
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
40654752 // a camera
40664753 {
4067
- CameraPane.camerachangeframe = 0; // don't refuse it
4068
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4069
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
4070
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
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
+ }
4759
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4760
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
40714761 }
40724762
4763
+ if (tps != null && tps.length == 1)
4764
+ {
4765
+ EditSelection(false);
4766
+ }
4767
+
4768
+ SetPinStates(tps != null && tps.length > 0);
4769
+
40734770 refreshContents();
40744771 //return true;
40754772 }
....@@ -4078,6 +4775,35 @@
40784775
40794776 freezemodel = false;
40804777 }
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
+ }
40814807
40824808 void linkSomething(Object3D thing)
40834809 {
....@@ -4149,16 +4875,19 @@
41494875 {
41504876 if (group.selection.isEmpty())
41514877 return;
4152
- GrafreeD.clipboardIsTempGroup = false;
4878
+
4879
+ Grafreed.clipboardIsTempGroup = false;
41534880 Composite tGroup = null;
41544881 if (group.selection.size() > 0) // 1)
41554882 {
41564883 tGroup = new cGroup();
4157
- GrafreeD.clipboardIsTempGroup = true;
4884
+ Grafreed.clipboardIsTempGroup = true;
41584885 }
41594886
41604887 if (cut)
41614888 {
4889
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4890
+// Save();
41624891 //int indices[] = jList.getSelectedIndices();
41634892 //for (int i = indices.length - 1; i >= 0; i--)
41644893 //jList.remove(indices[i]);
....@@ -4194,16 +4923,16 @@
41944923 //System.out.println("cut " + child);
41954924 //System.out.println("parent = " + child.parent);
41964925 // tmp.addChild(child);
4197
- if (GrafreeD.clipboardIsTempGroup)
4926
+ if (Grafreed.clipboardIsTempGroup)
41984927 tGroup.add/*Child*/(tmp);
41994928 else
4200
- GrafreeD.clipboard = tmp;
4929
+ Grafreed.clipboard = tmp;
42014930 }
42024931 else
4203
- if (GrafreeD.clipboardIsTempGroup)
4932
+ if (Grafreed.clipboardIsTempGroup)
42044933 tGroup.add/*Child*/(child);
42054934 else
4206
- GrafreeD.clipboard = child;
4935
+ Grafreed.clipboard = child;
42074936 }
42084937
42094938 //ResetModel();
....@@ -4235,21 +4964,23 @@
42354964 //System.out.println("cut " + elem);
42364965 //System.out.println("parent = " + elem.parent);
42374966 // tmp.addChild(elem);
4238
- if (GrafreeD.clipboardIsTempGroup)
4967
+ if (Grafreed.clipboardIsTempGroup)
42394968 tGroup.add/*Child*/(tmp);
42404969 else
4241
- GrafreeD.clipboard = tmp;
4970
+ Grafreed.clipboard = tmp;
42424971 }
42434972 else
4244
- if (GrafreeD.clipboardIsTempGroup)
4973
+ if (Grafreed.clipboardIsTempGroup)
42454974 tGroup.add/*Child*/(child);
42464975 else
4247
- GrafreeD.clipboard = child;
4976
+ Grafreed.clipboard = child;
42484977 }
42494978
42504979 }
4251
- if (GrafreeD.clipboardIsTempGroup)
4252
- GrafreeD.clipboard = tGroup;
4980
+
4981
+ if (Grafreed.clipboardIsTempGroup)
4982
+ Grafreed.clipboard = tGroup;
4983
+
42534984 if (cut)
42544985 {
42554986 ResetModel();
....@@ -4259,11 +4990,15 @@
42594990
42604991 void paste(boolean expand)
42614992 {
4993
+ if (Globals.REPLACEONMAKE)
4994
+ Save();
4995
+ boolean keep = Globals.REPLACEONMAKE;
4996
+ Globals.REPLACEONMAKE = false;
42624997 // if (GrafreeD.clipboard == null)
42634998 // return;
42644999 boolean first = true;
42655000
4266
- if (GrafreeD.clipboardIsTempGroup)
5001
+ if (Grafreed.clipboardIsTempGroup)
42675002 {
42685003 Composite temp;
42695004
....@@ -4274,7 +5009,7 @@
42745009 temp = (Composite)Applet3D.clipboard.deepCopy();
42755010 */
42765011 Object3D elem;
4277
- 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))
42785013 {
42795014 Object3D child = (Object3D)e.nextElement();
42805015
....@@ -4308,21 +5043,22 @@
43085043 //Object3D cb = Applet3D.clipboard;
43095044 //temp.addChild(cb);
43105045 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4311
- assert(GrafreeD.clipboard.parent == null);
4312
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4313
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4314
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4315
- 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());
43165051 else
4317
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4318
- GrafreeD.clipboard.get(0).parent = keepparent;
5052
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
5053
+ Grafreed.clipboard.get(0).parent = keepparent;
43195054 }
43205055
5056
+ Globals.REPLACEONMAKE = keep;
43215057 ResetModel();
43225058 refreshContents();
43235059 }
43245060
4325
- void pasteInto(boolean copyit)
5061
+ void pasteInto(boolean copyit, boolean clone)
43265062 {
43275063 // if (GrafreeD.clipboard == null)
43285064 // return;
....@@ -4351,15 +5087,22 @@
43515087 if (copyit)
43525088 {
43535089 // paste(false);
4354
- CloneClipboard(false); // sept 2014
5090
+ if (clone)
5091
+ {
5092
+ CloneClipboard(false); // sept 2014
5093
+ }
5094
+ else
5095
+ {
5096
+ paste(false);
5097
+ }
43555098 }
43565099 else
43575100 {
43585101 boolean first = true;
43595102
4360
- if (GrafreeD.clipboardIsTempGroup)
5103
+ if (Grafreed.clipboardIsTempGroup)
43615104 {
4362
- Composite temp = (Composite)GrafreeD.clipboard;
5105
+ Composite temp = (Composite)Grafreed.clipboard;
43635106 Object3D copy;
43645107 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
43655108 {
....@@ -4369,7 +5112,7 @@
43695112 }
43705113 } else
43715114 {
4372
- linkSomething(GrafreeD.clipboard); //.get(0));
5115
+ linkSomething(Grafreed.clipboard); //.get(0));
43735116 }
43745117 }
43755118 }
....@@ -4446,6 +5189,10 @@
44465189
44475190 void group(Object3D csg, boolean grab)
44485191 {
5192
+ if (Globals.REPLACEONMAKE)
5193
+ Save();
5194
+ boolean keep = Globals.REPLACEONMAKE;
5195
+ Globals.REPLACEONMAKE = false;
44495196 if (//false) // why??
44505197 !group.selection.isEmpty())
44515198 {
....@@ -4559,10 +5306,15 @@
45595306 //node.add(csg);
45605307 //makeSomething(node);
45615308 makeSomething(csg);
5309
+ Globals.REPLACEONMAKE = keep;
45625310 }
45635311
45645312 void Ungroup(Object3D g)
45655313 {
5314
+ if (Globals.REPLACEONMAKE)
5315
+ Save();
5316
+ boolean keep = Globals.REPLACEONMAKE;
5317
+ Globals.REPLACEONMAKE = false;
45665318 if (g instanceof HiddenObject)
45675319 {
45685320 HiddenObject h = (HiddenObject) g;
....@@ -4579,6 +5331,7 @@
45795331 objEditor.makeSomething(g.get(i), false);
45805332 }
45815333 }
5334
+ Globals.REPLACEONMAKE = keep;
45825335 }
45835336
45845337 void ungroup()
....@@ -4774,21 +5527,6 @@
47745527 }
47755528 */
47765529
4777
- void ImportGFD()
4778
- {
4779
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4780
- browser.show();
4781
- String filename = browser.getFile();
4782
- if (filename != null && filename.length() > 0)
4783
- {
4784
- String fullname = browser.getDirectory() + filename;
4785
-
4786
- //Object3D readobj =
4787
- objEditor.ReadGFD(fullname, objEditor);
4788
- //makeSomething(readobj);
4789
- }
4790
- }
4791
-
47925530 /*
47935531 public void Callback(Object obj)
47945532 {
....@@ -4812,26 +5550,9 @@
48125550 }
48135551 */
48145552
4815
- void ImportVRMLX3D()
4816
- {
4817
- if (GrafreeD.standAlone)
4818
- {
4819
- /**/
4820
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4821
- browser.show();
4822
- String filename = browser.getFile();
4823
- if (filename != null && filename.length() > 0)
4824
- {
4825
- String fullname = browser.getDirectory() + filename;
4826
- LoadVRMLX3D(fullname);
4827
- }
4828
- /**/
4829
- }
4830
- }
4831
-
48325553 String GetFile(String dialogName)
48335554 {
4834
- if (GrafreeD.standAlone)
5555
+ if (Grafreed.standAlone)
48355556 {
48365557 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
48375558 browser.show();
....@@ -4895,10 +5616,33 @@
48955616 cButton flashSelectionButton;
48965617 cButton editButton;
48975618 cButton uneditButton;
5619
+ JCheckBox allParamsButton;
48985620 cButton clearpanelButton;
4899
- cButton allParamsButton;
49005621 cButton unselectButton;
49015622
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
+
49025646 cButton screenfitButton;
49035647 cButton screenfitpointButton;
49045648 cButton snapobjectButton;
....@@ -4910,14 +5654,6 @@
49105654
49115655 cButton setsupportButton;
49125656
4913
- cButton twoButton;
4914
- cButton sixButton;
4915
- cButton threeButton;
4916
- cButton sevenButton;
4917
- cButton fourButton; // full panel
4918
- cButton oneButton; // full XYZ
4919
- //cButton currentLayout;
4920
-
49215657 //
49225658 //Composite
49235659 Object3D // to do !!
....@@ -4927,9 +5663,11 @@
49275663 //JTree jTree;
49285664 private MenuItem lookAtItem;
49295665 private MenuItem lookFromItem;
4930
- private MenuItem switchItem;
5666
+ private MenuItem switchViewItem;
49315667 private MenuItem cutItem;
4932
- private MenuItem duplicateItem;
5668
+ private MenuItem undoItem;
5669
+ private MenuItem redoItem;
5670
+ private JMenuItem duplicateItem;
49335671 private MenuItem cloneItem;
49345672 private MenuItem cloneSupportItem;
49355673 private MenuItem overwriteGeoItem;
....@@ -4942,7 +5680,7 @@
49425680 private MenuItem linkverticesItem;
49435681 private MenuItem relinkverticesItem;
49445682 private MenuItem setMasterItem;
4945
- private MenuItem resetMeshItem;
5683
+ private MenuItem resetAllItem;
49465684 private MenuItem stepAllItem;
49475685 private MenuItem revertMeshItem;
49485686 private MenuItem poseMeshItem;
....@@ -4953,6 +5691,7 @@
49535691 private MenuItem mergeGeometriesItem;
49545692 private MenuItem copyItem;
49555693 private MenuItem pasteItem;
5694
+ private MenuItem pasteIntoItem;
49565695 private MenuItem pasteLinkItem;
49575696 private MenuItem pasteCloneItem;
49585697 private MenuItem pasteExpandItem;
....@@ -4991,6 +5730,10 @@
49915730 private MenuItem showleavesItem;
49925731 private MenuItem markleavesItem;
49935732 private MenuItem unmarkleavesItem;
5733
+ private MenuItem rewindleavesItem;
5734
+ private MenuItem unrewindleavesItem;
5735
+ private MenuItem randomleavesItem;
5736
+ private MenuItem unrandomleavesItem;
49945737
49955738 private MenuItem flipVItem;
49965739 private MenuItem unflipVItem;
....@@ -5002,15 +5745,17 @@
50025745 private MenuItem panoTexturesItem;
50035746
50045747 private MenuItem resetCentroidItem;
5005
- private MenuItem transformgeometryItem;
5748
+ private MenuItem resetCentroidXZItem;
50065749 private MenuItem resetTransformItem;
5750
+ private MenuItem transformGeometryItem;
5751
+ private MenuItem transformChildrenItem;
50075752 private MenuItem hideItem;
50085753 private MenuItem grabItem;
50095754 private MenuItem backItem;
50105755 private MenuItem frontItem;
50115756 private MenuItem cameraItem;
50125757 private MenuItem compositeItem;
5013
- private MenuItem randomItem;
5758
+ private MenuItem switchItem;
50145759 private MenuItem physicsItem;
50155760 private MenuItem frameselectorItem;
50165761 private MenuItem scriptNodeItem;
....@@ -5050,7 +5795,7 @@
50505795 private MenuItem blobItem;
50515796 private MenuItem latheItem;
50525797 private MenuItem bezierItem;
5053
- private MenuItem checkerItem;
5798
+ private MenuItem overlayItem;
50545799 private MenuItem meshItem;
50555800 // private MenuItem meshGroupItem;
50565801 private MenuItem springItem;
....@@ -5072,11 +5817,6 @@
50725817 private MenuItem doubleItem;
50735818 private MenuItem tripleItem;
50745819
5075
- private MenuItem importGFDItem;
5076
- private MenuItem importVRMLX3DItem;
5077
- private MenuItem import3DSItem;
5078
- private MenuItem importOBJItem;
5079
-
50805820 private MenuItem computeAOItem;
50815821 private MenuItem recompileItem;
50825822 private MenuItem editScriptItem;
....@@ -5086,4 +5826,8 @@
50865826 private MenuItem analyzeItem;
50875827 private MenuItem dumpItem;
50885828 //boolean freezemodel = false;
5829
+
5830
+ Menu cameraMenu;
5831
+ MenuItem editCameraItem;
5832
+ MenuItem restoreCameraItem;
50895833 }