Normand Briere
2019-06-24 c67da2e5d8655704601d6d06e8bc60aabe212253
GroupEditor.java
....@@ -74,7 +74,7 @@
7474 this.copy = this.group = copy;
7575 //selectees = this.group.selectees;
7676
77
- SetupMenu2(objEditor);
77
+ SetupMenu2(this); //objEditor);
7878 SetupUI2(objEditor);
7979 objEditor.SetupUI(true);
8080 SetupViews(objEditor);
....@@ -98,14 +98,14 @@
9898
9999 void CloneClipboard(boolean supports)
100100 {
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));
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));
106106 else
107
- makeSomething(CloneObject(GrafreeD.clipboard, false));
108
- GrafreeD.clipboard.get(0).parent = keepparent;
107
+ makeSomething(CloneObject(Grafreed.clipboard, false));
108
+ Grafreed.clipboard.get(0).parent = keepparent;
109109 }
110110
111111 static Object3D CloneObject(Object3D obj, boolean supports)
....@@ -119,7 +119,7 @@
119119 // obj.support = null;
120120 if (!supports)
121121 obj.SaveSupports();
122
- Object3D clone = (Object3D)GrafreeD.clone(obj);
122
+ Object3D clone = (Object3D)Grafreed.clone(obj);
123123 obj.parent = parent;
124124 // obj.support = support;
125125 // clone.support = support; // aout 2013
....@@ -148,27 +148,18 @@
148148
149149 //JTextField nameField;
150150
151
- void SetupMenu2(ObjEditor oe)
151
+ void SetupMenu2(GroupEditor oe)
152152 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
168153 Menu menu;
169154 oe.menuBar.add(menu = new Menu("Edit"));
170155 //editItem = menu.add(new MenuItem("Edit"));
171156 //editItem.addActionListener(this);
157
+
158
+// undoItem = menu.add(new MenuItem("Undo"));
159
+// undoItem.addActionListener(this);
160
+// redoItem = menu.add(new MenuItem("Redo"));
161
+// redoItem.addActionListener(this);
162
+// menu.add("-");
172163 duplicateItem = menu.add(new MenuItem("Duplicate"));
173164 duplicateItem.addActionListener(this);
174165 cloneItem = menu.add(new MenuItem("Clone"));
....@@ -185,7 +176,6 @@
185176 copyItem.addActionListener(this);
186177 pasteItem = menu.add(new MenuItem("Paste"));
187178 pasteItem.addActionListener(this);
188
- menu.add("-");
189179
190180 menu.add("-");
191181 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -206,14 +196,97 @@
206196 clearAllItem = menu.add(new MenuItem("Clear All"));
207197 clearAllItem.addActionListener(this);
208198 }
199
+
200
+ menuBar.add(cameraMenu = new Menu("View"));
201
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
202
+ //zBufferItem.addActionListener(this);
203
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
204
+ //normalLensItem.addActionListener(this);
205
+ cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
206
+ revertCameraItem.addActionListener(this);
207
+
208
+ cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
209
+ toggleFullScreenItem.addItemListener(this);
210
+ toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
211
+ cameraMenu.add("-");
212
+
213
+ cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
214
+ toggleTextureItem.addItemListener(this);
215
+ toggleTextureItem.setState(CameraPane.textureon);
216
+
217
+ cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
218
+ toggleSwitchItem.addItemListener(this);
219
+ toggleSwitchItem.setState(CameraPane.SWITCH);
220
+
221
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
222
+ toggleHandleItem.addItemListener(this);
223
+ toggleHandleItem.setState(CameraPane.HANDLES);
224
+
225
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
226
+ togglePaintItem.addItemListener(this);
227
+ togglePaintItem.setState(CameraPane.PAINTMODE);
228
+
229
+ if (Globals.ADVANCED)
230
+ {
231
+ cameraMenu.add("-");
232
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
233
+ toggleLiveItem.addItemListener(this);
234
+ toggleLiveItem.setState(Globals.isLIVE());
209235
236
+ cameraMenu.add(stepItem = new MenuItem("Step"));
237
+ stepItem.addActionListener(this);
238
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
239
+ // toggleDLItem.addItemListener(this);
240
+ // toggleDLItem.setState(false);
241
+
242
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
243
+ toggleRenderItem.addItemListener(this);
244
+ toggleRenderItem.setState(!CameraPane.frozen);
245
+
246
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
247
+ toggleDebugItem.addItemListener(this);
248
+ toggleDebugItem.setState(Globals.DEBUG);
249
+
250
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
251
+ toggleFrustumItem.addItemListener(this);
252
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
253
+
254
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
255
+ toggleFootContactItem.addItemListener(this);
256
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
257
+
258
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
259
+ toggleTimelineItem.addItemListener(this);
260
+ }
261
+
262
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
263
+// toggleRootItem.addItemListener(this);
264
+// toggleRootItem.setState(false);
265
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
266
+// animationItem.addItemListener(this);
267
+// animationItem.setState(CameraPane.ANIMATION);
268
+ cameraMenu.add("-");
269
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
270
+ editCameraItem.addActionListener(this);
271
+
272
+ if (Globals.ADVANCED)
273
+ {
274
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
275
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
276
+ //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
277
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
278
+ oe.cameraMenu.add("-");
279
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
280
+ openWindowItem.addActionListener(this);
281
+ editLeafItem.addActionListener(this);
282
+ lookAtItem.addActionListener(this);
283
+ //lookFromItem.addActinoListener(this);
284
+ //switchItem.addActionListener(this);
285
+ }
286
+
210287 oe.menuBar.add(menu = new Menu("Setting"));
211288 if (Globals.ADVANCED)
212289 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217290 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218291 revertMeshItem.addActionListener(this);
219292 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -295,11 +368,11 @@
295368 billboardItem.addActionListener(this);
296369 csgItem = menu.add(new MenuItem("CSG"));
297370 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
371
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299372 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
373
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301374 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
375
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303376 shadowZItem.addActionListener(this);
304377 if (Globals.ADVANCED)
305378 {
....@@ -318,8 +391,12 @@
318391 resetTransformItem.addActionListener(this);
319392 resetCentroidItem = menu.add(new MenuItem("Reset Centroid"));
320393 resetCentroidItem.addActionListener(this);
321
- transformgeometryItem = menu.add(new MenuItem("Transform Geometry"));
322
- transformgeometryItem.addActionListener(this);
394
+ resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY"));
395
+ resetCentroidXZItem.addActionListener(this);
396
+ transformGeometryItem = menu.add(new MenuItem("Transform Geometry"));
397
+ transformGeometryItem.addActionListener(this);
398
+ transformChildrenItem = menu.add(new MenuItem("Transform Children"));
399
+ transformChildrenItem.addActionListener(this);
323400
324401 oe.menuBar.add(menu = new Menu("Geometry"));
325402 genUVItem = menu.add(new MenuItem("Generate UV"));
....@@ -368,6 +445,10 @@
368445 oe.menuBar.add(menu = new Menu("Attributes"));
369446 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
370447 clearMaterialsItem.addActionListener(this);
448
+ resetAllItem = menu.add(new MenuItem("Reset All"));
449
+ resetAllItem.addActionListener(this);
450
+ stepAllItem = menu.add(new MenuItem("Step All"));
451
+ stepAllItem.addActionListener(this);
371452 menu.add("-");
372453 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
373454 liveleavesItem.addActionListener(this);
....@@ -388,6 +469,14 @@
388469 markleavesItem.addActionListener(this);
389470 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
390471 unmarkleavesItem.addActionListener(this);
472
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
473
+ rewindleavesItem.addActionListener(this);
474
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
475
+ unrewindleavesItem.addActionListener(this);
476
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
477
+ randomleavesItem.addActionListener(this);
478
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
479
+ unrandomleavesItem.addActionListener(this);
391480 menu.add("-");
392481 flipVItem = menu.add(new MenuItem("Flip V"));
393482 flipVItem.addActionListener(this);
....@@ -422,41 +511,41 @@
422511 sortbysizeItem.addActionListener(this);
423512 sortbynameItem = menu.add(new MenuItem("Sort by name"));
424513 sortbynameItem.addActionListener(this);
514
+ menu.add("-");
515
+ shareGeometriesItem = menu.add(new MenuItem("Share Geometries"));
516
+ shareGeometriesItem.addActionListener(this);
517
+ mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries"));
518
+ mergeGeometriesItem.addActionListener(this);
425519 if (Globals.ADVANCED)
426520 {
427
- menu.add("-");
521
+ // Pretty much the same as duplicate and clone.
428522 extractGeometriesItem = menu.add(new MenuItem("Link Geometry"));
429523 extractGeometriesItem.addActionListener(this);
430524 cloneGeometriesItem = menu.add(new MenuItem("Clone Geometry"));
431525 cloneGeometriesItem.addActionListener(this);
432
- shareGeometriesItem = menu.add(new MenuItem("Share Geometry"));
433
- shareGeometriesItem.addActionListener(this);
434
- mergeGeometriesItem = menu.add(new MenuItem("Merge Geometry"));
435
- mergeGeometriesItem.addActionListener(this);
436526 }
437527
438528 oe.menuBar.add(menu = new Menu("Insert"));
439529 buildCreateMenu(menu);
440530
441
- oe.menuBar.add(menu = new Menu("Include"));
442
- importOBJItem = menu.add(new MenuItem("OBJ file..."));
443
- importOBJItem.addActionListener(this);
444
- menu.add("-");
445
- import3DSItem = menu.add(new MenuItem("3DS file..."));
446
- import3DSItem.addActionListener(this);
447
- menu.add("-");
448
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
449
- importVRMLX3DItem.addActionListener(this);
450
- menu.add("-");
451
- importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
452
- importGFDItem.addActionListener(this);
453
-
454531 oe.menuBar.add(menu = new Menu("Tools"));
455532 buildToolsMenu(menu);
456533 }
457534
458535 void SetupUI2(ObjEditor oe)
459536 {
537
+ // June 2019
538
+ if (oe == null)
539
+ {
540
+ //super.SetupUI2(this);
541
+ //return;
542
+ }
543
+
544
+ if (copy != group)
545
+ {
546
+ //super.SetupUI2(this);
547
+ }
548
+
460549 //new Exception().printStackTrace();
461550
462551 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -487,11 +576,35 @@
487576 */
488577 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
489578
579
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
580
+ //minButton.setToolTipText("Minimize window");
581
+ //minButton.addActionListener(this);
582
+
583
+ oe.toolbarPanel.add(maxButton = new cButton("\u271A", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
584
+ maxButton.setToolTipText("Maximize window");
585
+ maxButton.addActionListener(this);
586
+
587
+ oe.toolbarPanel.add(fullButton = new cButton("\u2b1c", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ fullButton.setToolTipText("Full-screen window");
589
+ fullButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(undoButton = new cButton("\u21a9", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ undoButton.setToolTipText("Undo changes");
593
+ undoButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ redoButton.setToolTipText("Redo changes");
597
+ redoButton.addActionListener(this);
598
+
599
+ oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
600
+ saveButton.setToolTipText("Save changes");
601
+ saveButton.addActionListener(this);
602
+
490603 oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
491
- liveCB.setToolTipText("Enabled animation");
604
+ liveCB.setToolTipText("Enable animation");
492605 liveCB.addItemListener(this);
493606
494
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
495608 oneStepButton.setToolTipText("Animate one step forward");
496609 oneStepButton.addActionListener(this);
497610
....@@ -499,11 +612,11 @@
499612 fastCB.setToolTipText("Fast mode");
500613 fastCB.addItemListener(this);
501614
502
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
615
+ oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints);
503616 trackCB.setToolTipText("Enable tracking");
504617 trackCB.addItemListener(this);
505618
506
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
619
+ oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
507620 screenfitButton.setToolTipText("Screen fit");
508621 screenfitButton.addActionListener(this);
509622
....@@ -512,70 +625,68 @@
512625
513626 if (Globals.ADVANCED)
514627 {
515
- oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
628
+ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
516629 snapobjectButton.addActionListener(this);
517630 snapobjectButton.setToolTipText("Snap Object");
518631 }
519632
520
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
633
+ oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521634 flashSelectionButton.setToolTipText("Show selection");
522635 flashSelectionButton.addActionListener(this);
523636
524637 oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
525638
526
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
639
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
527640 twoButton.setToolTipText("Show center view only");
528641 twoButton.addActionListener(this);
529
- oe.toolbarPanel.add(fourButton = new cButton("+||", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
642
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
530643 fourButton.addActionListener(this);
531644 fourButton.setToolTipText("Show left panel only");
532
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
645
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
533646 sixButton.setToolTipText("2-column layout left");
534647 sixButton.addActionListener(this);
535
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
648
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
536649 threeButton.setToolTipText("2-column layout right");
537650 threeButton.addActionListener(this);
538
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
651
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
539652 sevenButton.setToolTipText("3-column layout");
540653 sevenButton.addActionListener(this);
541654 //
542655
543
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
656
+ oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544657 rootButton.setToolTipText("Edit selection in new tab");
545658 rootButton.addActionListener(this);
546659
547
- oe.toolbarPanel.add(closeButton = new cButton("X", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
660
+ oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
548661 closeButton.setToolTipText("Close tab");
549662 closeButton.addActionListener(this);
550663 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
551664 //clearButton.addActionListener(this);
552665
553
- cGridBag commandsPanel = new cGridBag();
554
-
555
- commandsPanel.add(editButton = new cButton("+", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
666
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
556667 editButton.setToolTipText("Edit selection");
557668 editButton.addActionListener(this);
558669
559
- commandsPanel.add(uneditButton = new cButton("-", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
670
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
560671 uneditButton.setToolTipText("Unedit selection");
561672 uneditButton.addActionListener(this);
562673
563
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
674
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
564675 allParamsButton.setToolTipText("Edit all params");
565676 allParamsButton.addActionListener(this);
566677
567
- commandsPanel.add(clearPanelButton = new cButton("C", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
678
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
568679 clearPanelButton.setToolTipText("Clear edit panel");
569680 clearPanelButton.addActionListener(this);
570681
571
- commandsPanel.add(unselectButton = new cButton("U", !GrafreeD.NIMBUSLAF)); //, oe.aConstraints);
682
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
572683 unselectButton.setToolTipText("Unselect");
573684 unselectButton.addActionListener(this);
574685
575
- commandsPanel.preferredHeight = 1;
686
+ editCommandsPanel.preferredHeight = 1;
576687
577
- oe.treePanel.add(commandsPanel);
578
- oe.treePanel.Return();
688
+// oe.treePanel.add(commandsPanel);
689
+// oe.treePanel.Return();
579690
580691 // oe.aConstraints.gridx += 1;
581692 // oe.aConstraints.weighty = 0;
....@@ -651,7 +762,7 @@
651762 zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
652763 zoomBoxCB.addItemListener(this);
653764
654
- if (Globals.ADVANCED)
765
+ if (true) // Globals.ADVANCED)
655766 {
656767 panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
657768 supportCB.setToolTipText("Enable rigging");
....@@ -697,11 +808,19 @@
697808 // debugCB.addItemListener(this);
698809
699810 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
811
+ oeilCB.setToolTipText("Move camera when tracking target");
700812 oeilCB.addItemListener(this);
701813
814
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
815
+ shadowCB.setToolTipText("Compute shadows when live");
816
+ shadowCB.addItemListener(this);
817
+
818
+ if (Globals.ADVANCED)
819
+ {
702820 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
703821 lookAtCB.setToolTipText("Look-at target");
704822 lookAtCB.addItemListener(this);
823
+ }
705824
706825 }
707826
....@@ -716,6 +835,14 @@
716835 void EditObject(Object3D obj)
717836 {
718837 cRadio radioButton = new cRadio(obj.name);
838
+
839
+ // Patch to avoid bug with transparency.
840
+ radioButton.hadMaterial = obj.material != null;
841
+ if (!radioButton.hadMaterial)
842
+ {
843
+ obj.material = new cMaterial();
844
+ }
845
+
719846 radioButton.SetObject(obj);
720847 radioButton.layout = sevenButton;
721848 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -724,8 +851,11 @@
724851 buttonGroup.add(radioButton);
725852 radioButton.doClick();
726853 }
854
+
727855 void SetupViews(ObjEditor oe)
728856 {
857
+ theFrame = this;
858
+
729859 oe.SetupViews();
730860
731861 System.out.println("SetupViews");
....@@ -749,7 +879,9 @@
749879 JCheckBox speakerCameraCB;
750880 JCheckBox speakerFocusCB;
751881 JCheckBox debugCB;
882
+
752883 JCheckBox oeilCB;
884
+ JCheckBox shadowCB;
753885 JCheckBox lookAtCB;
754886
755887 // static int COLOR = 1;
....@@ -788,6 +920,7 @@
788920 } else if(e.getSource() == liveCB)
789921 {
790922 cameraView.ToggleLive();
923
+ refreshContents(false);
791924 }
792925 else if(e.getSource() == supportCB)
793926 {
....@@ -851,6 +984,10 @@
851984 else if(e.getSource() == oeilCB)
852985 {
853986 cameraView.ToggleOeil();
987
+ }
988
+ else if(e.getSource() == shadowCB)
989
+ {
990
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
854991 }
855992 else if(e.getSource() == lookAtCB)
856993 {
....@@ -940,7 +1077,9 @@
9401077 // objEditor.DropFile((java.io.File[]) object, true);
9411078 // return;
9421079 // }
943
- if (string.charAt(0) == '/')
1080
+
1081
+ // File path for Mac and Windows
1082
+ if (string.charAt(0) == '/' || string.charAt(1) == ':')
9441083 {
9451084 // file(s)
9461085 String[] names = string.split("\n");
....@@ -967,7 +1106,7 @@
9671106
9681107 flashIt = false;
9691108 CameraPane pane = (CameraPane) target;
970
- pane.clickStart(objEditor.location.x, objEditor.location.y, 0);
1109
+ pane.clickStart(objEditor.location.x, objEditor.location.y, 0, 0);
9711110 pane.clickEnd(objEditor.location.x, objEditor.location.y, 0, true);
9721111
9731112 if (group.selection.size() == 1)
....@@ -1193,7 +1332,7 @@
11931332 memoryItem.addActionListener(this);
11941333 menu.add(analyzeItem = new MenuItem("Analyze"));
11951334 analyzeItem.addActionListener(this);
1196
- menu.add(dumpItem = new MenuItem("Dump"));
1335
+ menu.add(dumpItem = new MenuItem("Print"));
11971336 dumpItem.addActionListener(this);
11981337 // menu.add(pathItem = new MenuItem("From-to path"));
11991338 // pathItem.addActionListener(this);
....@@ -1334,6 +1473,7 @@
13341473 shadow.material = new cMaterial(obj.material);
13351474 shadow.material.diffuse = 0.0001f;
13361475 shadow.material.specular = 0.0001f;
1476
+ //shadow.projectedVertices[1].x = 300;
13371477
13381478 makeSomething(shadow);
13391479 }
....@@ -1540,9 +1680,9 @@
15401680
15411681 void Overwrite(int mask)
15421682 {
1543
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
1683
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
15441684 {
1545
- Object3D content = GrafreeD.clipboard.get(0);
1685
+ Object3D content = Grafreed.clipboard.get(0);
15461686
15471687 if (content instanceof cGroup && ((cGroup)content).transientlink )
15481688 content = ((cGroup)content).get(0);
....@@ -1847,31 +1987,6 @@
18471987 csg.addChild(child);
18481988 child.addChild(csg);
18491989 } else
1850
-
1851
- if (source == importGFDItem)
1852
- {
1853
- ImportGFD();
1854
- } else
1855
- if (source == importVRMLX3DItem)
1856
- {
1857
- ImportVRMLX3D();
1858
- } else
1859
- if (source == import3DSItem)
1860
- {
1861
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1862
- } else
1863
- if (source == importOBJItem)
1864
- {
1865
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1866
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1867
- browser.setVisible(true);
1868
- String filename = browser.getFile();
1869
- if (filename != null && filename.length() > 0)
1870
- {
1871
- String fullname = browser.getDirectory() + filename;
1872
- makeSomething(ReadOBJ(fullname), true);
1873
- }
1874
- } else
18751990 if (source == computeAOItem)
18761991 {
18771992 Globals.drawMode = CameraPane.OCCLUSION;
....@@ -1890,7 +2005,7 @@
18902005 if (source == invariantsItem)
18912006 {
18922007 System.out.println("Invariants:");
1893
- GrafreeD.grafreeD.universe.invariants();
2008
+ Grafreed.grafreeD.universe.invariants();
18942009 } else
18952010 if (source == memoryItem)
18962011 {
....@@ -1908,6 +2023,30 @@
19082023 if (source == dumpItem)
19092024 {
19102025 DumpObject();
2026
+ } else
2027
+ if (source == minButton)
2028
+ {
2029
+ Minimize();
2030
+ } else
2031
+ if (source == maxButton)
2032
+ {
2033
+ Maximize();
2034
+ } else
2035
+ if (source == fullButton)
2036
+ {
2037
+ ToggleFullScreen();
2038
+ } else
2039
+ if (source == undoButton)
2040
+ {
2041
+ Undo();
2042
+ } else
2043
+ if (source == redoButton)
2044
+ {
2045
+ Redo();
2046
+ } else
2047
+ if (source == saveButton)
2048
+ {
2049
+ Save();
19112050 } else
19122051 if (source == oneStepButton)
19132052 {
....@@ -1963,12 +2102,20 @@
19632102 {
19642103 loadClipboard(true);
19652104 } else
2105
+ if (source == undoItem)
2106
+ {
2107
+ Undo();
2108
+ } else
2109
+ if (source == redoItem)
2110
+ {
2111
+ Redo();
2112
+ } else
19662113 if (source == duplicateItem)
19672114 {
1968
- Object3D keep = GrafreeD.clipboard;
2115
+ Object3D keep = Grafreed.clipboard;
19692116 loadClipboard(false);
19702117 paste(false);
1971
- GrafreeD.clipboard = keep;
2118
+ Grafreed.clipboard = keep;
19722119 } else
19732120 if (source == cloneItem)
19742121 {
....@@ -2188,9 +2335,9 @@
21882335 // group.selection.get(0).setMasterThis(content); // should be identity
21892336 // refreshContents();
21902337 // }
2191
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
2338
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
21922339 {
2193
- Object3D content = GrafreeD.clipboard.get(0);
2340
+ Object3D content = Grafreed.clipboard.get(0);
21942341
21952342 if (content instanceof cGroup && ((cGroup)content).transientlink )
21962343 content = ((cGroup)content).get(0);
....@@ -2240,9 +2387,9 @@
22402387 } else
22412388 if (source == setMasterItem)
22422389 {
2243
- if (group.selection.size() == 1 && GrafreeD.clipboard.size() == 1)
2390
+ if (group.selection.size() == 1 && Grafreed.clipboard.size() == 1)
22442391 {
2245
- Object3D content = GrafreeD.clipboard.get(0);
2392
+ Object3D content = Grafreed.clipboard.get(0);
22462393
22472394 if (content instanceof cGroup && ((cGroup)content).transientlink )
22482395 content = ((cGroup)content).get(0);
....@@ -2255,9 +2402,9 @@
22552402 {
22562403 if (group.selection.size() == 1)
22572404 {
2258
- if (GrafreeD.clipboard.size() == 1)
2405
+ if (Grafreed.clipboard.size() == 1)
22592406 {
2260
- Object3D content = GrafreeD.clipboard.get(0);
2407
+ Object3D content = Grafreed.clipboard.get(0);
22612408
22622409 if (content instanceof cGroup && ((cGroup)content).transientlink )
22632410 content = ((cGroup)content).get(0);
....@@ -2274,7 +2421,7 @@
22742421 {
22752422 RevertMeshes();
22762423 } else
2277
- if (source == resetMeshItem)
2424
+ if (source == resetAllItem)
22782425 {
22792426 ResetAll();
22802427 } else
....@@ -2462,7 +2609,7 @@
24622609 } else
24632610 if (source == genNormalsMESHItem)
24642611 {
2465
- GenNormals(true); // TODO
2612
+ GenNormalsMESH();
24662613 } else
24672614 if (source == genNormalsORGANItem)
24682615 {
....@@ -2527,6 +2674,22 @@
25272674 if (source == unmarkleavesItem)
25282675 {
25292676 MarkLeaves(false);
2677
+ } else
2678
+ if (source == rewindleavesItem)
2679
+ {
2680
+ RewindLeaves(true);
2681
+ } else
2682
+ if (source == unrewindleavesItem)
2683
+ {
2684
+ RewindLeaves(false);
2685
+ } else
2686
+ if (source == randomleavesItem)
2687
+ {
2688
+ RandomLeaves(true);
2689
+ } else
2690
+ if (source == unrandomleavesItem)
2691
+ {
2692
+ RandomLeaves(false);
25302693 } else
25312694 if (source == flipVItem)
25322695 {
....@@ -2612,9 +2775,13 @@
26122775 {
26132776 SmoothMesh();
26142777 } else
2615
- if (source == transformgeometryItem)
2778
+ if (source == transformGeometryItem)
26162779 {
26172780 TransformGeometry();
2781
+ } else
2782
+ if (source == transformChildrenItem)
2783
+ {
2784
+ TransformChildren();
26182785 } else
26192786 if (source == resetTransformItem)
26202787 {
....@@ -2622,7 +2789,11 @@
26222789 } else
26232790 if (source == resetCentroidItem)
26242791 {
2625
- ResetCentroid();
2792
+ ResetCentroid(true);
2793
+ } else
2794
+ if (source == resetCentroidXZItem)
2795
+ {
2796
+ ResetCentroid(false);
26262797 } else
26272798 if (source == resetParentItem)
26282799 {
....@@ -2786,6 +2957,24 @@
27862957 bigThree.ClearUI();
27872958 bigThree.add(centralPanel);
27882959 bigThree.FlushUI();
2960
+
2961
+ cameraView.requestFocusInWindow();
2962
+
2963
+// refreshContents(true);
2964
+//
2965
+// try
2966
+// {
2967
+// java.awt.Robot bot = new java.awt.Robot();
2968
+// int mask = InputEvent.BUTTON1_MASK;
2969
+// bot.mouseMove(100, 100);
2970
+// bot.mousePress(mask);
2971
+// bot.mouseRelease(mask);
2972
+// }
2973
+// catch (Exception e)
2974
+// {
2975
+//
2976
+// }
2977
+
27892978 } else
27902979 if (source == threeButton)
27912980 {
....@@ -2822,6 +3011,8 @@
28223011 bigThree.add(centralPanel);
28233012 bigThree.add(XYZPanel);
28243013 bigThree.FlushUI();
3014
+
3015
+ cameraView.requestFocusInWindow();
28253016 } else
28263017 if (source == fourButton)
28273018 {
....@@ -2857,6 +3048,8 @@
28573048 bigThree.ClearUI();
28583049 bigThree.add(scenePanel);
28593050 bigThree.FlushUI();
3051
+
3052
+ cameraView.requestFocusInWindow();
28603053 } else
28613054 if (source == sixButton)
28623055 {
....@@ -2893,6 +3086,8 @@
28933086 bigThree.add(scenePanel);
28943087 bigThree.add(centralPanel);
28953088 bigThree.FlushUI();
3089
+
3090
+ cameraView.requestFocusInWindow();
28963091 } else
28973092 if (source == sevenButton)
28983093 {
....@@ -2930,6 +3125,8 @@
29303125 bigThree.add(centralPanel);
29313126 bigThree.add(XYZPanel);
29323127 bigThree.FlushUI();
3128
+
3129
+ cameraView.requestFocusInWindow();
29333130 } else
29343131 if (source == rootButton)
29353132 {
....@@ -2941,6 +3138,7 @@
29413138 EditObject(obj);
29423139 }
29433140
3141
+ cameraView.requestFocusInWindow();
29443142 refreshContents(true);
29453143 } else
29463144 if (source == closeButton)
....@@ -2950,8 +3148,14 @@
29503148 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29513149 {
29523150 ab = (cRadio)e.nextElement();
2953
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3151
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29543152 {
3153
+ // Patch to avoid bug with transparency.
3154
+ if (!ab.hadMaterial)
3155
+ {
3156
+ ab.object.material = null;
3157
+ }
3158
+
29553159 buttonGroup.remove(ab);
29563160 radioPanel.remove(ab);
29573161
....@@ -2962,6 +3166,8 @@
29623166 break;
29633167 }
29643168 }
3169
+
3170
+ cameraView.requestFocusInWindow();
29653171 refreshContents(true);
29663172 } else
29673173 if (source == editItem || source == editButton)
....@@ -2978,7 +3184,7 @@
29783184 child.CloseUI();
29793185 listUI.remove(child);
29803186
2981
- child.editWindow = null; // ???????????
3187
+ //child.editWindow = null; // ???????????
29823188 }
29833189 objEditor.ctrlPanel.FlushUI();
29843190 //objEditor.jTree.clearSelection();
....@@ -3064,7 +3270,10 @@
30643270 frontView.object = group;
30653271 sideView.object = group;
30663272 }
3067
- group.editWindow = this;
3273
+
3274
+// fix "+" issue
3275
+ //group.editWindow = this;
3276
+
30683277 /*
30693278 currentLayout = radio.layout;
30703279 if (currentLayout == null)
....@@ -3076,8 +3285,23 @@
30763285 //group.parent = null; // ROOT
30773286 //group.attributes = -1;
30783287 ResetModel();
3288
+
3289
+ cameraView.requestFocusInWindow();
30793290 refreshContents(true);
3080
- }
3291
+ } else if (event.getSource() == editCameraItem)
3292
+ {
3293
+ cameraView.ProtectCamera();
3294
+ cameraView.repaint();
3295
+ return;
3296
+ } else if (event.getSource() == revertCameraItem)
3297
+ {
3298
+ cameraView.RevertCamera();
3299
+ cameraView.repaint();
3300
+ return;
3301
+ // } else if (event.getSource() == textureButton)
3302
+ // {
3303
+ // return; // true;
3304
+ }
30813305 else
30823306 {
30833307 //return super.action(event, arg);
....@@ -3086,7 +3310,6 @@
30863310 }
30873311
30883312 boolean useclient = false;
3089
- cRadio radio;
30903313
30913314 void ToggleRoot()
30923315 {
....@@ -3138,6 +3361,28 @@
31383361 refreshContents();
31393362 }
31403363
3364
+ void TransformChildren()
3365
+ {
3366
+ Object3D obj;
3367
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3368
+ {
3369
+ obj = (Object3D)e.nextElement();
3370
+ obj.KeepTextureMatrices();
3371
+ obj.TransformChildren();
3372
+ obj.RestoreTextureMatrices();
3373
+
3374
+// if (obj.parent == null)
3375
+// {
3376
+// System.out.println("NULL PARENT!");
3377
+// new Exception().printStackTrace();
3378
+// }
3379
+// else
3380
+// TouchTransform(obj);
3381
+// //obj.parent.Touch();
3382
+ }
3383
+
3384
+ refreshContents();
3385
+ }
31413386
31423387 void ResetTransform()
31433388 {
....@@ -3250,7 +3495,7 @@
32503495 refreshContents();
32513496 }
32523497
3253
- void ResetCentroid()
3498
+ void ResetCentroid(boolean full)
32543499 {
32553500 Object3D obj;
32563501 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -3265,12 +3510,16 @@
32653510 LA.matIdentity(Object3D.mat);
32663511 obj.getBounds(minima, maxima, false);
32673512 Object3D.mat[3][0] = -(minima.x + maxima.x)/2;
3268
- Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
3513
+ if (full)
3514
+ Object3D.mat[3][1] = -(minima.y + maxima.y)/2;
32693515 Object3D.mat[3][2] = -(minima.z + maxima.z)/2;
32703516 obj.TransformMesh(Object3D.mat);
3517
+
32713518 Object3D.mat[3][0] = (minima.x + maxima.x)/2;
3272
- Object3D.mat[3][1] = (minima.y + maxima.y)/2;
3519
+ if (full)
3520
+ Object3D.mat[3][1] = (minima.y + maxima.y)/2;
32733521 Object3D.mat[3][2] = (minima.z + maxima.z)/2;
3522
+
32743523 LA.matConcat(Object3D.mat, obj.toParent, obj.toParent);
32753524 //Object3D.mat[3][0] = -Object3D.mat[3][0];
32763525 //Object3D.mat[3][1] = -Object3D.mat[3][1];
....@@ -3299,7 +3548,8 @@
32993548
33003549 int size = obj.MemorySize();
33013550
3302
- System.err.println((size/1024) + " KB is the size of " + obj);
3551
+ //System.err.println((size/1024) + " KB is the size of " + obj);
3552
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33033553 }
33043554 }
33053555 catch (Exception e)
....@@ -3336,9 +3586,9 @@
33363586 obj = (Object3D)e.nextElement();
33373587
33383588 System.out.println("Object is: " + obj);
3339
- GrafreeD.AnalyzeObject(obj);
3589
+ Grafreed.AnalyzeObject(obj);
33403590 System.out.println("Boundary rep: " + obj.bRep);
3341
- GrafreeD.AnalyzeObject(obj.bRep);
3591
+ Grafreed.AnalyzeObject(obj.bRep);
33423592
33433593 // System.err.println((size/1024) + " KB is the size of " + obj);
33443594 }
....@@ -3380,6 +3630,13 @@
33803630 void GenNormals(boolean crease)
33813631 {
33823632 group.GenNormalsS(crease);
3633
+
3634
+ refreshContents();
3635
+ }
3636
+
3637
+ void GenNormalsMESH()
3638
+ {
3639
+ group.GenNormalsMeshS();
33833640
33843641 refreshContents();
33853642 }
....@@ -3552,8 +3809,8 @@
35523809
35533810 void ParseVertices()
35543811 {
3555
- boolean epsequal = GrafreeD.epsequal;
3556
- GrafreeD.epsequal = true;
3812
+ boolean epsequal = Grafreed.epsequal;
3813
+ Grafreed.epsequal = true;
35573814
35583815 for (int i=0; i<group.selection.size(); i++)
35593816 {
....@@ -3578,7 +3835,7 @@
35783835 LA.matTranslate(g.toParent, temp.x, temp.y, temp.z);
35793836 LA.matTranslate(g.fromParent, -temp.x, -temp.y, -temp.z);
35803837
3581
- g.add(GrafreeD.clipboard);
3838
+ g.add(Grafreed.clipboard);
35823839
35833840 buffer.add(g);
35843841 }
....@@ -3593,7 +3850,7 @@
35933850 makeSomething(buffer, i==group.selection.size()-1);
35943851 }
35953852
3596
- GrafreeD.epsequal = epsequal;
3853
+ Grafreed.epsequal = epsequal;
35973854
35983855 refreshContents();
35993856 }
....@@ -3611,7 +3868,16 @@
36113868 String pigment = Object3D.GetPigment(tex);
36123869 //String bump = Object3D.GetBump(tex);
36133870
3614
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3871
+ com.sun.opengl.util.texture.TextureData texturedata = null;
3872
+
3873
+ try
3874
+ {
3875
+ texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
3876
+ }
3877
+ catch (Exception e)
3878
+ {
3879
+ System.err.println("FAIL: " + node);
3880
+ }
36153881
36163882 double s = v.s;
36173883
....@@ -3743,7 +4009,7 @@
37434009 return;
37444010
37454011 Object3D poses = group.selection.get(0);
3746
- Object3D ref = GrafreeD.clipboard.get(0);
4012
+ Object3D ref = Grafreed.clipboard.get(0);
37474013
37484014 Object3D newgroup = new Object3D("Po:" + poses.name);
37494015
....@@ -3937,9 +4203,9 @@
39374203
39384204 void ClipMesh()
39394205 {
3940
- if (/*group.selection.size() == 1 &&*/ GrafreeD.clipboard.size() == 1)
4206
+ if (/*group.selection.size() == 1 &&*/ Grafreed.clipboard.size() == 1)
39414207 {
3942
- Object3D content = GrafreeD.clipboard.get(0);
4208
+ Object3D content = Grafreed.clipboard.get(0);
39434209
39444210 if (content instanceof cGroup && ((cGroup)content).transientlink )
39454211 content = ((cGroup)content).get(0);
....@@ -3948,7 +4214,7 @@
39484214 // {
39494215 // group.selection.get(i).ClipMesh(GrafreeD.clipboard);
39504216 // }
3951
- group.selection.ClipMesh(GrafreeD.clipboard);
4217
+ group.selection.ClipMesh(Grafreed.clipboard);
39524218 }
39534219 // group.selection.ClipMesh(GrafreeD.clipboard);
39544220 System.out.println("DONE.");
....@@ -3995,6 +4261,18 @@
39954261 void MarkLeaves(boolean hide)
39964262 {
39974263 group.selection.MarkLeaves(hide);
4264
+ refreshContents();
4265
+ }
4266
+
4267
+ void RewindLeaves(boolean hide)
4268
+ {
4269
+ group.selection.RewindLeaves(hide);
4270
+ refreshContents();
4271
+ }
4272
+
4273
+ void RandomLeaves(boolean hide)
4274
+ {
4275
+ group.selection.RandomLeaves(hide);
39984276 refreshContents();
39994277 }
40004278
....@@ -4083,7 +4361,7 @@
40834361 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
40844362
40854363 Object3D elem = (Object3D)group.selection.elementAt(i);
4086
- if(elem != group)
4364
+ if(elem != group || !newWindow)
40874365 {
40884366 // if (!(elem instanceof Composite))
40894367 // newWindow = false;
....@@ -4173,7 +4451,6 @@
41734451 //case 702: // Event.LIST_DESELECT
41744452 group.deselectAll();
41754453 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4176
- objEditor.ClearInfo(); // .GetMaterial());
41774454 if (tps != null)
41784455 {
41794456 for (int i=0; i < tps.length; i++)
....@@ -4182,10 +4459,8 @@
41824459
41834460 //if (child.parent != null)
41844461 //child.parent.addSelectee(child);
4462
+ objEditor.SetMaterial(child);
41854463 group.addSelectee(child);
4186
- objEditor.SetMaterial(child); // .GetMaterial());
4187
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4188
- System.err.println("info : " + child.GetPath());
41894464 }
41904465 }
41914466 // else
....@@ -4195,16 +4470,17 @@
41954470 // System.err.println("info : " + group.GetPath());
41964471 // }
41974472
4198
- objEditor.SetText(); // jan 2014
4199
-
4200
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
4473
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42014474 CameraPane.flash = true;
42024475
4203
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
4476
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42044477 // a camera
42054478 {
4206
- CameraPane.camerachangeframe = 0; // don't refuse it
4207
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4479
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
4480
+ {
4481
+ CameraPane.camerachangeframe = 0; // don't refuse it
4482
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
4483
+ }
42084484 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42094485 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42104486 }
....@@ -4217,6 +4493,26 @@
42174493
42184494 freezemodel = false;
42194495 }
4496
+
4497
+ void refreshContents(boolean cp)
4498
+ {
4499
+ if (!Globals.MOUSEDRAGGED)
4500
+ {
4501
+ objEditor.ClearInfo(); // .GetMaterial());
4502
+
4503
+ for (int i=0; i < group.selection.Size(); i++)
4504
+ {
4505
+ Object3D child = (Object3D) group.selection.get(i);
4506
+
4507
+ objEditor.AddInfo(child, this, true);
4508
+ System.err.println("info : " + child.GetPath());
4509
+ }
4510
+
4511
+ objEditor.SetText(); // jan 2014
4512
+ }
4513
+
4514
+ super.refreshContents(cp);
4515
+ }
42204516
42214517 void linkSomething(Object3D thing)
42224518 {
....@@ -4288,16 +4584,18 @@
42884584 {
42894585 if (group.selection.isEmpty())
42904586 return;
4291
- GrafreeD.clipboardIsTempGroup = false;
4587
+
4588
+ Grafreed.clipboardIsTempGroup = false;
42924589 Composite tGroup = null;
42934590 if (group.selection.size() > 0) // 1)
42944591 {
42954592 tGroup = new cGroup();
4296
- GrafreeD.clipboardIsTempGroup = true;
4593
+ Grafreed.clipboardIsTempGroup = true;
42974594 }
42984595
42994596 if (cut)
43004597 {
4598
+ Save();
43014599 //int indices[] = jList.getSelectedIndices();
43024600 //for (int i = indices.length - 1; i >= 0; i--)
43034601 //jList.remove(indices[i]);
....@@ -4333,16 +4631,16 @@
43334631 //System.out.println("cut " + child);
43344632 //System.out.println("parent = " + child.parent);
43354633 // tmp.addChild(child);
4336
- if (GrafreeD.clipboardIsTempGroup)
4634
+ if (Grafreed.clipboardIsTempGroup)
43374635 tGroup.add/*Child*/(tmp);
43384636 else
4339
- GrafreeD.clipboard = tmp;
4637
+ Grafreed.clipboard = tmp;
43404638 }
43414639 else
4342
- if (GrafreeD.clipboardIsTempGroup)
4640
+ if (Grafreed.clipboardIsTempGroup)
43434641 tGroup.add/*Child*/(child);
43444642 else
4345
- GrafreeD.clipboard = child;
4643
+ Grafreed.clipboard = child;
43464644 }
43474645
43484646 //ResetModel();
....@@ -4374,21 +4672,23 @@
43744672 //System.out.println("cut " + elem);
43754673 //System.out.println("parent = " + elem.parent);
43764674 // tmp.addChild(elem);
4377
- if (GrafreeD.clipboardIsTempGroup)
4675
+ if (Grafreed.clipboardIsTempGroup)
43784676 tGroup.add/*Child*/(tmp);
43794677 else
4380
- GrafreeD.clipboard = tmp;
4678
+ Grafreed.clipboard = tmp;
43814679 }
43824680 else
4383
- if (GrafreeD.clipboardIsTempGroup)
4681
+ if (Grafreed.clipboardIsTempGroup)
43844682 tGroup.add/*Child*/(child);
43854683 else
4386
- GrafreeD.clipboard = child;
4684
+ Grafreed.clipboard = child;
43874685 }
43884686
43894687 }
4390
- if (GrafreeD.clipboardIsTempGroup)
4391
- GrafreeD.clipboard = tGroup;
4688
+
4689
+ if (Grafreed.clipboardIsTempGroup)
4690
+ Grafreed.clipboard = tGroup;
4691
+
43924692 if (cut)
43934693 {
43944694 ResetModel();
....@@ -4402,7 +4702,7 @@
44024702 // return;
44034703 boolean first = true;
44044704
4405
- if (GrafreeD.clipboardIsTempGroup)
4705
+ if (Grafreed.clipboardIsTempGroup)
44064706 {
44074707 Composite temp;
44084708
....@@ -4413,7 +4713,7 @@
44134713 temp = (Composite)Applet3D.clipboard.deepCopy();
44144714 */
44154715 Object3D elem;
4416
- for (Enumeration e = /*temp.children*/GrafreeD.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
4716
+ for (Enumeration e = /*temp.children*/Grafreed.clipboard.elements(); e.hasMoreElements();) // objList.add(copy.name))
44174717 {
44184718 Object3D child = (Object3D)e.nextElement();
44194719
....@@ -4447,14 +4747,14 @@
44474747 //Object3D cb = Applet3D.clipboard;
44484748 //temp.addChild(cb);
44494749 //makeSomething((expand?temp.copyExpand():temp.deepCopy()).get(0));
4450
- assert(GrafreeD.clipboard.parent == null);
4451
- Object3D /*Composite*/ keepparent = GrafreeD.clipboard.get(0).parent;
4452
- GrafreeD.clipboard.get(0).parent = null; // Avoid copy?
4453
- if (LA.isIdentity(GrafreeD.clipboard.toParent))
4454
- makeSomething(expand?GrafreeD.clipboard.get(0).copyExpand():GrafreeD.clipboard.get(0).deepCopy());
4750
+ assert(Grafreed.clipboard.parent == null);
4751
+ Object3D /*Composite*/ keepparent = Grafreed.clipboard.get(0).parent;
4752
+ Grafreed.clipboard.get(0).parent = null; // Avoid copy?
4753
+ if (LA.isIdentity(Grafreed.clipboard.toParent))
4754
+ makeSomething(expand?Grafreed.clipboard.get(0).copyExpand():Grafreed.clipboard.get(0).deepCopy());
44554755 else
4456
- makeSomething(expand?GrafreeD.clipboard.copyExpand():GrafreeD.clipboard.deepCopy());
4457
- GrafreeD.clipboard.get(0).parent = keepparent;
4756
+ makeSomething(expand?Grafreed.clipboard.copyExpand():Grafreed.clipboard.deepCopy());
4757
+ Grafreed.clipboard.get(0).parent = keepparent;
44584758 }
44594759
44604760 ResetModel();
....@@ -4503,9 +4803,9 @@
45034803 {
45044804 boolean first = true;
45054805
4506
- if (GrafreeD.clipboardIsTempGroup)
4806
+ if (Grafreed.clipboardIsTempGroup)
45074807 {
4508
- Composite temp = (Composite)GrafreeD.clipboard;
4808
+ Composite temp = (Composite)Grafreed.clipboard;
45094809 Object3D copy;
45104810 for (Enumeration e = temp.children.elements(); e.hasMoreElements();)
45114811 {
....@@ -4515,7 +4815,7 @@
45154815 }
45164816 } else
45174817 {
4518
- linkSomething(GrafreeD.clipboard); //.get(0));
4818
+ linkSomething(Grafreed.clipboard); //.get(0));
45194819 }
45204820 }
45214821 }
....@@ -4920,21 +5220,6 @@
49205220 }
49215221 */
49225222
4923
- void ImportGFD()
4924
- {
4925
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4926
- browser.show();
4927
- String filename = browser.getFile();
4928
- if (filename != null && filename.length() > 0)
4929
- {
4930
- String fullname = browser.getDirectory() + filename;
4931
-
4932
- //Object3D readobj =
4933
- objEditor.ReadGFD(fullname, objEditor);
4934
- //makeSomething(readobj);
4935
- }
4936
- }
4937
-
49385223 /*
49395224 public void Callback(Object obj)
49405225 {
....@@ -4958,26 +5243,9 @@
49585243 }
49595244 */
49605245
4961
- void ImportVRMLX3D()
4962
- {
4963
- if (GrafreeD.standAlone)
4964
- {
4965
- /**/
4966
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
4967
- browser.show();
4968
- String filename = browser.getFile();
4969
- if (filename != null && filename.length() > 0)
4970
- {
4971
- String fullname = browser.getDirectory() + filename;
4972
- LoadVRMLX3D(fullname);
4973
- }
4974
- /**/
4975
- }
4976
- }
4977
-
49785246 String GetFile(String dialogName)
49795247 {
4980
- if (GrafreeD.standAlone)
5248
+ if (Grafreed.standAlone)
49815249 {
49825250 FileDialog browser = new FileDialog(objEditor.frame, dialogName, FileDialog.LOAD);
49835251 browser.show();
....@@ -5045,6 +5313,12 @@
50455313 cButton clearpanelButton;
50465314 cButton unselectButton;
50475315
5316
+ cButton minButton;
5317
+ cButton maxButton;
5318
+ cButton fullButton;
5319
+ cButton undoButton;
5320
+ cButton redoButton;
5321
+ cButton saveButton;
50485322 cButton oneStepButton;
50495323
50505324 cButton screenfitButton;
....@@ -5058,14 +5332,6 @@
50585332
50595333 cButton setsupportButton;
50605334
5061
- cButton twoButton;
5062
- cButton sixButton;
5063
- cButton threeButton;
5064
- cButton sevenButton;
5065
- cButton fourButton; // full panel
5066
- cButton oneButton; // full XYZ
5067
- //cButton currentLayout;
5068
-
50695335 //
50705336 //Composite
50715337 Object3D // to do !!
....@@ -5077,6 +5343,8 @@
50775343 private MenuItem lookFromItem;
50785344 private MenuItem switchItem;
50795345 private MenuItem cutItem;
5346
+ private MenuItem undoItem;
5347
+ private MenuItem redoItem;
50805348 private MenuItem duplicateItem;
50815349 private MenuItem cloneItem;
50825350 private MenuItem cloneSupportItem;
....@@ -5090,7 +5358,7 @@
50905358 private MenuItem linkverticesItem;
50915359 private MenuItem relinkverticesItem;
50925360 private MenuItem setMasterItem;
5093
- private MenuItem resetMeshItem;
5361
+ private MenuItem resetAllItem;
50945362 private MenuItem stepAllItem;
50955363 private MenuItem revertMeshItem;
50965364 private MenuItem poseMeshItem;
....@@ -5140,6 +5408,10 @@
51405408 private MenuItem showleavesItem;
51415409 private MenuItem markleavesItem;
51425410 private MenuItem unmarkleavesItem;
5411
+ private MenuItem rewindleavesItem;
5412
+ private MenuItem unrewindleavesItem;
5413
+ private MenuItem randomleavesItem;
5414
+ private MenuItem unrandomleavesItem;
51435415
51445416 private MenuItem flipVItem;
51455417 private MenuItem unflipVItem;
....@@ -5151,8 +5423,10 @@
51515423 private MenuItem panoTexturesItem;
51525424
51535425 private MenuItem resetCentroidItem;
5154
- private MenuItem transformgeometryItem;
5426
+ private MenuItem resetCentroidXZItem;
51555427 private MenuItem resetTransformItem;
5428
+ private MenuItem transformGeometryItem;
5429
+ private MenuItem transformChildrenItem;
51565430 private MenuItem hideItem;
51575431 private MenuItem grabItem;
51585432 private MenuItem backItem;
....@@ -5221,11 +5495,6 @@
52215495 private MenuItem doubleItem;
52225496 private MenuItem tripleItem;
52235497
5224
- private MenuItem importGFDItem;
5225
- private MenuItem importVRMLX3DItem;
5226
- private MenuItem import3DSItem;
5227
- private MenuItem importOBJItem;
5228
-
52295498 private MenuItem computeAOItem;
52305499 private MenuItem recompileItem;
52315500 private MenuItem editScriptItem;
....@@ -5235,4 +5504,8 @@
52355504 private MenuItem analyzeItem;
52365505 private MenuItem dumpItem;
52375506 //boolean freezemodel = false;
5507
+
5508
+ Menu cameraMenu;
5509
+ MenuItem editCameraItem;
5510
+ MenuItem revertCameraItem;
52385511 }