.. | .. |
---|
176 | 176 | copyItem.addActionListener(this); |
---|
177 | 177 | pasteItem = menu.add(new MenuItem("Paste")); |
---|
178 | 178 | pasteItem.addActionListener(this); |
---|
179 | | - menu.add("-"); |
---|
180 | 179 | |
---|
181 | 180 | menu.add("-"); |
---|
182 | 181 | pasteIntoItem = menu.add(new MenuItem("Paste into")); |
---|
.. | .. |
---|
246 | 245 | |
---|
247 | 246 | cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
248 | 247 | toggleDebugItem.addItemListener(this); |
---|
249 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
| 248 | + toggleDebugItem.setState(Globals.DEBUG); |
---|
250 | 249 | |
---|
251 | 250 | cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
252 | 251 | toggleFrustumItem.addItemListener(this); |
---|
.. | .. |
---|
369 | 368 | billboardItem.addActionListener(this); |
---|
370 | 369 | csgItem = menu.add(new MenuItem("CSG")); |
---|
371 | 370 | csgItem.addActionListener(this); |
---|
372 | | - shadowXItem = menu.add(new MenuItem("Shadow X")); |
---|
| 371 | + shadowXItem = menu.add(new MenuItem("Shadow Red")); |
---|
373 | 372 | shadowXItem.addActionListener(this); |
---|
374 | | - shadowYItem = menu.add(new MenuItem("Shadow Y")); |
---|
| 373 | + shadowYItem = menu.add(new MenuItem("Shadow Green")); |
---|
375 | 374 | shadowYItem.addActionListener(this); |
---|
376 | | - shadowZItem = menu.add(new MenuItem("Shadow Z")); |
---|
| 375 | + shadowZItem = menu.add(new MenuItem("Shadow Blue")); |
---|
377 | 376 | shadowZItem.addActionListener(this); |
---|
378 | 377 | if (Globals.ADVANCED) |
---|
379 | 378 | { |
---|
.. | .. |
---|
535 | 534 | |
---|
536 | 535 | void SetupUI2(ObjEditor oe) |
---|
537 | 536 | { |
---|
| 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 | + |
---|
538 | 549 | //new Exception().printStackTrace(); |
---|
539 | 550 | |
---|
540 | 551 | oe.radioPanel = new JPanel(new GridBagLayout()); |
---|
.. | .. |
---|
565 | 576 | */ |
---|
566 | 577 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
567 | 578 | |
---|
568 | | - oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 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); |
---|
569 | 592 | undoButton.setToolTipText("Undo changes"); |
---|
570 | 593 | undoButton.addActionListener(this); |
---|
571 | 594 | |
---|
572 | | - oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 595 | + oe.toolbarPanel.add(redoButton = new cButton("\u21aa", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
573 | 596 | redoButton.setToolTipText("Redo changes"); |
---|
574 | 597 | redoButton.addActionListener(this); |
---|
575 | 598 | |
---|
576 | | - oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 599 | + oe.toolbarPanel.add(saveButton = new cButton("\u21e3", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
577 | 600 | saveButton.setToolTipText("Save changes"); |
---|
578 | 601 | saveButton.addActionListener(this); |
---|
579 | 602 | |
---|
.. | .. |
---|
581 | 604 | liveCB.setToolTipText("Enable animation"); |
---|
582 | 605 | liveCB.addItemListener(this); |
---|
583 | 606 | |
---|
584 | | - oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 607 | + oe.toolbarPanel.add(oneStepButton = new cButton("\u29f4", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
585 | 608 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
586 | 609 | oneStepButton.addActionListener(this); |
---|
587 | 610 | |
---|
.. | .. |
---|
589 | 612 | fastCB.setToolTipText("Fast mode"); |
---|
590 | 613 | fastCB.addItemListener(this); |
---|
591 | 614 | |
---|
592 | | - oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints); |
---|
| 615 | + oe.toolbarPanel.add(trackCB = new cCheckBox(":", CameraPane.TRACK)); //, oe.aConstraints); |
---|
593 | 616 | trackCB.setToolTipText("Enable tracking"); |
---|
594 | 617 | trackCB.addItemListener(this); |
---|
595 | 618 | |
---|
.. | .. |
---|
613 | 636 | |
---|
614 | 637 | oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
615 | 638 | |
---|
616 | | - oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 639 | + oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
617 | 640 | twoButton.setToolTipText("Show center view only"); |
---|
618 | 641 | twoButton.addActionListener(this); |
---|
619 | | - oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 642 | + oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
620 | 643 | fourButton.addActionListener(this); |
---|
621 | 644 | fourButton.setToolTipText("Show left panel only"); |
---|
622 | | - oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 645 | + oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
623 | 646 | sixButton.setToolTipText("2-column layout left"); |
---|
624 | 647 | sixButton.addActionListener(this); |
---|
625 | | - oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 648 | + oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
626 | 649 | threeButton.setToolTipText("2-column layout right"); |
---|
627 | 650 | threeButton.addActionListener(this); |
---|
628 | | - oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 651 | + oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
629 | 652 | sevenButton.setToolTipText("3-column layout"); |
---|
630 | 653 | sevenButton.addActionListener(this); |
---|
631 | 654 | // |
---|
.. | .. |
---|
640 | 663 | //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); |
---|
641 | 664 | //clearButton.addActionListener(this); |
---|
642 | 665 | |
---|
643 | | - cGridBag commandsPanel = new cGridBag(); |
---|
644 | | - |
---|
645 | | - commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 666 | + editCommandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
646 | 667 | editButton.setToolTipText("Edit selection"); |
---|
647 | 668 | editButton.addActionListener(this); |
---|
648 | 669 | |
---|
649 | | - commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 670 | + editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
650 | 671 | uneditButton.setToolTipText("Unedit selection"); |
---|
651 | 672 | uneditButton.addActionListener(this); |
---|
652 | 673 | |
---|
653 | | - commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
| 674 | + editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
654 | 675 | allParamsButton.setToolTipText("Edit all params"); |
---|
655 | 676 | allParamsButton.addActionListener(this); |
---|
656 | 677 | |
---|
657 | | - commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 678 | + editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
658 | 679 | clearPanelButton.setToolTipText("Clear edit panel"); |
---|
659 | 680 | clearPanelButton.addActionListener(this); |
---|
660 | 681 | |
---|
661 | | - commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 682 | + editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
662 | 683 | unselectButton.setToolTipText("Unselect"); |
---|
663 | 684 | unselectButton.addActionListener(this); |
---|
664 | 685 | |
---|
665 | | - commandsPanel.preferredHeight = 1; |
---|
| 686 | + editCommandsPanel.preferredHeight = 1; |
---|
666 | 687 | |
---|
667 | | - oe.treePanel.add(commandsPanel); |
---|
668 | | - oe.treePanel.Return(); |
---|
| 688 | +// oe.treePanel.add(commandsPanel); |
---|
| 689 | +// oe.treePanel.Return(); |
---|
669 | 690 | |
---|
670 | 691 | // oe.aConstraints.gridx += 1; |
---|
671 | 692 | // oe.aConstraints.weighty = 0; |
---|
.. | .. |
---|
787 | 808 | // debugCB.addItemListener(this); |
---|
788 | 809 | |
---|
789 | 810 | panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints); |
---|
| 811 | + oeilCB.setToolTipText("Move camera when tracking target"); |
---|
790 | 812 | oeilCB.addItemListener(this); |
---|
791 | 813 | |
---|
| 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 | + { |
---|
792 | 820 | panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints); |
---|
793 | 821 | lookAtCB.setToolTipText("Look-at target"); |
---|
794 | 822 | lookAtCB.addItemListener(this); |
---|
| 823 | + } |
---|
795 | 824 | |
---|
796 | 825 | } |
---|
797 | 826 | |
---|
.. | .. |
---|
806 | 835 | void EditObject(Object3D obj) |
---|
807 | 836 | { |
---|
808 | 837 | 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 | + |
---|
809 | 846 | radioButton.SetObject(obj); |
---|
810 | 847 | radioButton.layout = sevenButton; |
---|
811 | 848 | radioButton.SetCamera(cameraView.renderCamera, false); |
---|
.. | .. |
---|
817 | 854 | |
---|
818 | 855 | void SetupViews(ObjEditor oe) |
---|
819 | 856 | { |
---|
| 857 | + theFrame = this; |
---|
| 858 | + |
---|
820 | 859 | oe.SetupViews(); |
---|
821 | 860 | |
---|
822 | 861 | System.out.println("SetupViews"); |
---|
.. | .. |
---|
840 | 879 | JCheckBox speakerCameraCB; |
---|
841 | 880 | JCheckBox speakerFocusCB; |
---|
842 | 881 | JCheckBox debugCB; |
---|
| 882 | + |
---|
843 | 883 | JCheckBox oeilCB; |
---|
| 884 | + JCheckBox shadowCB; |
---|
844 | 885 | JCheckBox lookAtCB; |
---|
845 | 886 | |
---|
846 | 887 | // static int COLOR = 1; |
---|
.. | .. |
---|
943 | 984 | else if(e.getSource() == oeilCB) |
---|
944 | 985 | { |
---|
945 | 986 | cameraView.ToggleOeil(); |
---|
| 987 | + } |
---|
| 988 | + else if(e.getSource() == shadowCB) |
---|
| 989 | + { |
---|
| 990 | + Globals.COMPUTESHADOWWHENLIVE ^= true; |
---|
946 | 991 | } |
---|
947 | 992 | else if(e.getSource() == lookAtCB) |
---|
948 | 993 | { |
---|
.. | .. |
---|
1428 | 1473 | shadow.material = new cMaterial(obj.material); |
---|
1429 | 1474 | shadow.material.diffuse = 0.0001f; |
---|
1430 | 1475 | shadow.material.specular = 0.0001f; |
---|
| 1476 | + //shadow.projectedVertices[1].x = 300; |
---|
1431 | 1477 | |
---|
1432 | 1478 | makeSomething(shadow); |
---|
1433 | 1479 | } |
---|
.. | .. |
---|
1977 | 2023 | if (source == dumpItem) |
---|
1978 | 2024 | { |
---|
1979 | 2025 | 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(); |
---|
1980 | 2038 | } else |
---|
1981 | 2039 | if (source == undoButton) |
---|
1982 | 2040 | { |
---|
.. | .. |
---|
2899 | 2957 | bigThree.ClearUI(); |
---|
2900 | 2958 | bigThree.add(centralPanel); |
---|
2901 | 2959 | 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 | + |
---|
2902 | 2978 | } else |
---|
2903 | 2979 | if (source == threeButton) |
---|
2904 | 2980 | { |
---|
.. | .. |
---|
2935 | 3011 | bigThree.add(centralPanel); |
---|
2936 | 3012 | bigThree.add(XYZPanel); |
---|
2937 | 3013 | bigThree.FlushUI(); |
---|
| 3014 | + |
---|
| 3015 | + cameraView.requestFocusInWindow(); |
---|
2938 | 3016 | } else |
---|
2939 | 3017 | if (source == fourButton) |
---|
2940 | 3018 | { |
---|
.. | .. |
---|
2970 | 3048 | bigThree.ClearUI(); |
---|
2971 | 3049 | bigThree.add(scenePanel); |
---|
2972 | 3050 | bigThree.FlushUI(); |
---|
| 3051 | + |
---|
| 3052 | + cameraView.requestFocusInWindow(); |
---|
2973 | 3053 | } else |
---|
2974 | 3054 | if (source == sixButton) |
---|
2975 | 3055 | { |
---|
.. | .. |
---|
3006 | 3086 | bigThree.add(scenePanel); |
---|
3007 | 3087 | bigThree.add(centralPanel); |
---|
3008 | 3088 | bigThree.FlushUI(); |
---|
| 3089 | + |
---|
| 3090 | + cameraView.requestFocusInWindow(); |
---|
3009 | 3091 | } else |
---|
3010 | 3092 | if (source == sevenButton) |
---|
3011 | 3093 | { |
---|
.. | .. |
---|
3043 | 3125 | bigThree.add(centralPanel); |
---|
3044 | 3126 | bigThree.add(XYZPanel); |
---|
3045 | 3127 | bigThree.FlushUI(); |
---|
| 3128 | + |
---|
| 3129 | + cameraView.requestFocusInWindow(); |
---|
3046 | 3130 | } else |
---|
3047 | 3131 | if (source == rootButton) |
---|
3048 | 3132 | { |
---|
.. | .. |
---|
3054 | 3138 | EditObject(obj); |
---|
3055 | 3139 | } |
---|
3056 | 3140 | |
---|
| 3141 | + cameraView.requestFocusInWindow(); |
---|
3057 | 3142 | refreshContents(true); |
---|
3058 | 3143 | } else |
---|
3059 | 3144 | if (source == closeButton) |
---|
.. | .. |
---|
3063 | 3148 | for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
3064 | 3149 | { |
---|
3065 | 3150 | ab = (cRadio)e.nextElement(); |
---|
3066 | | - if(ab.getModel().isSelected() && ab.GetObject() != client) |
---|
| 3151 | + if (ab.getModel().isSelected() && ab.GetObject() != client) |
---|
3067 | 3152 | { |
---|
| 3153 | + // Patch to avoid bug with transparency. |
---|
| 3154 | + if (!ab.hadMaterial) |
---|
| 3155 | + { |
---|
| 3156 | + ab.object.material = null; |
---|
| 3157 | + } |
---|
| 3158 | + |
---|
3068 | 3159 | buttonGroup.remove(ab); |
---|
3069 | 3160 | radioPanel.remove(ab); |
---|
3070 | 3161 | |
---|
.. | .. |
---|
3075 | 3166 | break; |
---|
3076 | 3167 | } |
---|
3077 | 3168 | } |
---|
| 3169 | + |
---|
| 3170 | + cameraView.requestFocusInWindow(); |
---|
3078 | 3171 | refreshContents(true); |
---|
3079 | 3172 | } else |
---|
3080 | 3173 | if (source == editItem || source == editButton) |
---|
.. | .. |
---|
3179 | 3272 | } |
---|
3180 | 3273 | |
---|
3181 | 3274 | // fix "+" issue |
---|
3182 | | - group.editWindow = this; |
---|
| 3275 | + //group.editWindow = this; |
---|
3183 | 3276 | |
---|
3184 | 3277 | /* |
---|
3185 | 3278 | currentLayout = radio.layout; |
---|
.. | .. |
---|
3192 | 3285 | //group.parent = null; // ROOT |
---|
3193 | 3286 | //group.attributes = -1; |
---|
3194 | 3287 | ResetModel(); |
---|
| 3288 | + |
---|
| 3289 | + cameraView.requestFocusInWindow(); |
---|
3195 | 3290 | refreshContents(true); |
---|
3196 | 3291 | } else if (event.getSource() == editCameraItem) |
---|
3197 | 3292 | { |
---|
.. | .. |
---|
3215 | 3310 | } |
---|
3216 | 3311 | |
---|
3217 | 3312 | boolean useclient = false; |
---|
3218 | | - cRadio radio; |
---|
3219 | 3313 | |
---|
3220 | 3314 | void ToggleRoot() |
---|
3221 | 3315 | { |
---|
.. | .. |
---|
5219 | 5313 | cButton clearpanelButton; |
---|
5220 | 5314 | cButton unselectButton; |
---|
5221 | 5315 | |
---|
5222 | | - cButton saveButton; |
---|
| 5316 | + cButton minButton; |
---|
| 5317 | + cButton maxButton; |
---|
| 5318 | + cButton fullButton; |
---|
5223 | 5319 | cButton undoButton; |
---|
5224 | 5320 | cButton redoButton; |
---|
| 5321 | + cButton saveButton; |
---|
5225 | 5322 | cButton oneStepButton; |
---|
5226 | 5323 | |
---|
5227 | 5324 | cButton screenfitButton; |
---|
.. | .. |
---|
5234 | 5331 | cButton closeButton; |
---|
5235 | 5332 | |
---|
5236 | 5333 | 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; |
---|
5245 | 5334 | |
---|
5246 | 5335 | // |
---|
5247 | 5336 | //Composite |
---|