.. | .. |
---|
150 | 150 | |
---|
151 | 151 | void SetupMenu2(GroupEditor oe) |
---|
152 | 152 | { |
---|
| 153 | + oe.jTree = new cTree(); |
---|
| 154 | + |
---|
153 | 155 | Menu menu; |
---|
154 | 156 | oe.menuBar.add(menu = new Menu("Edit")); |
---|
155 | 157 | //editItem = menu.add(new MenuItem("Edit")); |
---|
.. | .. |
---|
160 | 162 | // redoItem = menu.add(new MenuItem("Redo")); |
---|
161 | 163 | // redoItem.addActionListener(this); |
---|
162 | 164 | // menu.add("-"); |
---|
163 | | - duplicateItem = menu.add(new MenuItem("Duplicate")); |
---|
| 165 | + duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); |
---|
164 | 166 | duplicateItem.addActionListener(this); |
---|
165 | 167 | cloneItem = menu.add(new MenuItem("Clone")); |
---|
166 | 168 | cloneItem.addActionListener(this); |
---|
.. | .. |
---|
176 | 178 | copyItem.addActionListener(this); |
---|
177 | 179 | pasteItem = menu.add(new MenuItem("Paste")); |
---|
178 | 180 | pasteItem.addActionListener(this); |
---|
179 | | - menu.add("-"); |
---|
180 | 181 | |
---|
181 | 182 | menu.add("-"); |
---|
182 | 183 | pasteIntoItem = menu.add(new MenuItem("Paste into")); |
---|
.. | .. |
---|
246 | 247 | |
---|
247 | 248 | cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug")); |
---|
248 | 249 | toggleDebugItem.addItemListener(this); |
---|
249 | | - toggleDebugItem.setState(CameraPane.DEBUG); |
---|
| 250 | + toggleDebugItem.setState(Globals.DEBUG); |
---|
250 | 251 | |
---|
251 | 252 | cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum")); |
---|
252 | 253 | toggleFrustumItem.addItemListener(this); |
---|
.. | .. |
---|
335 | 336 | frontItem.addActionListener(this); |
---|
336 | 337 | compositeItem = menu.add(new MenuItem("Composite")); |
---|
337 | 338 | compositeItem.addActionListener(this); |
---|
| 339 | + |
---|
| 340 | + if (Globals.ADVANCED) |
---|
| 341 | + { |
---|
338 | 342 | hideItem = menu.add(new MenuItem("Hidden Group")); |
---|
339 | 343 | hideItem.addActionListener(this); |
---|
| 344 | + } |
---|
340 | 345 | ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
341 | 346 | ungroupItem.addActionListener(this); |
---|
| 347 | + |
---|
342 | 348 | menu.add("-"); |
---|
| 349 | + |
---|
343 | 350 | randomItem = menu.add(new MenuItem("Switch node")); |
---|
344 | 351 | randomItem.addActionListener(this); |
---|
| 352 | + if (Globals.ADVANCED) |
---|
| 353 | + { |
---|
345 | 354 | switchGeoItem = menu.add(new MenuItem("Switch Geometry")); |
---|
346 | 355 | switchGeoItem.addActionListener(this); |
---|
347 | 356 | switchTransfoItem = menu.add(new MenuItem("Switch Transform")); |
---|
.. | .. |
---|
349 | 358 | morphItem = menu.add(new MenuItem("Morph Group")); |
---|
350 | 359 | morphItem.addActionListener(this); |
---|
351 | 360 | |
---|
352 | | - if (Globals.ADVANCED) |
---|
353 | | - { |
---|
354 | 361 | menu.add("-"); |
---|
355 | 362 | physicsItem = menu.add(new MenuItem("Physics")); |
---|
356 | 363 | physicsItem.addActionListener(this); |
---|
.. | .. |
---|
369 | 376 | billboardItem.addActionListener(this); |
---|
370 | 377 | csgItem = menu.add(new MenuItem("CSG")); |
---|
371 | 378 | csgItem.addActionListener(this); |
---|
372 | | - shadowXItem = menu.add(new MenuItem("Shadow X")); |
---|
| 379 | + shadowXItem = menu.add(new MenuItem("Shadow Red")); |
---|
373 | 380 | shadowXItem.addActionListener(this); |
---|
374 | | - shadowYItem = menu.add(new MenuItem("Shadow Y")); |
---|
| 381 | + shadowYItem = menu.add(new MenuItem("Shadow Green")); |
---|
375 | 382 | shadowYItem.addActionListener(this); |
---|
376 | | - shadowZItem = menu.add(new MenuItem("Shadow Z")); |
---|
| 383 | + shadowZItem = menu.add(new MenuItem("Shadow Blue")); |
---|
377 | 384 | shadowZItem.addActionListener(this); |
---|
378 | 385 | if (Globals.ADVANCED) |
---|
379 | 386 | { |
---|
.. | .. |
---|
535 | 542 | |
---|
536 | 543 | void SetupUI2(ObjEditor oe) |
---|
537 | 544 | { |
---|
| 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 | + |
---|
538 | 557 | //new Exception().printStackTrace(); |
---|
539 | 558 | |
---|
540 | 559 | oe.radioPanel = new JPanel(new GridBagLayout()); |
---|
.. | .. |
---|
565 | 584 | */ |
---|
566 | 585 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
567 | 586 | |
---|
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); |
---|
569 | 600 | undoButton.setToolTipText("Undo changes"); |
---|
570 | 601 | undoButton.addActionListener(this); |
---|
571 | 602 | |
---|
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); |
---|
573 | 604 | redoButton.setToolTipText("Redo changes"); |
---|
574 | 605 | redoButton.addActionListener(this); |
---|
575 | 606 | |
---|
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); |
---|
577 | 608 | saveButton.setToolTipText("Save changes"); |
---|
578 | 609 | saveButton.addActionListener(this); |
---|
579 | 610 | |
---|
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); |
---|
581 | 612 | liveCB.setToolTipText("Enable animation"); |
---|
582 | 613 | liveCB.addItemListener(this); |
---|
583 | 614 | |
---|
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); |
---|
585 | 616 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
586 | 617 | oneStepButton.addActionListener(this); |
---|
587 | 618 | |
---|
588 | | - oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints); |
---|
| 619 | + oe.toolboxPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
589 | 620 | fastCB.setToolTipText("Fast mode"); |
---|
590 | 621 | fastCB.addItemListener(this); |
---|
591 | 622 | |
---|
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); |
---|
593 | 626 | trackCB.setToolTipText("Enable tracking"); |
---|
594 | 627 | trackCB.addItemListener(this); |
---|
595 | 628 | |
---|
596 | | - oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 629 | + oe.toolboxPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
597 | 630 | screenfitButton.setToolTipText("Screen fit"); |
---|
598 | 631 | screenfitButton.addActionListener(this); |
---|
599 | 632 | |
---|
.. | .. |
---|
607 | 640 | snapobjectButton.setToolTipText("Snap Object"); |
---|
608 | 641 | } |
---|
609 | 642 | |
---|
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"); |
---|
612 | 645 | flashSelectionButton.addActionListener(this); |
---|
613 | 646 | |
---|
614 | | - oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
| 647 | + //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
615 | 648 | |
---|
616 | | - oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 649 | + oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
617 | 650 | twoButton.setToolTipText("Show center view only"); |
---|
618 | 651 | 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); |
---|
620 | 655 | fourButton.addActionListener(this); |
---|
621 | 656 | 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); |
---|
623 | 658 | sixButton.setToolTipText("2-column layout left"); |
---|
624 | 659 | 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); |
---|
626 | 661 | threeButton.setToolTipText("2-column layout right"); |
---|
627 | 662 | 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); |
---|
629 | 664 | sevenButton.setToolTipText("3-column layout"); |
---|
630 | 665 | sevenButton.addActionListener(this); |
---|
631 | 666 | // |
---|
632 | 667 | |
---|
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); |
---|
634 | 669 | rootButton.setToolTipText("Edit selection in new tab"); |
---|
635 | 670 | rootButton.addActionListener(this); |
---|
636 | 671 | |
---|
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); |
---|
638 | 673 | closeButton.setToolTipText("Close tab"); |
---|
639 | 674 | closeButton.addActionListener(this); |
---|
640 | 675 | //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); |
---|
641 | 676 | //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(); |
---|
644 | 692 | |
---|
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); |
---|
646 | 726 | editButton.setToolTipText("Edit selection"); |
---|
647 | 727 | editButton.addActionListener(this); |
---|
648 | 728 | |
---|
649 | | - commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 729 | + editCommandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
650 | 730 | uneditButton.setToolTipText("Unedit selection"); |
---|
651 | 731 | uneditButton.addActionListener(this); |
---|
652 | 732 | |
---|
653 | | - commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
| 733 | + editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
654 | 734 | allParamsButton.setToolTipText("Edit all params"); |
---|
655 | 735 | allParamsButton.addActionListener(this); |
---|
656 | 736 | |
---|
657 | | - commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 737 | + editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
658 | 738 | clearPanelButton.setToolTipText("Clear edit panel"); |
---|
659 | 739 | clearPanelButton.addActionListener(this); |
---|
660 | 740 | |
---|
661 | | - commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 741 | + editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
662 | 742 | unselectButton.setToolTipText("Unselect"); |
---|
663 | 743 | unselectButton.addActionListener(this); |
---|
664 | 744 | |
---|
665 | | - commandsPanel.preferredHeight = 1; |
---|
| 745 | + editCommandsPanel.preferredHeight = 1; |
---|
666 | 746 | |
---|
667 | | - oe.treePanel.add(commandsPanel); |
---|
668 | | - oe.treePanel.Return(); |
---|
| 747 | +// oe.treePanel.add(commandsPanel); |
---|
| 748 | +// oe.treePanel.Return(); |
---|
669 | 749 | |
---|
670 | 750 | // oe.aConstraints.gridx += 1; |
---|
671 | 751 | // oe.aConstraints.weighty = 0; |
---|
.. | .. |
---|
682 | 762 | |
---|
683 | 763 | JScrollPane jSP; |
---|
684 | 764 | //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); |
---|
686 | 766 | ResetModel(); |
---|
687 | 767 | |
---|
688 | 768 | oe.treePanel.add(jSPPanel); |
---|
.. | .. |
---|
787 | 867 | // debugCB.addItemListener(this); |
---|
788 | 868 | |
---|
789 | 869 | panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints); |
---|
| 870 | + oeilCB.setToolTipText("Move camera when tracking target"); |
---|
790 | 871 | oeilCB.addItemListener(this); |
---|
791 | 872 | |
---|
| 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 | + { |
---|
792 | 883 | panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints); |
---|
793 | 884 | lookAtCB.setToolTipText("Look-at target"); |
---|
794 | 885 | lookAtCB.addItemListener(this); |
---|
| 886 | + } |
---|
795 | 887 | |
---|
796 | 888 | } |
---|
797 | 889 | |
---|
.. | .. |
---|
806 | 898 | void EditObject(Object3D obj) |
---|
807 | 899 | { |
---|
808 | 900 | 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 | + |
---|
809 | 909 | radioButton.SetObject(obj); |
---|
810 | 910 | radioButton.layout = sevenButton; |
---|
811 | 911 | radioButton.SetCamera(cameraView.renderCamera, false); |
---|
.. | .. |
---|
817 | 917 | |
---|
818 | 918 | void SetupViews(ObjEditor oe) |
---|
819 | 919 | { |
---|
| 920 | + theFrame = this; |
---|
| 921 | + |
---|
820 | 922 | oe.SetupViews(); |
---|
821 | 923 | |
---|
822 | 924 | System.out.println("SetupViews"); |
---|
.. | .. |
---|
825 | 927 | /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this); |
---|
826 | 928 | } |
---|
827 | 929 | |
---|
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; |
---|
839 | 941 | // 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; |
---|
845 | 950 | |
---|
846 | 951 | // static int COLOR = 1; |
---|
847 | 952 | // static int MATERIAL = 2; |
---|
.. | .. |
---|
849 | 954 | |
---|
850 | 955 | int dropAttributes = Object3D.COLOR | Object3D.MATERIAL; |
---|
851 | 956 | |
---|
852 | | - JCheckBox colorCB; |
---|
853 | | - JCheckBox materialCB; |
---|
854 | | - JCheckBox textureCB; |
---|
| 957 | + cCheckBox colorCB; |
---|
| 958 | + cCheckBox materialCB; |
---|
| 959 | + cCheckBox textureCB; |
---|
855 | 960 | |
---|
856 | 961 | public void itemStateChanged(ItemEvent e) |
---|
857 | 962 | { |
---|
.. | .. |
---|
944 | 1049 | { |
---|
945 | 1050 | cameraView.ToggleOeil(); |
---|
946 | 1051 | } |
---|
| 1052 | + else if(e.getSource() == shadowCB) |
---|
| 1053 | + { |
---|
| 1054 | + Globals.COMPUTESHADOWWHENLIVE ^= true; |
---|
| 1055 | + } |
---|
| 1056 | + else if(e.getSource() == autosaveCB) |
---|
| 1057 | + { |
---|
| 1058 | + Globals.SAVEONMAKE ^= true; |
---|
| 1059 | + } |
---|
947 | 1060 | else if(e.getSource() == lookAtCB) |
---|
948 | 1061 | { |
---|
949 | 1062 | cameraView.ToggleLookAt(); |
---|
.. | .. |
---|
960 | 1073 | |
---|
961 | 1074 | /**/ |
---|
962 | 1075 | //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(); |
---|
964 | 1078 | if ((path == null) || (path.getPathCount() <= 1)) { |
---|
965 | 1079 | // We can't move the root node or an empty selection |
---|
966 | 1080 | return; |
---|
.. | .. |
---|
1084 | 1198 | return; |
---|
1085 | 1199 | } |
---|
1086 | 1200 | |
---|
1087 | | - if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK) |
---|
1088 | | - { |
---|
| 1201 | +// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK) |
---|
| 1202 | +// { |
---|
1089 | 1203 | loadClipboard(true); |
---|
1090 | 1204 | objEditor.jTree.setSelectionPath(destinationPath); |
---|
1091 | 1205 | 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 | +// } |
---|
1097 | 1211 | } |
---|
1098 | 1212 | public void dropActionChanged(DropTargetDragEvent dtde) |
---|
1099 | 1213 | // Called if the user has modified the current drop gesture |
---|
.. | .. |
---|
1428 | 1542 | shadow.material = new cMaterial(obj.material); |
---|
1429 | 1543 | shadow.material.diffuse = 0.0001f; |
---|
1430 | 1544 | shadow.material.specular = 0.0001f; |
---|
| 1545 | + //shadow.projectedVertices[1].x = 300; |
---|
1431 | 1546 | |
---|
1432 | 1547 | makeSomething(shadow); |
---|
1433 | 1548 | } |
---|
.. | .. |
---|
1684 | 1799 | objEditor.cameraView.renderCamera.setAim(v2, v1); |
---|
1685 | 1800 | objEditor.cameraView.repaint(); |
---|
1686 | 1801 | } else |
---|
1687 | | - if (source == rectoidItem) |
---|
| 1802 | + if (source == rectoidItem || source == boxButton) |
---|
1688 | 1803 | { |
---|
1689 | 1804 | makeSomething(new Box()); |
---|
1690 | 1805 | } else |
---|
1691 | | - if (source == particleItem) |
---|
| 1806 | + if (source == particleItem || source == particlesButton) |
---|
1692 | 1807 | { |
---|
1693 | 1808 | ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType); |
---|
1694 | 1809 | ParticleController particleController = new ParticleController(particleGeom); |
---|
.. | .. |
---|
1767 | 1882 | |
---|
1768 | 1883 | makeSomething(obj); |
---|
1769 | 1884 | } else |
---|
1770 | | - if (source == gridItem) |
---|
| 1885 | + if (source == gridItem || source == gridButton) |
---|
1771 | 1886 | { |
---|
1772 | 1887 | makeSomething(new Grid()); |
---|
1773 | 1888 | } else |
---|
1774 | | - if (source == ellipsoidItem) |
---|
| 1889 | + if (source == ellipsoidItem || source == sphereButton) |
---|
1775 | 1890 | { |
---|
1776 | 1891 | makeSomething(new Sphere()); |
---|
1777 | 1892 | } else |
---|
1778 | | - if (source == coneItem) |
---|
| 1893 | + if (source == coneItem || source == coneButton) |
---|
1779 | 1894 | { |
---|
1780 | 1895 | makeSomething(new Cone()); |
---|
1781 | 1896 | } else |
---|
1782 | | - if (source == torusItem) |
---|
| 1897 | + if (source == torusItem || source == torusButton) |
---|
1783 | 1898 | { |
---|
1784 | 1899 | makeSomething(new Torus()); |
---|
1785 | 1900 | } else |
---|
1786 | | - if (source == superItem) |
---|
| 1901 | + if (source == superItem || source == superButton) |
---|
1787 | 1902 | { |
---|
1788 | 1903 | makeSomething(new Superellipsoid()); |
---|
1789 | 1904 | } else |
---|
1790 | | - if (source == kleinItem) |
---|
| 1905 | + if (source == kleinItem || source == kleinButton) |
---|
1791 | 1906 | { |
---|
1792 | 1907 | makeSomething(new Klein()); |
---|
1793 | 1908 | } else |
---|
.. | .. |
---|
1807 | 1922 | { |
---|
1808 | 1923 | makeSomething(new BezierSurface()); |
---|
1809 | 1924 | } else |
---|
1810 | | - if (source == overlayItem) |
---|
| 1925 | + if (source == overlayItem || source == overlayButton) |
---|
1811 | 1926 | { |
---|
1812 | 1927 | /* |
---|
1813 | 1928 | Object3D obj = new BezierSurface(5,8); |
---|
.. | .. |
---|
1855 | 1970 | s.setup(); |
---|
1856 | 1971 | makeSomething(s); |
---|
1857 | 1972 | } else |
---|
1858 | | - if (source == lightItem) |
---|
| 1973 | + if (source == lightItem || source == lightButton) |
---|
1859 | 1974 | { |
---|
1860 | 1975 | makeSomething(new Light()); |
---|
1861 | 1976 | } else |
---|
.. | .. |
---|
1977 | 2092 | if (source == dumpItem) |
---|
1978 | 2093 | { |
---|
1979 | 2094 | 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(); |
---|
1980 | 2107 | } else |
---|
1981 | 2108 | if (source == undoButton) |
---|
1982 | 2109 | { |
---|
.. | .. |
---|
2529 | 2656 | { |
---|
2530 | 2657 | CastShadow(2); |
---|
2531 | 2658 | } else |
---|
2532 | | - if (source == ungroupItem) |
---|
| 2659 | + if (source == ungroupItem || source == ungroupButton) |
---|
2533 | 2660 | { |
---|
2534 | 2661 | //ungroup(); |
---|
2535 | 2662 | for (int i=0; i<group.selection.size(); i++) |
---|
.. | .. |
---|
2867 | 2994 | if (source == twoButton) |
---|
2868 | 2995 | { |
---|
2869 | 2996 | radio.layout = twoButton; |
---|
| 2997 | + |
---|
| 2998 | + if (CameraPane.FULLSCREEN) |
---|
| 2999 | + fullscreenLayout = radio.layout; |
---|
| 3000 | + |
---|
2870 | 3001 | // bug |
---|
2871 | 3002 | //gridPanel.setDividerLocation(1.0); |
---|
2872 | 3003 | //bigPanel.setDividerLocation(0.0); |
---|
.. | .. |
---|
2899 | 3030 | bigThree.ClearUI(); |
---|
2900 | 3031 | bigThree.add(centralPanel); |
---|
2901 | 3032 | 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 | + |
---|
2902 | 3051 | } else |
---|
2903 | 3052 | if (source == threeButton) |
---|
2904 | 3053 | { |
---|
2905 | 3054 | radio.layout = threeButton; |
---|
| 3055 | + |
---|
| 3056 | + if (CameraPane.FULLSCREEN) |
---|
| 3057 | + fullscreenLayout = radio.layout; |
---|
2906 | 3058 | |
---|
2907 | 3059 | // bigThree.remove(scenePanel); |
---|
2908 | 3060 | // bigThree.remove(centralPanel); |
---|
.. | .. |
---|
2935 | 3087 | bigThree.add(centralPanel); |
---|
2936 | 3088 | bigThree.add(XYZPanel); |
---|
2937 | 3089 | bigThree.FlushUI(); |
---|
| 3090 | + |
---|
| 3091 | + cameraView.requestFocusInWindow(); |
---|
2938 | 3092 | } else |
---|
2939 | 3093 | if (source == fourButton) |
---|
2940 | 3094 | { |
---|
2941 | 3095 | radio.layout = fourButton; |
---|
| 3096 | + |
---|
| 3097 | + if (CameraPane.FULLSCREEN) |
---|
| 3098 | + fullscreenLayout = radio.layout; |
---|
2942 | 3099 | |
---|
2943 | 3100 | // bigThree.remove(scenePanel); |
---|
2944 | 3101 | // bigThree.remove(centralPanel); |
---|
.. | .. |
---|
2970 | 3127 | bigThree.ClearUI(); |
---|
2971 | 3128 | bigThree.add(scenePanel); |
---|
2972 | 3129 | bigThree.FlushUI(); |
---|
| 3130 | + |
---|
| 3131 | + cameraView.requestFocusInWindow(); |
---|
2973 | 3132 | } else |
---|
2974 | 3133 | if (source == sixButton) |
---|
2975 | 3134 | { |
---|
2976 | 3135 | radio.layout = sixButton; |
---|
| 3136 | + |
---|
| 3137 | + if (CameraPane.FULLSCREEN) |
---|
| 3138 | + fullscreenLayout = radio.layout; |
---|
2977 | 3139 | |
---|
2978 | 3140 | // bigThree.remove(scenePanel); |
---|
2979 | 3141 | // bigThree.remove(centralPanel); |
---|
.. | .. |
---|
3006 | 3168 | bigThree.add(scenePanel); |
---|
3007 | 3169 | bigThree.add(centralPanel); |
---|
3008 | 3170 | bigThree.FlushUI(); |
---|
| 3171 | + |
---|
| 3172 | + cameraView.requestFocusInWindow(); |
---|
3009 | 3173 | } else |
---|
3010 | 3174 | if (source == sevenButton) |
---|
3011 | 3175 | { |
---|
3012 | 3176 | radio.layout = sevenButton; |
---|
| 3177 | + |
---|
| 3178 | + if (CameraPane.FULLSCREEN) |
---|
| 3179 | + fullscreenLayout = radio.layout; |
---|
3013 | 3180 | |
---|
3014 | 3181 | // bigThree.remove(scenePanel); |
---|
3015 | 3182 | // bigThree.remove(centralPanel); |
---|
.. | .. |
---|
3043 | 3210 | bigThree.add(centralPanel); |
---|
3044 | 3211 | bigThree.add(XYZPanel); |
---|
3045 | 3212 | bigThree.FlushUI(); |
---|
| 3213 | + |
---|
| 3214 | + cameraView.requestFocusInWindow(); |
---|
3046 | 3215 | } else |
---|
3047 | 3216 | if (source == rootButton) |
---|
3048 | 3217 | { |
---|
.. | .. |
---|
3054 | 3223 | EditObject(obj); |
---|
3055 | 3224 | } |
---|
3056 | 3225 | |
---|
| 3226 | + cameraView.requestFocusInWindow(); |
---|
3057 | 3227 | refreshContents(true); |
---|
3058 | 3228 | } else |
---|
3059 | 3229 | if (source == closeButton) |
---|
.. | .. |
---|
3063 | 3233 | for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
3064 | 3234 | { |
---|
3065 | 3235 | ab = (cRadio)e.nextElement(); |
---|
3066 | | - if(ab.getModel().isSelected() && ab.GetObject() != client) |
---|
| 3236 | + if (ab.getModel().isSelected() && ab.GetObject() != client) |
---|
3067 | 3237 | { |
---|
| 3238 | + // Patch to avoid bug with transparency. |
---|
| 3239 | + if (!ab.hadMaterial) |
---|
| 3240 | + { |
---|
| 3241 | + ab.object.material = null; |
---|
| 3242 | + } |
---|
| 3243 | + |
---|
3068 | 3244 | buttonGroup.remove(ab); |
---|
3069 | 3245 | radioPanel.remove(ab); |
---|
3070 | 3246 | |
---|
3071 | | - ab.GetObject().editWindow = null; |
---|
| 3247 | + //ab.GetObject().editWindow = null; |
---|
| 3248 | + ab.GetObject().manipWindow = null; |
---|
3072 | 3249 | // ab.GetObject().objectUI = null; // ????????? |
---|
3073 | 3250 | |
---|
3074 | 3251 | ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick(); |
---|
3075 | 3252 | break; |
---|
3076 | 3253 | } |
---|
3077 | 3254 | } |
---|
| 3255 | + |
---|
| 3256 | + cameraView.requestFocusInWindow(); |
---|
3078 | 3257 | refreshContents(true); |
---|
3079 | 3258 | } else |
---|
3080 | 3259 | if (source == editItem || source == editButton) |
---|
.. | .. |
---|
3179 | 3358 | } |
---|
3180 | 3359 | |
---|
3181 | 3360 | // fix "+" issue |
---|
3182 | | - group.editWindow = this; |
---|
| 3361 | + //group.editWindow = this; |
---|
| 3362 | + group.manipWindow = this; |
---|
3183 | 3363 | |
---|
3184 | 3364 | /* |
---|
3185 | 3365 | currentLayout = radio.layout; |
---|
.. | .. |
---|
3192 | 3372 | //group.parent = null; // ROOT |
---|
3193 | 3373 | //group.attributes = -1; |
---|
3194 | 3374 | ResetModel(); |
---|
| 3375 | + |
---|
| 3376 | + cameraView.requestFocusInWindow(); |
---|
3195 | 3377 | refreshContents(true); |
---|
3196 | 3378 | } else if (event.getSource() == editCameraItem) |
---|
3197 | 3379 | { |
---|
.. | .. |
---|
3215 | 3397 | } |
---|
3216 | 3398 | |
---|
3217 | 3399 | boolean useclient = false; |
---|
3218 | | - cRadio radio; |
---|
3219 | 3400 | |
---|
3220 | 3401 | void ToggleRoot() |
---|
3221 | 3402 | { |
---|
.. | .. |
---|
4264 | 4445 | { |
---|
4265 | 4446 | //System.out.println("edit : " + objectPanel.indexOfTab("Material")); |
---|
4266 | 4447 | //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false); |
---|
4267 | | - objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
| 4448 | + //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
4268 | 4449 | |
---|
4269 | 4450 | Object3D elem = (Object3D)group.selection.elementAt(i); |
---|
4270 | 4451 | if(elem != group || !newWindow) |
---|
.. | .. |
---|
4501 | 4682 | |
---|
4502 | 4683 | if (cut) |
---|
4503 | 4684 | { |
---|
| 4685 | + if (Globals.SAVEONMAKE) |
---|
4504 | 4686 | Save(); |
---|
4505 | 4687 | //int indices[] = jList.getSelectedIndices(); |
---|
4506 | 4688 | //for (int i = indices.length - 1; i >= 0; i--) |
---|
.. | .. |
---|
5219 | 5401 | cButton clearpanelButton; |
---|
5220 | 5402 | cButton unselectButton; |
---|
5221 | 5403 | |
---|
5222 | | - cButton saveButton; |
---|
| 5404 | + cButton minButton; |
---|
| 5405 | + cButton maxButton; |
---|
| 5406 | + cButton fullButton; |
---|
5223 | 5407 | cButton undoButton; |
---|
5224 | 5408 | cButton redoButton; |
---|
| 5409 | + cButton saveButton; |
---|
5225 | 5410 | 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; |
---|
5226 | 5426 | |
---|
5227 | 5427 | cButton screenfitButton; |
---|
5228 | 5428 | cButton screenfitpointButton; |
---|
.. | .. |
---|
5234 | 5434 | cButton closeButton; |
---|
5235 | 5435 | |
---|
5236 | 5436 | 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 | 5437 | |
---|
5246 | 5438 | // |
---|
5247 | 5439 | //Composite |
---|
.. | .. |
---|
5256 | 5448 | private MenuItem cutItem; |
---|
5257 | 5449 | private MenuItem undoItem; |
---|
5258 | 5450 | private MenuItem redoItem; |
---|
5259 | | - private MenuItem duplicateItem; |
---|
| 5451 | + private JMenuItem duplicateItem; |
---|
5260 | 5452 | private MenuItem cloneItem; |
---|
5261 | 5453 | private MenuItem cloneSupportItem; |
---|
5262 | 5454 | private MenuItem overwriteGeoItem; |
---|