Normand Briere
2019-06-30 cfd7a643cb5a445016ddb15595158ecc59b184fd
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,104 @@
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);
10791474
10801475 menu.add("-");
10811476 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
10821477 parseverticesItem.addActionListener(this);
10831478 textureFieldItem = menu.add(new MenuItem("Texture Field"));
10841479 textureFieldItem.addActionListener(this);
1085
- alignItem = menu.add(new MenuItem("Align"));
1480
+ alignItem = menu.add(new MenuItem("Align Objects"));
10861481 alignItem.addActionListener(this);
1087
- mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1088
- mirrorItem.addActionListener(this);
10891482 reduceMorphItem = menu.add(new MenuItem("Reduce Morphs"));
10901483 reduceMorphItem.addActionListener(this);
10911484 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
10921485 reduce34MorphItem.addActionListener(this);
1093
-
1486
+ menu.add("-");
10941487 menu.add(computeAOItem = new MenuItem("Compute AO"));
10951488 computeAOItem.addActionListener(this);
1096
- menu.add("-");
10971489
1490
+ if (Globals.ADVANCED)
1491
+ {
1492
+ mirrorItem = menu.add(new MenuItem("Mirror Poses"));
1493
+ mirrorItem.addActionListener(this);
1494
+ menu.add("-");
10981495 menu.add(memoryItem = new MenuItem("Memory Usage"));
10991496 memoryItem.addActionListener(this);
11001497 menu.add(analyzeItem = new MenuItem("Analyze"));
11011498 analyzeItem.addActionListener(this);
1102
- menu.add(dumpItem = new MenuItem("Dump"));
1499
+ menu.add(dumpItem = new MenuItem("Print"));
11031500 dumpItem.addActionListener(this);
11041501 // menu.add(pathItem = new MenuItem("From-to path"));
11051502 // pathItem.addActionListener(this);
....@@ -1108,6 +1505,8 @@
11081505 resetParentItem.addActionListener(this);
11091506 repairParentItem = menu.add(new MenuItem("Repair Parent"));
11101507 repairParentItem.addActionListener(this);
1508
+ repairShadowItem = menu.add(new MenuItem("Repair Shadow"));
1509
+ repairShadowItem.addActionListener(this);
11111510 menu.add(invariantsItem = new MenuItem("Invariants"));
11121511 invariantsItem.addActionListener(this);
11131512 menu.add(recompileItem = new MenuItem("Recompile"));
....@@ -1115,6 +1514,7 @@
11151514 menu.add("-");
11161515 menu.add(editScriptItem = new MenuItem("Edit Script..."));
11171516 editScriptItem.addActionListener(this);
1517
+ }
11181518 }
11191519
11201520 void ScreenFit()
....@@ -1237,9 +1637,24 @@
12371637 shadow.material = new cMaterial(obj.material);
12381638 shadow.material.diffuse = 0.0001f;
12391639 shadow.material.specular = 0.0001f;
1640
+ //shadow.projectedVertices[1].x = 300;
12401641
12411642 makeSomething(shadow);
12421643 }
1644
+
1645
+ private void ClearUnpinned()
1646
+ {
1647
+ //for (Object3D obj : listUI)
1648
+ for (int i=listUI.size(); --i>=0;)
1649
+ {
1650
+ Object3D obj = listUI.elementAt(i);
1651
+ if (!obj.pinned)
1652
+ {
1653
+ obj.CloseUI();
1654
+ listUI.remove(i);
1655
+ }
1656
+ }
1657
+ }
12431658
12441659 /**
12451660 * applyExample
....@@ -1443,9 +1858,9 @@
14431858
14441859 void Overwrite(int mask)
14451860 {
1446
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1861
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
14471862 {
1448
- Object3D content = GrafreeD.clipboard.get(0);
1863
+ Object3D content = Grafreed.clipboard.get(0);
14491864
14501865 if (content instanceof cGroup && ((cGroup)content).transientlink )
14511866 content = ((cGroup)content).get(0);
....@@ -1468,6 +1883,7 @@
14681883 //
14691884 public void actionPerformed(ActionEvent event) // , Object arg)
14701885 {
1886
+ Object source = event.getSource();
14711887 /*
14721888 if (event.getSource() == nameField)
14731889 {
....@@ -1479,11 +1895,11 @@
14791895 }
14801896 else
14811897 */
1482
- if (event.getSource() == lookAtItem || event.getSource() == lookFromItem)
1898
+ if (source == lookAtItem || source == lookFromItem)
14831899 {
14841900 ScreenFit();
14851901 } else
1486
- if (event.getSource() == switchItem)
1902
+ if (source == switchViewItem)
14871903 {
14881904 cVector v1 = new cVector();
14891905 cVector v2 = new cVector();
....@@ -1492,11 +1908,11 @@
14921908 objEditor.cameraView.renderCamera.setAim(v2, v1);
14931909 objEditor.cameraView.repaint();
14941910 } else
1495
- if (event.getSource() == rectoidItem)
1911
+ if (source == rectoidItem || source == boxButton)
14961912 {
14971913 makeSomething(new Box());
14981914 } else
1499
- if (event.getSource() == particleItem)
1915
+ if (source == particleItem || source == particlesButton)
15001916 {
15011917 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
15021918 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1517,9 +1933,9 @@
15171933 applyExample(particleGeom, "SMOKE");
15181934 makeSomething(particleGeom);
15191935 } else
1520
- if (event.getSource() == ragdollItem || event.getSource() == ragdoll2Item)
1936
+ if (source == ragdollItem || source == ragdoll2Item)
15211937 {
1522
- GenericJoint ragdoll = new GenericJoint(event.getSource() == ragdollItem);
1938
+ GenericJoint ragdoll = new GenericJoint(source == ragdollItem);
15231939
15241940 ragdoll.toParent = LA.newMatrix();
15251941 ragdoll.fromParent = LA.newMatrix();
....@@ -1537,7 +1953,7 @@
15371953 } else
15381954 /*
15391955 */
1540
- if (event.getSource() == heightFieldItem)
1956
+ if (source == heightFieldItem)
15411957 {
15421958 Object3D obj = new Object3D();
15431959
....@@ -1575,27 +1991,31 @@
15751991
15761992 makeSomething(obj);
15771993 } else
1578
- if (event.getSource() == gridItem)
1994
+ if (source == gridItem || source == gridButton)
15791995 {
15801996 makeSomething(new Grid());
15811997 } else
1582
- if (event.getSource() == ellipsoidItem)
1998
+ if (source == ellipsoidItem || source == sphereButton)
15831999 {
15842000 makeSomething(new Sphere());
15852001 } else
1586
- if (event.getSource() == coneItem)
2002
+ if (source == coneItem || source == coneButton)
15872003 {
15882004 makeSomething(new Cone());
15892005 } else
1590
- if (event.getSource() == torusItem)
2006
+ if (source == torusItem || source == torusButton)
15912007 {
15922008 makeSomething(new Torus());
15932009 } else
1594
- if (event.getSource() == superItem)
2010
+ if (source == superItem || source == superButton)
15952011 {
15962012 makeSomething(new Superellipsoid());
15972013 } else
1598
- if (event.getSource() == blobItem)
2014
+ if (source == kleinItem || source == kleinButton)
2015
+ {
2016
+ makeSomething(new Klein());
2017
+ } else
2018
+ if (source == blobItem)
15992019 {
16002020 Blob blob = new Blob();
16012021 BlobComponent comp = new BlobComponent();
....@@ -1603,15 +2023,15 @@
16032023 //blob.retile();
16042024 makeSomething(blob);
16052025 } else
1606
- if (event.getSource() == latheItem)
2026
+ if (source == latheItem)
16072027 {
16082028 makeSomething(new Lathe());
16092029 } else
1610
- if (event.getSource() == bezierItem)
2030
+ if (source == bezierItem)
16112031 {
16122032 makeSomething(new BezierSurface());
16132033 } else
1614
- if (event.getSource() == checkerItem)
2034
+ if (source == overlayItem || source == overlayButton)
16152035 {
16162036 /*
16172037 Object3D obj = new BezierSurface(5,8);
....@@ -1626,7 +2046,7 @@
16262046 */
16272047 makeSomething(new Checker());
16282048 } else
1629
- if (event.getSource() == meshItem)
2049
+ if (source == meshItem)
16302050 {
16312051 Object3D itemtomake = new Object3D();
16322052 Object3D child;
....@@ -1647,35 +2067,35 @@
16472067 makeSomething(child);
16482068 }
16492069 } else
1650
- if (event.getSource() == springItem)
2070
+ if (source == springItem)
16512071 {
16522072 cSpring s = new cSpring();
16532073 s.setup();
16542074 makeSomething(s);
16552075 } else
1656
- if (event.getSource() == flagItem)
2076
+ if (source == flagItem)
16572077 {
16582078 cSpring s = new cFlag();
16592079 s.setup();
16602080 makeSomething(s);
16612081 } else
1662
- if (event.getSource() == lightItem)
2082
+ if (source == lightItem || source == lightButton)
16632083 {
16642084 makeSomething(new Light());
16652085 } else
1666
- if (event.getSource() == csgItem)
2086
+ if (source == csgItem)
16672087 {
16682088 group(new CSG());
16692089 } else
1670
- if (event.getSource() == templateItem)
2090
+ if (source == templateItem)
16712091 {
16722092 group(new cTemplate());
16732093 } else
1674
- if (event.getSource() == attributeItem)
2094
+ if (source == attributeItem)
16752095 {
16762096 makeSomething(new Attribute());
16772097 } else
1678
- if (event.getSource() == pointflowItem)
2098
+ if (source == pointflowItem)
16792099 {
16802100 makeSomething(new PointFlow());
16812101 } else
....@@ -1687,7 +2107,7 @@
16872107 } else
16882108 */
16892109
1690
- if (event.getSource() == superLoopItem)
2110
+ if (source == superLoopItem)
16912111 {
16922112 Composite g = new cGroup();
16932113 for (int i=0; i<15; i++)
....@@ -1709,30 +2129,30 @@
17092129
17102130 group(g);
17112131 } else
1712
- if (event.getSource() == loopItem)
2132
+ if (source == loopItem || source == loopButton)
17132133 {
17142134 Composite csg = new GroupLeaf();
17152135 csg.count = 5;
17162136 group(csg);
1717
- Composite child = new cGroup();
2137
+ Composite child = new cGroup("Branch");
17182138 csg.addChild(child);
17192139 child.addChild(csg);
17202140 } else
1721
- if (event.getSource() == doubleItem)
2141
+ if (source == doubleItem)
17222142 {
1723
- Composite csg = new GroupLeaf();
2143
+ Composite csg = new GroupLeaf("Fork");
17242144 csg.count = 5;
17252145 group(csg);
1726
- Composite child = new cGroup();
2146
+ Composite child = new cGroup("Branch A");
17272147 csg.addChild(child);
17282148 child.addChild(csg);
1729
- child = new cGroup();
2149
+ child = new cGroup("Branch B");
17302150 csg.addChild(child);
17312151 child.addChild(csg);
17322152 } else
1733
- if (event.getSource() == tripleItem)
2153
+ if (source == tripleItem)
17342154 {
1735
- Composite csg = new GroupLeaf();
2155
+ Composite csg = new GroupLeaf("Trident");
17362156 csg.count = 4;
17372157 group(csg);
17382158 Composite child = new cGroup();
....@@ -1745,71 +2165,83 @@
17452165 csg.addChild(child);
17462166 child.addChild(csg);
17472167 } else
1748
-
1749
- if (event.getSource() == importGFDItem)
2168
+ if (source == computeAOItem)
17502169 {
1751
- ImportGFD();
2170
+ Globals.drawMode = CameraPane.OCCLUSION;
2171
+ Globals.theRenderer.repaint();
17522172 } 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)
2173
+ if (source == recompileItem)
17712174 {
17722175 Recompile();
17732176 refreshContents();
17742177 } else
1775
- if (event.getSource() == editScriptItem)
2178
+ if (source == editScriptItem)
17762179 {
17772180 OpenDialog();
17782181 refreshContents();
17792182 } else
1780
- if (event.getSource() == invariantsItem)
2183
+ if (source == invariantsItem)
17812184 {
17822185 System.out.println("Invariants:");
1783
- GrafreeD.theApplet3D.universe.invariants();
2186
+ Grafreed.grafreeD.universe.invariants();
17842187 } else
1785
- if (event.getSource() == memoryItem)
2188
+ if (source == memoryItem)
17862189 {
17872190 //System.out.println("Invariants:");
17882191 PrintMemory();
17892192 } else
1790
- if (event.getSource() == pathItem)
2193
+ if (source == pathItem)
17912194 {
17922195 PrintPath();
17932196 } else
1794
- if (event.getSource() == analyzeItem)
2197
+ if (source == analyzeItem)
17952198 {
17962199 AnalyzeObject();
17972200 } else
1798
- if (event.getSource() == dumpItem)
2201
+ if (source == dumpItem)
17992202 {
18002203 DumpObject();
18012204 } else
1802
- if (event.getSource() == screenfitButton)
2205
+ if (source == minButton)
2206
+ {
2207
+ Minimize();
2208
+ } else
2209
+ if (source == maxButton)
2210
+ {
2211
+ Maximize();
2212
+ } else
2213
+ if (source == fullButton)
2214
+ {
2215
+ ToggleFullScreen();
2216
+ } else
2217
+ if (source == undoButton)
2218
+ {
2219
+ Undo();
2220
+ } else
2221
+ if (source == redoButton)
2222
+ {
2223
+ Redo();
2224
+ } else
2225
+ if (source == saveButton)
2226
+ {
2227
+ Save();
2228
+ } else
2229
+ if (source == oneStepButton)
2230
+ {
2231
+ Globals.ONESTEP = true;
2232
+ cameraView.repaint();
2233
+ } else
2234
+ if (source == screenfitButton)
18032235 {
18042236 //Reload(lastConverter, lastFilename, true);
18052237 ScreenFit();
18062238 } else
1807
- if (event.getSource() == screenfitpointButton)
2239
+ if (source == screenfitpointButton)
18082240 {
18092241 //Reload(lastConverter, lastFilename, true);
18102242 ScreenFitPoint();
18112243 } else
1812
- if (event.getSource() == snapobjectButton)
2244
+ if (source == snapobjectButton)
18132245 {
18142246 //Reload(lastConverter, lastFilename, true);
18152247 SnapObject();
....@@ -1820,13 +2252,13 @@
18202252 // Recompile();
18212253 // refreshContents();
18222254 // } else
1823
- if (event.getSource() == gcButton)
2255
+ if (source == gcButton)
18242256 {
18252257 System.out.println("Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18262258 System.gc();
18272259 System.out.println("GC Memory (F/T/M) : " + Runtime.getRuntime().freeMemory() + "/" + Runtime.getRuntime().totalMemory() + "/" + Runtime.getRuntime().maxMemory());
18282260 } else
1829
- if (event.getSource() == editLeafItem)
2261
+ if (source == editLeafItem)
18302262 {
18312263 Object3D obj;
18322264 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -1840,62 +2272,74 @@
18402272 }
18412273 refreshContents(true);
18422274 } else
1843
- if (event.getSource() == openWindowItem)
2275
+ if (source == openWindowItem)
18442276 {
18452277 EditSelection(true);
18462278 } else
1847
- if (event.getSource() == cutItem || event.getSource() == clearButton)
2279
+ if (source == cutItem || source == clearButton)
18482280 {
18492281 loadClipboard(true);
18502282 } else
1851
- if (event.getSource() == duplicateItem)
2283
+ if (source == undoItem)
18522284 {
1853
- Object3D keep = GrafreeD.clipboard;
2285
+ Undo();
2286
+ } else
2287
+ if (source == redoItem)
2288
+ {
2289
+ Redo();
2290
+ } else
2291
+ if (source == duplicateItem)
2292
+ {
2293
+ Object3D keep = Grafreed.clipboard;
18542294 loadClipboard(false);
18552295 paste(false);
1856
- GrafreeD.clipboard = keep;
2296
+ Grafreed.clipboard = keep;
18572297 } else
1858
- if (event.getSource() == cloneItem)
2298
+ if (source == cloneItem)
18592299 {
18602300 CloneSelection(false);
18612301 } else
1862
- if (event.getSource() == cloneSupportItem)
2302
+ if (source == cloneSupportItem)
18632303 {
18642304 CloneSelection(true);
18652305 } else
1866
- if (event.getSource() == copyItem)
2306
+ if (source == copyItem)
18672307 {
18682308 loadClipboard(false);
18692309 } else
1870
- if (event.getSource() == pasteItem)
2310
+ if (source == pasteItem)
18712311 {
18722312 paste(false);
18732313 } else
1874
- if (event.getSource() == pasteLinkItem)
2314
+ if (source == pasteIntoItem)
18752315 {
1876
- pasteInto(false);
2316
+ pasteInto(true, false);
18772317 } else
1878
- if (event.getSource() == pasteCloneItem)
2318
+ if (source == pasteLinkItem)
18792319 {
1880
- pasteInto(true);
2320
+ pasteInto(false, false);
18812321 } else
1882
- if (event.getSource() == pasteExpandItem)
2322
+ if (source == pasteCloneItem)
2323
+ {
2324
+ pasteInto(true, true);
2325
+ } else
2326
+ if (source == pasteExpandItem)
18832327 {
18842328 paste(true);
18852329 } else
1886
- if (event.getSource() == synchronizeItem)
2330
+ if (source == synchronizeItem)
18872331 {
18882332 Overwrite(Object3D.TRANSFORM);
18892333 } else
1890
- if (event.getSource() == overwriteNameItem)
2334
+ if (source == overwriteNameItem)
18912335 {
18922336 Overwrite(Object3D.NAME);
18932337 } else
1894
- if (event.getSource() == overwriteUVItem)
2338
+ if (source == overwriteUVItem)
18952339 {
18962340 Overwrite(Object3D.UV);
18972341 } else
1898
- if (event.getSource() == overwriteMatItem)
2342
+ if (source == overwriteMatItem)
18992343 {
19002344 /* july 2015
19012345 if ((dropAttributes & Object3D.TEXTURE) == 0)
....@@ -1915,7 +2359,7 @@
19152359
19162360 Overwrite(dropAttributes);
19172361 }
1918
- if (event.getSource() == overwriteGeoItem)
2362
+ if (source == overwriteGeoItem)
19192363 {
19202364 Overwrite(Object3D.GEOMETRY);
19212365 // if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
....@@ -1932,7 +2376,7 @@
19322376 // refreshContents();
19332377 // }
19342378 } else
1935
- if (event.getSource() == generateMeshItem)
2379
+ if (source == generateMeshItem)
19362380 {
19372381 //if (group.selection.size() == 1)
19382382 // for (int i=0; i<group.selection.size(); i++)
....@@ -1943,7 +2387,7 @@
19432387 ResetModel();
19442388 refreshContents();
19452389 } else
1946
- if (event.getSource() == extractGeometriesItem)
2390
+ if (source == extractGeometriesItem)
19472391 {
19482392 boolean one = false;
19492393
....@@ -1970,7 +2414,7 @@
19702414 ResetModel();
19712415 refreshContents();
19722416 } else
1973
- if (event.getSource() == cloneGeometriesItem)
2417
+ if (source == cloneGeometriesItem)
19742418 {
19752419 boolean one = false;
19762420
....@@ -1996,32 +2440,37 @@
19962440 ResetModel();
19972441 refreshContents();
19982442 } else
1999
- if (event.getSource() == shareGeometriesItem)
2443
+ if (source == shareGeometriesItem)
20002444 {
20012445 boolean one = false;
20022446
20032447 if (group.selection.size() == 1)
20042448 one = true;
20052449
2450
+ Object3D merge = null;
2451
+
20062452 Object3D content = new cGroup();
20072453
20082454 for (int i=0; i<group.selection.size(); i++)
20092455 {
2010
- Object3D sel = new Merge(group.selection.get(i));
2456
+ merge = new Merge(group.selection.get(i));
20112457
20122458 if (one)
2013
- makeSomething(sel, false);
2459
+ makeSomething(merge, false);
20142460 else
2015
- content.addChild(sel);
2461
+ content.addChild(merge);
20162462 }
20172463
20182464 if (!one)
2019
- makeSomething(content, false);
2020
-
2021
- ResetModel();
2022
- refreshContents();
2465
+ makeSomething(content, true);
2466
+ else
2467
+ {
2468
+ ResetModel();
2469
+ Select(merge.GetTreePath(), true, false); // unselect... false);
2470
+ refreshContents();
2471
+ }
20232472 } else
2024
- if (event.getSource() == mergeGeometriesItem)
2473
+ if (source == mergeGeometriesItem)
20252474 {
20262475 boolean one = false;
20272476
....@@ -2051,7 +2500,7 @@
20512500 ResetModel();
20522501 refreshContents();
20532502 } else
2054
- if (event.getSource() == linkverticesItem)
2503
+ if (source == linkverticesItem)
20552504 {
20562505 // if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
20572506 // {
....@@ -2064,39 +2513,48 @@
20642513 // group.selection.get(0).setMasterThis(content); // should be identity
20652514 // refreshContents();
20662515 // }
2067
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2516
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
20682517 {
2069
- Object3D content = GrafreeD.clipboard.get(0);
2518
+ Object3D content = Grafreed.clipboard.get(0);
20702519
20712520 if (content instanceof cGroup && ((cGroup)content).transientlink )
20722521 content = ((cGroup)content).get(0);
20732522
2074
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
2523
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
20752524 for (int i=0; i<group.selection.size(); i++)
20762525 {
2077
- boolean random = CameraPane.RANDOM;
2078
- CameraPane.RANDOM = false; // parse all random nodes
2526
+ boolean random = CameraPane.SWITCH;
2527
+ CameraPane.SWITCH = false; // parse all random nodes
20792528 group.selection.get(i).linkVerticesThis(content);
20802529 // group.selection.get(i).setMasterThis(content); // should be identity
2081
- CameraPane.RANDOM = random;
2530
+ CameraPane.SWITCH = random;
20822531 }
2083
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
2532
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
20842533 refreshContents();
20852534 }
20862535 } else
2087
- if (event.getSource() == resetsupportItem)
2536
+ if (source == resetsupportItem)
20882537 {
20892538 for (int i=0; i<group.selection.size(); i++)
20902539 {
2091
- boolean random = CameraPane.RANDOM;
2092
- CameraPane.RANDOM = false; // parse all random nodes
2540
+ boolean random = CameraPane.SWITCH;
2541
+ CameraPane.SWITCH = false; // parse all random nodes
20932542 group.selection.get(i).linkVerticesThis(null);
2094
- CameraPane.RANDOM = random;
2543
+ CameraPane.SWITCH = random;
20952544 }
20962545
20972546 refreshContents();
20982547 } else
2099
- if (event.getSource() == resetreferencesItem)
2548
+ if (source == relinkverticesItem)
2549
+ {
2550
+ boolean random = CameraPane.SWITCH;
2551
+ CameraPane.SWITCH = false; // parse all random nodes
2552
+ group.selection.RelinkToSupport();
2553
+ CameraPane.SWITCH = random;
2554
+
2555
+ refreshContents();
2556
+ } else
2557
+ if (source == resetreferencesItem)
21002558 {
21012559 for (int i=0; i<group.selection.size(); i++)
21022560 {
....@@ -2105,11 +2563,11 @@
21052563
21062564 refreshContents();
21072565 } else
2108
- if (event.getSource() == setMasterItem)
2566
+ if (source == setMasterItem)
21092567 {
2110
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2568
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
21112569 {
2112
- Object3D content = GrafreeD.clipboard.get(0);
2570
+ Object3D content = Grafreed.clipboard.get(0);
21132571
21142572 if (content instanceof cGroup && ((cGroup)content).transientlink )
21152573 content = ((cGroup)content).get(0);
....@@ -2118,13 +2576,13 @@
21182576 refreshContents();
21192577 }
21202578 } else
2121
- if (event.getSource() == poseMeshItem)
2579
+ if (source == poseMeshItem)
21222580 {
21232581 if (group.selection.size() == 1)
21242582 {
2125
- if (GrafreeD.clipboard.size() == 1)
2583
+ if (Grafreed.clipboard.size() == 1)
21262584 {
2127
- Object3D content = GrafreeD.clipboard.get(0);
2585
+ Object3D content = Grafreed.clipboard.get(0);
21282586
21292587 if (content instanceof cGroup && ((cGroup)content).transientlink )
21302588 content = ((cGroup)content).get(0);
....@@ -2137,19 +2595,19 @@
21372595 }
21382596
21392597 } else
2140
- if (event.getSource() == revertMeshItem)
2598
+ if (source == revertMeshItem)
21412599 {
21422600 RevertMeshes();
21432601 } else
2144
- if (event.getSource() == resetMeshItem)
2602
+ if (source == resetAllItem)
21452603 {
21462604 ResetAll();
21472605 } else
2148
- if (event.getSource() == stepAllItem)
2606
+ if (source == stepAllItem)
21492607 {
21502608 StepAll();
21512609 } else
2152
- if (event.getSource() == clearItem) // || event.getSource() == clearButton)
2610
+ if (source == clearItem) // || event.getSource() == clearButton)
21532611 {
21542612 //int indices[] = jList.getSelectedIndices();
21552613 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2157,42 +2615,46 @@
21572615
21582616 ClearSelection(false);
21592617 } else
2160
- if (event.getSource() == clearAllItem)
2618
+ if (source == clearAllItem)
21612619 {
21622620 ClearSelection(true);
21632621 } else
2164
- if (event.getSource() == grabItem)
2622
+ if (source == grabItem || source == groupButton)
21652623 {
2166
- group(new cGroup(), true);
2624
+ group(new cGroup(), false); // true);
21672625 } else
2168
- if (event.getSource() == frontItem)
2626
+ if (source == hideItem)
2627
+ {
2628
+ group(new HiddenObject());
2629
+ } else
2630
+ if (source == frontItem)
21692631 {
21702632 front();
21712633 } else
2172
- if (event.getSource() == backItem)
2634
+ if (source == backItem)
21732635 {
21742636 back();
21752637 } else
2176
- if (event.getSource() == cameraItem)
2638
+ if (source == cameraItem)
21772639 {
21782640 makeSomething(new Camera());
21792641 } else
2180
- if (event.getSource() == compositeItem)
2642
+ if (source == compositeItem || source == compositeButton)
21812643 {
21822644 group(new Composite());
21832645 } else
2184
- if (event.getSource() == randomItem)
2646
+ if (source == switchItem || source == switchButton)
21852647 {
21862648 RandomNode random = new RandomNode();
21872649 group(random);
21882650 if (random.size() > 0)
2189
- random.name = random.get(0).name + "Rnd";
2651
+ random.name = random.get(0).name + "Switch";
21902652 } else
2191
- if (event.getSource() == physicsItem)
2653
+ if (source == physicsItem)
21922654 {
21932655 group(new PhysicsNode());
21942656 } else
2195
- if (event.getSource() == frameselectorItem)
2657
+ if (source == frameselectorItem)
21962658 {
21972659 for (int i=0; i<group.selection.size(); i++)
21982660 {
....@@ -2204,7 +2666,7 @@
22042666 ResetModel();
22052667 refreshContents();
22062668 } else
2207
- if (event.getSource() == switchGeoItem)
2669
+ if (source == switchGeoItem)
22082670 {
22092671 for (int i=0; i<group.selection.size(); i++)
22102672 {
....@@ -2216,7 +2678,7 @@
22162678 ResetModel();
22172679 refreshContents();
22182680 } else
2219
- if (event.getSource() == switchTransfoItem)
2681
+ if (source == switchTransfoItem)
22202682 {
22212683 for (int i=0; i<group.selection.size(); i++)
22222684 {
....@@ -2228,7 +2690,7 @@
22282690 ResetModel();
22292691 refreshContents();
22302692 } else
2231
- if (event.getSource() == morphItem)
2693
+ if (source == morphItem)
22322694 {
22332695 for (int i=0; i<group.selection.size(); i++)
22342696 {
....@@ -2240,7 +2702,7 @@
22402702 ResetModel();
22412703 refreshContents();
22422704 } else
2243
- if (event.getSource() == scriptNodeItem)
2705
+ if (source == scriptNodeItem)
22442706 {
22452707 boolean atleastone = false;
22462708
....@@ -2279,199 +2741,252 @@
22792741 }
22802742 }
22812743 } else
2282
- if (event.getSource() == linkerItem)
2744
+ if (source == linkerItem)
22832745 {
22842746 group(new cLinker());
22852747 } else
2286
- if (event.getSource() == textureItem)
2748
+ if (source == textureItem || source == textureButton)
22872749 {
22882750 group(new TextureNode());
22892751 } else
2290
- if (event.getSource() == shadowXItem)
2752
+ if (source == billboardItem)
2753
+ {
2754
+ group(new BillboardNode());
2755
+ } else
2756
+ if (source == shadowXItem)
22912757 {
22922758 CastShadow(0);
22932759 } else
2294
- if (event.getSource() == shadowYItem)
2760
+ if (source == shadowYItem)
22952761 {
22962762 CastShadow(1);
22972763 } else
2298
- if (event.getSource() == shadowZItem)
2764
+ if (source == shadowZItem)
22992765 {
23002766 CastShadow(2);
23012767 } else
2302
- if (event.getSource() == ungroupItem)
2768
+ if (source == ungroupItem || source == ungroupButton)
23032769 {
2304
- ungroup();
2770
+ boolean hasRoot = false;
2771
+
2772
+ for (int i=0; i<group.selection.size(); i++)
2773
+ {
2774
+ if (group.selection.get(i) == group)
2775
+ {
2776
+ hasRoot = true;
2777
+ break;
2778
+ }
2779
+ }
2780
+
2781
+ if (!hasRoot)
2782
+ {
2783
+ for (int i=0; i<group.selection.size(); i++)
2784
+ {
2785
+ Ungroup(group.selection.get(i));
2786
+ }
2787
+
2788
+ ClearSelection(false);
2789
+
2790
+ refreshContents();
2791
+ }
23052792 } else
2306
- if (event.getSource() == genUVItem)
2793
+ if (source == genUVItem)
23072794 {
23082795 GenUV();
23092796 } else
2310
- if (event.getSource() == genNormalsCADItem)
2797
+ if (source == genNormalsCADItem)
23112798 {
23122799 GenNormals(true);
23132800 } else
2314
- if (event.getSource() == genNormalsMESHItem)
2801
+ if (source == genNormalsMESHItem)
23152802 {
2316
- GenNormals(true); // TODO
2803
+ GenNormalsMESH();
23172804 } else
2318
- if (event.getSource() == genNormalsORGANItem)
2805
+ if (source == genNormalsORGANItem)
23192806 {
23202807 GenNormals(false);
23212808 } else
2322
- if (event.getSource() == stripifyItem)
2809
+ if (source == genNormalsMINEItem)
2810
+ {
2811
+ GenNormalsMINE();
2812
+ } else
2813
+ if (source == stripifyItem)
23232814 {
23242815 Stripify();
23252816 } else
2326
- if (event.getSource() == unstripifyItem)
2817
+ if (source == unstripifyItem)
23272818 {
23282819 Unstripify();
23292820 } else
2330
- if (event.getSource() == trimItem)
2821
+ if (source == trimItem)
23312822 {
23322823 Trim();
23332824 } else
2334
- if (event.getSource() == untrimItem)
2825
+ if (source == untrimItem)
23352826 {
23362827 Untrim();
23372828 } else
2338
- if (event.getSource() == clearColorsItem)
2829
+ if (source == clearColorsItem)
23392830 {
23402831 ClearColors();
23412832 } else
2342
- if (event.getSource() == clearMaterialsItem)
2833
+ if (source == clearMaterialsItem)
23432834 {
23442835 ClearMaterials();
23452836 } else
2346
- if (event.getSource() == liveleavesItem)
2837
+ if (source == liveleavesItem)
23472838 {
23482839 LiveLeaves(true);
23492840 } else
2350
- if (event.getSource() == unliveleavesItem)
2841
+ if (source == unliveleavesItem)
23512842 {
23522843 LiveLeaves(false);
23532844 } else
2354
- if (event.getSource() == supportleavesItem)
2845
+ if (source == supportleavesItem)
23552846 {
23562847 SupportLeaves(true);
23572848 } else
2358
- if (event.getSource() == unsupportleavesItem)
2849
+ if (source == unsupportleavesItem)
23592850 {
23602851 SupportLeaves(false);
23612852 } else
2362
- if (event.getSource() == hideleavesItem)
2853
+ if (source == hideleavesItem)
23632854 {
23642855 HideLeaves(true);
23652856 } else
2366
- if (event.getSource() == showleavesItem)
2857
+ if (source == showleavesItem)
23672858 {
23682859 HideLeaves(false);
23692860 } else
2370
- if (event.getSource() == markleavesItem)
2861
+ if (source == markleavesItem)
23712862 {
23722863 MarkLeaves(true);
23732864 } else
2374
- if (event.getSource() == unmarkleavesItem)
2865
+ if (source == unmarkleavesItem)
23752866 {
23762867 MarkLeaves(false);
23772868 } else
2378
- if (event.getSource() == flipVItem)
2869
+ if (source == rewindleavesItem)
2870
+ {
2871
+ RewindLeaves(true);
2872
+ } else
2873
+ if (source == unrewindleavesItem)
2874
+ {
2875
+ RewindLeaves(false);
2876
+ } else
2877
+ if (source == randomleavesItem)
2878
+ {
2879
+ RandomLeaves(true);
2880
+ } else
2881
+ if (source == unrandomleavesItem)
2882
+ {
2883
+ RandomLeaves(false);
2884
+ } else
2885
+ if (source == flipVItem)
23792886 {
23802887 FlipV(true);
23812888 } else
2382
- if (event.getSource() == unflipVItem)
2889
+ if (source == unflipVItem)
23832890 {
23842891 FlipV(false);
23852892 } else
2386
- if (event.getSource() == lowTexturesItem)
2893
+ if (source == lowTexturesItem)
23872894 {
23882895 SetTexRes(0);
23892896 } else
2390
- if (event.getSource() == normalTexturesItem)
2897
+ if (source == normalTexturesItem)
23912898 {
23922899 SetTexRes(1);
23932900 } else
2394
- if (event.getSource() == highTexturesItem)
2901
+ if (source == highTexturesItem)
23952902 {
23962903 SetTexRes(2);
23972904 } else
2398
- if (event.getSource() == veryhighTexturesItem)
2905
+ if (source == veryhighTexturesItem)
23992906 {
24002907 SetTexRes(3);
24012908 } else
2402
- if (event.getSource() == maxTexturesItem)
2909
+ if (source == maxTexturesItem)
24032910 {
24042911 SetTexRes(4);
24052912 } else
2406
- if (event.getSource() == panoTexturesItem)
2913
+ if (source == panoTexturesItem)
24072914 {
24082915 SetTexRes(5);
24092916 } else
2410
- if (event.getSource() == reverseNormalsItem)
2917
+ if (source == reverseNormalsItem)
24112918 {
24122919 ReverseNormals();
24132920 } else
2414
- if (event.getSource() == parseverticesItem)
2921
+ if (source == parseverticesItem)
24152922 {
24162923 ParseVertices();
24172924 } else
2418
- if (event.getSource() == textureFieldItem)
2925
+ if (source == textureFieldItem)
24192926 {
24202927 TextureVertices();
24212928 } else
2422
- if (event.getSource() == alignItem)
2929
+ if (source == alignItem)
24232930 {
24242931 Align();
24252932 } else
2426
- if (event.getSource() == mirrorItem)
2933
+ if (source == mirrorItem)
24272934 {
24282935 MirrorPoses();
24292936 } else
2430
- if (event.getSource() == reduceMorphItem)
2937
+ if (source == reduceMorphItem)
24312938 {
24322939 MeshReduction(false);
24332940 } else
2434
- if (event.getSource() == reduce34MorphItem)
2941
+ if (source == reduce34MorphItem)
24352942 {
24362943 MeshReduction(true);
24372944 } else
2438
- if (event.getSource() == reverseTrianglesItem)
2945
+ if (source == reverseTrianglesItem)
24392946 {
24402947 ReverseTriangles();
24412948 } else
2442
- if (event.getSource() == reduceMeshItem)
2949
+ if (source == reduceMeshItem)
24432950 {
24442951 ReduceMesh(false);
24452952 } else
2446
- if (event.getSource() == reduce34MeshItem)
2953
+ if (source == reduce34MeshItem)
24472954 {
24482955 ReduceMesh(true);
24492956 } else
2450
- if (event.getSource() == increaseMeshItem)
2957
+ if (source == increaseMeshItem)
24512958 {
24522959 IncreaseMesh();
24532960 } else
2454
- if (event.getSource() == clipMeshItem)
2961
+ if (source == clipMeshItem)
24552962 {
24562963 ClipMesh();
24572964 } else
2458
- if (event.getSource() == smoothMeshItem)
2965
+ if (source == smoothMeshItem)
24592966 {
24602967 SmoothMesh();
24612968 } else
2462
- if (event.getSource() == transformgeometryItem)
2969
+ if (source == transformGeometryItem)
24632970 {
24642971 TransformGeometry();
24652972 } else
2466
- if (event.getSource() == resetTransformItem)
2973
+ if (source == transformChildrenItem)
2974
+ {
2975
+ TransformChildren();
2976
+ } else
2977
+ if (source == resetTransformItem)
24672978 {
24682979 ResetTransform();
24692980 } else
2470
- if (event.getSource() == resetCentroidItem)
2981
+ if (source == resetCentroidItem)
24712982 {
2472
- ResetCentroid();
2983
+ ResetCentroid(true);
24732984 } else
2474
- if (event.getSource() == resetParentItem)
2985
+ if (source == resetCentroidXZItem)
2986
+ {
2987
+ ResetCentroid(false);
2988
+ } else
2989
+ if (source == resetParentItem)
24752990 {
24762991 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24772992 {
....@@ -2481,7 +2996,7 @@
24812996
24822997 refreshContents();
24832998 } else
2484
- if (event.getSource() == repairParentItem)
2999
+ if (source == repairParentItem)
24853000 {
24863001 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
24873002 {
....@@ -2495,7 +3010,21 @@
24953010
24963011 refreshContents();
24973012 } else
2498
- if (event.getSource() == sortbysizeItem)
3013
+ if (source == repairShadowItem)
3014
+ {
3015
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3016
+ {
3017
+ Object3D obj = (Object3D)e.nextElement();
3018
+ obj.RepairShadow();
3019
+// for (int i=0; i<obj.size(); i++)
3020
+// {
3021
+// obj.get(i).parent = obj;
3022
+// }
3023
+ }
3024
+
3025
+ refreshContents();
3026
+ } else
3027
+ if (source == sortbysizeItem)
24993028 {
25003029 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25013030 {
....@@ -2507,7 +3036,7 @@
25073036 ResetModel();
25083037 refreshContents();
25093038 } else
2510
- if (event.getSource() == sortbynameItem)
3039
+ if (source == sortbynameItem)
25113040 {
25123041 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
25133042 {
....@@ -2519,7 +3048,7 @@
25193048 ResetModel();
25203049 refreshContents();
25213050 } else
2522
- if (event.getSource() == attachPigmentItem)
3051
+ if (source == attachPigmentItem)
25233052 {
25243053 String texture = GetFile("Attach pigment");
25253054 Object3D obj;
....@@ -2531,7 +3060,7 @@
25313060
25323061 refreshContents();
25333062 } else
2534
- if (event.getSource() == detachPigmentItem)
3063
+ if (source == detachPigmentItem)
25353064 {
25363065 Object3D obj;
25373066 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2542,7 +3071,7 @@
25423071
25433072 refreshContents();
25443073 } else
2545
- if (event.getSource() == attachBumpItem)
3074
+ if (source == attachBumpItem)
25463075 {
25473076 String texture = GetFile("Attach bump");
25483077 Object3D obj;
....@@ -2554,7 +3083,7 @@
25543083
25553084 refreshContents();
25563085 } else
2557
- if (event.getSource() == detachBumpItem)
3086
+ if (source == detachBumpItem)
25583087 {
25593088 Object3D obj;
25603089 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2565,7 +3094,7 @@
25653094
25663095 refreshContents();
25673096 } else
2568
- if (event.getSource() == pigmentBumpItem)
3097
+ if (source == pigmentBumpItem)
25693098 {
25703099 Object3D obj;
25713100 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2576,158 +3105,237 @@
25763105
25773106 refreshContents();
25783107 } else
2579
- if (event.getSource() == flashSelectionButton)
3108
+ if (source == flashSelectionButton)
25803109 {
25813110 CameraPane.flash = true;
25823111 refreshContents();
25833112 } else
2584
- if (event.getSource() == oneButton)
3113
+ if (source == oneButton)
25853114 {
25863115 } else
2587
- if (event.getSource() == twoButton)
3116
+ if (source == twoButton)
25883117 {
25893118 radio.layout = twoButton;
3119
+
3120
+ if (CameraPane.FULLSCREEN)
3121
+ fullscreenLayout = radio.layout;
3122
+
25903123 // bug
25913124 //gridPanel.setDividerLocation(1.0);
25923125 //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();
3126
+// bigThree.remove(scenePanel);
3127
+// bigThree.remove(centralPanel);
3128
+// bigThree.remove(XYZPanel);
3129
+// aWindowConstraints.gridx = 0;
3130
+// aWindowConstraints.gridy = 0;
3131
+// aWindowConstraints.gridwidth = 1;
3132
+// // aConstraints.gridheight = 3;
3133
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3134
+// aWindowConstraints.weightx = 0;
3135
+// aWindowConstraints.weighty = 1;
3136
+// //bigThree.add(jtp, aWindowConstraints);
3137
+// aWindowConstraints.weightx = 1;
3138
+// aWindowConstraints.gridwidth = 3;
3139
+// // aConstraints.gridheight = 3;
3140
+// aWindowConstraints.gridx = 1;
3141
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3142
+// bigThree.add(centralPanel, aWindowConstraints);
3143
+// aWindowConstraints.weightx = 0;
3144
+// aWindowConstraints.gridx = 4;
3145
+// aWindowConstraints.gridwidth = 1;
3146
+// // aConstraints.gridheight = 3;
3147
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3148
+// //bigThree.add(XYZPanel, aWindowConstraints);
3149
+// scenePanel.setVisible(false);
3150
+// centralPanel.setVisible(true);
3151
+// XYZPanel.setVisible(false);
3152
+ bigThree.ClearUI();
3153
+ bigThree.add(centralPanel);
3154
+ bigThree.FlushUI();
3155
+
3156
+ cameraView.requestFocusInWindow();
3157
+
3158
+// refreshContents(true);
3159
+//
3160
+// try
3161
+// {
3162
+// java.awt.Robot bot = new java.awt.Robot();
3163
+// int mask = InputEvent.BUTTON1_MASK;
3164
+// bot.mouseMove(100, 100);
3165
+// bot.mousePress(mask);
3166
+// bot.mouseRelease(mask);
3167
+// }
3168
+// catch (Exception e)
3169
+// {
3170
+//
3171
+// }
3172
+
26173173 } else
2618
- if (event.getSource() == threeButton)
3174
+ if (source == threeButton)
26193175 {
26203176 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();
3177
+
3178
+ if (CameraPane.FULLSCREEN)
3179
+ fullscreenLayout = radio.layout;
3180
+
3181
+// bigThree.remove(scenePanel);
3182
+// bigThree.remove(centralPanel);
3183
+// bigThree.remove(XYZPanel);
3184
+// aWindowConstraints.gridx = 0;
3185
+// aWindowConstraints.gridy = 0;
3186
+// aWindowConstraints.gridwidth = 1;
3187
+// // aConstraints.gridheight = 3;
3188
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3189
+// aWindowConstraints.weightx = 0;
3190
+// aWindowConstraints.weighty = 1;
3191
+// //bigThree.add(jtp, aWindowConstraints);
3192
+// aWindowConstraints.weightx = 1;
3193
+// aWindowConstraints.gridwidth = 3;
3194
+// // aConstraints.gridheight = 3;
3195
+// aWindowConstraints.gridx = 1;
3196
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3197
+// bigThree.add(centralPanel, aWindowConstraints);
3198
+// aWindowConstraints.weightx = 0;
3199
+// aWindowConstraints.gridx = 4;
3200
+// aWindowConstraints.gridwidth = 1;
3201
+// // aConstraints.gridheight = 3;
3202
+// aConstraints.fill = GridBagConstraints.VERTICAL;
3203
+// bigThree.add(XYZPanel, aWindowConstraints);
3204
+// bigThree.validate();
3205
+// scenePanel.setVisible(false);
3206
+// centralPanel.setVisible(true);
3207
+// XYZPanel.setVisible(true);
3208
+ bigThree.ClearUI();
3209
+ bigThree.add(centralPanel);
3210
+ bigThree.add(XYZPanel);
3211
+ bigThree.FlushUI();
3212
+
3213
+ cameraView.requestFocusInWindow();
26453214 } else
2646
- if (event.getSource() == fourButton)
3215
+ if (source == fourButton)
26473216 {
26483217 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();
3218
+
3219
+ if (CameraPane.FULLSCREEN)
3220
+ fullscreenLayout = radio.layout;
3221
+
3222
+// bigThree.remove(scenePanel);
3223
+// bigThree.remove(centralPanel);
3224
+// bigThree.remove(XYZPanel);
3225
+// aWindowConstraints.gridx = 0;
3226
+// aWindowConstraints.gridy = 0;
3227
+// aWindowConstraints.gridwidth = 1;
3228
+// // aWindowConstraints.gridheight = 3;
3229
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3230
+// aWindowConstraints.weightx = 1;
3231
+// aWindowConstraints.weighty = 1;
3232
+// bigThree.add(scenePanel, aWindowConstraints);
3233
+// aWindowConstraints.weightx = 1;
3234
+// aWindowConstraints.gridwidth = 3;
3235
+// // aConstraints.gridheight = 3;
3236
+// aWindowConstraints.gridx = 1;
3237
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3238
+// //bigThree.add(cameraPanel, aWindowConstraints);
3239
+// aWindowConstraints.weightx = 0;
3240
+// aWindowConstraints.gridx = 4;
3241
+// aWindowConstraints.gridwidth = 1;
3242
+// // aWindowConstraints.gridheight = 3;
3243
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3244
+// //bigThree.add(XYZPanel, aWindowConstraints);
3245
+// bigThree.validate();
3246
+// scenePanel.setVisible(true);
3247
+// centralPanel.setVisible(false);
3248
+// XYZPanel.setVisible(false);
3249
+ bigThree.ClearUI();
3250
+ bigThree.add(scenePanel);
3251
+ bigThree.FlushUI();
3252
+
3253
+ cameraView.requestFocusInWindow();
26733254 } else
2674
- if (event.getSource() == sixButton)
3255
+ if (source == sixButton)
26753256 {
26763257 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();
3258
+
3259
+ if (CameraPane.FULLSCREEN)
3260
+ fullscreenLayout = radio.layout;
3261
+
3262
+// bigThree.remove(scenePanel);
3263
+// bigThree.remove(centralPanel);
3264
+// bigThree.remove(XYZPanel);
3265
+// aWindowConstraints.gridx = 0;
3266
+// aWindowConstraints.gridy = 0;
3267
+// aWindowConstraints.gridwidth = 1;
3268
+// // aConstraints.gridheight = 3;
3269
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3270
+// aWindowConstraints.weightx = 0;
3271
+// aWindowConstraints.weighty = 1;
3272
+// bigThree.add(scenePanel, aWindowConstraints);
3273
+// aWindowConstraints.weightx = 1;
3274
+// aWindowConstraints.gridwidth = 3;
3275
+// // aWindowConstraints.gridheight = 3;
3276
+// aWindowConstraints.gridx = 1;
3277
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3278
+// bigThree.add(centralPanel, aWindowConstraints);
3279
+// aWindowConstraints.weightx = 0;
3280
+// aWindowConstraints.gridx = 4;
3281
+// aWindowConstraints.gridwidth = 1;
3282
+// // aWindowConstraints.gridheight = 3;
3283
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3284
+// //bigThree.add(XYZPanel, aConstraints);
3285
+// bigThree.validate();
3286
+// scenePanel.setVisible(true);
3287
+// centralPanel.setVisible(true);
3288
+// XYZPanel.setVisible(false);
3289
+ bigThree.ClearUI();
3290
+ bigThree.add(scenePanel);
3291
+ bigThree.add(centralPanel);
3292
+ bigThree.FlushUI();
3293
+
3294
+ cameraView.requestFocusInWindow();
27013295 } else
2702
- if (event.getSource() == sevenButton)
3296
+ if (source == sevenButton)
27033297 {
27043298 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();
3299
+
3300
+ if (CameraPane.FULLSCREEN)
3301
+ fullscreenLayout = radio.layout;
3302
+
3303
+// bigThree.remove(scenePanel);
3304
+// bigThree.remove(centralPanel);
3305
+// bigThree.remove(XYZPanel);
3306
+// aWindowConstraints.gridx = 0;
3307
+// aWindowConstraints.gridy = 0;
3308
+// aWindowConstraints.gridwidth = 1;
3309
+// // aWindowConstraints.gridheight = 3;
3310
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3311
+// aWindowConstraints.weightx = 0;
3312
+// aWindowConstraints.weighty = 1;
3313
+// bigThree.add(scenePanel, aWindowConstraints);
3314
+// aWindowConstraints.weightx = 1;
3315
+// aWindowConstraints.gridwidth = 3;
3316
+// // aWindowConstraints.gridheight = 3;
3317
+// aWindowConstraints.gridx = 1;
3318
+// aWindowConstraints.fill = GridBagConstraints.BOTH;
3319
+// bigThree.add(centralPanel, aWindowConstraints);
3320
+// aWindowConstraints.weightx = 0;
3321
+// aWindowConstraints.gridx = 4;
3322
+// aWindowConstraints.gridwidth = 1;
3323
+// // aConstraints.gridheight = 3;
3324
+// aWindowConstraints.fill = GridBagConstraints.VERTICAL;
3325
+// bigThree.add(XYZPanel, aWindowConstraints);
3326
+// bigThree.validate();
3327
+// scenePanel.setVisible(true);
3328
+// centralPanel.setVisible(true);
3329
+// XYZPanel.setVisible(true);
3330
+ bigThree.ClearUI();
3331
+ bigThree.add(scenePanel);
3332
+ bigThree.add(centralPanel);
3333
+ bigThree.add(XYZPanel);
3334
+ bigThree.FlushUI();
3335
+
3336
+ cameraView.requestFocusInWindow();
27293337 } else
2730
- if (event.getSource() == rootButton)
3338
+ if (source == rootButton)
27313339 {
27323340 Object3D obj;
27333341 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -2737,66 +3345,84 @@
27373345 EditObject(obj);
27383346 }
27393347
3348
+ cameraView.requestFocusInWindow();
27403349 refreshContents(true);
27413350 } else
2742
- if (event.getSource() == closeButton)
3351
+ if (source == closeButton)
27433352 {
27443353 //System.out.println("CLOSE: " + buttonGroup.getSelection());
27453354 cRadio ab;
27463355 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
27473356 {
27483357 ab = (cRadio)e.nextElement();
2749
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3358
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
27503359 {
3360
+ // Patch to avoid bug with transparency.
3361
+ if (!ab.hadMaterial)
3362
+ {
3363
+ ab.object.material = null;
3364
+ }
3365
+
27513366 buttonGroup.remove(ab);
27523367 radioPanel.remove(ab);
27533368
2754
- ab.GetObject().editWindow = null;
3369
+ //ab.GetObject().editWindow = null;
3370
+ ab.GetObject().manipWindow = null;
27553371 // ab.GetObject().objectUI = null; // ?????????
27563372
27573373 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
27583374 break;
27593375 }
27603376 }
3377
+
3378
+ cameraView.requestFocusInWindow();
27613379 refreshContents(true);
27623380 } else
2763
- if (event.getSource() == editItem || event.getSource() == editButton)
3381
+ if (source == editItem || source == editButton)
27643382 {
3383
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3384
+ {
3385
+ Object3D child = (Object3D)e.nextElement();
3386
+ child.pinned = true;
3387
+ }
3388
+
27653389 EditSelection(false);
27663390 } else
2767
- if (event.getSource() == uneditButton)
3391
+ if (source == uneditButton)
27683392 {
27693393 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27703394 {
27713395 Object3D child = (Object3D)e.nextElement();
27723396 if(child.editWindow != null)
27733397 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3398
+ child.pinned = false;
27743399 child.CloseUI();
27753400 listUI.remove(child);
27763401
2777
- child.editWindow = null; // ???????????
3402
+ //child.editWindow = null; // ???????????
27783403 }
2779
- objEditor.ctrlPanel.revalidate();
3404
+ objEditor.ctrlPanel.FlushUI();
27803405 //objEditor.jTree.clearSelection();
27813406 //objEditor.ResetSliders();
27823407 refreshContents(true);
27833408 } else
2784
- if (event.getSource() == clearPanelButton)
3409
+ if (source == clearPanelButton)
27853410 {
27863411 assert(copy == group);
27873412 //copy.ClearUI();
27883413 for (Object3D obj : listUI)
27893414 {
3415
+ obj.pinned = false;
27903416 obj.CloseUI();
27913417 }
27923418 listUI.clear();
27933419 refreshContents(true);
27943420 } else
2795
- if (event.getSource() == allParamsButton)
3421
+ if (source == allParamsButton)
27963422 {
27973423 assert(copy == group);
27983424
2799
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3425
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
28003426
28013427 for (Object3D obj : listUI)
28023428 {
....@@ -2813,19 +3439,19 @@
28133439
28143440 refreshContents(true);
28153441 } else
2816
- if (event.getSource() == unselectButton)
3442
+ if (source == unselectButton)
28173443 {
28183444 objEditor.jTree.clearSelection();
28193445 // ?? oct 2012 GrafreeD.clipboard.clear();
28203446 objEditor.ResetSliders();
28213447 refreshContents(true);
28223448 } else
2823
- if(event.getSource() instanceof cRadio)
3449
+ if(source instanceof cRadio)
28243450 {
28253451 group.parent = keepparent;
28263452 group.attributes = 0;
28273453 //group.editWindow = null;
2828
- /*cRadio*/ radio = (cRadio)event.getSource();
3454
+ /*cRadio*/ radio = (cRadio)source;
28293455 Object3D obj = radio.GetObject();
28303456 System.out.println("Edit " + obj);
28313457 if (true) // obj instanceof Composite) // obj.parent == null) // obj instanceof Composite)
....@@ -2845,7 +3471,7 @@
28453471 }
28463472
28473473 copy = group;
2848
- //CameraPane.theRenderer.object = group;
3474
+ //Globals.theRenderer.object = group;
28493475 if(!useclient)
28503476 {
28513477 cameraView.renderCamera = radio.camera;
....@@ -2854,25 +3480,50 @@
28543480 cameraView.cameras[cameraView.cameracount] = radio.camera;
28553481 cameraView.targetLookAt.set(radio.camera.lookAt);
28563482 cameraView.object = group;
2857
- cameraView.lighttouched = true;
3483
+ //cameraView.lighttouched = true;
3484
+ Globals.lighttouched = true;
28583485 topView.object = group;
28593486 frontView.object = group;
28603487 sideView.object = group;
28613488 }
2862
- group.editWindow = this;
3489
+
3490
+// fix "+" issue
3491
+ //group.editWindow = this;
3492
+ group.manipWindow = this;
3493
+
28633494 /*
28643495 currentLayout = radio.layout;
28653496 if (currentLayout == null)
28663497 currentLayout = sevenButton;
28673498 */
28683499 radio.layout.doClick();
3500
+
3501
+ ClearUnpinned();
3502
+ SetPinStates(group.selection.size() > 0);
3503
+ if (group.selection.size() == 1)
3504
+ EditSelection(false);
28693505 keepparent = group.parent;
28703506 // PARENT = NULL or not???
28713507 //group.parent = null; // ROOT
28723508 //group.attributes = -1;
28733509 ResetModel();
3510
+
3511
+ cameraView.requestFocusInWindow();
28743512 refreshContents(true);
2875
- }
3513
+ } else if (event.getSource() == editCameraItem)
3514
+ {
3515
+ cameraView.ProtectCamera();
3516
+ cameraView.repaint();
3517
+ return;
3518
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3519
+ {
3520
+ cameraView.RevertCamera();
3521
+ cameraView.repaint();
3522
+ return;
3523
+ // } else if (event.getSource() == textureButton)
3524
+ // {
3525
+ // return; // true;
3526
+ }
28763527 else
28773528 {
28783529 //return super.action(event, arg);
....@@ -2881,7 +3532,6 @@
28813532 }
28823533
28833534 boolean useclient = false;
2884
- cRadio radio;
28853535
28863536 void ToggleRoot()
28873537 {
....@@ -2890,7 +3540,7 @@
28903540 if (useclient)
28913541 {
28923542 cameraView.object = client;
2893
- cameraView.lighttouched = true;
3543
+ Globals.lighttouched = true;
28943544 //topView.object = client;
28953545 //frontView.object = client;
28963546 //sideView.object = client;
....@@ -2898,7 +3548,7 @@
28983548 else
28993549 {
29003550 cameraView.object = group;
2901
- cameraView.lighttouched = true;
3551
+ Globals.lighttouched = true;
29023552 //topView.object = group;
29033553 //frontView.object = group;
29043554 //sideView.object = group;
....@@ -2933,6 +3583,28 @@
29333583 refreshContents();
29343584 }
29353585
3586
+ void TransformChildren()
3587
+ {
3588
+ Object3D obj;
3589
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3590
+ {
3591
+ obj = (Object3D)e.nextElement();
3592
+ obj.KeepTextureMatrices();
3593
+ obj.TransformChildren();
3594
+ obj.RestoreTextureMatrices();
3595
+
3596
+// if (obj.parent == null)
3597
+// {
3598
+// System.out.println("NULL PARENT!");
3599
+// new Exception().printStackTrace();
3600
+// }
3601
+// else
3602
+// TouchTransform(obj);
3603
+// //obj.parent.Touch();
3604
+ }
3605
+
3606
+ refreshContents();
3607
+ }
29363608
29373609 void ResetTransform()
29383610 {
....@@ -3045,7 +3717,7 @@
30453717 refreshContents();
30463718 }
30473719
3048
- void ResetCentroid()
3720
+ void ResetCentroid(boolean full)
30493721 {
30503722 Object3D obj;
30513723 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3060,12 +3732,16 @@
30603732 LA.matIdentity(Object3D.mat);
30613733 obj.getBounds(minima, maxima, false);
30623734 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3063
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3735
+ if (full)
3736
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
30643737 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
30653738 obj.TransformMesh(Object3D.mat);
3739
+
30663740 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3067
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3741
+ if (full)
3742
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
30683743 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3744
+
30693745 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
30703746 //Object3D.mat[3][0] = -Object3D.mat[3][0];
30713747 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3094,7 +3770,8 @@
30943770
30953771 int size = obj.MemorySize();
30963772
3097
- System.err.println((size/1024) + " KB is the size of " + obj);
3773
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3774
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
30983775 }
30993776 }
31003777 catch (Exception e)
....@@ -3131,9 +3808,9 @@
31313808 obj = (Object3D)e.nextElement();
31323809
31333810 System.out.println("Object is: " + obj);
3134
- GrafreeD.AnalyzeObject(obj);
3811
+ Grafreed.AnalyzeObject(obj);
31353812 System.out.println("Boundary rep: " + obj.bRep);
3136
- GrafreeD.AnalyzeObject(obj.bRep);
3813
+ Grafreed.AnalyzeObject(obj.bRep);
31373814
31383815 // System.err.println((size/1024) + " KB is the size of " + obj);
31393816 }
....@@ -3175,6 +3852,20 @@
31753852 void GenNormals(boolean crease)
31763853 {
31773854 group.GenNormalsS(crease);
3855
+
3856
+ refreshContents();
3857
+ }
3858
+
3859
+ void GenNormalsMESH()
3860
+ {
3861
+ group.GenNormalsMeshS();
3862
+
3863
+ refreshContents();
3864
+ }
3865
+
3866
+ void GenNormalsMINE()
3867
+ {
3868
+ group.selection.GenNormalsMINE();
31783869
31793870 refreshContents();
31803871 }
....@@ -3340,8 +4031,8 @@
33404031
33414032 void ParseVertices()
33424033 {
3343
- boolean epsequal = GrafreeD.epsequal;
3344
- GrafreeD.epsequal = true;
4034
+ boolean epsequal = Grafreed.epsequal;
4035
+ Grafreed.epsequal = true;
33454036
33464037 for (int i=0; i<group.selection.size(); i++)
33474038 {
....@@ -3366,7 +4057,7 @@
33664057 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
33674058 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
33684059
3369
- g.add(GrafreeD.clipboard);
4060
+ g.add(Grafreed.clipboard);
33704061
33714062 buffer.add(g);
33724063 }
....@@ -3381,7 +4072,7 @@
33814072 makeSomething(buffer, i==group.selection.size()-1);
33824073 }
33834074
3384
- GrafreeD.epsequal = epsequal;
4075
+ Grafreed.epsequal = epsequal;
33854076
33864077 refreshContents();
33874078 }
....@@ -3399,7 +4090,16 @@
33994090 String pigment = Object3D.GetPigment(tex);
34004091 //String bump = Object3D.GetBump(tex);
34014092
3402
- com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres);
4093
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4094
+
4095
+ try
4096
+ {
4097
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4098
+ }
4099
+ catch (Exception e)
4100
+ {
4101
+ System.err.println("FAIL: " + node);
4102
+ }
34034103
34044104 double s = v.s;
34054105
....@@ -3447,12 +4147,26 @@
34474147
34484148 void Align()
34494149 {
4150
+ if (group.selection.size() == 0)
4151
+ return;
4152
+
4153
+ cVector bbmin = new cVector();
4154
+ cVector bbmax = new cVector();
4155
+
4156
+ group.selection.get(0).getBounds(bbmin, bbmax, true);
4157
+
4158
+ double dx = bbmax.x - bbmin.x;
4159
+ double dy = bbmax.y - bbmin.y;
4160
+ double dz = bbmax.z - bbmin.z;
4161
+
4162
+ double scale = Math.sqrt(dx*dx + dy*dy + dz*dz);
4163
+
34504164 for (int i=0; i<group.selection.size(); i++)
34514165 {
34524166 Object3D obj = group.selection.get(i);
34534167
3454
- LA.matTranslate(obj.toParent, i/2f, 0, 0);
3455
- LA.matTranslateInv(obj.fromParent, -i/2f, 0, 0);
4168
+ LA.matTranslate(obj.toParent, i * scale, 0, 0);
4169
+ LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0);
34564170 }
34574171
34584172 refreshContents();
....@@ -3473,11 +4187,11 @@
34734187
34744188 SwitchNode sn = new SwitchNode(poses, Object3D.GEOMETRY);
34754189
3476
- boolean random = CameraPane.RANDOM;
3477
- CameraPane.RANDOM = false; // parse all random nodes
4190
+ boolean random = CameraPane.SWITCH;
4191
+ CameraPane.SWITCH = false; // parse all random nodes
34784192 lowres.linkVerticesThis(null);
34794193 lowres.linkVerticesThis(sn);
3480
- CameraPane.RANDOM = random;
4194
+ CameraPane.SWITCH = random;
34814195
34824196 System.err.flush();
34834197
....@@ -3517,7 +4231,7 @@
35174231 return;
35184232
35194233 Object3D poses = group.selection.get(0);
3520
- Object3D ref = GrafreeD.clipboard.get(0);
4234
+ Object3D ref = Grafreed.clipboard.get(0);
35214235
35224236 Object3D newgroup = new Object3D("Po:" + poses.name);
35234237
....@@ -3686,7 +4400,7 @@
36864400 group.selection.RelinkToSupport(); // july 2014
36874401 System.out.println("DONE.");
36884402 refreshContents();
3689
- CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
4403
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));
36904404 }
36914405
36924406 void ReduceMesh(boolean reduction34)
....@@ -3711,9 +4425,9 @@
37114425
37124426 void ClipMesh()
37134427 {
3714
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4428
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
37154429 {
3716
- Object3D content = GrafreeD.clipboard.get(0);
4430
+ Object3D content = Grafreed.clipboard.get(0);
37174431
37184432 if (content instanceof cGroup && ((cGroup)content).transientlink )
37194433 content = ((cGroup)content).get(0);
....@@ -3722,7 +4436,7 @@
37224436 // {
37234437 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
37244438 // }
3725
- group.selection.ClipMesh(GrafreeD.clipboard);
4439
+ group.selection.ClipMesh(Grafreed.clipboard);
37264440 }
37274441 // group.selection.ClipMesh(GrafreeD.clipboard);
37284442 System.out.println("DONE.");
....@@ -3769,6 +4483,18 @@
37694483 void MarkLeaves(boolean hide)
37704484 {
37714485 group.selection.MarkLeaves(hide);
4486
+ refreshContents();
4487
+ }
4488
+
4489
+ void RewindLeaves(boolean hide)
4490
+ {
4491
+ group.selection.RewindLeaves(hide);
4492
+ refreshContents();
4493
+ }
4494
+
4495
+ void RandomLeaves(boolean hide)
4496
+ {
4497
+ group.selection.RandomLeaves(hide);
37724498 refreshContents();
37734499 }
37744500
....@@ -3843,10 +4569,6 @@
38434569 // }
38444570 // }
38454571
3846
- static boolean allparams = true;
3847
-
3848
- static Vector<Object3D> listUI = new Vector<Object3D>();
3849
-
38504572 void EditSelection(boolean newWindow)
38514573 {
38524574 // aConstraints.gridy = 0;
....@@ -3854,10 +4576,10 @@
38544576 {
38554577 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
38564578 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
3857
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4579
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
38584580
38594581 Object3D elem = (Object3D)group.selection.elementAt(i);
3860
- if(elem != group)
4582
+ if(elem != group || !newWindow)
38614583 {
38624584 // if (!(elem instanceof Composite))
38634585 // newWindow = false;
....@@ -3939,7 +4661,8 @@
39394661 //new Exception().printStackTrace();
39404662
39414663 freezemodel = true;
3942
-
4664
+ ClearUnpinned();
4665
+
39434666 /**/
39444667 //switch (event.id)
39454668 {
....@@ -3947,7 +4670,6 @@
39474670 //case 702: // Event.LIST_DESELECT
39484671 group.deselectAll();
39494672 TreePath tps[] = objEditor.jTree.getSelectionPaths();
3950
- objEditor.ClearInfo(); // .GetMaterial());
39514673 if (tps != null)
39524674 {
39534675 for (int i=0; i < tps.length; i++)
....@@ -3956,33 +4678,39 @@
39564678
39574679 //if (child.parent != null)
39584680 //child.parent.addSelectee(child);
4681
+ objEditor.SetMaterial(child);
39594682 group.addSelectee(child);
3960
- objEditor.SetMaterial(child); // .GetMaterial());
3961
- objEditor.AddInfo(child, this, true); // .GetMaterial());
3962
- System.err.println("info : " + child.GetPath());
39634683 }
39644684 }
3965
- else
3966
- {
3967
- objEditor.SetMaterial(group); // .GetMaterial());
3968
- objEditor.AddInfo(group, this, true); // .GetMaterial());
3969
- System.err.println("info : " + group.GetPath());
3970
- }
4685
+// else
4686
+// {
4687
+// objEditor.SetMaterial(group); // .GetMaterial());
4688
+// objEditor.AddInfo(group, this, true); // .GetMaterial());
4689
+// System.err.println("info : " + group.GetPath());
4690
+// }
39714691
3972
- objEditor.SetText(); // jan 2014
3973
-
3974
- if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4692
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
39754693 CameraPane.flash = true;
39764694
3977
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4695
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
39784696 // a camera
39794697 {
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;
4698
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
4699
+ {
4700
+ CameraPane.camerachangeframe = 0; // don't refuse it
4701
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4702
+ }
4703
+ // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
4704
+ // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
39844705 }
39854706
4707
+ if (tps != null && tps.length == 1)
4708
+ {
4709
+ EditSelection(false);
4710
+ }
4711
+
4712
+ SetPinStates(tps != null && tps.length > 0);
4713
+
39864714 refreshContents();
39874715 //return true;
39884716 }
....@@ -3991,6 +4719,35 @@
39914719
39924720 freezemodel = false;
39934721 }
4722
+
4723
+ void SetPinStates(boolean enabled)
4724
+ {
4725
+ editButton.setEnabled(enabled);
4726
+ uneditButton.setEnabled(enabled);
4727
+ unselectButton.setEnabled(enabled);
4728
+ flashSelectionButton.setEnabled(enabled);
4729
+ }
4730
+
4731
+ void refreshContents(boolean cp)
4732
+ {
4733
+ if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
4734
+ if (!Globals.MOUSEDRAGGED) // && !Globals.TIMERRUNNING)
4735
+ {
4736
+ objEditor.ClearInfo(); // .GetMaterial());
4737
+
4738
+ for (int i=0; i < group.selection.Size(); i++)
4739
+ {
4740
+ Object3D child = (Object3D) group.selection.get(i);
4741
+
4742
+ objEditor.AddInfo(child, this, true);
4743
+ System.err.println("info : " + child.GetPath());
4744
+ }
4745
+
4746
+ objEditor.SetText(); // jan 2014
4747
+ }
4748
+
4749
+ super.refreshContents(cp);
4750
+ }
39944751
39954752 void linkSomething(Object3D thing)
39964753 {
....@@ -4062,16 +4819,19 @@
40624819 {
40634820 if (group.selection.isEmpty())
40644821 return;
4065
- GrafreeD.clipboardIsTempGroup = false;
4822
+
4823
+ Grafreed.clipboardIsTempGroup = false;
40664824 Composite tGroup = null;
40674825 if (group.selection.size() > 0) // 1)
40684826 {
40694827 tGroup = new cGroup();
4070
- GrafreeD.clipboardIsTempGroup = true;
4828
+ Grafreed.clipboardIsTempGroup = true;
40714829 }
40724830
40734831 if (cut)
40744832 {
4833
+ if (Globals.SAVEONMAKE)
4834
+ Save();
40754835 //int indices[] = jList.getSelectedIndices();
40764836 //for (int i = indices.length - 1; i >= 0; i--)
40774837 //jList.remove(indices[i]);
....@@ -4107,16 +4867,16 @@
41074867 //System.out.println("cut " + child);
41084868 //System.out.println("parent = " + child.parent);
41094869 // tmp.addChild(child);
4110
- if (GrafreeD.clipboardIsTempGroup)
4870
+ if (Grafreed.clipboardIsTempGroup)
41114871 tGroup.add/*Child*/(tmp);
41124872 else
4113
- GrafreeD.clipboard = tmp;
4873
+ Grafreed.clipboard = tmp;
41144874 }
41154875 else
4116
- if (GrafreeD.clipboardIsTempGroup)
4876
+ if (Grafreed.clipboardIsTempGroup)
41174877 tGroup.add/*Child*/(child);
41184878 else
4119
- GrafreeD.clipboard = child;
4879
+ Grafreed.clipboard = child;
41204880 }
41214881
41224882 //ResetModel();
....@@ -4148,21 +4908,23 @@
41484908 //System.out.println("cut " + elem);
41494909 //System.out.println("parent = " + elem.parent);
41504910 // tmp.addChild(elem);
4151
- if (GrafreeD.clipboardIsTempGroup)
4911
+ if (Grafreed.clipboardIsTempGroup)
41524912 tGroup.add/*Child*/(tmp);
41534913 else
4154
- GrafreeD.clipboard = tmp;
4914
+ Grafreed.clipboard = tmp;
41554915 }
41564916 else
4157
- if (GrafreeD.clipboardIsTempGroup)
4917
+ if (Grafreed.clipboardIsTempGroup)
41584918 tGroup.add/*Child*/(child);
41594919 else
4160
- GrafreeD.clipboard = child;
4920
+ Grafreed.clipboard = child;
41614921 }
41624922
41634923 }
4164
- if (GrafreeD.clipboardIsTempGroup)
4165
- GrafreeD.clipboard = tGroup;
4924
+
4925
+ if (Grafreed.clipboardIsTempGroup)
4926
+ Grafreed.clipboard = tGroup;
4927
+
41664928 if (cut)
41674929 {
41684930 ResetModel();
....@@ -4176,7 +4938,7 @@
41764938 // return;
41774939 boolean first = true;
41784940
4179
- if (GrafreeD.clipboardIsTempGroup)
4941
+ if (Grafreed.clipboardIsTempGroup)
41804942 {
41814943 Composite temp;
41824944
....@@ -4187,7 +4949,7 @@
41874949 temp = (Composite)Applet3D.clipboard.deepCopy();
41884950 */
41894951 Object3D elem;
4190
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4952
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
41914953 {
41924954 Object3D child = (Object3D)e.nextElement();
41934955
....@@ -4221,21 +4983,21 @@
42214983 //Object3D cb = Applet3D.clipboard;
42224984 //temp.addChild(cb);
42234985 //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());
4986
+ assert(Grafreed.clipboard.parent == null);
4987
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4988
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4989
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4990
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
42294991 else
4230
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4231
- GrafreeD.clipboard.get(0).parent = keepparent;
4992
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4993
+ Grafreed.clipboard.get(0).parent = keepparent;
42324994 }
42334995
42344996 ResetModel();
42354997 refreshContents();
42364998 }
42374999
4238
- void pasteInto(boolean copyit)
5000
+ void pasteInto(boolean copyit, boolean clone)
42395001 {
42405002 // if (GrafreeD.clipboard == null)
42415003 // return;
....@@ -4264,15 +5026,22 @@
42645026 if (copyit)
42655027 {
42665028 // paste(false);
4267
- CloneClipboard(false); // sept 2014
5029
+ if (clone)
5030
+ {
5031
+ CloneClipboard(false); // sept 2014
5032
+ }
5033
+ else
5034
+ {
5035
+ paste(false);
5036
+ }
42685037 }
42695038 else
42705039 {
42715040 boolean first = true;
42725041
4273
- if (GrafreeD.clipboardIsTempGroup)
5042
+ if (Grafreed.clipboardIsTempGroup)
42745043 {
4275
- Composite temp = (Composite)GrafreeD.clipboard;
5044
+ Composite temp = (Composite)Grafreed.clipboard;
42765045 Object3D copy;
42775046 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
42785047 {
....@@ -4282,7 +5051,7 @@
42825051 }
42835052 } else
42845053 {
4285
- linkSomething(GrafreeD.clipboard); //.get(0));
5054
+ linkSomething(Grafreed.clipboard); //.get(0));
42865055 }
42875056 }
42885057 }
....@@ -4474,6 +5243,26 @@
44745243 makeSomething(csg);
44755244 }
44765245
5246
+ void Ungroup(Object3D g)
5247
+ {
5248
+ if (g instanceof HiddenObject)
5249
+ {
5250
+ HiddenObject h = (HiddenObject) g;
5251
+
5252
+ for (int i=0; i<h.ActualSize(); i++)
5253
+ {
5254
+ objEditor.makeSomething(h.get(i), false);
5255
+ }
5256
+ }
5257
+ else
5258
+ {
5259
+ for (int i=0; i<g.Size(); i++)
5260
+ {
5261
+ objEditor.makeSomething(g.get(i), false);
5262
+ }
5263
+ }
5264
+ }
5265
+
44775266 void ungroup()
44785267 {
44795268 /*
....@@ -4667,21 +5456,6 @@
46675456 }
46685457 */
46695458
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
-
46855459 /*
46865460 public void Callback(Object obj)
46875461 {
....@@ -4705,26 +5479,9 @@
47055479 }
47065480 */
47075481
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
-
47255482 String GetFile(String dialogName)
47265483 {
4727
- if (GrafreeD.standAlone)
5484
+ if (Grafreed.standAlone)
47285485 {
47295486 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
47305487 browser.show();
....@@ -4788,10 +5545,33 @@
47885545 cButton flashSelectionButton;
47895546 cButton editButton;
47905547 cButton uneditButton;
5548
+ JCheckBox allParamsButton;
47915549 cButton clearpanelButton;
4792
- cButton allParamsButton;
47935550 cButton unselectButton;
47945551
5552
+ cButton restoreCameraButton;
5553
+
5554
+ cButton saveButton;
5555
+ cButton oneStepButton;
5556
+
5557
+ cButton groupButton;
5558
+ cButton ungroupButton;
5559
+ cButton compositeButton;
5560
+ cButton switchButton;
5561
+ cButton loopButton;
5562
+ cButton textureButton;
5563
+
5564
+ cButton gridButton;
5565
+ cButton boxButton;
5566
+ cButton sphereButton;
5567
+ cButton coneButton;
5568
+ cButton torusButton;
5569
+ cButton superButton;
5570
+ cButton kleinButton;
5571
+ cButton particlesButton;
5572
+ cButton overlayButton;
5573
+ cButton lightButton;
5574
+
47955575 cButton screenfitButton;
47965576 cButton screenfitpointButton;
47975577 cButton snapobjectButton;
....@@ -4803,14 +5583,6 @@
48035583
48045584 cButton setsupportButton;
48055585
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
-
48145586 //
48155587 //Composite
48165588 Object3D // to do !!
....@@ -4820,9 +5592,11 @@
48205592 //JTree jTree;
48215593 private MenuItem lookAtItem;
48225594 private MenuItem lookFromItem;
4823
- private MenuItem switchItem;
5595
+ private MenuItem switchViewItem;
48245596 private MenuItem cutItem;
4825
- private MenuItem duplicateItem;
5597
+ private MenuItem undoItem;
5598
+ private MenuItem redoItem;
5599
+ private JMenuItem duplicateItem;
48265600 private MenuItem cloneItem;
48275601 private MenuItem cloneSupportItem;
48285602 private MenuItem overwriteGeoItem;
....@@ -4833,8 +5607,9 @@
48335607 private MenuItem resetsupportItem;
48345608 private MenuItem resetreferencesItem;
48355609 private MenuItem linkverticesItem;
5610
+ private MenuItem relinkverticesItem;
48365611 private MenuItem setMasterItem;
4837
- private MenuItem resetMeshItem;
5612
+ private MenuItem resetAllItem;
48385613 private MenuItem stepAllItem;
48395614 private MenuItem revertMeshItem;
48405615 private MenuItem poseMeshItem;
....@@ -4845,6 +5620,7 @@
48455620 private MenuItem mergeGeometriesItem;
48465621 private MenuItem copyItem;
48475622 private MenuItem pasteItem;
5623
+ private MenuItem pasteIntoItem;
48485624 private MenuItem pasteLinkItem;
48495625 private MenuItem pasteCloneItem;
48505626 private MenuItem pasteExpandItem;
....@@ -4854,6 +5630,7 @@
48545630 private MenuItem genNormalsMESHItem;
48555631 private MenuItem genNormalsCADItem;
48565632 private MenuItem genNormalsORGANItem;
5633
+ private MenuItem genNormalsMINEItem;
48575634 private MenuItem stripifyItem;
48585635 private MenuItem unstripifyItem;
48595636 private MenuItem trimItem;
....@@ -4882,6 +5659,10 @@
48825659 private MenuItem showleavesItem;
48835660 private MenuItem markleavesItem;
48845661 private MenuItem unmarkleavesItem;
5662
+ private MenuItem rewindleavesItem;
5663
+ private MenuItem unrewindleavesItem;
5664
+ private MenuItem randomleavesItem;
5665
+ private MenuItem unrandomleavesItem;
48855666
48865667 private MenuItem flipVItem;
48875668 private MenuItem unflipVItem;
....@@ -4893,14 +5674,17 @@
48935674 private MenuItem panoTexturesItem;
48945675
48955676 private MenuItem resetCentroidItem;
4896
- private MenuItem transformgeometryItem;
5677
+ private MenuItem resetCentroidXZItem;
48975678 private MenuItem resetTransformItem;
5679
+ private MenuItem transformGeometryItem;
5680
+ private MenuItem transformChildrenItem;
5681
+ private MenuItem hideItem;
48985682 private MenuItem grabItem;
48995683 private MenuItem backItem;
49005684 private MenuItem frontItem;
49015685 private MenuItem cameraItem;
49025686 private MenuItem compositeItem;
4903
- private MenuItem randomItem;
5687
+ private MenuItem switchItem;
49045688 private MenuItem physicsItem;
49055689 private MenuItem frameselectorItem;
49065690 private MenuItem scriptNodeItem;
....@@ -4915,6 +5699,7 @@
49155699
49165700 private MenuItem resetParentItem;
49175701 private MenuItem repairParentItem;
5702
+ private MenuItem repairShadowItem;
49185703 private MenuItem sortbysizeItem;
49195704 private MenuItem sortbynameItem;
49205705
....@@ -4935,10 +5720,11 @@
49355720 private MenuItem coneItem;
49365721 private MenuItem torusItem;
49375722 private MenuItem superItem;
5723
+ private MenuItem kleinItem;
49385724 private MenuItem blobItem;
49395725 private MenuItem latheItem;
49405726 private MenuItem bezierItem;
4941
- private MenuItem checkerItem;
5727
+ private MenuItem overlayItem;
49425728 private MenuItem meshItem;
49435729 // private MenuItem meshGroupItem;
49445730 private MenuItem springItem;
....@@ -4947,6 +5733,7 @@
49475733 private MenuItem csgItem;
49485734 private MenuItem templateItem;
49495735 private MenuItem textureItem;
5736
+ private MenuItem billboardItem;
49505737 private MenuItem shadowXItem;
49515738 private MenuItem shadowYItem;
49525739 private MenuItem shadowZItem;
....@@ -4959,11 +5746,6 @@
49595746 private MenuItem doubleItem;
49605747 private MenuItem tripleItem;
49615748
4962
- private MenuItem importGFDItem;
4963
- private MenuItem importVRMLX3DItem;
4964
- private MenuItem import3DSItem;
4965
- private MenuItem importOBJItem;
4966
-
49675749 private MenuItem computeAOItem;
49685750 private MenuItem recompileItem;
49695751 private MenuItem editScriptItem;
....@@ -4973,4 +5755,8 @@
49735755 private MenuItem analyzeItem;
49745756 private MenuItem dumpItem;
49755757 //boolean freezemodel = false;
5758
+
5759
+ Menu cameraMenu;
5760
+ MenuItem editCameraItem;
5761
+ MenuItem restoreCameraItem;
49765762 }