Normand Briere
2019-06-24 47cd0f0a3870d843cb758535316060d30f15c811
GroupEditor.java
....@@ -150,6 +150,8 @@
150150
151151 void SetupMenu2(GroupEditor oe)
152152 {
153
+ oe.jTree = new cTree();
154
+
153155 Menu menu;
154156 oe.menuBar.add(menu = new Menu("Edit"));
155157 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +162,7 @@
160162 // redoItem = menu.add(new MenuItem("Redo"));
161163 // redoItem.addActionListener(this);
162164 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
165
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164166 duplicateItem.addActionListener(this);
165167 cloneItem = menu.add(new MenuItem("Clone"));
166168 cloneItem.addActionListener(this);
....@@ -176,7 +178,6 @@
176178 copyItem.addActionListener(this);
177179 pasteItem = menu.add(new MenuItem("Paste"));
178180 pasteItem.addActionListener(this);
179
- menu.add("-");
180181
181182 menu.add("-");
182183 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -246,7 +247,7 @@
246247
247248 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248249 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
250
+ toggleDebugItem.setState(Globals.DEBUG);
250251
251252 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252253 toggleFrustumItem.addItemListener(this);
....@@ -335,13 +336,21 @@
335336 frontItem.addActionListener(this);
336337 compositeItem = menu.add(new MenuItem("Composite"));
337338 compositeItem.addActionListener(this);
339
+
340
+ if (Globals.ADVANCED)
341
+ {
338342 hideItem = menu.add(new MenuItem("Hidden Group"));
339343 hideItem.addActionListener(this);
344
+ }
340345 ungroupItem = menu.add(new MenuItem("Ungroup"));
341346 ungroupItem.addActionListener(this);
347
+
342348 menu.add("-");
349
+
343350 randomItem = menu.add(new MenuItem("Switch node"));
344351 randomItem.addActionListener(this);
352
+ if (Globals.ADVANCED)
353
+ {
345354 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346355 switchGeoItem.addActionListener(this);
347356 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +358,6 @@
349358 morphItem = menu.add(new MenuItem("Morph Group"));
350359 morphItem.addActionListener(this);
351360
352
- if (Globals.ADVANCED)
353
- {
354361 menu.add("-");
355362 physicsItem = menu.add(new MenuItem("Physics"));
356363 physicsItem.addActionListener(this);
....@@ -369,11 +376,11 @@
369376 billboardItem.addActionListener(this);
370377 csgItem = menu.add(new MenuItem("CSG"));
371378 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
379
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373380 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
381
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375382 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
383
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377384 shadowZItem.addActionListener(this);
378385 if (Globals.ADVANCED)
379386 {
....@@ -535,6 +542,18 @@
535542
536543 void SetupUI2(ObjEditor oe)
537544 {
545
+ // June 2019
546
+ if (oe == null)
547
+ {
548
+ //super.SetupUI2(this);
549
+ //return;
550
+ }
551
+
552
+ if (copy != group)
553
+ {
554
+ //super.SetupUI2(this);
555
+ }
556
+
538557 //new Exception().printStackTrace();
539558
540559 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -565,35 +584,49 @@
565584 */
566585 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
567586
568
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
587
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
588
+ //minButton.setToolTipText("Minimize window");
589
+ //minButton.addActionListener(this);
590
+
591
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
592
+ maxButton.setToolTipText("Maximize window");
593
+ maxButton.addActionListener(this);
594
+
595
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
596
+ fullButton.setToolTipText("Full-screen window");
597
+ fullButton.addActionListener(this);
598
+
599
+ oe.toolboxPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569600 undoButton.setToolTipText("Undo changes");
570601 undoButton.addActionListener(this);
571602
572
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
+ oe.toolboxPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573604 redoButton.setToolTipText("Redo changes");
574605 redoButton.addActionListener(this);
575606
576
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
607
+ oe.toolboxPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577608 saveButton.setToolTipText("Save changes");
578609 saveButton.addActionListener(this);
579610
580
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
611
+ oe.toolboxPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
581612 liveCB.setToolTipText("Enable animation");
582613 liveCB.addItemListener(this);
583614
584
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
+ oe.toolboxPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585616 oneStepButton.setToolTipText("Animate one step forward");
586617 oneStepButton.addActionListener(this);
587618
588
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
619
+ oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
589620 fastCB.setToolTipText("Fast mode");
590621 fastCB.addItemListener(this);
591622
592
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
623
+ oe.toolboxPanel.Return();
624
+
625
+ oe.toolboxPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
593626 trackCB.setToolTipText("Enable tracking");
594627 trackCB.addItemListener(this);
595628
596
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
+ oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597630 screenfitButton.setToolTipText("Screen fit");
598631 screenfitButton.addActionListener(this);
599632
....@@ -607,65 +640,112 @@
607640 snapobjectButton.setToolTipText("Snap Object");
608641 }
609642
610
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
- flashSelectionButton.setToolTipText("Show selection");
643
+ oe.toolboxPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
644
+ flashSelectionButton.setToolTipText("Highlight selection");
612645 flashSelectionButton.addActionListener(this);
613646
614
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
647
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
615648
616
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
649
+ oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617650 twoButton.setToolTipText("Show center view only");
618651 twoButton.addActionListener(this);
619
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
652
+ this.fullscreenLayout = twoButton;
653
+
654
+ oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620655 fourButton.addActionListener(this);
621656 fourButton.setToolTipText("Show left panel only");
622
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
+ oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623658 sixButton.setToolTipText("2-column layout left");
624659 sixButton.addActionListener(this);
625
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
660
+ oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626661 threeButton.setToolTipText("2-column layout right");
627662 threeButton.addActionListener(this);
628
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
+ oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629664 sevenButton.setToolTipText("3-column layout");
630665 sevenButton.addActionListener(this);
631666 //
632667
633
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
+ oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634669 rootButton.setToolTipText("Edit selection in new tab");
635670 rootButton.addActionListener(this);
636671
637
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
672
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638673 closeButton.setToolTipText("Close tab");
639674 closeButton.addActionListener(this);
640675 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
641676 //clearButton.addActionListener(this);
642
-
643
- cGridBag commandsPanel = new cGridBag();
677
+
678
+ // INSERT
679
+ oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
680
+ gridButton.setToolTipText("Create grid");
681
+ gridButton.addActionListener(this);
682
+
683
+ oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
684
+ boxButton.setToolTipText("Create box");
685
+ boxButton.addActionListener(this);
686
+
687
+ oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
688
+ sphereButton.setToolTipText("Create sphere");
689
+ sphereButton.addActionListener(this);
690
+
691
+ oe.toolboxPanel.Return();
644692
645
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693
+ oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
694
+ coneButton.setToolTipText("Create cone");
695
+ coneButton.addActionListener(this);
696
+
697
+ oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
698
+ torusButton.setToolTipText("Create torus");
699
+ torusButton.addActionListener(this);
700
+
701
+ oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
702
+ superButton.setToolTipText("Create superellipsoid");
703
+ superButton.addActionListener(this);
704
+
705
+ if (Globals.ADVANCED)
706
+ {
707
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
708
+ kleinButton.setToolTipText("Create Klein bottle");
709
+ kleinButton.addActionListener(this);
710
+ }
711
+
712
+ oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713
+ particlesButton.setToolTipText("Create particle system");
714
+ particlesButton.addActionListener(this);
715
+
716
+ oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
717
+ overlayButton.setToolTipText("Create overlay");
718
+ overlayButton.addActionListener(this);
719
+
720
+ oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
721
+ lightButton.setToolTipText("Create light");
722
+ lightButton.addActionListener(this);
723
+
724
+ // EDIT panel
725
+ editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646726 editButton.setToolTipText("Edit selection");
647727 editButton.addActionListener(this);
648728
649
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
729
+ editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650730 uneditButton.setToolTipText("Unedit selection");
651731 uneditButton.addActionListener(this);
652732
653
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
733
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
654734 allParamsButton.setToolTipText("Edit all params");
655735 allParamsButton.addActionListener(this);
656736
657
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
737
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
658738 clearPanelButton.setToolTipText("Clear edit panel");
659739 clearPanelButton.addActionListener(this);
660740
661
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
741
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662742 unselectButton.setToolTipText("Unselect");
663743 unselectButton.addActionListener(this);
664744
665
- commandsPanel.preferredHeight = 1;
745
+ editCommandsPanel.preferredHeight = 1;
666746
667
- oe.treePanel.add(commandsPanel);
668
- oe.treePanel.Return();
747
+// oe.treePanel.add(commandsPanel);
748
+// oe.treePanel.Return();
669749
670750 // oe.aConstraints.gridx += 1;
671751 // oe.aConstraints.weighty = 0;
....@@ -682,7 +762,7 @@
682762
683763 JScrollPane jSP;
684764 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
685
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
765
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
686766 ResetModel();
687767
688768 oe.treePanel.add(jSPPanel);
....@@ -787,11 +867,23 @@
787867 // debugCB.addItemListener(this);
788868
789869 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
870
+ oeilCB.setToolTipText("Move camera when tracking target");
790871 oeilCB.addItemListener(this);
791872
873
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
874
+ shadowCB.setToolTipText("Compute shadows when live");
875
+ shadowCB.addItemListener(this);
876
+
877
+ panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
878
+ autosaveCB.setToolTipText("Auto-save on structure change");
879
+ autosaveCB.addItemListener(this);
880
+
881
+ if (Globals.ADVANCED)
882
+ {
792883 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
793884 lookAtCB.setToolTipText("Look-at target");
794885 lookAtCB.addItemListener(this);
886
+ }
795887
796888 }
797889
....@@ -806,6 +898,14 @@
806898 void EditObject(Object3D obj)
807899 {
808900 cRadio radioButton = new cRadio(obj.name);
901
+
902
+ // Patch to avoid bug with transparency.
903
+ radioButton.hadMaterial = obj.material != null;
904
+ if (!radioButton.hadMaterial)
905
+ {
906
+ obj.material = new cMaterial();
907
+ }
908
+
809909 radioButton.SetObject(obj);
810910 radioButton.layout = sevenButton;
811911 radioButton.SetCamera(cameraView.renderCamera, false);
....@@ -817,6 +917,8 @@
817917
818918 void SetupViews(ObjEditor oe)
819919 {
920
+ theFrame = this;
921
+
820922 oe.SetupViews();
821923
822924 System.out.println("SetupViews");
....@@ -825,23 +927,26 @@
825927 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
826928 }
827929
828
- JCheckBox liveCB;
829
- JCheckBox supportCB;
830
- JCheckBox localCB;
831
- JCheckBox crowdCB;
832
- JCheckBox smoothCB;
833
- JCheckBox fastCB;
834
- JCheckBox slowCB;
835
- JCheckBox boxCB;
836
- JCheckBox zoomBoxCB;
837
- JCheckBox trackCB;
838
- JCheckBox smoothfocusCB;
930
+ cToggleButton liveCB;
931
+ cCheckBox supportCB;
932
+ cCheckBox localCB;
933
+ cCheckBox crowdCB;
934
+ cCheckBox smoothCB;
935
+ cToggleButton fastCB;
936
+ cCheckBox slowCB;
937
+ cCheckBox boxCB;
938
+ cCheckBox zoomBoxCB;
939
+ cToggleButton trackCB;
940
+ cCheckBox smoothfocusCB;
839941 // JCheckBox speakerMocapCB;
840
- JCheckBox speakerCameraCB;
841
- JCheckBox speakerFocusCB;
842
- JCheckBox debugCB;
843
- JCheckBox oeilCB;
844
- JCheckBox lookAtCB;
942
+ cCheckBox speakerCameraCB;
943
+ cCheckBox speakerFocusCB;
944
+ cCheckBox debugCB;
945
+
946
+ cCheckBox oeilCB;
947
+ cCheckBox shadowCB;
948
+ cCheckBox autosaveCB;
949
+ cCheckBox lookAtCB;
845950
846951 // static int COLOR = 1;
847952 // static int MATERIAL = 2;
....@@ -849,9 +954,9 @@
849954
850955 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
851956
852
- JCheckBox colorCB;
853
- JCheckBox materialCB;
854
- JCheckBox textureCB;
957
+ cCheckBox colorCB;
958
+ cCheckBox materialCB;
959
+ cCheckBox textureCB;
855960
856961 public void itemStateChanged(ItemEvent e)
857962 {
....@@ -944,6 +1049,14 @@
9441049 {
9451050 cameraView.ToggleOeil();
9461051 }
1052
+ else if(e.getSource() == shadowCB)
1053
+ {
1054
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1055
+ }
1056
+ else if(e.getSource() == autosaveCB)
1057
+ {
1058
+ Globals.SAVEONMAKE ^= true;
1059
+ }
9471060 else if(e.getSource() == lookAtCB)
9481061 {
9491062 cameraView.ToggleLookAt();
....@@ -960,7 +1073,8 @@
9601073
9611074 /**/
9621075 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
963
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1076
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1077
+ TreePath path = objEditor.jTree.getSelectionPath();
9641078 if ((path == null) || (path.getPathCount() <= 1)) {
9651079 // We can't move the root node or an empty selection
9661080 return;
....@@ -1084,16 +1198,16 @@
10841198 return;
10851199 }
10861200
1087
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1088
- {
1201
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1202
+// {
10891203 loadClipboard(true);
10901204 objEditor.jTree.setSelectionPath(destinationPath);
10911205 pasteInto(false, false);
1092
- } else {
1093
- loadClipboard(false);
1094
- objEditor.jTree.setSelectionPath(destinationPath);
1095
- pasteInto(false, false); // true); // ???
1096
- }
1206
+// } else {
1207
+// loadClipboard(false);
1208
+// objEditor.jTree.setSelectionPath(destinationPath);
1209
+// pasteInto(false, false); // true); // ???
1210
+// }
10971211 }
10981212 public void dropActionChanged(DropTargetDragEvent dtde)
10991213 // Called if the user has modified the current drop gesture
....@@ -1428,6 +1542,7 @@
14281542 shadow.material = new cMaterial(obj.material);
14291543 shadow.material.diffuse = 0.0001f;
14301544 shadow.material.specular = 0.0001f;
1545
+ //shadow.projectedVertices[1].x = 300;
14311546
14321547 makeSomething(shadow);
14331548 }
....@@ -1684,11 +1799,11 @@
16841799 objEditor.cameraView.renderCamera.setAim(v2, v1);
16851800 objEditor.cameraView.repaint();
16861801 } else
1687
- if (source == rectoidItem)
1802
+ if (source == rectoidItem || source == boxButton)
16881803 {
16891804 makeSomething(new Box());
16901805 } else
1691
- if (source == particleItem)
1806
+ if (source == particleItem || source == particlesButton)
16921807 {
16931808 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16941809 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1767,27 +1882,27 @@
17671882
17681883 makeSomething(obj);
17691884 } else
1770
- if (source == gridItem)
1885
+ if (source == gridItem || source == gridButton)
17711886 {
17721887 makeSomething(new Grid());
17731888 } else
1774
- if (source == ellipsoidItem)
1889
+ if (source == ellipsoidItem || source == sphereButton)
17751890 {
17761891 makeSomething(new Sphere());
17771892 } else
1778
- if (source == coneItem)
1893
+ if (source == coneItem || source == coneButton)
17791894 {
17801895 makeSomething(new Cone());
17811896 } else
1782
- if (source == torusItem)
1897
+ if (source == torusItem || source == torusButton)
17831898 {
17841899 makeSomething(new Torus());
17851900 } else
1786
- if (source == superItem)
1901
+ if (source == superItem || source == superButton)
17871902 {
17881903 makeSomething(new Superellipsoid());
17891904 } else
1790
- if (source == kleinItem)
1905
+ if (source == kleinItem || source == kleinButton)
17911906 {
17921907 makeSomething(new Klein());
17931908 } else
....@@ -1807,7 +1922,7 @@
18071922 {
18081923 makeSomething(new BezierSurface());
18091924 } else
1810
- if (source == overlayItem)
1925
+ if (source == overlayItem || source == overlayButton)
18111926 {
18121927 /*
18131928 Object3D obj = new BezierSurface(5,8);
....@@ -1855,7 +1970,7 @@
18551970 s.setup();
18561971 makeSomething(s);
18571972 } else
1858
- if (source == lightItem)
1973
+ if (source == lightItem || source == lightButton)
18591974 {
18601975 makeSomething(new Light());
18611976 } else
....@@ -1977,6 +2092,18 @@
19772092 if (source == dumpItem)
19782093 {
19792094 DumpObject();
2095
+ } else
2096
+ if (source == minButton)
2097
+ {
2098
+ Minimize();
2099
+ } else
2100
+ if (source == maxButton)
2101
+ {
2102
+ Maximize();
2103
+ } else
2104
+ if (source == fullButton)
2105
+ {
2106
+ ToggleFullScreen();
19802107 } else
19812108 if (source == undoButton)
19822109 {
....@@ -2529,7 +2656,7 @@
25292656 {
25302657 CastShadow(2);
25312658 } else
2532
- if (source == ungroupItem)
2659
+ if (source == ungroupItem || source == ungroupButton)
25332660 {
25342661 //ungroup();
25352662 for (int i=0; i<group.selection.size(); i++)
....@@ -2867,6 +2994,10 @@
28672994 if (source == twoButton)
28682995 {
28692996 radio.layout = twoButton;
2997
+
2998
+ if (CameraPane.FULLSCREEN)
2999
+ fullscreenLayout = radio.layout;
3000
+
28703001 // bug
28713002 //gridPanel.setDividerLocation(1.0);
28723003 //bigPanel.setDividerLocation(0.0);
....@@ -2899,10 +3030,31 @@
28993030 bigThree.ClearUI();
29003031 bigThree.add(centralPanel);
29013032 bigThree.FlushUI();
3033
+
3034
+ cameraView.requestFocusInWindow();
3035
+
3036
+// refreshContents(true);
3037
+//
3038
+// try
3039
+// {
3040
+// java.awt.Robot bot = new java.awt.Robot();
3041
+// int mask = InputEvent.BUTTON1_MASK;
3042
+// bot.mouseMove(100, 100);
3043
+// bot.mousePress(mask);
3044
+// bot.mouseRelease(mask);
3045
+// }
3046
+// catch (Exception e)
3047
+// {
3048
+//
3049
+// }
3050
+
29023051 } else
29033052 if (source == threeButton)
29043053 {
29053054 radio.layout = threeButton;
3055
+
3056
+ if (CameraPane.FULLSCREEN)
3057
+ fullscreenLayout = radio.layout;
29063058
29073059 // bigThree.remove(scenePanel);
29083060 // bigThree.remove(centralPanel);
....@@ -2935,10 +3087,15 @@
29353087 bigThree.add(centralPanel);
29363088 bigThree.add(XYZPanel);
29373089 bigThree.FlushUI();
3090
+
3091
+ cameraView.requestFocusInWindow();
29383092 } else
29393093 if (source == fourButton)
29403094 {
29413095 radio.layout = fourButton;
3096
+
3097
+ if (CameraPane.FULLSCREEN)
3098
+ fullscreenLayout = radio.layout;
29423099
29433100 // bigThree.remove(scenePanel);
29443101 // bigThree.remove(centralPanel);
....@@ -2970,10 +3127,15 @@
29703127 bigThree.ClearUI();
29713128 bigThree.add(scenePanel);
29723129 bigThree.FlushUI();
3130
+
3131
+ cameraView.requestFocusInWindow();
29733132 } else
29743133 if (source == sixButton)
29753134 {
29763135 radio.layout = sixButton;
3136
+
3137
+ if (CameraPane.FULLSCREEN)
3138
+ fullscreenLayout = radio.layout;
29773139
29783140 // bigThree.remove(scenePanel);
29793141 // bigThree.remove(centralPanel);
....@@ -3006,10 +3168,15 @@
30063168 bigThree.add(scenePanel);
30073169 bigThree.add(centralPanel);
30083170 bigThree.FlushUI();
3171
+
3172
+ cameraView.requestFocusInWindow();
30093173 } else
30103174 if (source == sevenButton)
30113175 {
30123176 radio.layout = sevenButton;
3177
+
3178
+ if (CameraPane.FULLSCREEN)
3179
+ fullscreenLayout = radio.layout;
30133180
30143181 // bigThree.remove(scenePanel);
30153182 // bigThree.remove(centralPanel);
....@@ -3043,6 +3210,8 @@
30433210 bigThree.add(centralPanel);
30443211 bigThree.add(XYZPanel);
30453212 bigThree.FlushUI();
3213
+
3214
+ cameraView.requestFocusInWindow();
30463215 } else
30473216 if (source == rootButton)
30483217 {
....@@ -3054,6 +3223,7 @@
30543223 EditObject(obj);
30553224 }
30563225
3226
+ cameraView.requestFocusInWindow();
30573227 refreshContents(true);
30583228 } else
30593229 if (source == closeButton)
....@@ -3063,18 +3233,27 @@
30633233 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30643234 {
30653235 ab = (cRadio)e.nextElement();
3066
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3236
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30673237 {
3238
+ // Patch to avoid bug with transparency.
3239
+ if (!ab.hadMaterial)
3240
+ {
3241
+ ab.object.material = null;
3242
+ }
3243
+
30683244 buttonGroup.remove(ab);
30693245 radioPanel.remove(ab);
30703246
3071
- ab.GetObject().editWindow = null;
3247
+ //ab.GetObject().editWindow = null;
3248
+ ab.GetObject().manipWindow = null;
30723249 // ab.GetObject().objectUI = null; // ?????????
30733250
30743251 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30753252 break;
30763253 }
30773254 }
3255
+
3256
+ cameraView.requestFocusInWindow();
30783257 refreshContents(true);
30793258 } else
30803259 if (source == editItem || source == editButton)
....@@ -3179,7 +3358,8 @@
31793358 }
31803359
31813360 // fix "+" issue
3182
- group.editWindow = this;
3361
+ //group.editWindow = this;
3362
+ group.manipWindow = this;
31833363
31843364 /*
31853365 currentLayout = radio.layout;
....@@ -3192,6 +3372,8 @@
31923372 //group.parent = null; // ROOT
31933373 //group.attributes = -1;
31943374 ResetModel();
3375
+
3376
+ cameraView.requestFocusInWindow();
31953377 refreshContents(true);
31963378 } else if (event.getSource() == editCameraItem)
31973379 {
....@@ -3215,7 +3397,6 @@
32153397 }
32163398
32173399 boolean useclient = false;
3218
- cRadio radio;
32193400
32203401 void ToggleRoot()
32213402 {
....@@ -4264,7 +4445,7 @@
42644445 {
42654446 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42664447 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4267
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4448
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42684449
42694450 Object3D elem = (Object3D)group.selection.elementAt(i);
42704451 if(elem != group || !newWindow)
....@@ -4501,6 +4682,7 @@
45014682
45024683 if (cut)
45034684 {
4685
+ if (Globals.SAVEONMAKE)
45044686 Save();
45054687 //int indices[] = jList.getSelectedIndices();
45064688 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -5219,10 +5401,28 @@
52195401 cButton clearpanelButton;
52205402 cButton unselectButton;
52215403
5222
- cButton saveButton;
5404
+ cButton minButton;
5405
+ cButton maxButton;
5406
+ cButton fullButton;
52235407 cButton undoButton;
52245408 cButton redoButton;
5409
+ cButton saveButton;
52255410 cButton oneStepButton;
5411
+
5412
+ cButton groupButton;
5413
+ cButton ungroupButton;
5414
+ cButton compositeButton;
5415
+
5416
+ cButton gridButton;
5417
+ cButton boxButton;
5418
+ cButton sphereButton;
5419
+ cButton coneButton;
5420
+ cButton torusButton;
5421
+ cButton superButton;
5422
+ cButton kleinButton;
5423
+ cButton particlesButton;
5424
+ cButton overlayButton;
5425
+ cButton lightButton;
52265426
52275427 cButton screenfitButton;
52285428 cButton screenfitpointButton;
....@@ -5234,14 +5434,6 @@
52345434 cButton closeButton;
52355435
52365436 cButton setsupportButton;
5237
-
5238
- cButton twoButton;
5239
- cButton sixButton;
5240
- cButton threeButton;
5241
- cButton sevenButton;
5242
- cButton fourButton; // full panel
5243
- cButton oneButton; // full XYZ
5244
- //cButton currentLayout;
52455437
52465438 //
52475439 //Composite
....@@ -5256,7 +5448,7 @@
52565448 private MenuItem cutItem;
52575449 private MenuItem undoItem;
52585450 private MenuItem redoItem;
5259
- private MenuItem duplicateItem;
5451
+ private JMenuItem duplicateItem;
52605452 private MenuItem cloneItem;
52615453 private MenuItem cloneSupportItem;
52625454 private MenuItem overwriteGeoItem;