Normand Briere
2019-07-01 9079880942d022ee32fd3a543843e132e52deb1a
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,
....@@ -73,7 +74,7 @@
7374 this.copy = this.group = copy;
7475 //selectees = this.group.selectees;
7576
76
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7778 SetupUI2(objEditor);
7879 objEditor.SetupUI(true);
7980 SetupViews(objEditor);
....@@ -97,14 +98,14 @@
9798
9899 void CloneClipboard(boolean supports)
99100 {
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));
101
+ assert(Grafreed.clipboard.parent == null);
102
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
103
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
104
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
105
+ makeSomething(CloneObject(Grafreed.clipboard.get(0), false));
105106 else
106
- makeSomething(CloneObject(GrafreeD.clipboard, false));
107
- GrafreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
108109 }
109110
110111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -118,7 +119,7 @@
118119 // obj.support = null;
119120 if (!supports)
120121 obj.SaveSupports();
121
- Object3D clone = (Object3D)GrafreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
122123 obj.parent = parent;
123124 // obj.support = support;
124125 // clone.support = support; // aout 2013
....@@ -147,30 +148,29 @@
147148
148149 //JTextField nameField;
149150
150
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
151152 {
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);
153
+ oe.jTree = new cTree();
154
+
163155 Menu menu;
164156 oe.menuBar.add(menu = new Menu("Edit"));
165157 //editItem = menu.add(new MenuItem("Edit"));
166158 //editItem.addActionListener(this);
167
- duplicateItem = menu.add(new MenuItem("Duplicate"));
159
+
160
+// undoItem = menu.add(new MenuItem("Undo"));
161
+// undoItem.addActionListener(this);
162
+// redoItem = menu.add(new MenuItem("Redo"));
163
+// redoItem.addActionListener(this);
164
+// menu.add("-");
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
168166 duplicateItem.addActionListener(this);
169
- menu.add("-");
170167 cloneItem = menu.add(new MenuItem("Clone"));
171168 cloneItem.addActionListener(this);
169
+ if (Globals.ADVANCED)
170
+ {
172171 cloneSupportItem = menu.add(new MenuItem("Clone (+supports)"));
173172 cloneSupportItem.addActionListener(this);
173
+ }
174174 menu.add("-");
175175 cutItem = menu.add(new MenuItem("Cut"));
176176 cutItem.addActionListener(this);
....@@ -178,27 +178,123 @@
178178 copyItem.addActionListener(this);
179179 pasteItem = menu.add(new MenuItem("Paste"));
180180 pasteItem.addActionListener(this);
181
+
182
+ menu.add("-");
183
+ pasteIntoItem = menu.add(new MenuItem("Paste into"));
184
+ pasteIntoItem.addActionListener(this);
181185 pasteLinkItem = menu.add(new MenuItem("Paste link"));
182186 pasteLinkItem.addActionListener(this);
183187 pasteCloneItem = menu.add(new MenuItem("Paste clone"));
184188 pasteCloneItem.addActionListener(this);
185189 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
186190 // pasteExpandItem.addActionListener(this);
191
+ menu.add("-");
187192 clearItem = menu.add(new MenuItem("Clear"));
188193 clearItem.addActionListener(this);
194
+
195
+ if (Globals.ADVANCED)
196
+ {
197
+ // Deletes the cameras...
189198 clearAllItem = menu.add(new MenuItem("Clear All"));
190199 clearAllItem.addActionListener(this);
200
+ }
201
+
202
+ menuBar.add(cameraMenu = new Menu("View"));
203
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
204
+ //zBufferItem.addActionListener(this);
205
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
206
+ //normalLensItem.addActionListener(this);
207
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
208
+ restoreCameraItem.addActionListener(this);
209
+
210
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
211
+// toggleFullScreenItem.addItemListener(this);
212
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
213
+// cameraMenu.add("-");
214
+//
215
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
216
+// toggleTextureItem.addItemListener(this);
217
+// toggleTextureItem.setState(CameraPane.textureon);
218
+//
219
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
220
+// toggleSwitchItem.addItemListener(this);
221
+// toggleSwitchItem.setState(CameraPane.SWITCH);
222
+
223
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
224
+ toggleHandleItem.addItemListener(this);
225
+ toggleHandleItem.setState(CameraPane.HANDLES);
226
+
227
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
228
+ togglePaintItem.addItemListener(this);
229
+ togglePaintItem.setState(CameraPane.PAINTMODE);
230
+
231
+ if (Globals.ADVANCED)
232
+ {
233
+ cameraMenu.add("-");
234
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
235
+ toggleLiveItem.addItemListener(this);
236
+ toggleLiveItem.setState(Globals.isLIVE());
191237
238
+ cameraMenu.add(stepItem = new MenuItem("Step"));
239
+ stepItem.addActionListener(this);
240
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
241
+ // toggleDLItem.addItemListener(this);
242
+ // toggleDLItem.setState(false);
243
+
244
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
245
+ toggleRenderItem.addItemListener(this);
246
+ toggleRenderItem.setState(!CameraPane.frozen);
247
+
248
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
249
+ toggleDebugItem.addItemListener(this);
250
+ toggleDebugItem.setState(Globals.DEBUG);
251
+
252
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
253
+ toggleFrustumItem.addItemListener(this);
254
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
255
+
256
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
257
+ toggleFootContactItem.addItemListener(this);
258
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
259
+
260
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
261
+ toggleTimelineItem.addItemListener(this);
262
+ }
263
+
264
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
265
+// toggleRootItem.addItemListener(this);
266
+// toggleRootItem.setState(false);
267
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
268
+// animationItem.addItemListener(this);
269
+// animationItem.setState(CameraPane.ANIMATION);
270
+ cameraMenu.add("-");
271
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
272
+ editCameraItem.addActionListener(this);
273
+
274
+ if (Globals.ADVANCED)
275
+ {
276
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
277
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
278
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
279
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
280
+ oe.cameraMenu.add("-");
281
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
282
+ openWindowItem.addActionListener(this);
283
+ editLeafItem.addActionListener(this);
284
+ lookAtItem.addActionListener(this);
285
+ //lookFromItem.addActinoListener(this);
286
+ //switchViewItem.addActionListener(this);
287
+ }
288
+
192289 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);
290
+ if (Globals.ADVANCED)
291
+ {
197292 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
198293 revertMeshItem.addActionListener(this);
199294 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
200295 resetreferencesItem.addActionListener(this);
201296 menu.add("-");
297
+ }
202298 overwriteGeoItem = menu.add(new MenuItem("Overwrite Geometry"));
203299 overwriteGeoItem.addActionListener(this);
204300 overwriteMatItem = menu.add(new MenuItem("Overwrite Material"));
....@@ -210,73 +306,103 @@
210306 overwriteUVItem = menu.add(new MenuItem("Overwrite UV"));
211307 overwriteUVItem.addActionListener(this);
212308 menu.add("-");
309
+ if (Globals.ADVANCED)
310
+ {
213311 generateMeshItem = menu.add(new MenuItem("Generate Meshes"));
214312 generateMeshItem.addActionListener(this);
215313 poseMeshItem = menu.add(new MenuItem("Set Pose Meshes"));
216314 poseMeshItem.addActionListener(this);
217315 menu.add("-");
316
+ }
218317 resetsupportItem = menu.add(new MenuItem("Reset support"));
219318 resetsupportItem.addActionListener(this);
220319 linkverticesItem = menu.add(new MenuItem("Link to Support"));
221320 linkverticesItem.addActionListener(this);
321
+ relinkverticesItem = menu.add(new MenuItem("Re-link to Support"));
322
+ relinkverticesItem.addActionListener(this);
323
+
324
+ if (Globals.ADVANCED)
325
+ {
222326 setMasterItem = menu.add(new MenuItem("Set Master Mesh"));
223327 setMasterItem.addActionListener(this);
328
+ }
224329
225330 oe.menuBar.add(menu = new Menu("Group"));
226
- grabItem = menu.add(new MenuItem("Grab"));
227
- grabItem.addActionListener(this);
331
+// grabItem = menu.add(new MenuItem("Grab"));
332
+// grabItem.addActionListener(this);
228333 backItem = menu.add(new MenuItem("Back"));
229334 backItem.addActionListener(this);
230335 frontItem = menu.add(new MenuItem("Front"));
231336 frontItem.addActionListener(this);
232
- compositeItem = menu.add(new MenuItem("Composite"));
233
- compositeItem.addActionListener(this);
234
- menu.add("-");
235
- randomItem = menu.add(new MenuItem("Random"));
236
- randomItem.addActionListener(this);
237
- physicsItem = menu.add(new MenuItem("Physics"));
238
- physicsItem.addActionListener(this);
239
- frameselectorItem = menu.add(new MenuItem("Frame Selector"));
240
- frameselectorItem.addActionListener(this);
337
+// compositeItem = menu.add(new MenuItem("Composite"));
338
+// compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
342
+ hideItem = menu.add(new MenuItem("Hidden Group"));
343
+ hideItem.addActionListener(this);
344
+ }
345
+ ungroupItem = menu.add(new MenuItem("Ungroup"));
346
+ ungroupItem.addActionListener(this);
347
+
348
+// menu.add("-");
349
+//
350
+// switchItem = menu.add(new MenuItem("Switch node"));
351
+// switchItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
241354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
242355 switchGeoItem.addActionListener(this);
243356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
244357 switchTransfoItem.addActionListener(this);
245
- morphItem = menu.add(new MenuItem("Morph"));
358
+ morphItem = menu.add(new MenuItem("Morph Group"));
246359 morphItem.addActionListener(this);
360
+
361
+ menu.add("-");
362
+ physicsItem = menu.add(new MenuItem("Physics"));
363
+ physicsItem.addActionListener(this);
364
+ frameselectorItem = menu.add(new MenuItem("Frame Selector"));
365
+ frameselectorItem.addActionListener(this);
247366 scriptNodeItem = menu.add(new MenuItem("Script Node"));
248367 scriptNodeItem.addActionListener(this);
249
- cameraItem = menu.add(new MenuItem("Camera"));
250
- cameraItem.addActionListener(this);
368
+ }
251369
252370 oe.menuBar.add(menu = new Menu("Object"));
253
- textureItem = menu.add(new MenuItem("Texture"));
254
- textureItem.addActionListener(this);
371
+// textureItem = menu.add(new MenuItem("Texture"));
372
+// textureItem.addActionListener(this);
373
+ billboardItem = menu.add(new MenuItem("Billboard"));
374
+ billboardItem.addActionListener(this);
255375 csgItem = menu.add(new MenuItem("CSG"));
256376 csgItem.addActionListener(this);
257
- shadowXItem = menu.add(new MenuItem("Shadow X"));
377
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
258378 shadowXItem.addActionListener(this);
259
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
379
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
260380 shadowYItem.addActionListener(this);
261
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
381
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
262382 shadowZItem.addActionListener(this);
383
+ if (Globals.ADVANCED)
384
+ {
385
+ menu.add("-");
263386 linkerItem = menu.add(new MenuItem("Linker"));
264387 linkerItem.addActionListener(this);
265
- templateItem = menu.add(new MenuItem("Template"));
266
- templateItem.addActionListener(this);
267388 attributeItem = menu.add(new MenuItem("Attribute"));
268389 attributeItem.addActionListener(this);
390
+ templateItem = menu.add(new MenuItem("Template"));
391
+ templateItem.addActionListener(this);
269392 pointflowItem = menu.add(new MenuItem("Point Flow"));
270393 pointflowItem.addActionListener(this);
394
+ }
271395 menu.add("-");
272
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
273
- transformgeometryItem.addActionListener(this);
274396 resetTransformItem = menu.add(new MenuItem("Reset Transform"));
275397 resetTransformItem.addActionListener(this);
276398 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
277399 resetCentroidItem.addActionListener(this);
278
- ungroupItem = menu.add(new MenuItem("Ungroup"));
279
- ungroupItem.addActionListener(this);
400
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
401
+ resetCentroidXZItem.addActionListener(this);
402
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
403
+ transformGeometryItem.addActionListener(this);
404
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
405
+ transformChildrenItem.addActionListener(this);
280406
281407 oe.menuBar.add(menu = new Menu("Geometry"));
282408 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -287,6 +413,11 @@
287413 genNormalsCADItem.addActionListener(this);
288414 genNormalsMESHItem = menu.add(new MenuItem("Mesh Normals"));
289415 genNormalsMESHItem.addActionListener(this);
416
+ if (Globals.ADVANCED)
417
+ {
418
+ genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
419
+ genNormalsMINEItem.addActionListener(this);
420
+ }
290421 stripifyItem = menu.add(new MenuItem("Stripify"));
291422 stripifyItem.addActionListener(this);
292423 unstripifyItem = menu.add(new MenuItem("Unstripify"));
....@@ -308,23 +439,34 @@
308439 reduce34MeshItem.addActionListener(this);
309440 increaseMeshItem = menu.add(new MenuItem("Increase mesh"));
310441 increaseMeshItem.addActionListener(this);
311
- smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
312
- smoothMeshItem.addActionListener(this);
313442 clipMeshItem = menu.add(new MenuItem("Clip mesh"));
314443 clipMeshItem.addActionListener(this);
444
+
445
+ if (Globals.ADVANCED)
446
+ {
447
+ smoothMeshItem = menu.add(new MenuItem("Smooth mesh"));
448
+ smoothMeshItem.addActionListener(this);
449
+ }
315450
316451 oe.menuBar.add(menu = new Menu("Attributes"));
317452 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
318453 clearMaterialsItem.addActionListener(this);
454
+ resetAllItem = menu.add(new MenuItem("Reset All"));
455
+ resetAllItem.addActionListener(this);
456
+ stepAllItem = menu.add(new MenuItem("Step All"));
457
+ stepAllItem.addActionListener(this);
319458 menu.add("-");
320459 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
321460 liveleavesItem.addActionListener(this);
322461 unliveleavesItem = menu.add(new MenuItem("Unlive Leaves"));
323462 unliveleavesItem.addActionListener(this);
463
+ if (Globals.ADVANCED)
464
+ {
324465 supportleavesItem = menu.add(new MenuItem("Support Leaves"));
325466 supportleavesItem.addActionListener(this);
326467 unsupportleavesItem = menu.add(new MenuItem("Unsupport Leaves"));
327468 unsupportleavesItem.addActionListener(this);
469
+ }
328470 hideleavesItem = menu.add(new MenuItem("Hide Leaves"));
329471 hideleavesItem.addActionListener(this);
330472 showleavesItem = menu.add(new MenuItem("Show Leaves"));
....@@ -333,6 +475,14 @@
333475 markleavesItem.addActionListener(this);
334476 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
335477 unmarkleavesItem.addActionListener(this);
478
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
479
+ rewindleavesItem.addActionListener(this);
480
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
481
+ unrewindleavesItem.addActionListener(this);
482
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
483
+ randomleavesItem.addActionListener(this);
484
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
485
+ unrandomleavesItem.addActionListener(this);
336486 menu.add("-");
337487 flipVItem = menu.add(new MenuItem("Flip V"));
338488 flipVItem.addActionListener(this);
....@@ -368,35 +518,40 @@
368518 sortbynameItem = menu.add(new MenuItem("Sort by name"));
369519 sortbynameItem.addActionListener(this);
370520 menu.add("-");
521
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
522
+ shareGeometriesItem.addActionListener(this);
523
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
524
+ mergeGeometriesItem.addActionListener(this);
525
+ if (Globals.ADVANCED)
526
+ {
527
+ // Pretty much the same as duplicate and clone.
371528 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
372529 extractGeometriesItem.addActionListener(this);
373530 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
374531 cloneGeometriesItem.addActionListener(this);
375
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
376
- shareGeometriesItem.addActionListener(this);
377
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
378
- mergeGeometriesItem.addActionListener(this);
532
+ }
379533
380534 oe.menuBar.add(menu = new Menu("Insert"));
381535 buildCreateMenu(menu);
382536
383
-
384
- oe.menuBar.add(menu = new Menu("Include"));
385
- importGFDItem = menu.add(new MenuItem("GrafreeD Object..."));
386
- importGFDItem.addActionListener(this);
387
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D Object..."));
388
- importVRMLX3DItem.addActionListener(this);
389
- importOBJItem = menu.add(new MenuItem("OBJ Object..."));
390
- importOBJItem.addActionListener(this);
391
- import3DSItem = menu.add(new MenuItem("3DS Object..."));
392
- import3DSItem.addActionListener(this);
393
-
394537 oe.menuBar.add(menu = new Menu("Tools"));
395538 buildToolsMenu(menu);
396539 }
397540
398541 void SetupUI2(ObjEditor oe)
399542 {
543
+ // June 2019
544
+ if (oe == null)
545
+ {
546
+ //super.SetupUI2(this);
547
+ //return;
548
+ }
549
+
550
+ if (copy != group)
551
+ {
552
+ //super.SetupUI2(this);
553
+ }
554
+
400555 //new Exception().printStackTrace();
401556
402557 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -425,150 +580,217 @@
425580 oe.radioPanel.add(dummyButton);
426581 oe.buttonGroup.add(dummyButton);
427582 */
428
- aConstraints.gridy += 1;
429
- oe.aConstraints.gridwidth = 1;
430
- oe.aConstraints.gridx = 0;
583
+ cGridBag copyOptionsPanel = new cGridBag();
584
+
585
+ copyOptionsPanel.preferredHeight = 1;
431586
432
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints);
587
+ //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
588
+
589
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
590
+ //minButton.setToolTipText("Minimize window");
591
+ //minButton.addActionListener(this);
592
+
593
+ if (Globals.ADVANCED)
594
+ {
595
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ maxButton.setToolTipText("Maximize window");
597
+ maxButton.addActionListener(this);
598
+ }
599
+
600
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
601
+ fullButton.setToolTipText("Full-screen window");
602
+ fullButton.addActionListener(this);
603
+
604
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605
+ restoreCameraButton.setToolTipText("Restore viewpoint");
606
+ restoreCameraButton.addActionListener(this);
607
+
608
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
+ undoButton.setToolTipText("Undo changes");
610
+ undoButton.addActionListener(this);
611
+ undoButton.setEnabled(false);
612
+
613
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614
+ redoButton.setToolTipText("Redo changes");
615
+ redoButton.addActionListener(this);
616
+ redoButton.setEnabled(false);
617
+
618
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
+ saveButton.setToolTipText("Save changes");
620
+ saveButton.addActionListener(this);
621
+
622
+ copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
623
+ liveCB.setToolTipText("Enable animation");
433624 liveCB.addItemListener(this);
434625
435
- oe.aConstraints.gridx += 1;
436
- oe.toolbarPanel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT), oe.aConstraints);
437
- supportCB.addItemListener(this);
438
-
439
- // oe.aConstraints.gridx += 1;
440
- // oe.toolbarPanel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), oe.aConstraints);
441
- // localCB.addItemListener(this);
442
-
443
- oe.aConstraints.gridx += 1;
444
- oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints);
445
- crowdCB.addItemListener(this);
446
-
447
- oe.aConstraints.gridx += 1;
448
- oe.toolbarPanel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA), oe.aConstraints);
449
- smoothCB.addItemListener(this);
450
-
451
- oe.aConstraints.gridx += 1;
452
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST), oe.aConstraints);
626
+ copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
627
+ oneStepButton.setToolTipText("Animate one step forward");
628
+ oneStepButton.addActionListener(this);
629
+
630
+ copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
631
+ fastCB.setToolTipText("Fast mode");
453632 fastCB.addItemListener(this);
454
- oe.aConstraints.gridx += 1;
455
- oe.toolbarPanel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE), oe.aConstraints);
456
- slowCB.addItemListener(this);
457
- oe.aConstraints.gridx += 1;
458
- oe.toolbarPanel.add(boxCB = new cCheckBox("Box", CameraPane.FAST), oe.aConstraints);
459
- boxCB.addItemListener(this);
460
-
461
-// oe.aConstraints.gridx += 1;
462
-// oe.toolbarPanel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), oe.aConstraints);
463
-// speakerMocapCB.addItemListener(this);
464
-
465
- if (false)
466
- {
467
- // handled in scripts
468
- oe.aConstraints.gridx += 1;
469
- oe.toolbarPanel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA), oe.aConstraints);
470
- speakerCameraCB.addItemListener(this);
471
-
472
- oe.aConstraints.gridx += 1;
473
- oe.toolbarPanel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS), oe.aConstraints);
474
- speakerFocusCB.addItemListener(this);
475
-
476
- oe.aConstraints.gridx += 1;
477
- oe.toolbarPanel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS), oe.aConstraints);
478
- smoothfocusCB.addItemListener(this);
479
- }
480
-
481
-//oe.aConstraints.gridx += 1;
482
-//oe.toolbarPanel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), oe.aConstraints);
483
-// debugCB.addItemListener(this);
484
-
485
- oe.aConstraints.gridx += 1;
486
- oe.toolbarPanel.add(oeilCB = new cCheckBox("O", CameraPane.OEIL), oe.aConstraints);
487
- oeilCB.addItemListener(this);
488
-
489
- oe.aConstraints.gridx += 1;
490
- oe.toolbarPanel.add(lookAtCB = new cCheckBox("T", CameraPane.LOOKAT), oe.aConstraints);
491
- lookAtCB.addItemListener(this);
492
-
493
- oe.aConstraints.gridx += 1;
494
- oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK), oe.aConstraints);
495
- trackCB.addItemListener(this);
496
-
497
- oe.aConstraints.gridx += 1;
498
- oe.toolbarPanel.add(screenfitButton = new cButton("@ ")); //, oe.aConstraints);
633
+
634
+ //oe.toolboxPanel.Return();
635
+
636
+ copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637
+ screenfitButton.setToolTipText("Screen fit");
499638 screenfitButton.addActionListener(this);
500
- oe.aConstraints.gridx += 1;
639
+
640
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
641
+// trackCB.setToolTipText("Enable tracking");
642
+// trackCB.addItemListener(this);
643
+
501644 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
502645 // screenfitpointButton.addActionListener(this);
503
-// oe.aConstraints.gridx += 1;
504
- oe.toolbarPanel.add(snapobjectButton = new cButton(" O+ ")); //, oe.aConstraints);
505
- snapobjectButton.addActionListener(this);
506
- oe.aConstraints.gridx += 1;
507646
508
- //aConstraints.gridx = 0;
509
- //aConstraints.gridy += 1;
510
- oe.aConstraints.weighty = 0;
511
- oe.aConstraints.gridwidth = 1;
512
-
513
- oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints);
514
- flashSelectionButton.addActionListener(this);
515
- oe.aConstraints.gridx += 1;
516
- oe.aConstraints.weighty = 0;
517
- oe.aConstraints.gridwidth = 1;
647
+ if (Globals.ADVANCED)
648
+ {
649
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
+ snapobjectButton.addActionListener(this);
651
+ snapobjectButton.setToolTipText("Snap Object");
652
+ }
653
+
654
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
518655
519
- //
520
- oe.toolbarPanel.add(twoButton = new cButton(" |+| ")); //, oe.aConstraints);
656
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ twoButton.setToolTipText("Show center view only");
521658 twoButton.addActionListener(this);
522
- oe.toolbarPanel.add(fourButton = new cButton("+|| ")); //, oe.aConstraints);
659
+ this.fullscreenLayout = twoButton;
660
+
661
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
523662 fourButton.addActionListener(this);
524
- oe.toolbarPanel.add(sixButton = new cButton("+|+| ")); //, oe.aConstraints);
663
+ fourButton.setToolTipText("Show left panel only");
664
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
+ sixButton.setToolTipText("2-column layout left");
525666 sixButton.addActionListener(this);
526
- oe.toolbarPanel.add(threeButton = new cButton(" |+|+")); //, oe.aConstraints);
667
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ threeButton.setToolTipText("2-column layout right");
527669 threeButton.addActionListener(this);
528
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+")); //, oe.aConstraints);
670
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
+ sevenButton.setToolTipText("3-column layout");
529672 sevenButton.addActionListener(this);
530673 //
531674
532
- oe.toolbarPanel.add(rootButton = new cButton(" o o o E ")); //, oe.aConstraints);
675
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
+ rootButton.setToolTipText("Edit selection in new tab");
533677 rootButton.addActionListener(this);
534
- oe.aConstraints.gridx += 1;
535
- oe.toolbarPanel.add(closeButton = new cButton(" X ")); //, oe.aConstraints);
678
+
679
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
680
+ closeButton.setToolTipText("Close tab");
536681 closeButton.addActionListener(this);
537682 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
538683 //clearButton.addActionListener(this);
539
- oe.aConstraints.gridx += 1;
540
-
541
- oe.aConstraints.gridx = 1; //
542
- oe.treePanel.add(editButton = new cButton("+"), oe.aConstraints);
543
- editButton.addActionListener(this);
544
- oe.aConstraints.gridx += 1;
545
- oe.aConstraints.weighty = 0;
546
- oe.aConstraints.gridwidth = 1;
547684
548
- oe.treePanel.add(uneditButton = new cButton("-"), oe.aConstraints);
685
+ // INSERT
686
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
687
+ gridButton.setToolTipText("Create grid");
688
+ gridButton.addActionListener(this);
689
+
690
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
691
+ boxButton.setToolTipText("Create box");
692
+ boxButton.addActionListener(this);
693
+
694
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695
+ sphereButton.setToolTipText("Create sphere");
696
+ sphereButton.addActionListener(this);
697
+
698
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
699
+ coneButton.setToolTipText("Create cone");
700
+ coneButton.addActionListener(this);
701
+
702
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703
+ torusButton.setToolTipText("Create torus");
704
+ torusButton.addActionListener(this);
705
+
706
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707
+ superButton.setToolTipText("Create superellipsoid");
708
+ superButton.addActionListener(this);
709
+
710
+ if (Globals.ADVANCED)
711
+ {
712
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ kleinButton.setToolTipText("Create Klein bottle");
714
+ kleinButton.addActionListener(this);
715
+ }
716
+
717
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
718
+ particlesButton.setToolTipText("Create particle system");
719
+ particlesButton.addActionListener(this);
720
+
721
+ oe.toolboxPanel.Return();
722
+
723
+ oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724
+ groupButton.setToolTipText("Create group");
725
+ groupButton.addActionListener(this);
726
+
727
+ oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
728
+ compositeButton.setToolTipText("Create composite");
729
+ compositeButton.addActionListener(this);
730
+
731
+ oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
732
+ switchButton.setToolTipText("Create item switcher");
733
+ switchButton.addActionListener(this);
734
+
735
+ oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
736
+ loopButton.setToolTipText("Create loop");
737
+ loopButton.addActionListener(this);
738
+
739
+ oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
740
+ textureButton.setToolTipText("Create texture");
741
+ textureButton.addActionListener(this);
742
+
743
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
744
+ overlayButton.setToolTipText("Create overlay");
745
+ overlayButton.addActionListener(this);
746
+
747
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
748
+ lightButton.setToolTipText("Create light");
749
+ lightButton.addActionListener(this);
750
+
751
+ for (int i=6; --i>=0;)
752
+ {
753
+ oe.toolboxPanel.Return();
754
+ oe.toolboxPanel.add(new cGridBag());
755
+ oe.toolboxPanel.add(new cGridBag());
756
+ oe.toolboxPanel.add(new cGridBag());
757
+ oe.toolboxPanel.add(new cGridBag());
758
+ oe.toolboxPanel.add(new cGridBag());
759
+ oe.toolboxPanel.add(new cGridBag());
760
+ oe.toolboxPanel.add(new cGridBag());
761
+ }
762
+
763
+ // EDIT panel
764
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
765
+ editButton.setToolTipText("Pin selection controls");
766
+ editButton.addActionListener(this);
767
+
768
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
769
+ uneditButton.setToolTipText("Remove selection controls");
549770 uneditButton.addActionListener(this);
550771
551
- oe.aConstraints.gridx += 1;
552
- oe.aConstraints.weighty = 0;
553
- oe.aConstraints.gridwidth = 1;
554
-
555
- oe.treePanel.add(clearPanelButton = new cButton("C"), oe.aConstraints);
556
- clearPanelButton.addActionListener(this);
557
-
558
- oe.aConstraints.gridx += 1;
559
- oe.aConstraints.weighty = 0;
560
- oe.aConstraints.gridwidth = 1;
561
-
562
- oe.treePanel.add(allParamsButton = new cButton("A"), oe.aConstraints);
772
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
773
+ allParamsButton.setToolTipText("Show all controle");
563774 allParamsButton.addActionListener(this);
564775
565
- oe.aConstraints.gridx += 1;
566
- oe.aConstraints.weighty = 0;
567
- oe.aConstraints.gridwidth = 1;
568
-
569
- oe.treePanel.add(unselectButton = new cButton("U"), oe.aConstraints);
776
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
777
+ clearPanelButton.setToolTipText("Clear edit panel");
778
+ clearPanelButton.addActionListener(this);
779
+
780
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
781
+ unselectButton.setToolTipText("Unselect");
570782 unselectButton.addActionListener(this);
571783
784
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
785
+ flashSelectionButton.setToolTipText("Highlight selection");
786
+ flashSelectionButton.addActionListener(this);
787
+
788
+ editCommandsPanel.preferredHeight = 1;
789
+
790
+ SetPinStates(false);
791
+// oe.treePanel.add(commandsPanel);
792
+// oe.treePanel.Return();
793
+
572794 // oe.aConstraints.gridx += 1;
573795 // oe.aConstraints.weighty = 0;
574796 // oe.aConstraints.gridwidth = 1;
....@@ -580,40 +802,22 @@
580802 // oe.treePanel.add(gcButton = new cButton("GC"), oe.aConstraints);
581803 // gcButton.addActionListener(this);
582804
583
- oe.aConstraints.gridx = 0;
584
- oe.aConstraints.gridy += 1;
585
-
586
- //ctrlPanel.add(objList = new List(5, true));
587
- oe.aConstraints.gridwidth = 100;
588
- // oe.aConstraints.gridheight = 100;
589
- oe.aConstraints.fill = GridBagConstraints.BOTH; // HORIZONTAL;
590
- oe.aConstraints.gridheight = 1;
591
- oe.aConstraints.weighty = 0.5;
592
- oe.aConstraints.gridx = 0;
593
- JScrollPane jSP;
805
+ cGridBag jSPPanel = new cGridBag();
806
+
807
+ JScrollPane jSP;
594808 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
595
- oe.treePanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null)), oe.aConstraints);
809
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
596810 ResetModel();
597
- oe.aConstraints.weighty = 0.5;
598
- oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;
599
- oe.aConstraints.gridy += 1;
600
- oe.aConstraints.gridwidth = 1;
601
-
602
- oe.aConstraints.weighty = 0;
603
- oe.aConstraints.gridwidth = 2;
604
-
605
- oe.treePanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0), oe.aConstraints);
606
- colorCB.addItemListener(this);
607
- oe.aConstraints.gridx += 2;
608
- oe.treePanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0), oe.aConstraints);
609
- materialCB.addItemListener(this);
610
- oe.aConstraints.gridx += 2;
611
- oe.treePanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0), oe.aConstraints);
612
- textureCB.addItemListener(this);
613
-
614
- oe.aConstraints.gridx = 0;
615
- oe.aConstraints.gridy += 1;
616811
812
+ oe.treePanel.add(jSPPanel);
813
+ oe.treePanel.Return();
814
+
815
+ oe.treePanel.add(copyOptionsPanel);
816
+ oe.treePanel.Return();
817
+
818
+// mainPanel.setDividerLocation(0.5); //1.0);
819
+// mainPanel.setResizeWeight(0.5);
820
+
617821 //jList.addListSelectionListener(this);
618822 oe.jTree.addTreeSelectionListener(this);
619823 //jTree.setRootVisible(false);
....@@ -635,20 +839,157 @@
635839 radio.layout = sevenButton;
636840 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
637841 }
842
+
843
+ void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
844
+ {
845
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
846
+ colorCB.setToolTipText("Copy color when dropped");
847
+ colorCB.addItemListener(this);
848
+
849
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
850
+ materialCB.setToolTipText("Copy material when dropped");
851
+ materialCB.addItemListener(this);
852
+
853
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
854
+ textureCB.setToolTipText("Copy texture when dropped");
855
+ textureCB.addItemListener(this);
856
+
857
+ panel.Return();
858
+
859
+ panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
860
+ boxCB.setToolTipText("Display bounding boxes");
861
+ boxCB.addItemListener(this);
862
+
863
+ panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
864
+ zoomBoxCB.setToolTipText("Display only for wheel");
865
+ zoomBoxCB.addItemListener(this);
866
+
867
+ if (true) // Globals.ADVANCED)
868
+ {
869
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
870
+// supportCB.setToolTipText("Enable rigging");
871
+// supportCB.addItemListener(this);
872
+
873
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
874
+ freezeCB.setToolTipText("Fast moving camera");
875
+ freezeCB.addItemListener(this);
876
+
877
+ // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
878
+ // localCB.addItemListener(this);
879
+
880
+ panel.Return();
881
+
882
+ panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
883
+ crowdCB.setToolTipText("Used for crowds");
884
+ crowdCB.addItemListener(this);
885
+
886
+ panel.add(smoothCB = new cCheckBox("Inertia", CameraPane.INERTIA)); //, constraints);
887
+ smoothCB.setToolTipText("Snapping delay");
888
+ smoothCB.addItemListener(this);
889
+
890
+ panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
891
+ slowCB.setToolTipText("Smooth interpolation");
892
+ slowCB.addItemListener(this);
893
+
894
+// constraints.gridy += 1;
895
+// panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
896
+// speakerMocapCB.addItemListener(this);
897
+
898
+ panel.Return();
899
+
900
+ if (false)
901
+ {
902
+ // handled in scripts
903
+ //constraints.gridy += 1;
904
+ panel.add(speakerCameraCB = new cCheckBox("Cam", CameraPane.SPEAKERCAMERA)); //, constraints);
905
+ speakerCameraCB.addItemListener(this);
906
+
907
+ //constraints.gridy += 1;
908
+ panel.add(speakerFocusCB = new cCheckBox("Focus", CameraPane.SPEAKERFOCUS)); //, constraints);
909
+ speakerFocusCB.addItemListener(this);
910
+
911
+ //constraints.gridy += 1;
912
+ panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
913
+ smoothfocusCB.addItemListener(this);
914
+ panel.Return();
915
+ }
916
+
917
+//constraints.gridx += 1;
918
+//panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
919
+// debugCB.addItemListener(this);
920
+
921
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
922
+ trackCB.setToolTipText("Enable tracking target");
923
+ trackCB.addItemListener(this);
924
+
925
+ panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
926
+ oeilCB.setToolTipText("Move camera when tracking");
927
+ oeilCB.addItemListener(this);
928
+
929
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
930
+ shadowCB.setToolTipText("When live compute shadows");
931
+ shadowCB.addItemListener(this);
932
+
933
+ panel.Return();
934
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
935
+ toggleTextureCB.setToolTipText("Load textures");
936
+ toggleTextureCB.addItemListener(this);
937
+
938
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
939
+ toggleSwitchCB.setToolTipText("Choose a single item");
940
+ toggleSwitchCB.addItemListener(this);
941
+
942
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
943
+ autosaveCB.setToolTipText("On structure change");
944
+ autosaveCB.addItemListener(this);
945
+
946
+ panel.Return();
947
+ if (Globals.ADVANCED)
948
+ {
949
+ panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
950
+ lookAtCB.setToolTipText("Look-at target");
951
+ lookAtCB.addItemListener(this);
952
+ }
953
+
954
+ }
955
+
956
+ cGridBag fill = new cGridBag();
957
+ fill.preferredHeight = 200;
958
+ cGridBag fill2 = new cGridBag();
959
+ fill2.preferredHeight = 200;
960
+ cGridBag fill3 = new cGridBag();
961
+ fill3.preferredHeight = 200;
962
+
963
+ panel.add(fill);
964
+ panel.add(fill2);
965
+ panel.add(fill3);
966
+
967
+ }
638968
639969 void EditObject(Object3D obj)
640970 {
641
- cRadio dummyButton = new cRadio(obj.name);
642
- dummyButton.SetObject(obj);
643
- dummyButton.layout = sevenButton;
644
- dummyButton.SetCamera(cameraView.renderCamera, false);
645
- dummyButton.addActionListener(this);
646
- radioPanel.add(dummyButton);
647
- buttonGroup.add(dummyButton);
648
- dummyButton.doClick();
971
+ cRadio radioButton = new cRadio(obj.name);
972
+
973
+ // Patch to avoid bug with transparency.
974
+ radioButton.hadMaterial = obj.material != null;
975
+ if (!radioButton.hadMaterial)
976
+ {
977
+ obj.material = new cMaterial();
978
+ }
979
+
980
+ radioButton.SetObject(obj);
981
+ radioButton.layout = sevenButton;
982
+ radioButton.SetCamera(cameraView.renderCamera, false);
983
+ radioButton.addActionListener(this);
984
+ radioPanel.add(radioButton);
985
+ buttonGroup.add(radioButton);
986
+ radioButton.doClick();
649987 }
988
+
650989 void SetupViews(ObjEditor oe)
651990 {
991
+ theFrame = this;
992
+
652993 oe.SetupViews();
653994
654995 System.out.println("SetupViews");
....@@ -657,22 +998,28 @@
657998 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
658999 }
6591000
660
- JCheckBox liveCB;
661
- JCheckBox supportCB;
662
- JCheckBox localCB;
663
- JCheckBox crowdCB;
664
- JCheckBox smoothCB;
665
- JCheckBox fastCB;
666
- JCheckBox slowCB;
667
- JCheckBox boxCB;
668
- JCheckBox trackCB;
669
- JCheckBox smoothfocusCB;
1001
+ cToggleButton liveCB;
1002
+ cCheckBox supportCB;
1003
+ cCheckBox localCB;
1004
+ cCheckBox crowdCB;
1005
+ cCheckBox smoothCB;
1006
+ cToggleButton fastCB;
1007
+ cCheckBox slowCB;
1008
+ cCheckBox boxCB;
1009
+ cCheckBox zoomBoxCB;
1010
+ cCheckBox freezeCB;
1011
+ //cToggleButton trackCB;
1012
+ cCheckBox trackCB;
1013
+ cCheckBox smoothfocusCB;
6701014 // JCheckBox speakerMocapCB;
671
- JCheckBox speakerCameraCB;
672
- JCheckBox speakerFocusCB;
673
- JCheckBox debugCB;
674
- JCheckBox oeilCB;
675
- JCheckBox lookAtCB;
1015
+ cCheckBox speakerCameraCB;
1016
+ cCheckBox speakerFocusCB;
1017
+ cCheckBox debugCB;
1018
+
1019
+ cCheckBox oeilCB;
1020
+ cCheckBox shadowCB;
1021
+ cCheckBox autosaveCB;
1022
+ cCheckBox lookAtCB;
6761023
6771024 // static int COLOR = 1;
6781025 // static int MATERIAL = 2;
....@@ -680,9 +1027,9 @@
6801027
6811028 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
6821029
683
- JCheckBox colorCB;
684
- JCheckBox materialCB;
685
- JCheckBox textureCB;
1030
+ cCheckBox colorCB;
1031
+ cCheckBox materialCB;
1032
+ cCheckBox textureCB;
6861033
6871034 public void itemStateChanged(ItemEvent e)
6881035 {
....@@ -707,10 +1054,10 @@
7071054 dropAttributes |= Object3D.TEXTURE;
7081055 else
7091056 dropAttributes &= ~Object3D.TEXTURE;
710
- }
711
- else if(e.getSource() == liveCB)
1057
+ } else if(e.getSource() == liveCB)
7121058 {
7131059 cameraView.ToggleLive();
1060
+ refreshContents(false);
7141061 }
7151062 else if(e.getSource() == supportCB)
7161063 {
....@@ -746,6 +1093,10 @@
7461093 cameraView.repaint();
7471094 // refreshContents();
7481095 }
1096
+ else if(e.getSource() == zoomBoxCB)
1097
+ {
1098
+ cameraView.ToggleZoomBoxMode();
1099
+ }
7491100 else if(e.getSource() == smoothfocusCB)
7501101 {
7511102 cameraView.ToggleSmoothFocus();
....@@ -771,6 +1122,18 @@
7711122 {
7721123 cameraView.ToggleOeil();
7731124 }
1125
+ else if(e.getSource() == shadowCB)
1126
+ {
1127
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1128
+ }
1129
+ else if(e.getSource() == freezeCB)
1130
+ {
1131
+ Globals.FREEZEONMOVE ^= true;
1132
+ }
1133
+ else if(e.getSource() == autosaveCB)
1134
+ {
1135
+ Globals.SAVEONMAKE ^= true;
1136
+ }
7741137 else if(e.getSource() == lookAtCB)
7751138 {
7761139 cameraView.ToggleLookAt();
....@@ -787,7 +1150,8 @@
7871150
7881151 /**/
7891152 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
790
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1153
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1154
+ TreePath path = objEditor.jTree.getSelectionPath();
7911155 if ((path == null) || (path.getPathCount() <= 1)) {
7921156 // We can't move the root node or an empty selection
7931157 return;
....@@ -859,7 +1223,9 @@
8591223 // objEditor.DropFile((java.io.File[]) object, true);
8601224 // return;
8611225 // }
862
- if (string.charAt(0) == '/')
1226
+
1227
+ // File path for Mac and Windows
1228
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
8631229 {
8641230 // file(s)
8651231 String[] names = string.split("\n");
....@@ -886,7 +1252,7 @@
8861252
8871253 flashIt = false;
8881254 CameraPane pane = (CameraPane) target;
889
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1255
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
8901256 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
8911257
8921258 if (group.selection.size() == 1)
....@@ -902,23 +1268,33 @@
9021268
9031269 assert target == objEditor.jTree;
9041270 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1271
+ Object3D destinationLeaf;
9051272 try {
906
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1273
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9071274 } catch (Exception e) {
9081275 System.out.println("destinationPath : " + destinationPath);
9091276 return;
9101277 }
9111278
912
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1279
+ for (int i=group.selection.size(); --i>=0;)
9131280 {
1281
+ Object3D child = (Object3D)group.selection.elementAt(i);
1282
+
1283
+ // Cannot move into itself
1284
+ if (child == destinationLeaf)
1285
+ return;
1286
+ }
1287
+
1288
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1289
+// {
9141290 loadClipboard(true);
9151291 objEditor.jTree.setSelectionPath(destinationPath);
916
- pasteInto(false);
917
- } else {
918
- loadClipboard(false);
919
- objEditor.jTree.setSelectionPath(destinationPath);
920
- pasteInto(false); // true); // ???
921
- }
1292
+ pasteInto(false, false);
1293
+// } else {
1294
+// loadClipboard(false);
1295
+// objEditor.jTree.setSelectionPath(destinationPath);
1296
+// pasteInto(false, false); // true); // ???
1297
+// }
9221298 }
9231299 public void dropActionChanged(DropTargetDragEvent dtde)
9241300 // Called if the user has modified the current drop gesture
....@@ -1023,83 +1399,107 @@
10231399 {
10241400 //heightFieldItem = menu.add(new MenuItem("Height Field"));
10251401 //heightFieldItem.addActionListener(this);
1026
- gridItem = menu.add(new MenuItem("Grid"));
1027
- gridItem.addActionListener(this);
1028
- rectoidItem = menu.add(new MenuItem("Box"));
1029
- rectoidItem.addActionListener(this);
1030
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1031
- ellipsoidItem.addActionListener(this);
1032
- coneItem = menu.add(new MenuItem("Cone"));
1033
- coneItem.addActionListener(this);
1034
- torusItem = menu.add(new MenuItem("Torus"));
1035
- torusItem.addActionListener(this);
1036
- superItem = menu.add(new MenuItem("Superellipsoid"));
1037
- superItem.addActionListener(this);
1038
- particleItem = menu.add(new MenuItem("Particle system"));
1039
- particleItem.addActionListener(this);
1402
+// gridItem = menu.add(new MenuItem("Grid"));
1403
+// gridItem.addActionListener(this);
1404
+// rectoidItem = menu.add(new MenuItem("Box"));
1405
+// rectoidItem.addActionListener(this);
1406
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1407
+// ellipsoidItem.addActionListener(this);
1408
+// coneItem = menu.add(new MenuItem("Cone"));
1409
+// coneItem.addActionListener(this);
1410
+// torusItem = menu.add(new MenuItem("Torus"));
1411
+// torusItem.addActionListener(this);
1412
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1413
+// superItem.addActionListener(this);
1414
+
1415
+ cameraItem = menu.add(new MenuItem("Camera"));
1416
+ cameraItem.addActionListener(this);
1417
+
1418
+ if (!Globals.ADVANCED)
1419
+ {
1420
+ kleinItem = menu.add(new MenuItem("Klein Bottle"));
1421
+ kleinItem.addActionListener(this);
1422
+ }
1423
+
1424
+// particleItem = menu.add(new MenuItem("Particle system"));
1425
+// particleItem.addActionListener(this);
1426
+ if (Globals.ADVANCED)
1427
+ {
10401428 ragdollItem = menu.add(new MenuItem("Rag Walk"));
10411429 ragdollItem.addActionListener(this);
10421430 ragdoll2Item = menu.add(new MenuItem("Rag Fall"));
10431431 ragdoll2Item.addActionListener(this);
1432
+ }
10441433 menu.add("-");
1045
- meshItem = menu.add(new MenuItem("Mesh"));
1434
+ meshItem = menu.add(new MenuItem("Dynamic Mesh"));
10461435 meshItem.addActionListener(this);
10471436 // meshGroupItem = menu.add(new MenuItem("Mesh Group"));
10481437 // meshGroupItem.addActionListener(this);
1438
+ if (Globals.ADVANCED)
1439
+ {
10491440 springItem = menu.add(new MenuItem("Spring"));
10501441 springItem.addActionListener(this);
10511442 flagItem = menu.add(new MenuItem("Flag"));
10521443 flagItem.addActionListener(this);
1053
- bezierItem = menu.add(new MenuItem("Patch"));
1054
- bezierItem.addActionListener(this);
1055
- checkerItem = menu.add(new MenuItem("Checker"));
1056
- checkerItem.addActionListener(this);
10571444 blobItem = menu.add(new MenuItem("Blob"));
10581445 blobItem.addActionListener(this);
10591446 latheItem = menu.add(new MenuItem("Lathe"));
10601447 latheItem.addActionListener(this);
1061
- lightItem = menu.add(new MenuItem("Light"));
1062
- lightItem.addActionListener(this);
1448
+ }
1449
+ bezierItem = menu.add(new MenuItem("Bezier Patch"));
1450
+ bezierItem.addActionListener(this);
1451
+// overlayItem = menu.add(new MenuItem("Overlay"));
1452
+// overlayItem.addActionListener(this);
1453
+// lightItem = menu.add(new MenuItem("Light"));
1454
+// lightItem.addActionListener(this);
10631455 menu.add("-");
10641456 //superLoopItem = menu.add(new MenuItem("Super Loop"));
10651457 //superLoopItem.addActionListener(this);
1066
- loopItem = menu.add(new MenuItem("Loop"));
1067
- loopItem.addActionListener(this);
1458
+// loopItem = menu.add(new MenuItem("Loop"));
1459
+// loopItem.addActionListener(this);
10681460 doubleItem = menu.add(new MenuItem("Fork"));
10691461 doubleItem.addActionListener(this);
1462
+ if (Globals.ADVANCED)
1463
+ {
10701464 tripleItem = menu.add(new MenuItem("Trident"));
10711465 tripleItem.addActionListener(this);
1466
+ }
10721467 }
10731468
10741469 void buildToolsMenu(Menu menu)
10751470 {
10761471 menu.add(animationItem = new CheckboxMenuItem("Animation..."));
10771472 animationItem.addItemListener(this);
1078
- animationItem.setState(CameraPane.ANIMATION);
1473
+ animationItem.setState(Globals.ANIMATION);
1474
+
1475
+ menu.add(archiveItem = new CheckboxMenuItem("Archive3D..."));
1476
+ archiveItem.addItemListener(this);
10791477
10801478 menu.add("-");
10811479 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10821480 parseverticesItem.addActionListener(this);
10831481 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10841482 textureFieldItem.addActionListener(this);
1085
- alignItem = menu.add(new MenuItem("Align"));
1483
+ alignItem = menu.add(new MenuItem("Align Objects"));
10861484 alignItem.addActionListener(this);
1087
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1088
- mirrorItem.addActionListener(this);
10891485 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10901486 reduceMorphItem.addActionListener(this);
10911487 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10921488 reduce34MorphItem.addActionListener(this);
1093
-
1489
+ menu.add("-");
10941490 menu.add(computeAOItem = new MenuItem("Compute AO"));
10951491 computeAOItem.addActionListener(this);
1096
- menu.add("-");
10971492
1493
+ if (Globals.ADVANCED)
1494
+ {
1495
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1496
+ mirrorItem.addActionListener(this);
1497
+ menu.add("-");
10981498 menu.add(memoryItem = new MenuItem("Memory Usage"));
10991499 memoryItem.addActionListener(this);
11001500 menu.add(analyzeItem = new MenuItem("Analyze"));
11011501 analyzeItem.addActionListener(this);
1102
- menu.add(dumpItem = new MenuItem("Dump"));
1502
+ menu.add(dumpItem = new MenuItem("Print"));
11031503 dumpItem.addActionListener(this);
11041504 // menu.add(pathItem = new MenuItem("From-to path"));
11051505 // pathItem.addActionListener(this);
....@@ -1108,6 +1508,8 @@
11081508 resetParentItem.addActionListener(this);
11091509 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11101510 repairParentItem.addActionListener(this);
1511
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1512
+ repairShadowItem.addActionListener(this);
11111513 menu.add(invariantsItem = new MenuItem("Invariants"));
11121514 invariantsItem.addActionListener(this);
11131515 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1115,6 +1517,7 @@
11151517 menu.add("-");
11161518 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11171519 editScriptItem.addActionListener(this);
1520
+ }
11181521 }
11191522
11201523 void ScreenFit()
....@@ -1237,9 +1640,24 @@
12371640 shadow.material = new cMaterial(obj.material);
12381641 shadow.material.diffuse = 0.0001f;
12391642 shadow.material.specular = 0.0001f;
1643
+ //shadow.projectedVertices[1].x = 300;
12401644
12411645 makeSomething(shadow);
12421646 }
1647
+
1648
+ private void ClearUnpinned()
1649
+ {
1650
+ //for (Object3D obj : listUI)
1651
+ for (int i=listUI.size(); --i>=0;)
1652
+ {
1653
+ Object3D obj = listUI.elementAt(i);
1654
+ if (!obj.pinned)
1655
+ {
1656
+ obj.CloseUI();
1657
+ listUI.remove(i);
1658
+ }
1659
+ }
1660
+ }
12431661
12441662 /**
12451663 * applyExample
....@@ -1443,9 +1861,9 @@
14431861
14441862 void Overwrite(int mask)
14451863 {
1446
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1864
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14471865 {
1448
- Object3D content = GrafreeD.clipboard.get(0);
1866
+ Object3D content = Grafreed.clipboard.get(0);
14491867
14501868 if (content instanceof cGroup && ((cGroup)content).transientlink )
14511869 content = ((cGroup)content).get(0);
....@@ -1468,6 +1886,7 @@
14681886 //
14691887 public void actionPerformed(ActionEvent event) // , Object arg)
14701888 {
1889
+ Object source = event.getSource();
14711890 /*
14721891 if (event.getSource() == nameField)
14731892 {
....@@ -1479,11 +1898,11 @@
14791898 }
14801899 else
14811900 */
1482
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1901
+ if (source == lookAtItem || source == lookFromItem)
14831902 {
14841903 ScreenFit();
14851904 } else
1486
- if (event.getSource() == switchItem)
1905
+ if (source == switchViewItem)
14871906 {
14881907 cVector v1 = new cVector();
14891908 cVector v2 = new cVector();
....@@ -1492,11 +1911,11 @@
14921911 objEditor.cameraView.renderCamera.setAim(v2, v1);
14931912 objEditor.cameraView.repaint();
14941913 } else
1495
- if (event.getSource() == rectoidItem)
1914
+ if (source == rectoidItem || source == boxButton)
14961915 {
14971916 makeSomething(new Box());
14981917 } else
1499
- if (event.getSource() == particleItem)
1918
+ if (source == particleItem || source == particlesButton)
15001919 {
15011920 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15021921 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1517,9 +1936,9 @@
15171936 applyExample(particleGeom, "SMOKE");
15181937 makeSomething(particleGeom);
15191938 } else
1520
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1939
+ if (source == ragdollItem || source == ragdoll2Item)
15211940 {
1522
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1941
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15231942
15241943 ragdoll.toParent = LA.newMatrix();
15251944 ragdoll.fromParent = LA.newMatrix();
....@@ -1537,7 +1956,7 @@
15371956 } else
15381957 /*
15391958 */
1540
- if (event.getSource() == heightFieldItem)
1959
+ if (source == heightFieldItem)
15411960 {
15421961 Object3D obj = new Object3D();
15431962
....@@ -1575,27 +1994,31 @@
15751994
15761995 makeSomething(obj);
15771996 } else
1578
- if (event.getSource() == gridItem)
1997
+ if (source == gridItem || source == gridButton)
15791998 {
15801999 makeSomething(new Grid());
15812000 } else
1582
- if (event.getSource() == ellipsoidItem)
2001
+ if (source == ellipsoidItem || source == sphereButton)
15832002 {
15842003 makeSomething(new Sphere());
15852004 } else
1586
- if (event.getSource() == coneItem)
2005
+ if (source == coneItem || source == coneButton)
15872006 {
15882007 makeSomething(new Cone());
15892008 } else
1590
- if (event.getSource() == torusItem)
2009
+ if (source == torusItem || source == torusButton)
15912010 {
15922011 makeSomething(new Torus());
15932012 } else
1594
- if (event.getSource() == superItem)
2013
+ if (source == superItem || source == superButton)
15952014 {
15962015 makeSomething(new Superellipsoid());
15972016 } else
1598
- if (event.getSource() == blobItem)
2017
+ if (source == kleinItem || source == kleinButton)
2018
+ {
2019
+ makeSomething(new Klein());
2020
+ } else
2021
+ if (source == blobItem)
15992022 {
16002023 Blob blob = new Blob();
16012024 BlobComponent comp = new BlobComponent();
....@@ -1603,15 +2026,15 @@
16032026 //blob.retile();
16042027 makeSomething(blob);
16052028 } else
1606
- if (event.getSource() == latheItem)
2029
+ if (source == latheItem)
16072030 {
16082031 makeSomething(new Lathe());
16092032 } else
1610
- if (event.getSource() == bezierItem)
2033
+ if (source == bezierItem)
16112034 {
16122035 makeSomething(new BezierSurface());
16132036 } else
1614
- if (event.getSource() == checkerItem)
2037
+ if (source == overlayItem || source == overlayButton)
16152038 {
16162039 /*
16172040 Object3D obj = new BezierSurface(5,8);
....@@ -1626,7 +2049,7 @@
16262049 */
16272050 makeSomething(new Checker());
16282051 } else
1629
- if (event.getSource() == meshItem)
2052
+ if (source == meshItem)
16302053 {
16312054 Object3D itemtomake = new Object3D();
16322055 Object3D child;
....@@ -1647,35 +2070,35 @@
16472070 makeSomething(child);
16482071 }
16492072 } else
1650
- if (event.getSource() == springItem)
2073
+ if (source == springItem)
16512074 {
16522075 cSpring s = new cSpring();
16532076 s.setup();
16542077 makeSomething(s);
16552078 } else
1656
- if (event.getSource() == flagItem)
2079
+ if (source == flagItem)
16572080 {
16582081 cSpring s = new cFlag();
16592082 s.setup();
16602083 makeSomething(s);
16612084 } else
1662
- if (event.getSource() == lightItem)
2085
+ if (source == lightItem || source == lightButton)
16632086 {
16642087 makeSomething(new Light());
16652088 } else
1666
- if (event.getSource() == csgItem)
2089
+ if (source == csgItem)
16672090 {
16682091 group(new CSG());
16692092 } else
1670
- if (event.getSource() == templateItem)
2093
+ if (source == templateItem)
16712094 {
16722095 group(new cTemplate());
16732096 } else
1674
- if (event.getSource() == attributeItem)
2097
+ if (source == attributeItem)
16752098 {
16762099 makeSomething(new Attribute());
16772100 } else
1678
- if (event.getSource() == pointflowItem)
2101
+ if (source == pointflowItem)
16792102 {
16802103 makeSomething(new PointFlow());
16812104 } else
....@@ -1687,7 +2110,7 @@
16872110 } else
16882111 */
16892112
1690
- if (event.getSource() == superLoopItem)
2113
+ if (source == superLoopItem)
16912114 {
16922115 Composite g = new cGroup();
16932116 for (int i=0; i<15; i++)
....@@ -1709,30 +2132,30 @@
17092132
17102133 group(g);
17112134 } else
1712
- if (event.getSource() == loopItem)
2135
+ if (source == loopItem || source == loopButton)
17132136 {
17142137 Composite csg = new GroupLeaf();
17152138 csg.count = 5;
17162139 group(csg);
1717
- Composite child = new cGroup();
2140
+ Composite child = new cGroup("Branch");
17182141 csg.addChild(child);
17192142 child.addChild(csg);
17202143 } else
1721
- if (event.getSource() == doubleItem)
2144
+ if (source == doubleItem)
17222145 {
1723
- Composite csg = new GroupLeaf();
2146
+ Composite csg = new GroupLeaf("Fork");
17242147 csg.count = 5;
17252148 group(csg);
1726
- Composite child = new cGroup();
2149
+ Composite child = new cGroup("Branch A");
17272150 csg.addChild(child);
17282151 child.addChild(csg);
1729
- child = new cGroup();
2152
+ child = new cGroup("Branch B");
17302153 csg.addChild(child);
17312154 child.addChild(csg);
17322155 } else
1733
- if (event.getSource() == tripleItem)
2156
+ if (source == tripleItem)
17342157 {
1735
- Composite csg = new GroupLeaf();
2158
+ Composite csg = new GroupLeaf("Trident");
17362159 csg.count = 4;
17372160 group(csg);
17382161 Composite child = new cGroup();
....@@ -1745,71 +2168,83 @@
17452168 csg.addChild(child);
17462169 child.addChild(csg);
17472170 } else
1748
-
1749
- if (event.getSource() == importGFDItem)
2171
+ if (source == computeAOItem)
17502172 {
1751
- ImportGFD();
2173
+ Globals.drawMode = CameraPane.OCCLUSION;
2174
+ Globals.theRenderer.repaint();
17522175 } else
1753
- if (event.getSource() == importVRMLX3DItem)
1754
- {
1755
- ImportVRMLX3D();
1756
- } else
1757
- if (event.getSource() == import3DSItem)
1758
- {
1759
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1760
- } else
1761
- if (event.getSource() == importOBJItem)
1762
- {
1763
- objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1764
- } else
1765
- if (event.getSource() == computeAOItem)
1766
- {
1767
- CameraPane.drawMode = CameraPane.OCCLUSION;
1768
- CameraPane.theRenderer.repaint();
1769
- } else
1770
- if (event.getSource() == recompileItem)
2176
+ if (source == recompileItem)
17712177 {
17722178 Recompile();
17732179 refreshContents();
17742180 } else
1775
- if (event.getSource() == editScriptItem)
2181
+ if (source == editScriptItem)
17762182 {
17772183 OpenDialog();
17782184 refreshContents();
17792185 } else
1780
- if (event.getSource() == invariantsItem)
2186
+ if (source == invariantsItem)
17812187 {
17822188 System.out.println("Invariants:");
1783
- GrafreeD.theApplet3D.universe.invariants();
2189
+ Grafreed.grafreeD.universe.invariants();
17842190 } else
1785
- if (event.getSource() == memoryItem)
2191
+ if (source == memoryItem)
17862192 {
17872193 //System.out.println("Invariants:");
17882194 PrintMemory();
17892195 } else
1790
- if (event.getSource() == pathItem)
2196
+ if (source == pathItem)
17912197 {
17922198 PrintPath();
17932199 } else
1794
- if (event.getSource() == analyzeItem)
2200
+ if (source == analyzeItem)
17952201 {
17962202 AnalyzeObject();
17972203 } else
1798
- if (event.getSource() == dumpItem)
2204
+ if (source == dumpItem)
17992205 {
18002206 DumpObject();
18012207 } else
1802
- if (event.getSource() == screenfitButton)
2208
+ if (source == minButton)
2209
+ {
2210
+ Minimize();
2211
+ } else
2212
+ if (source == maxButton)
2213
+ {
2214
+ Maximize();
2215
+ } else
2216
+ if (source == fullButton)
2217
+ {
2218
+ ToggleFullScreen();
2219
+ } else
2220
+ if (source == undoButton)
2221
+ {
2222
+ Undo();
2223
+ } else
2224
+ if (source == redoButton)
2225
+ {
2226
+ Redo();
2227
+ } else
2228
+ if (source == saveButton)
2229
+ {
2230
+ Save();
2231
+ } else
2232
+ if (source == oneStepButton)
2233
+ {
2234
+ Globals.ONESTEP = true;
2235
+ cameraView.repaint();
2236
+ } else
2237
+ if (source == screenfitButton)
18032238 {
18042239 //Reload(lastConverter, lastFilename, true);
18052240 ScreenFit();
18062241 } else
1807
- if (event.getSource() == screenfitpointButton)
2242
+ if (source == screenfitpointButton)
18082243 {
18092244 //Reload(lastConverter, lastFilename, true);
18102245 ScreenFitPoint();
18112246 } else
1812
- if (event.getSource() == snapobjectButton)
2247
+ if (source == snapobjectButton)
18132248 {
18142249 //Reload(lastConverter, lastFilename, true);
18152250 SnapObject();
....@@ -1820,13 +2255,13 @@
18202255 // Recompile();
18212256 // refreshContents();
18222257 // } else
1823
- if (event.getSource() == gcButton)
2258
+ if (source == gcButton)
18242259 {
18252260 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262261 System.gc();
18272262 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18282263 } else
1829
- if (event.getSource() == editLeafItem)
2264
+ if (source == editLeafItem)
18302265 {
18312266 Object3D obj;
18322267 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1840,62 +2275,74 @@
18402275 }
18412276 refreshContents(true);
18422277 } else
1843
- if (event.getSource() == openWindowItem)
2278
+ if (source == openWindowItem)
18442279 {
18452280 EditSelection(true);
18462281 } else
1847
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2282
+ if (source == cutItem || source == clearButton)
18482283 {
18492284 loadClipboard(true);
18502285 } else
1851
- if (event.getSource() == duplicateItem)
2286
+ if (source == undoItem)
18522287 {
1853
- Object3D keep = GrafreeD.clipboard;
2288
+ Undo();
2289
+ } else
2290
+ if (source == redoItem)
2291
+ {
2292
+ Redo();
2293
+ } else
2294
+ if (source == duplicateItem)
2295
+ {
2296
+ Object3D keep = Grafreed.clipboard;
18542297 loadClipboard(false);
18552298 paste(false);
1856
- GrafreeD.clipboard = keep;
2299
+ Grafreed.clipboard = keep;
18572300 } else
1858
- if (event.getSource() == cloneItem)
2301
+ if (source == cloneItem)
18592302 {
18602303 CloneSelection(false);
18612304 } else
1862
- if (event.getSource() == cloneSupportItem)
2305
+ if (source == cloneSupportItem)
18632306 {
18642307 CloneSelection(true);
18652308 } else
1866
- if (event.getSource() == copyItem)
2309
+ if (source == copyItem)
18672310 {
18682311 loadClipboard(false);
18692312 } else
1870
- if (event.getSource() == pasteItem)
2313
+ if (source == pasteItem)
18712314 {
18722315 paste(false);
18732316 } else
1874
- if (event.getSource() == pasteLinkItem)
2317
+ if (source == pasteIntoItem)
18752318 {
1876
- pasteInto(false);
2319
+ pasteInto(true, false);
18772320 } else
1878
- if (event.getSource() == pasteCloneItem)
2321
+ if (source == pasteLinkItem)
18792322 {
1880
- pasteInto(true);
2323
+ pasteInto(false, false);
18812324 } else
1882
- if (event.getSource() == pasteExpandItem)
2325
+ if (source == pasteCloneItem)
2326
+ {
2327
+ pasteInto(true, true);
2328
+ } else
2329
+ if (source == pasteExpandItem)
18832330 {
18842331 paste(true);
18852332 } else
1886
- if (event.getSource() == synchronizeItem)
2333
+ if (source == synchronizeItem)
18872334 {
18882335 Overwrite(Object3D.TRANSFORM);
18892336 } else
1890
- if (event.getSource() == overwriteNameItem)
2337
+ if (source == overwriteNameItem)
18912338 {
18922339 Overwrite(Object3D.NAME);
18932340 } else
1894
- if (event.getSource() == overwriteUVItem)
2341
+ if (source == overwriteUVItem)
18952342 {
18962343 Overwrite(Object3D.UV);
18972344 } else
1898
- if (event.getSource() == overwriteMatItem)
2345
+ if (source == overwriteMatItem)
18992346 {
19002347 /* july 2015
19012348 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1915,7 +2362,7 @@
19152362
19162363 Overwrite(dropAttributes);
19172364 }
1918
- if (event.getSource() == overwriteGeoItem)
2365
+ if (source == overwriteGeoItem)
19192366 {
19202367 Overwrite(Object3D.GEOMETRY);
19212368 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1932,7 +2379,7 @@
19322379 // refreshContents();
19332380 // }
19342381 } else
1935
- if (event.getSource() == generateMeshItem)
2382
+ if (source == generateMeshItem)
19362383 {
19372384 //if (group.selection.size() == 1)
19382385 // for (int i=0; i<group.selection.size(); i++)
....@@ -1943,7 +2390,7 @@
19432390 ResetModel();
19442391 refreshContents();
19452392 } else
1946
- if (event.getSource() == extractGeometriesItem)
2393
+ if (source == extractGeometriesItem)
19472394 {
19482395 boolean one = false;
19492396
....@@ -1970,7 +2417,7 @@
19702417 ResetModel();
19712418 refreshContents();
19722419 } else
1973
- if (event.getSource() == cloneGeometriesItem)
2420
+ if (source == cloneGeometriesItem)
19742421 {
19752422 boolean one = false;
19762423
....@@ -1996,32 +2443,37 @@
19962443 ResetModel();
19972444 refreshContents();
19982445 } else
1999
- if (event.getSource() == shareGeometriesItem)
2446
+ if (source == shareGeometriesItem)
20002447 {
20012448 boolean one = false;
20022449
20032450 if (group.selection.size() == 1)
20042451 one = true;
20052452
2453
+ Object3D merge = null;
2454
+
20062455 Object3D content = new cGroup();
20072456
20082457 for (int i=0; i<group.selection.size(); i++)
20092458 {
2010
- Object3D sel = new Merge(group.selection.get(i));
2459
+ merge = new Merge(group.selection.get(i));
20112460
20122461 if (one)
2013
- makeSomething(sel, false);
2462
+ makeSomething(merge, false);
20142463 else
2015
- content.addChild(sel);
2464
+ content.addChild(merge);
20162465 }
20172466
20182467 if (!one)
2019
- makeSomething(content, false);
2020
-
2021
- ResetModel();
2022
- refreshContents();
2468
+ makeSomething(content, true);
2469
+ else
2470
+ {
2471
+ ResetModel();
2472
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2473
+ refreshContents();
2474
+ }
20232475 } else
2024
- if (event.getSource() == mergeGeometriesItem)
2476
+ if (source == mergeGeometriesItem)
20252477 {
20262478 boolean one = false;
20272479
....@@ -2051,7 +2503,7 @@
20512503 ResetModel();
20522504 refreshContents();
20532505 } else
2054
- if (event.getSource() == linkverticesItem)
2506
+ if (source == linkverticesItem)
20552507 {
20562508 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20572509 // {
....@@ -2064,39 +2516,48 @@
20642516 // group.selection.get(0).setMasterThis(content); // should be identity
20652517 // refreshContents();
20662518 // }
2067
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2519
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20682520 {
2069
- Object3D content = GrafreeD.clipboard.get(0);
2521
+ Object3D content = Grafreed.clipboard.get(0);
20702522
20712523 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722524 content = ((cGroup)content).get(0);
20732525
2074
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2526
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20752527 for (int i=0; i<group.selection.size(); i++)
20762528 {
2077
- boolean random = CameraPane.RANDOM;
2078
- CameraPane.RANDOM = false; // parse all random nodes
2529
+ boolean random = CameraPane.SWITCH;
2530
+ CameraPane.SWITCH = false; // parse all random nodes
20792531 group.selection.get(i).linkVerticesThis(content);
20802532 // group.selection.get(i).setMasterThis(content); // should be identity
2081
- CameraPane.RANDOM = random;
2533
+ CameraPane.SWITCH = random;
20822534 }
2083
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2535
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20842536 refreshContents();
20852537 }
20862538 } else
2087
- if (event.getSource() == resetsupportItem)
2539
+ if (source == resetsupportItem)
20882540 {
20892541 for (int i=0; i<group.selection.size(); i++)
20902542 {
2091
- boolean random = CameraPane.RANDOM;
2092
- CameraPane.RANDOM = false; // parse all random nodes
2543
+ boolean random = CameraPane.SWITCH;
2544
+ CameraPane.SWITCH = false; // parse all random nodes
20932545 group.selection.get(i).linkVerticesThis(null);
2094
- CameraPane.RANDOM = random;
2546
+ CameraPane.SWITCH = random;
20952547 }
20962548
20972549 refreshContents();
20982550 } else
2099
- if (event.getSource() == resetreferencesItem)
2551
+ if (source == relinkverticesItem)
2552
+ {
2553
+ boolean random = CameraPane.SWITCH;
2554
+ CameraPane.SWITCH = false; // parse all random nodes
2555
+ group.selection.RelinkToSupport();
2556
+ CameraPane.SWITCH = random;
2557
+
2558
+ refreshContents();
2559
+ } else
2560
+ if (source == resetreferencesItem)
21002561 {
21012562 for (int i=0; i<group.selection.size(); i++)
21022563 {
....@@ -2105,11 +2566,11 @@
21052566
21062567 refreshContents();
21072568 } else
2108
- if (event.getSource() == setMasterItem)
2569
+ if (source == setMasterItem)
21092570 {
2110
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2571
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21112572 {
2112
- Object3D content = GrafreeD.clipboard.get(0);
2573
+ Object3D content = Grafreed.clipboard.get(0);
21132574
21142575 if (content instanceof cGroup && ((cGroup)content).transientlink )
21152576 content = ((cGroup)content).get(0);
....@@ -2118,13 +2579,13 @@
21182579 refreshContents();
21192580 }
21202581 } else
2121
- if (event.getSource() == poseMeshItem)
2582
+ if (source == poseMeshItem)
21222583 {
21232584 if (group.selection.size() == 1)
21242585 {
2125
- if (GrafreeD.clipboard.size() == 1)
2586
+ if (Grafreed.clipboard.size() == 1)
21262587 {
2127
- Object3D content = GrafreeD.clipboard.get(0);
2588
+ Object3D content = Grafreed.clipboard.get(0);
21282589
21292590 if (content instanceof cGroup && ((cGroup)content).transientlink )
21302591 content = ((cGroup)content).get(0);
....@@ -2137,19 +2598,19 @@
21372598 }
21382599
21392600 } else
2140
- if (event.getSource() == revertMeshItem)
2601
+ if (source == revertMeshItem)
21412602 {
21422603 RevertMeshes();
21432604 } else
2144
- if (event.getSource() == resetMeshItem)
2605
+ if (source == resetAllItem)
21452606 {
21462607 ResetAll();
21472608 } else
2148
- if (event.getSource() == stepAllItem)
2609
+ if (source == stepAllItem)
21492610 {
21502611 StepAll();
21512612 } else
2152
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2613
+ if (source == clearItem) // || event.getSource() == clearButton)
21532614 {
21542615 //int indices[] = jList.getSelectedIndices();
21552616 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2157,42 +2618,46 @@
21572618
21582619 ClearSelection(false);
21592620 } else
2160
- if (event.getSource() == clearAllItem)
2621
+ if (source == clearAllItem)
21612622 {
21622623 ClearSelection(true);
21632624 } else
2164
- if (event.getSource() == grabItem)
2625
+ if (source == grabItem || source == groupButton)
21652626 {
2166
- group(new cGroup(), true);
2627
+ group(new cGroup(), false); // true);
21672628 } else
2168
- if (event.getSource() == frontItem)
2629
+ if (source == hideItem)
2630
+ {
2631
+ group(new HiddenObject());
2632
+ } else
2633
+ if (source == frontItem)
21692634 {
21702635 front();
21712636 } else
2172
- if (event.getSource() == backItem)
2637
+ if (source == backItem)
21732638 {
21742639 back();
21752640 } else
2176
- if (event.getSource() == cameraItem)
2641
+ if (source == cameraItem)
21772642 {
21782643 makeSomething(new Camera());
21792644 } else
2180
- if (event.getSource() == compositeItem)
2645
+ if (source == compositeItem || source == compositeButton)
21812646 {
21822647 group(new Composite());
21832648 } else
2184
- if (event.getSource() == randomItem)
2649
+ if (source == switchItem || source == switchButton)
21852650 {
21862651 RandomNode random = new RandomNode();
21872652 group(random);
21882653 if (random.size() > 0)
2189
- random.name = random.get(0).name + "Rnd";
2654
+ random.name = random.get(0).name + "Switch";
21902655 } else
2191
- if (event.getSource() == physicsItem)
2656
+ if (source == physicsItem)
21922657 {
21932658 group(new PhysicsNode());
21942659 } else
2195
- if (event.getSource() == frameselectorItem)
2660
+ if (source == frameselectorItem)
21962661 {
21972662 for (int i=0; i<group.selection.size(); i++)
21982663 {
....@@ -2204,7 +2669,7 @@
22042669 ResetModel();
22052670 refreshContents();
22062671 } else
2207
- if (event.getSource() == switchGeoItem)
2672
+ if (source == switchGeoItem)
22082673 {
22092674 for (int i=0; i<group.selection.size(); i++)
22102675 {
....@@ -2216,7 +2681,7 @@
22162681 ResetModel();
22172682 refreshContents();
22182683 } else
2219
- if (event.getSource() == switchTransfoItem)
2684
+ if (source == switchTransfoItem)
22202685 {
22212686 for (int i=0; i<group.selection.size(); i++)
22222687 {
....@@ -2228,7 +2693,7 @@
22282693 ResetModel();
22292694 refreshContents();
22302695 } else
2231
- if (event.getSource() == morphItem)
2696
+ if (source == morphItem)
22322697 {
22332698 for (int i=0; i<group.selection.size(); i++)
22342699 {
....@@ -2240,7 +2705,7 @@
22402705 ResetModel();
22412706 refreshContents();
22422707 } else
2243
- if (event.getSource() == scriptNodeItem)
2708
+ if (source == scriptNodeItem)
22442709 {
22452710 boolean atleastone = false;
22462711
....@@ -2279,199 +2744,252 @@
22792744 }
22802745 }
22812746 } else
2282
- if (event.getSource() == linkerItem)
2747
+ if (source == linkerItem)
22832748 {
22842749 group(new cLinker());
22852750 } else
2286
- if (event.getSource() == textureItem)
2751
+ if (source == textureItem || source == textureButton)
22872752 {
22882753 group(new TextureNode());
22892754 } else
2290
- if (event.getSource() == shadowXItem)
2755
+ if (source == billboardItem)
2756
+ {
2757
+ group(new BillboardNode());
2758
+ } else
2759
+ if (source == shadowXItem)
22912760 {
22922761 CastShadow(0);
22932762 } else
2294
- if (event.getSource() == shadowYItem)
2763
+ if (source == shadowYItem)
22952764 {
22962765 CastShadow(1);
22972766 } else
2298
- if (event.getSource() == shadowZItem)
2767
+ if (source == shadowZItem)
22992768 {
23002769 CastShadow(2);
23012770 } else
2302
- if (event.getSource() == ungroupItem)
2771
+ if (source == ungroupItem || source == ungroupButton)
23032772 {
2304
- ungroup();
2773
+ boolean hasRoot = false;
2774
+
2775
+ for (int i=0; i<group.selection.size(); i++)
2776
+ {
2777
+ if (group.selection.get(i) == group)
2778
+ {
2779
+ hasRoot = true;
2780
+ break;
2781
+ }
2782
+ }
2783
+
2784
+ if (!hasRoot)
2785
+ {
2786
+ for (int i=0; i<group.selection.size(); i++)
2787
+ {
2788
+ Ungroup(group.selection.get(i));
2789
+ }
2790
+
2791
+ ClearSelection(false);
2792
+
2793
+ refreshContents();
2794
+ }
23052795 } else
2306
- if (event.getSource() == genUVItem)
2796
+ if (source == genUVItem)
23072797 {
23082798 GenUV();
23092799 } else
2310
- if (event.getSource() == genNormalsCADItem)
2800
+ if (source == genNormalsCADItem)
23112801 {
23122802 GenNormals(true);
23132803 } else
2314
- if (event.getSource() == genNormalsMESHItem)
2804
+ if (source == genNormalsMESHItem)
23152805 {
2316
- GenNormals(true); // TODO
2806
+ GenNormalsMESH();
23172807 } else
2318
- if (event.getSource() == genNormalsORGANItem)
2808
+ if (source == genNormalsORGANItem)
23192809 {
23202810 GenNormals(false);
23212811 } else
2322
- if (event.getSource() == stripifyItem)
2812
+ if (source == genNormalsMINEItem)
2813
+ {
2814
+ GenNormalsMINE();
2815
+ } else
2816
+ if (source == stripifyItem)
23232817 {
23242818 Stripify();
23252819 } else
2326
- if (event.getSource() == unstripifyItem)
2820
+ if (source == unstripifyItem)
23272821 {
23282822 Unstripify();
23292823 } else
2330
- if (event.getSource() == trimItem)
2824
+ if (source == trimItem)
23312825 {
23322826 Trim();
23332827 } else
2334
- if (event.getSource() == untrimItem)
2828
+ if (source == untrimItem)
23352829 {
23362830 Untrim();
23372831 } else
2338
- if (event.getSource() == clearColorsItem)
2832
+ if (source == clearColorsItem)
23392833 {
23402834 ClearColors();
23412835 } else
2342
- if (event.getSource() == clearMaterialsItem)
2836
+ if (source == clearMaterialsItem)
23432837 {
23442838 ClearMaterials();
23452839 } else
2346
- if (event.getSource() == liveleavesItem)
2840
+ if (source == liveleavesItem)
23472841 {
23482842 LiveLeaves(true);
23492843 } else
2350
- if (event.getSource() == unliveleavesItem)
2844
+ if (source == unliveleavesItem)
23512845 {
23522846 LiveLeaves(false);
23532847 } else
2354
- if (event.getSource() == supportleavesItem)
2848
+ if (source == supportleavesItem)
23552849 {
23562850 SupportLeaves(true);
23572851 } else
2358
- if (event.getSource() == unsupportleavesItem)
2852
+ if (source == unsupportleavesItem)
23592853 {
23602854 SupportLeaves(false);
23612855 } else
2362
- if (event.getSource() == hideleavesItem)
2856
+ if (source == hideleavesItem)
23632857 {
23642858 HideLeaves(true);
23652859 } else
2366
- if (event.getSource() == showleavesItem)
2860
+ if (source == showleavesItem)
23672861 {
23682862 HideLeaves(false);
23692863 } else
2370
- if (event.getSource() == markleavesItem)
2864
+ if (source == markleavesItem)
23712865 {
23722866 MarkLeaves(true);
23732867 } else
2374
- if (event.getSource() == unmarkleavesItem)
2868
+ if (source == unmarkleavesItem)
23752869 {
23762870 MarkLeaves(false);
23772871 } else
2378
- if (event.getSource() == flipVItem)
2872
+ if (source == rewindleavesItem)
2873
+ {
2874
+ RewindLeaves(true);
2875
+ } else
2876
+ if (source == unrewindleavesItem)
2877
+ {
2878
+ RewindLeaves(false);
2879
+ } else
2880
+ if (source == randomleavesItem)
2881
+ {
2882
+ RandomLeaves(true);
2883
+ } else
2884
+ if (source == unrandomleavesItem)
2885
+ {
2886
+ RandomLeaves(false);
2887
+ } else
2888
+ if (source == flipVItem)
23792889 {
23802890 FlipV(true);
23812891 } else
2382
- if (event.getSource() == unflipVItem)
2892
+ if (source == unflipVItem)
23832893 {
23842894 FlipV(false);
23852895 } else
2386
- if (event.getSource() == lowTexturesItem)
2896
+ if (source == lowTexturesItem)
23872897 {
23882898 SetTexRes(0);
23892899 } else
2390
- if (event.getSource() == normalTexturesItem)
2900
+ if (source == normalTexturesItem)
23912901 {
23922902 SetTexRes(1);
23932903 } else
2394
- if (event.getSource() == highTexturesItem)
2904
+ if (source == highTexturesItem)
23952905 {
23962906 SetTexRes(2);
23972907 } else
2398
- if (event.getSource() == veryhighTexturesItem)
2908
+ if (source == veryhighTexturesItem)
23992909 {
24002910 SetTexRes(3);
24012911 } else
2402
- if (event.getSource() == maxTexturesItem)
2912
+ if (source == maxTexturesItem)
24032913 {
24042914 SetTexRes(4);
24052915 } else
2406
- if (event.getSource() == panoTexturesItem)
2916
+ if (source == panoTexturesItem)
24072917 {
24082918 SetTexRes(5);
24092919 } else
2410
- if (event.getSource() == reverseNormalsItem)
2920
+ if (source == reverseNormalsItem)
24112921 {
24122922 ReverseNormals();
24132923 } else
2414
- if (event.getSource() == parseverticesItem)
2924
+ if (source == parseverticesItem)
24152925 {
24162926 ParseVertices();
24172927 } else
2418
- if (event.getSource() == textureFieldItem)
2928
+ if (source == textureFieldItem)
24192929 {
24202930 TextureVertices();
24212931 } else
2422
- if (event.getSource() == alignItem)
2932
+ if (source == alignItem)
24232933 {
24242934 Align();
24252935 } else
2426
- if (event.getSource() == mirrorItem)
2936
+ if (source == mirrorItem)
24272937 {
24282938 MirrorPoses();
24292939 } else
2430
- if (event.getSource() == reduceMorphItem)
2940
+ if (source == reduceMorphItem)
24312941 {
24322942 MeshReduction(false);
24332943 } else
2434
- if (event.getSource() == reduce34MorphItem)
2944
+ if (source == reduce34MorphItem)
24352945 {
24362946 MeshReduction(true);
24372947 } else
2438
- if (event.getSource() == reverseTrianglesItem)
2948
+ if (source == reverseTrianglesItem)
24392949 {
24402950 ReverseTriangles();
24412951 } else
2442
- if (event.getSource() == reduceMeshItem)
2952
+ if (source == reduceMeshItem)
24432953 {
24442954 ReduceMesh(false);
24452955 } else
2446
- if (event.getSource() == reduce34MeshItem)
2956
+ if (source == reduce34MeshItem)
24472957 {
24482958 ReduceMesh(true);
24492959 } else
2450
- if (event.getSource() == increaseMeshItem)
2960
+ if (source == increaseMeshItem)
24512961 {
24522962 IncreaseMesh();
24532963 } else
2454
- if (event.getSource() == clipMeshItem)
2964
+ if (source == clipMeshItem)
24552965 {
24562966 ClipMesh();
24572967 } else
2458
- if (event.getSource() == smoothMeshItem)
2968
+ if (source == smoothMeshItem)
24592969 {
24602970 SmoothMesh();
24612971 } else
2462
- if (event.getSource() == transformgeometryItem)
2972
+ if (source == transformGeometryItem)
24632973 {
24642974 TransformGeometry();
24652975 } else
2466
- if (event.getSource() == resetTransformItem)
2976
+ if (source == transformChildrenItem)
2977
+ {
2978
+ TransformChildren();
2979
+ } else
2980
+ if (source == resetTransformItem)
24672981 {
24682982 ResetTransform();
24692983 } else
2470
- if (event.getSource() == resetCentroidItem)
2984
+ if (source == resetCentroidItem)
24712985 {
2472
- ResetCentroid();
2986
+ ResetCentroid(true);
24732987 } else
2474
- if (event.getSource() == resetParentItem)
2988
+ if (source == resetCentroidXZItem)
2989
+ {
2990
+ ResetCentroid(false);
2991
+ } else
2992
+ if (source == resetParentItem)
24752993 {
24762994 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24772995 {
....@@ -2481,7 +2999,7 @@
24812999
24823000 refreshContents();
24833001 } else
2484
- if (event.getSource() == repairParentItem)
3002
+ if (source == repairParentItem)
24853003 {
24863004 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24873005 {
....@@ -2495,7 +3013,21 @@
24953013
24963014 refreshContents();
24973015 } else
2498
- if (event.getSource() == sortbysizeItem)
3016
+ if (source == repairShadowItem)
3017
+ {
3018
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3019
+ {
3020
+ Object3D obj = (Object3D)e.nextElement();
3021
+ obj.RepairShadow();
3022
+// for (int i=0; i<obj.size(); i++)
3023
+// {
3024
+// obj.get(i).parent = obj;
3025
+// }
3026
+ }
3027
+
3028
+ refreshContents();
3029
+ } else
3030
+ if (source == sortbysizeItem)
24993031 {
25003032 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25013033 {
....@@ -2507,7 +3039,7 @@
25073039 ResetModel();
25083040 refreshContents();
25093041 } else
2510
- if (event.getSource() == sortbynameItem)
3042
+ if (source == sortbynameItem)
25113043 {
25123044 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25133045 {
....@@ -2519,7 +3051,7 @@
25193051 ResetModel();
25203052 refreshContents();
25213053 } else
2522
- if (event.getSource() == attachPigmentItem)
3054
+ if (source == attachPigmentItem)
25233055 {
25243056 String texture = GetFile("Attach pigment");
25253057 Object3D obj;
....@@ -2531,7 +3063,7 @@
25313063
25323064 refreshContents();
25333065 } else
2534
- if (event.getSource() == detachPigmentItem)
3066
+ if (source == detachPigmentItem)
25353067 {
25363068 Object3D obj;
25373069 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2542,7 +3074,7 @@
25423074
25433075 refreshContents();
25443076 } else
2545
- if (event.getSource() == attachBumpItem)
3077
+ if (source == attachBumpItem)
25463078 {
25473079 String texture = GetFile("Attach bump");
25483080 Object3D obj;
....@@ -2554,7 +3086,7 @@
25543086
25553087 refreshContents();
25563088 } else
2557
- if (event.getSource() == detachBumpItem)
3089
+ if (source == detachBumpItem)
25583090 {
25593091 Object3D obj;
25603092 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2565,7 +3097,7 @@
25653097
25663098 refreshContents();
25673099 } else
2568
- if (event.getSource() == pigmentBumpItem)
3100
+ if (source == pigmentBumpItem)
25693101 {
25703102 Object3D obj;
25713103 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2576,158 +3108,237 @@
25763108
25773109 refreshContents();
25783110 } else
2579
- if (event.getSource() == flashSelectionButton)
3111
+ if (source == flashSelectionButton)
25803112 {
25813113 CameraPane.flash = true;
25823114 refreshContents();
25833115 } else
2584
- if (event.getSource() == oneButton)
3116
+ if (source == oneButton)
25853117 {
25863118 } else
2587
- if (event.getSource() == twoButton)
3119
+ if (source == twoButton)
25883120 {
25893121 radio.layout = twoButton;
3122
+
3123
+ if (CameraPane.FULLSCREEN)
3124
+ fullscreenLayout = radio.layout;
3125
+
25903126 // bug
25913127 //gridPanel.setDividerLocation(1.0);
25923128 //bigPanel.setDividerLocation(0.0);
2593
- bigThree.remove(jtp);
2594
- bigThree.remove(cameraPanel);
2595
- bigThree.remove(XYZPanel);
2596
- aWindowConstraints.gridx = 0;
2597
- aWindowConstraints.gridy = 0;
2598
- aWindowConstraints.gridwidth = 1;
2599
- // aConstraints.gridheight = 3;
2600
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2601
- aWindowConstraints.weightx = 0;
2602
- aWindowConstraints.weighty = 1;
2603
- //bigThree.add(jtp, aWindowConstraints);
2604
- aWindowConstraints.weightx = 1;
2605
- aWindowConstraints.gridwidth = 3;
2606
- // aConstraints.gridheight = 3;
2607
- aWindowConstraints.gridx = 1;
2608
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2609
- bigThree.add(cameraPanel, aWindowConstraints);
2610
- aWindowConstraints.weightx = 0;
2611
- aWindowConstraints.gridx = 4;
2612
- aWindowConstraints.gridwidth = 1;
2613
- // aConstraints.gridheight = 3;
2614
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2615
- //bigThree.add(XYZPanel, aWindowConstraints);
2616
- bigThree.revalidate();
3129
+// bigThree.remove(scenePanel);
3130
+// bigThree.remove(centralPanel);
3131
+// bigThree.remove(XYZPanel);
3132
+// aWindowConstraints.gridx = 0;
3133
+// aWindowConstraints.gridy = 0;
3134
+// aWindowConstraints.gridwidth = 1;
3135
+// // aConstraints.gridheight = 3;
3136
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3137
+// aWindowConstraints.weightx = 0;
3138
+// aWindowConstraints.weighty = 1;
3139
+// //bigThree.add(jtp, aWindowConstraints);
3140
+// aWindowConstraints.weightx = 1;
3141
+// aWindowConstraints.gridwidth = 3;
3142
+// // aConstraints.gridheight = 3;
3143
+// aWindowConstraints.gridx = 1;
3144
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3145
+// bigThree.add(centralPanel, aWindowConstraints);
3146
+// aWindowConstraints.weightx = 0;
3147
+// aWindowConstraints.gridx = 4;
3148
+// aWindowConstraints.gridwidth = 1;
3149
+// // aConstraints.gridheight = 3;
3150
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3151
+// //bigThree.add(XYZPanel, aWindowConstraints);
3152
+// scenePanel.setVisible(false);
3153
+// centralPanel.setVisible(true);
3154
+// XYZPanel.setVisible(false);
3155
+ bigThree.ClearUI();
3156
+ bigThree.add(centralPanel);
3157
+ bigThree.FlushUI();
3158
+
3159
+ cameraView.requestFocusInWindow();
3160
+
3161
+// refreshContents(true);
3162
+//
3163
+// try
3164
+// {
3165
+// java.awt.Robot bot = new java.awt.Robot();
3166
+// int mask = InputEvent.BUTTON1_MASK;
3167
+// bot.mouseMove(100, 100);
3168
+// bot.mousePress(mask);
3169
+// bot.mouseRelease(mask);
3170
+// }
3171
+// catch (Exception e)
3172
+// {
3173
+//
3174
+// }
3175
+
26173176 } else
2618
- if (event.getSource() == threeButton)
3177
+ if (source == threeButton)
26193178 {
26203179 radio.layout = threeButton;
2621
- bigThree.remove(jtp);
2622
- bigThree.remove(cameraPanel);
2623
- bigThree.remove(XYZPanel);
2624
- aWindowConstraints.gridx = 0;
2625
- aWindowConstraints.gridy = 0;
2626
- aWindowConstraints.gridwidth = 1;
2627
- // aConstraints.gridheight = 3;
2628
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2629
- aWindowConstraints.weightx = 0;
2630
- aWindowConstraints.weighty = 1;
2631
- //bigThree.add(jtp, aWindowConstraints);
2632
- aWindowConstraints.weightx = 1;
2633
- aWindowConstraints.gridwidth = 3;
2634
- // aConstraints.gridheight = 3;
2635
- aWindowConstraints.gridx = 1;
2636
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2637
- bigThree.add(cameraPanel, aWindowConstraints);
2638
- aWindowConstraints.weightx = 0;
2639
- aWindowConstraints.gridx = 4;
2640
- aWindowConstraints.gridwidth = 1;
2641
- // aConstraints.gridheight = 3;
2642
- aConstraints.fill = GridBagConstraints.VERTICAL;
2643
- bigThree.add(XYZPanel, aWindowConstraints);
2644
- bigThree.revalidate();
3180
+
3181
+ if (CameraPane.FULLSCREEN)
3182
+ fullscreenLayout = radio.layout;
3183
+
3184
+// bigThree.remove(scenePanel);
3185
+// bigThree.remove(centralPanel);
3186
+// bigThree.remove(XYZPanel);
3187
+// aWindowConstraints.gridx = 0;
3188
+// aWindowConstraints.gridy = 0;
3189
+// aWindowConstraints.gridwidth = 1;
3190
+// // aConstraints.gridheight = 3;
3191
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3192
+// aWindowConstraints.weightx = 0;
3193
+// aWindowConstraints.weighty = 1;
3194
+// //bigThree.add(jtp, aWindowConstraints);
3195
+// aWindowConstraints.weightx = 1;
3196
+// aWindowConstraints.gridwidth = 3;
3197
+// // aConstraints.gridheight = 3;
3198
+// aWindowConstraints.gridx = 1;
3199
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3200
+// bigThree.add(centralPanel, aWindowConstraints);
3201
+// aWindowConstraints.weightx = 0;
3202
+// aWindowConstraints.gridx = 4;
3203
+// aWindowConstraints.gridwidth = 1;
3204
+// // aConstraints.gridheight = 3;
3205
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3206
+// bigThree.add(XYZPanel, aWindowConstraints);
3207
+// bigThree.validate();
3208
+// scenePanel.setVisible(false);
3209
+// centralPanel.setVisible(true);
3210
+// XYZPanel.setVisible(true);
3211
+ bigThree.ClearUI();
3212
+ bigThree.add(centralPanel);
3213
+ bigThree.add(XYZPanel);
3214
+ bigThree.FlushUI();
3215
+
3216
+ cameraView.requestFocusInWindow();
26453217 } else
2646
- if (event.getSource() == fourButton)
3218
+ if (source == fourButton)
26473219 {
26483220 radio.layout = fourButton;
2649
- bigThree.remove(jtp);
2650
- bigThree.remove(cameraPanel);
2651
- bigThree.remove(XYZPanel);
2652
- aWindowConstraints.gridx = 0;
2653
- aWindowConstraints.gridy = 0;
2654
- aWindowConstraints.gridwidth = 1;
2655
- // aWindowConstraints.gridheight = 3;
2656
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2657
- aWindowConstraints.weightx = 1;
2658
- aWindowConstraints.weighty = 1;
2659
- bigThree.add(jtp, aWindowConstraints);
2660
- aWindowConstraints.weightx = 1;
2661
- aWindowConstraints.gridwidth = 3;
2662
- // aConstraints.gridheight = 3;
2663
- aWindowConstraints.gridx = 1;
2664
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2665
- //bigThree.add(cameraPanel, aWindowConstraints);
2666
- aWindowConstraints.weightx = 0;
2667
- aWindowConstraints.gridx = 4;
2668
- aWindowConstraints.gridwidth = 1;
2669
- // aWindowConstraints.gridheight = 3;
2670
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2671
- //bigThree.add(XYZPanel, aWindowConstraints);
2672
- bigThree.revalidate();
3221
+
3222
+ if (CameraPane.FULLSCREEN)
3223
+ fullscreenLayout = radio.layout;
3224
+
3225
+// bigThree.remove(scenePanel);
3226
+// bigThree.remove(centralPanel);
3227
+// bigThree.remove(XYZPanel);
3228
+// aWindowConstraints.gridx = 0;
3229
+// aWindowConstraints.gridy = 0;
3230
+// aWindowConstraints.gridwidth = 1;
3231
+// // aWindowConstraints.gridheight = 3;
3232
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3233
+// aWindowConstraints.weightx = 1;
3234
+// aWindowConstraints.weighty = 1;
3235
+// bigThree.add(scenePanel, aWindowConstraints);
3236
+// aWindowConstraints.weightx = 1;
3237
+// aWindowConstraints.gridwidth = 3;
3238
+// // aConstraints.gridheight = 3;
3239
+// aWindowConstraints.gridx = 1;
3240
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3241
+// //bigThree.add(cameraPanel, aWindowConstraints);
3242
+// aWindowConstraints.weightx = 0;
3243
+// aWindowConstraints.gridx = 4;
3244
+// aWindowConstraints.gridwidth = 1;
3245
+// // aWindowConstraints.gridheight = 3;
3246
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3247
+// //bigThree.add(XYZPanel, aWindowConstraints);
3248
+// bigThree.validate();
3249
+// scenePanel.setVisible(true);
3250
+// centralPanel.setVisible(false);
3251
+// XYZPanel.setVisible(false);
3252
+ bigThree.ClearUI();
3253
+ bigThree.add(scenePanel);
3254
+ bigThree.FlushUI();
3255
+
3256
+ cameraView.requestFocusInWindow();
26733257 } else
2674
- if (event.getSource() == sixButton)
3258
+ if (source == sixButton)
26753259 {
26763260 radio.layout = sixButton;
2677
- bigThree.remove(jtp);
2678
- bigThree.remove(cameraPanel);
2679
- bigThree.remove(XYZPanel);
2680
- aWindowConstraints.gridx = 0;
2681
- aWindowConstraints.gridy = 0;
2682
- aWindowConstraints.gridwidth = 1;
2683
- // aConstraints.gridheight = 3;
2684
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2685
- aWindowConstraints.weightx = 0;
2686
- aWindowConstraints.weighty = 1;
2687
- bigThree.add(jtp, aWindowConstraints);
2688
- aWindowConstraints.weightx = 1;
2689
- aWindowConstraints.gridwidth = 3;
2690
- // aWindowConstraints.gridheight = 3;
2691
- aWindowConstraints.gridx = 1;
2692
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2693
- bigThree.add(cameraPanel, aWindowConstraints);
2694
- aWindowConstraints.weightx = 0;
2695
- aWindowConstraints.gridx = 4;
2696
- aWindowConstraints.gridwidth = 1;
2697
- // aWindowConstraints.gridheight = 3;
2698
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2699
- //bigThree.add(XYZPanel, aConstraints);
2700
- bigThree.revalidate();
3261
+
3262
+ if (CameraPane.FULLSCREEN)
3263
+ fullscreenLayout = radio.layout;
3264
+
3265
+// bigThree.remove(scenePanel);
3266
+// bigThree.remove(centralPanel);
3267
+// bigThree.remove(XYZPanel);
3268
+// aWindowConstraints.gridx = 0;
3269
+// aWindowConstraints.gridy = 0;
3270
+// aWindowConstraints.gridwidth = 1;
3271
+// // aConstraints.gridheight = 3;
3272
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3273
+// aWindowConstraints.weightx = 0;
3274
+// aWindowConstraints.weighty = 1;
3275
+// bigThree.add(scenePanel, aWindowConstraints);
3276
+// aWindowConstraints.weightx = 1;
3277
+// aWindowConstraints.gridwidth = 3;
3278
+// // aWindowConstraints.gridheight = 3;
3279
+// aWindowConstraints.gridx = 1;
3280
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3281
+// bigThree.add(centralPanel, aWindowConstraints);
3282
+// aWindowConstraints.weightx = 0;
3283
+// aWindowConstraints.gridx = 4;
3284
+// aWindowConstraints.gridwidth = 1;
3285
+// // aWindowConstraints.gridheight = 3;
3286
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3287
+// //bigThree.add(XYZPanel, aConstraints);
3288
+// bigThree.validate();
3289
+// scenePanel.setVisible(true);
3290
+// centralPanel.setVisible(true);
3291
+// XYZPanel.setVisible(false);
3292
+ bigThree.ClearUI();
3293
+ bigThree.add(scenePanel);
3294
+ bigThree.add(centralPanel);
3295
+ bigThree.FlushUI();
3296
+
3297
+ cameraView.requestFocusInWindow();
27013298 } else
2702
- if (event.getSource() == sevenButton)
3299
+ if (source == sevenButton)
27033300 {
27043301 radio.layout = sevenButton;
2705
- bigThree.remove(jtp);
2706
- bigThree.remove(cameraPanel);
2707
- bigThree.remove(XYZPanel);
2708
- aWindowConstraints.gridx = 0;
2709
- aWindowConstraints.gridy = 0;
2710
- aWindowConstraints.gridwidth = 1;
2711
- // aWindowConstraints.gridheight = 3;
2712
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2713
- aWindowConstraints.weightx = 0;
2714
- aWindowConstraints.weighty = 1;
2715
- bigThree.add(jtp, aWindowConstraints);
2716
- aWindowConstraints.weightx = 1;
2717
- aWindowConstraints.gridwidth = 3;
2718
- // aWindowConstraints.gridheight = 3;
2719
- aWindowConstraints.gridx = 1;
2720
- aWindowConstraints.fill = GridBagConstraints.BOTH;
2721
- bigThree.add(cameraPanel, aWindowConstraints);
2722
- aWindowConstraints.weightx = 0;
2723
- aWindowConstraints.gridx = 4;
2724
- aWindowConstraints.gridwidth = 1;
2725
- // aConstraints.gridheight = 3;
2726
- aWindowConstraints.fill = GridBagConstraints.VERTICAL;
2727
- bigThree.add(XYZPanel, aWindowConstraints);
2728
- bigThree.revalidate();
3302
+
3303
+ if (CameraPane.FULLSCREEN)
3304
+ fullscreenLayout = radio.layout;
3305
+
3306
+// bigThree.remove(scenePanel);
3307
+// bigThree.remove(centralPanel);
3308
+// bigThree.remove(XYZPanel);
3309
+// aWindowConstraints.gridx = 0;
3310
+// aWindowConstraints.gridy = 0;
3311
+// aWindowConstraints.gridwidth = 1;
3312
+// // aWindowConstraints.gridheight = 3;
3313
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3314
+// aWindowConstraints.weightx = 0;
3315
+// aWindowConstraints.weighty = 1;
3316
+// bigThree.add(scenePanel, aWindowConstraints);
3317
+// aWindowConstraints.weightx = 1;
3318
+// aWindowConstraints.gridwidth = 3;
3319
+// // aWindowConstraints.gridheight = 3;
3320
+// aWindowConstraints.gridx = 1;
3321
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3322
+// bigThree.add(centralPanel, aWindowConstraints);
3323
+// aWindowConstraints.weightx = 0;
3324
+// aWindowConstraints.gridx = 4;
3325
+// aWindowConstraints.gridwidth = 1;
3326
+// // aConstraints.gridheight = 3;
3327
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3328
+// bigThree.add(XYZPanel, aWindowConstraints);
3329
+// bigThree.validate();
3330
+// scenePanel.setVisible(true);
3331
+// centralPanel.setVisible(true);
3332
+// XYZPanel.setVisible(true);
3333
+ bigThree.ClearUI();
3334
+ bigThree.add(scenePanel);
3335
+ bigThree.add(centralPanel);
3336
+ bigThree.add(XYZPanel);
3337
+ bigThree.FlushUI();
3338
+
3339
+ cameraView.requestFocusInWindow();
27293340 } else
2730
- if (event.getSource() == rootButton)
3341
+ if (source == rootButton)
27313342 {
27323343 Object3D obj;
27333344 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2737,66 +3348,84 @@
27373348 EditObject(obj);
27383349 }
27393350
3351
+ cameraView.requestFocusInWindow();
27403352 refreshContents(true);
27413353 } else
2742
- if (event.getSource() == closeButton)
3354
+ if (source == closeButton)
27433355 {
27443356 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27453357 cRadio ab;
27463358 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27473359 {
27483360 ab = (cRadio)e.nextElement();
2749
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3361
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27503362 {
3363
+ // Patch to avoid bug with transparency.
3364
+ if (!ab.hadMaterial)
3365
+ {
3366
+ ab.object.material = null;
3367
+ }
3368
+
27513369 buttonGroup.remove(ab);
27523370 radioPanel.remove(ab);
27533371
2754
- ab.GetObject().editWindow = null;
3372
+ //ab.GetObject().editWindow = null;
3373
+ ab.GetObject().manipWindow = null;
27553374 // ab.GetObject().objectUI = null; // ?????????
27563375
27573376 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27583377 break;
27593378 }
27603379 }
3380
+
3381
+ cameraView.requestFocusInWindow();
27613382 refreshContents(true);
27623383 } else
2763
- if (event.getSource() == editItem || event.getSource() == editButton)
3384
+ if (source == editItem || source == editButton)
27643385 {
3386
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3387
+ {
3388
+ Object3D child = (Object3D)e.nextElement();
3389
+ child.pinned = true;
3390
+ }
3391
+
27653392 EditSelection(false);
27663393 } else
2767
- if (event.getSource() == uneditButton)
3394
+ if (source == uneditButton)
27683395 {
27693396 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27703397 {
27713398 Object3D child = (Object3D)e.nextElement();
27723399 if(child.editWindow != null)
27733400 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3401
+ child.pinned = false;
27743402 child.CloseUI();
27753403 listUI.remove(child);
27763404
2777
- child.editWindow = null; // ???????????
3405
+ //child.editWindow = null; // ???????????
27783406 }
2779
- objEditor.ctrlPanel.revalidate();
3407
+ objEditor.ctrlPanel.FlushUI();
27803408 //objEditor.jTree.clearSelection();
27813409 //objEditor.ResetSliders();
27823410 refreshContents(true);
27833411 } else
2784
- if (event.getSource() == clearPanelButton)
3412
+ if (source == clearPanelButton)
27853413 {
27863414 assert(copy == group);
27873415 //copy.ClearUI();
27883416 for (Object3D obj : listUI)
27893417 {
3418
+ obj.pinned = false;
27903419 obj.CloseUI();
27913420 }
27923421 listUI.clear();
27933422 refreshContents(true);
27943423 } else
2795
- if (event.getSource() == allParamsButton)
3424
+ if (source == allParamsButton)
27963425 {
27973426 assert(copy == group);
27983427
2799
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3428
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28003429
28013430 for (Object3D obj : listUI)
28023431 {
....@@ -2813,19 +3442,19 @@
28133442
28143443 refreshContents(true);
28153444 } else
2816
- if (event.getSource() == unselectButton)
3445
+ if (source == unselectButton)
28173446 {
28183447 objEditor.jTree.clearSelection();
28193448 // ?? oct 2012 GrafreeD.clipboard.clear();
28203449 objEditor.ResetSliders();
28213450 refreshContents(true);
28223451 } else
2823
- if(event.getSource() instanceof cRadio)
3452
+ if(source instanceof cRadio)
28243453 {
28253454 group.parent = keepparent;
28263455 group.attributes = 0;
28273456 //group.editWindow = null;
2828
- /*cRadio*/ radio = (cRadio)event.getSource();
3457
+ /*cRadio*/ radio = (cRadio)source;
28293458 Object3D obj = radio.GetObject();
28303459 System.out.println("Edit " + obj);
28313460 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2845,7 +3474,7 @@
28453474 }
28463475
28473476 copy = group;
2848
- //CameraPane.theRenderer.object = group;
3477
+ //Globals.theRenderer.object = group;
28493478 if(!useclient)
28503479 {
28513480 cameraView.renderCamera = radio.camera;
....@@ -2854,25 +3483,50 @@
28543483 cameraView.cameras[cameraView.cameracount] = radio.camera;
28553484 cameraView.targetLookAt.set(radio.camera.lookAt);
28563485 cameraView.object = group;
2857
- cameraView.lighttouched = true;
3486
+ //cameraView.lighttouched = true;
3487
+ Globals.lighttouched = true;
28583488 topView.object = group;
28593489 frontView.object = group;
28603490 sideView.object = group;
28613491 }
2862
- group.editWindow = this;
3492
+
3493
+// fix "+" issue
3494
+ //group.editWindow = this;
3495
+ group.manipWindow = this;
3496
+
28633497 /*
28643498 currentLayout = radio.layout;
28653499 if (currentLayout == null)
28663500 currentLayout = sevenButton;
28673501 */
28683502 radio.layout.doClick();
3503
+
3504
+ ClearUnpinned();
3505
+ SetPinStates(group.selection.size() > 0);
3506
+ if (group.selection.size() == 1)
3507
+ EditSelection(false);
28693508 keepparent = group.parent;
28703509 // PARENT = NULL or not???
28713510 //group.parent = null; // ROOT
28723511 //group.attributes = -1;
28733512 ResetModel();
3513
+
3514
+ cameraView.requestFocusInWindow();
28743515 refreshContents(true);
2875
- }
3516
+ } else if (event.getSource() == editCameraItem)
3517
+ {
3518
+ cameraView.ProtectCamera();
3519
+ cameraView.repaint();
3520
+ return;
3521
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3522
+ {
3523
+ cameraView.RevertCamera();
3524
+ cameraView.repaint();
3525
+ return;
3526
+ // } else if (event.getSource() == textureButton)
3527
+ // {
3528
+ // return; // true;
3529
+ }
28763530 else
28773531 {
28783532 //return super.action(event, arg);
....@@ -2881,7 +3535,6 @@
28813535 }
28823536
28833537 boolean useclient = false;
2884
- cRadio radio;
28853538
28863539 void ToggleRoot()
28873540 {
....@@ -2890,7 +3543,7 @@
28903543 if (useclient)
28913544 {
28923545 cameraView.object = client;
2893
- cameraView.lighttouched = true;
3546
+ Globals.lighttouched = true;
28943547 //topView.object = client;
28953548 //frontView.object = client;
28963549 //sideView.object = client;
....@@ -2898,7 +3551,7 @@
28983551 else
28993552 {
29003553 cameraView.object = group;
2901
- cameraView.lighttouched = true;
3554
+ Globals.lighttouched = true;
29023555 //topView.object = group;
29033556 //frontView.object = group;
29043557 //sideView.object = group;
....@@ -2933,6 +3586,28 @@
29333586 refreshContents();
29343587 }
29353588
3589
+ void TransformChildren()
3590
+ {
3591
+ Object3D obj;
3592
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3593
+ {
3594
+ obj = (Object3D)e.nextElement();
3595
+ obj.KeepTextureMatrices();
3596
+ obj.TransformChildren();
3597
+ obj.RestoreTextureMatrices();
3598
+
3599
+// if (obj.parent == null)
3600
+// {
3601
+// System.out.println("NULL PARENT!");
3602
+// new Exception().printStackTrace();
3603
+// }
3604
+// else
3605
+// TouchTransform(obj);
3606
+// //obj.parent.Touch();
3607
+ }
3608
+
3609
+ refreshContents();
3610
+ }
29363611
29373612 void ResetTransform()
29383613 {
....@@ -3045,7 +3720,7 @@
30453720 refreshContents();
30463721 }
30473722
3048
- void ResetCentroid()
3723
+ void ResetCentroid(boolean full)
30493724 {
30503725 Object3D obj;
30513726 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3060,12 +3735,16 @@
30603735 LA.matIdentity(Object3D.mat);
30613736 obj.getBounds(minima, maxima, false);
30623737 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3063
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3738
+ if (full)
3739
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30643740 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30653741 obj.TransformMesh(Object3D.mat);
3742
+
30663743 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3067
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3744
+ if (full)
3745
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30683746 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3747
+
30693748 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30703749 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30713750 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3094,7 +3773,8 @@
30943773
30953774 int size = obj.MemorySize();
30963775
3097
- System.err.println((size/1024) + " KB is the size of " + obj);
3776
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3777
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30983778 }
30993779 }
31003780 catch (Exception e)
....@@ -3131,9 +3811,9 @@
31313811 obj = (Object3D)e.nextElement();
31323812
31333813 System.out.println("Object is: " + obj);
3134
- GrafreeD.AnalyzeObject(obj);
3814
+ Grafreed.AnalyzeObject(obj);
31353815 System.out.println("Boundary rep: " + obj.bRep);
3136
- GrafreeD.AnalyzeObject(obj.bRep);
3816
+ Grafreed.AnalyzeObject(obj.bRep);
31373817
31383818 // System.err.println((size/1024) + " KB is the size of " + obj);
31393819 }
....@@ -3175,6 +3855,20 @@
31753855 void GenNormals(boolean crease)
31763856 {
31773857 group.GenNormalsS(crease);
3858
+
3859
+ refreshContents();
3860
+ }
3861
+
3862
+ void GenNormalsMESH()
3863
+ {
3864
+ group.GenNormalsMeshS();
3865
+
3866
+ refreshContents();
3867
+ }
3868
+
3869
+ void GenNormalsMINE()
3870
+ {
3871
+ group.selection.GenNormalsMINE();
31783872
31793873 refreshContents();
31803874 }
....@@ -3340,8 +4034,8 @@
33404034
33414035 void ParseVertices()
33424036 {
3343
- boolean epsequal = GrafreeD.epsequal;
3344
- GrafreeD.epsequal = true;
4037
+ boolean epsequal = Grafreed.epsequal;
4038
+ Grafreed.epsequal = true;
33454039
33464040 for (int i=0; i<group.selection.size(); i++)
33474041 {
....@@ -3366,7 +4060,7 @@
33664060 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33674061 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33684062
3369
- g.add(GrafreeD.clipboard);
4063
+ g.add(Grafreed.clipboard);
33704064
33714065 buffer.add(g);
33724066 }
....@@ -3381,7 +4075,7 @@
33814075 makeSomething(buffer, i==group.selection.size()-1);
33824076 }
33834077
3384
- GrafreeD.epsequal = epsequal;
4078
+ Grafreed.epsequal = epsequal;
33854079
33864080 refreshContents();
33874081 }
....@@ -3399,7 +4093,16 @@
33994093 String pigment = Object3D.GetPigment(tex);
34004094 //String bump = Object3D.GetBump(tex);
34014095
3402
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4096
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4097
+
4098
+ try
4099
+ {
4100
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4101
+ }
4102
+ catch (Exception e)
4103
+ {
4104
+ System.err.println("FAIL: " + node);
4105
+ }
34034106
34044107 double s = v.s;
34054108
....@@ -3447,12 +4150,26 @@
34474150
34484151 void Align()
34494152 {
4153
+ if (group.selection.size() == 0)
4154
+ return;
4155
+
4156
+ cVector bbmin = new cVector();
4157
+ cVector bbmax = new cVector();
4158
+
4159
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4160
+
4161
+ double dx = bbmax.x - bbmin.x;
4162
+ double dy = bbmax.y - bbmin.y;
4163
+ double dz = bbmax.z - bbmin.z;
4164
+
4165
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4166
+
34504167 for (int i=0; i<group.selection.size(); i++)
34514168 {
34524169 Object3D obj = group.selection.get(i);
34534170
3454
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3455
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4171
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4172
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34564173 }
34574174
34584175 refreshContents();
....@@ -3473,11 +4190,11 @@
34734190
34744191 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34754192
3476
- boolean random = CameraPane.RANDOM;
3477
- CameraPane.RANDOM = false; // parse all random nodes
4193
+ boolean random = CameraPane.SWITCH;
4194
+ CameraPane.SWITCH = false; // parse all random nodes
34784195 lowres.linkVerticesThis(null);
34794196 lowres.linkVerticesThis(sn);
3480
- CameraPane.RANDOM = random;
4197
+ CameraPane.SWITCH = random;
34814198
34824199 System.err.flush();
34834200
....@@ -3517,7 +4234,7 @@
35174234 return;
35184235
35194236 Object3D poses = group.selection.get(0);
3520
- Object3D ref = GrafreeD.clipboard.get(0);
4237
+ Object3D ref = Grafreed.clipboard.get(0);
35214238
35224239 Object3D newgroup = new Object3D("Po:" + poses.name);
35234240
....@@ -3686,7 +4403,7 @@
36864403 group.selection.RelinkToSupport(); // july 2014
36874404 System.out.println("DONE.");
36884405 refreshContents();
3689
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4406
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36904407 }
36914408
36924409 void ReduceMesh(boolean reduction34)
....@@ -3711,9 +4428,9 @@
37114428
37124429 void ClipMesh()
37134430 {
3714
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4431
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37154432 {
3716
- Object3D content = GrafreeD.clipboard.get(0);
4433
+ Object3D content = Grafreed.clipboard.get(0);
37174434
37184435 if (content instanceof cGroup && ((cGroup)content).transientlink )
37194436 content = ((cGroup)content).get(0);
....@@ -3722,7 +4439,7 @@
37224439 // {
37234440 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37244441 // }
3725
- group.selection.ClipMesh(GrafreeD.clipboard);
4442
+ group.selection.ClipMesh(Grafreed.clipboard);
37264443 }
37274444 // group.selection.ClipMesh(GrafreeD.clipboard);
37284445 System.out.println("DONE.");
....@@ -3769,6 +4486,18 @@
37694486 void MarkLeaves(boolean hide)
37704487 {
37714488 group.selection.MarkLeaves(hide);
4489
+ refreshContents();
4490
+ }
4491
+
4492
+ void RewindLeaves(boolean hide)
4493
+ {
4494
+ group.selection.RewindLeaves(hide);
4495
+ refreshContents();
4496
+ }
4497
+
4498
+ void RandomLeaves(boolean hide)
4499
+ {
4500
+ group.selection.RandomLeaves(hide);
37724501 refreshContents();
37734502 }
37744503
....@@ -3843,10 +4572,6 @@
38434572 // }
38444573 // }
38454574
3846
- static boolean allparams = true;
3847
-
3848
- static Vector<Object3D> listUI = new Vector<Object3D>();
3849
-
38504575 void EditSelection(boolean newWindow)
38514576 {
38524577 // aConstraints.gridy = 0;
....@@ -3854,10 +4579,10 @@
38544579 {
38554580 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38564581 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3857
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4582
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38584583
38594584 Object3D elem = (Object3D)group.selection.elementAt(i);
3860
- if(elem != group)
4585
+ if(elem != group || !newWindow)
38614586 {
38624587 // if (!(elem instanceof Composite))
38634588 // newWindow = false;
....@@ -3939,7 +4664,8 @@
39394664 //new Exception().printStackTrace();
39404665
39414666 freezemodel = true;
3942
-
4667
+ ClearUnpinned();
4668
+
39434669 /**/
39444670 //switch (event.id)
39454671 {
....@@ -3947,7 +4673,6 @@
39474673 //case 702: // Event.LIST_DESELECT
39484674 group.deselectAll();
39494675 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3950
- objEditor.ClearInfo(); // .GetMaterial());
39514676 if (tps != null)
39524677 {
39534678 for (int i=0; i < tps.length; i++)
....@@ -3956,33 +4681,39 @@
39564681
39574682 //if (child.parent != null)
39584683 //child.parent.addSelectee(child);
4684
+ objEditor.SetMaterial(child);
39594685 group.addSelectee(child);
3960
- objEditor.SetMaterial(child); // .GetMaterial());
3961
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3962
- System.err.println("info : " + child.GetPath());
39634686 }
39644687 }
3965
- else
3966
- {
3967
- objEditor.SetMaterial(group); // .GetMaterial());
3968
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3969
- System.err.println("info : " + group.GetPath());
3970
- }
4688
+// else
4689
+// {
4690
+// objEditor.SetMaterial(group); // .GetMaterial());
4691
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4692
+// System.err.println("info : " + group.GetPath());
4693
+// }
39714694
3972
- objEditor.SetText(); // jan 2014
3973
-
3974
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4695
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39754696 CameraPane.flash = true;
39764697
3977
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4698
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39784699 // a camera
39794700 {
3980
- CameraPane.camerachangeframe = 0; // don't refuse it
3981
- CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
3982
- // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera;
3983
- // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera;
4701
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4702
+ {
4703
+ CameraPane.camerachangeframe = 0; // don't refuse it
4704
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4705
+ }
4706
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4707
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39844708 }
39854709
4710
+ if (tps != null && tps.length == 1)
4711
+ {
4712
+ EditSelection(false);
4713
+ }
4714
+
4715
+ SetPinStates(tps != null && tps.length > 0);
4716
+
39864717 refreshContents();
39874718 //return true;
39884719 }
....@@ -3991,6 +4722,35 @@
39914722
39924723 freezemodel = false;
39934724 }
4725
+
4726
+ void SetPinStates(boolean enabled)
4727
+ {
4728
+ editButton.setEnabled(enabled);
4729
+ uneditButton.setEnabled(enabled);
4730
+ unselectButton.setEnabled(enabled);
4731
+ flashSelectionButton.setEnabled(enabled);
4732
+ }
4733
+
4734
+ void refreshContents(boolean cp)
4735
+ {
4736
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4737
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4738
+ {
4739
+ objEditor.ClearInfo(); // .GetMaterial());
4740
+
4741
+ for (int i=0; i < group.selection.Size(); i++)
4742
+ {
4743
+ Object3D child = (Object3D) group.selection.get(i);
4744
+
4745
+ objEditor.AddInfo(child, this, true);
4746
+ System.err.println("info : " + child.GetPath());
4747
+ }
4748
+
4749
+ objEditor.SetText(); // jan 2014
4750
+ }
4751
+
4752
+ super.refreshContents(cp);
4753
+ }
39944754
39954755 void linkSomething(Object3D thing)
39964756 {
....@@ -4062,16 +4822,19 @@
40624822 {
40634823 if (group.selection.isEmpty())
40644824 return;
4065
- GrafreeD.clipboardIsTempGroup = false;
4825
+
4826
+ Grafreed.clipboardIsTempGroup = false;
40664827 Composite tGroup = null;
40674828 if (group.selection.size() > 0) // 1)
40684829 {
40694830 tGroup = new cGroup();
4070
- GrafreeD.clipboardIsTempGroup = true;
4831
+ Grafreed.clipboardIsTempGroup = true;
40714832 }
40724833
40734834 if (cut)
40744835 {
4836
+ if (Globals.SAVEONMAKE)
4837
+ Save();
40754838 //int indices[] = jList.getSelectedIndices();
40764839 //for (int i = indices.length - 1; i >= 0; i--)
40774840 //jList.remove(indices[i]);
....@@ -4107,16 +4870,16 @@
41074870 //System.out.println("cut " + child);
41084871 //System.out.println("parent = " + child.parent);
41094872 // tmp.addChild(child);
4110
- if (GrafreeD.clipboardIsTempGroup)
4873
+ if (Grafreed.clipboardIsTempGroup)
41114874 tGroup.add/*Child*/(tmp);
41124875 else
4113
- GrafreeD.clipboard = tmp;
4876
+ Grafreed.clipboard = tmp;
41144877 }
41154878 else
4116
- if (GrafreeD.clipboardIsTempGroup)
4879
+ if (Grafreed.clipboardIsTempGroup)
41174880 tGroup.add/*Child*/(child);
41184881 else
4119
- GrafreeD.clipboard = child;
4882
+ Grafreed.clipboard = child;
41204883 }
41214884
41224885 //ResetModel();
....@@ -4148,21 +4911,23 @@
41484911 //System.out.println("cut " + elem);
41494912 //System.out.println("parent = " + elem.parent);
41504913 // tmp.addChild(elem);
4151
- if (GrafreeD.clipboardIsTempGroup)
4914
+ if (Grafreed.clipboardIsTempGroup)
41524915 tGroup.add/*Child*/(tmp);
41534916 else
4154
- GrafreeD.clipboard = tmp;
4917
+ Grafreed.clipboard = tmp;
41554918 }
41564919 else
4157
- if (GrafreeD.clipboardIsTempGroup)
4920
+ if (Grafreed.clipboardIsTempGroup)
41584921 tGroup.add/*Child*/(child);
41594922 else
4160
- GrafreeD.clipboard = child;
4923
+ Grafreed.clipboard = child;
41614924 }
41624925
41634926 }
4164
- if (GrafreeD.clipboardIsTempGroup)
4165
- GrafreeD.clipboard = tGroup;
4927
+
4928
+ if (Grafreed.clipboardIsTempGroup)
4929
+ Grafreed.clipboard = tGroup;
4930
+
41664931 if (cut)
41674932 {
41684933 ResetModel();
....@@ -4176,7 +4941,7 @@
41764941 // return;
41774942 boolean first = true;
41784943
4179
- if (GrafreeD.clipboardIsTempGroup)
4944
+ if (Grafreed.clipboardIsTempGroup)
41804945 {
41814946 Composite temp;
41824947
....@@ -4187,7 +4952,7 @@
41874952 temp = (Composite)Applet3D.clipboard.deepCopy();
41884953 */
41894954 Object3D elem;
4190
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4955
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41914956 {
41924957 Object3D child = (Object3D)e.nextElement();
41934958
....@@ -4221,21 +4986,21 @@
42214986 //Object3D cb = Applet3D.clipboard;
42224987 //temp.addChild(cb);
42234988 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4224
- assert(GrafreeD.clipboard.parent == null);
4225
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4226
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4227
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4228
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4989
+ assert(Grafreed.clipboard.parent == null);
4990
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4991
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4992
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4993
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42294994 else
4230
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4231
- GrafreeD.clipboard.get(0).parent = keepparent;
4995
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4996
+ Grafreed.clipboard.get(0).parent = keepparent;
42324997 }
42334998
42344999 ResetModel();
42355000 refreshContents();
42365001 }
42375002
4238
- void pasteInto(boolean copyit)
5003
+ void pasteInto(boolean copyit, boolean clone)
42395004 {
42405005 // if (GrafreeD.clipboard == null)
42415006 // return;
....@@ -4264,15 +5029,22 @@
42645029 if (copyit)
42655030 {
42665031 // paste(false);
4267
- CloneClipboard(false); // sept 2014
5032
+ if (clone)
5033
+ {
5034
+ CloneClipboard(false); // sept 2014
5035
+ }
5036
+ else
5037
+ {
5038
+ paste(false);
5039
+ }
42685040 }
42695041 else
42705042 {
42715043 boolean first = true;
42725044
4273
- if (GrafreeD.clipboardIsTempGroup)
5045
+ if (Grafreed.clipboardIsTempGroup)
42745046 {
4275
- Composite temp = (Composite)GrafreeD.clipboard;
5047
+ Composite temp = (Composite)Grafreed.clipboard;
42765048 Object3D copy;
42775049 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42785050 {
....@@ -4282,7 +5054,7 @@
42825054 }
42835055 } else
42845056 {
4285
- linkSomething(GrafreeD.clipboard); //.get(0));
5057
+ linkSomething(Grafreed.clipboard); //.get(0));
42865058 }
42875059 }
42885060 }
....@@ -4474,6 +5246,26 @@
44745246 makeSomething(csg);
44755247 }
44765248
5249
+ void Ungroup(Object3D g)
5250
+ {
5251
+ if (g instanceof HiddenObject)
5252
+ {
5253
+ HiddenObject h = (HiddenObject) g;
5254
+
5255
+ for (int i=0; i<h.ActualSize(); i++)
5256
+ {
5257
+ objEditor.makeSomething(h.get(i), false);
5258
+ }
5259
+ }
5260
+ else
5261
+ {
5262
+ for (int i=0; i<g.Size(); i++)
5263
+ {
5264
+ objEditor.makeSomething(g.get(i), false);
5265
+ }
5266
+ }
5267
+ }
5268
+
44775269 void ungroup()
44785270 {
44795271 /*
....@@ -4667,21 +5459,6 @@
46675459 }
46685460 */
46695461
4670
- void ImportGFD()
4671
- {
4672
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4673
- browser.show();
4674
- String filename = browser.getFile();
4675
- if (filename != null && filename.length() > 0)
4676
- {
4677
- String fullname = browser.getDirectory() + filename;
4678
-
4679
- //Object3D readobj =
4680
- objEditor.ReadGFD(fullname, objEditor);
4681
- //makeSomething(readobj);
4682
- }
4683
- }
4684
-
46855462 /*
46865463 public void Callback(Object obj)
46875464 {
....@@ -4705,26 +5482,9 @@
47055482 }
47065483 */
47075484
4708
- void ImportVRMLX3D()
4709
- {
4710
- if (GrafreeD.standAlone)
4711
- {
4712
- /**/
4713
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4714
- browser.show();
4715
- String filename = browser.getFile();
4716
- if (filename != null && filename.length() > 0)
4717
- {
4718
- String fullname = browser.getDirectory() + filename;
4719
- LoadVRMLX3D(fullname);
4720
- }
4721
- /**/
4722
- }
4723
- }
4724
-
47255485 String GetFile(String dialogName)
47265486 {
4727
- if (GrafreeD.standAlone)
5487
+ if (Grafreed.standAlone)
47285488 {
47295489 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47305490 browser.show();
....@@ -4788,10 +5548,33 @@
47885548 cButton flashSelectionButton;
47895549 cButton editButton;
47905550 cButton uneditButton;
5551
+ JCheckBox allParamsButton;
47915552 cButton clearpanelButton;
4792
- cButton allParamsButton;
47935553 cButton unselectButton;
47945554
5555
+ cButton restoreCameraButton;
5556
+
5557
+ cButton saveButton;
5558
+ cButton oneStepButton;
5559
+
5560
+ cButton groupButton;
5561
+ cButton ungroupButton;
5562
+ cButton compositeButton;
5563
+ cButton switchButton;
5564
+ cButton loopButton;
5565
+ cButton textureButton;
5566
+
5567
+ cButton gridButton;
5568
+ cButton boxButton;
5569
+ cButton sphereButton;
5570
+ cButton coneButton;
5571
+ cButton torusButton;
5572
+ cButton superButton;
5573
+ cButton kleinButton;
5574
+ cButton particlesButton;
5575
+ cButton overlayButton;
5576
+ cButton lightButton;
5577
+
47955578 cButton screenfitButton;
47965579 cButton screenfitpointButton;
47975580 cButton snapobjectButton;
....@@ -4803,14 +5586,6 @@
48035586
48045587 cButton setsupportButton;
48055588
4806
- cButton twoButton;
4807
- cButton sixButton;
4808
- cButton threeButton;
4809
- cButton sevenButton;
4810
- cButton fourButton; // full panel
4811
- cButton oneButton; // full XYZ
4812
- //cButton currentLayout;
4813
-
48145589 //
48155590 //Composite
48165591 Object3D // to do !!
....@@ -4820,9 +5595,11 @@
48205595 //JTree jTree;
48215596 private MenuItem lookAtItem;
48225597 private MenuItem lookFromItem;
4823
- private MenuItem switchItem;
5598
+ private MenuItem switchViewItem;
48245599 private MenuItem cutItem;
4825
- private MenuItem duplicateItem;
5600
+ private MenuItem undoItem;
5601
+ private MenuItem redoItem;
5602
+ private JMenuItem duplicateItem;
48265603 private MenuItem cloneItem;
48275604 private MenuItem cloneSupportItem;
48285605 private MenuItem overwriteGeoItem;
....@@ -4833,8 +5610,9 @@
48335610 private MenuItem resetsupportItem;
48345611 private MenuItem resetreferencesItem;
48355612 private MenuItem linkverticesItem;
5613
+ private MenuItem relinkverticesItem;
48365614 private MenuItem setMasterItem;
4837
- private MenuItem resetMeshItem;
5615
+ private MenuItem resetAllItem;
48385616 private MenuItem stepAllItem;
48395617 private MenuItem revertMeshItem;
48405618 private MenuItem poseMeshItem;
....@@ -4845,6 +5623,7 @@
48455623 private MenuItem mergeGeometriesItem;
48465624 private MenuItem copyItem;
48475625 private MenuItem pasteItem;
5626
+ private MenuItem pasteIntoItem;
48485627 private MenuItem pasteLinkItem;
48495628 private MenuItem pasteCloneItem;
48505629 private MenuItem pasteExpandItem;
....@@ -4854,6 +5633,7 @@
48545633 private MenuItem genNormalsMESHItem;
48555634 private MenuItem genNormalsCADItem;
48565635 private MenuItem genNormalsORGANItem;
5636
+ private MenuItem genNormalsMINEItem;
48575637 private MenuItem stripifyItem;
48585638 private MenuItem unstripifyItem;
48595639 private MenuItem trimItem;
....@@ -4882,6 +5662,10 @@
48825662 private MenuItem showleavesItem;
48835663 private MenuItem markleavesItem;
48845664 private MenuItem unmarkleavesItem;
5665
+ private MenuItem rewindleavesItem;
5666
+ private MenuItem unrewindleavesItem;
5667
+ private MenuItem randomleavesItem;
5668
+ private MenuItem unrandomleavesItem;
48855669
48865670 private MenuItem flipVItem;
48875671 private MenuItem unflipVItem;
....@@ -4893,14 +5677,17 @@
48935677 private MenuItem panoTexturesItem;
48945678
48955679 private MenuItem resetCentroidItem;
4896
- private MenuItem transformgeometryItem;
5680
+ private MenuItem resetCentroidXZItem;
48975681 private MenuItem resetTransformItem;
5682
+ private MenuItem transformGeometryItem;
5683
+ private MenuItem transformChildrenItem;
5684
+ private MenuItem hideItem;
48985685 private MenuItem grabItem;
48995686 private MenuItem backItem;
49005687 private MenuItem frontItem;
49015688 private MenuItem cameraItem;
49025689 private MenuItem compositeItem;
4903
- private MenuItem randomItem;
5690
+ private MenuItem switchItem;
49045691 private MenuItem physicsItem;
49055692 private MenuItem frameselectorItem;
49065693 private MenuItem scriptNodeItem;
....@@ -4915,6 +5702,7 @@
49155702
49165703 private MenuItem resetParentItem;
49175704 private MenuItem repairParentItem;
5705
+ private MenuItem repairShadowItem;
49185706 private MenuItem sortbysizeItem;
49195707 private MenuItem sortbynameItem;
49205708
....@@ -4935,10 +5723,11 @@
49355723 private MenuItem coneItem;
49365724 private MenuItem torusItem;
49375725 private MenuItem superItem;
5726
+ private MenuItem kleinItem;
49385727 private MenuItem blobItem;
49395728 private MenuItem latheItem;
49405729 private MenuItem bezierItem;
4941
- private MenuItem checkerItem;
5730
+ private MenuItem overlayItem;
49425731 private MenuItem meshItem;
49435732 // private MenuItem meshGroupItem;
49445733 private MenuItem springItem;
....@@ -4947,6 +5736,7 @@
49475736 private MenuItem csgItem;
49485737 private MenuItem templateItem;
49495738 private MenuItem textureItem;
5739
+ private MenuItem billboardItem;
49505740 private MenuItem shadowXItem;
49515741 private MenuItem shadowYItem;
49525742 private MenuItem shadowZItem;
....@@ -4959,11 +5749,6 @@
49595749 private MenuItem doubleItem;
49605750 private MenuItem tripleItem;
49615751
4962
- private MenuItem importGFDItem;
4963
- private MenuItem importVRMLX3DItem;
4964
- private MenuItem import3DSItem;
4965
- private MenuItem importOBJItem;
4966
-
49675752 private MenuItem computeAOItem;
49685753 private MenuItem recompileItem;
49695754 private MenuItem editScriptItem;
....@@ -4973,4 +5758,8 @@
49735758 private MenuItem analyzeItem;
49745759 private MenuItem dumpItem;
49755760 //boolean freezemodel = false;
5761
+
5762
+ Menu cameraMenu;
5763
+ MenuItem editCameraItem;
5764
+ MenuItem restoreCameraItem;
49765765 }