.. | .. |
---|
16 | 16 | //import buoy.widget.BFileChooser; |
---|
17 | 17 | |
---|
18 | 18 | class GroupEditor extends ObjEditor implements //iParse, //iCallBack, |
---|
| 19 | + Grafreed.iResourceCallBack, |
---|
19 | 20 | ObjectUI, |
---|
20 | 21 | Runnable, |
---|
21 | 22 | ActionListener, |
---|
.. | .. |
---|
28 | 29 | { |
---|
29 | 30 | cButton skyboxButton; |
---|
30 | 31 | final String path = "cubemaps/" + f + "-skyboxes/" + s; |
---|
31 | | - row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF)); |
---|
| 32 | + row.add(skyboxButton = GetButton(path + "/preview.jpg", !Globals.NIMBUSLAF)); |
---|
32 | 33 | //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF)); |
---|
33 | | - skyboxButton.setToolTipText(s); |
---|
| 34 | + skyboxButton.setToolTipText(s.equals("") ? "No background" : s); |
---|
34 | 35 | skyboxButton.addActionListener(new ActionListener() |
---|
35 | 36 | { |
---|
36 | 37 | @Override |
---|
.. | .. |
---|
41 | 42 | }); |
---|
42 | 43 | } |
---|
43 | 44 | |
---|
| 45 | + public void AddTextureButton(String f, String c, final String t, int count, cGridBag row) |
---|
| 46 | + { |
---|
| 47 | + cButton textureButton; |
---|
| 48 | + final String path = "textures/" + f + "/" + c + "/"; // + t; |
---|
| 49 | + row.add(textureButton = GetButton(path + "icons/" + t, !Globals.NIMBUSLAF)); |
---|
| 50 | + textureButton.setToolTipText(c + count); |
---|
| 51 | + textureButton.addActionListener(new ActionListener() |
---|
| 52 | + { |
---|
| 53 | + @Override |
---|
| 54 | + public void actionPerformed(ActionEvent e) |
---|
| 55 | + { |
---|
| 56 | + ChangeTexture(path + t); |
---|
| 57 | + } |
---|
| 58 | + }); |
---|
| 59 | + } |
---|
| 60 | + |
---|
44 | 61 | public void AddSkyboxTab0(JTabbedPane skyboxpanel) |
---|
45 | 62 | { |
---|
46 | 63 | cGridBag tab0 = new cGridBag().setVertical(true); |
---|
.. | .. |
---|
56 | 73 | cGridBag row5 = new cGridBag(); |
---|
57 | 74 | cGridBag row6 = new cGridBag(); |
---|
58 | 75 | |
---|
59 | | - AddSkyboxButton("default", "rgb", row0); |
---|
| 76 | + AddSkyboxButton("default", "", row0); |
---|
60 | 77 | //AddSkyboxButton("default", "cornell", row0); |
---|
61 | 78 | AddSkyboxButton("penguins", "dust", row0); |
---|
62 | 79 | AddSkyboxButton("penguins", "tropic", row0); |
---|
.. | .. |
---|
311 | 328 | } |
---|
312 | 329 | } |
---|
313 | 330 | |
---|
314 | | - public void ChangeSkybox(String name) |
---|
| 331 | + public void ChangeSkybox(String skybox) |
---|
315 | 332 | { |
---|
316 | | - //cameraView.envyoff = false; |
---|
317 | | - group.skyboxname = name; |
---|
318 | | - group.skyboxext = "jpg"; |
---|
319 | | - cameraView.repaint(); |
---|
| 333 | + if (skybox.endsWith("/")) |
---|
| 334 | + { |
---|
| 335 | + group.skyboxname = null; |
---|
| 336 | + group.skyboxext = null; |
---|
| 337 | + cameraView.repaint(); |
---|
| 338 | + } |
---|
| 339 | + else |
---|
| 340 | + { |
---|
| 341 | + //cameraView.envyoff = false; |
---|
| 342 | + group.skyboxname = skybox; |
---|
| 343 | + group.skyboxext = "jpg"; |
---|
| 344 | + cameraView.repaint(); |
---|
| 345 | + } |
---|
| 346 | + } |
---|
| 347 | + |
---|
| 348 | + public void CreateSkyboxPanel(cGridBag skyboxPanel) |
---|
| 349 | + { |
---|
| 350 | + JTabbedPane skyboxpane = new JTabbedPane(JTabbedPane.LEFT); |
---|
| 351 | + |
---|
| 352 | + AddSkyboxTab0(skyboxpane); |
---|
| 353 | + AddSkyboxTab1(skyboxpane); |
---|
| 354 | + AddSkyboxTab2(skyboxpane); |
---|
| 355 | + AddSkyboxTab3(skyboxpane); |
---|
| 356 | + |
---|
| 357 | + skyboxPanel.add(skyboxpane); |
---|
320 | 358 | } |
---|
321 | 359 | |
---|
| 360 | + public void ChangeTexture(String texture) |
---|
| 361 | + { |
---|
| 362 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 363 | + { |
---|
| 364 | + Object3D obj = group.selection.get(i); |
---|
| 365 | + obj.SetPigmentTexture("@" + texture); |
---|
| 366 | + } |
---|
| 367 | + |
---|
| 368 | + refreshContents(); |
---|
| 369 | + } |
---|
| 370 | + |
---|
322 | 371 | //ObjEditor objEditor; |
---|
323 | 372 | public void closeUI2() |
---|
324 | 373 | { |
---|
.. | .. |
---|
356 | 405 | this.copy = this.group = group; |
---|
357 | 406 | //selectees = this.group.selectees; |
---|
358 | 407 | |
---|
359 | | - if (copy.versions == null) |
---|
360 | | - { |
---|
361 | | - copy.versions = new Object3D[100]; |
---|
362 | | - copy.versionindex = -1; |
---|
363 | | - } |
---|
| 408 | + assert(false); |
---|
| 409 | + |
---|
| 410 | +// if (copy.versionlist == null) |
---|
| 411 | +// { |
---|
| 412 | +// copy.versionlist = new Object3D[100]; |
---|
| 413 | +// copy.versionindex = -1; |
---|
| 414 | +// |
---|
| 415 | +// //Save(true); |
---|
| 416 | +// } |
---|
364 | 417 | |
---|
365 | 418 | if(ui) |
---|
366 | 419 | SetupUI(objEditor); |
---|
.. | .. |
---|
383 | 436 | |
---|
384 | 437 | ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true); |
---|
385 | 438 | |
---|
386 | | - if (copy.versions == null) |
---|
387 | | - { |
---|
388 | | - copy.versions = new Object3D[100]; |
---|
389 | | - copy.versionindex = -1; |
---|
390 | | - |
---|
391 | | - Save(true); |
---|
392 | | - } |
---|
| 439 | +// if (copy.versionlist == null) |
---|
| 440 | +// { |
---|
| 441 | +// copy.versionlist = new Object3D[100]; |
---|
| 442 | +// copy.versionindex = -1; |
---|
| 443 | +// |
---|
| 444 | +// //Save(true); |
---|
| 445 | +// } |
---|
393 | 446 | } |
---|
394 | 447 | |
---|
395 | 448 | void CloneSelection(boolean supports) |
---|
.. | .. |
---|
479 | 532 | // menu.add("-"); |
---|
480 | 533 | duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate")); |
---|
481 | 534 | duplicateItem.addActionListener(this); |
---|
482 | | - cloneItem = menu.add(new MenuItem("Clone")); |
---|
| 535 | + |
---|
| 536 | + cloneItem = oe.jTree.popup.add(new JMenuItem("Clone")); |
---|
483 | 537 | cloneItem.addActionListener(this); |
---|
484 | | - if (Globals.ADVANCED) |
---|
| 538 | + //if (Globals.ADVANCED) |
---|
485 | 539 | { |
---|
486 | 540 | cloneSupportItem = menu.add(new MenuItem("Clone (+supports)")); |
---|
487 | 541 | cloneSupportItem.addActionListener(this); |
---|
488 | 542 | } |
---|
| 543 | + oe.jTree.popup.addSeparator(); |
---|
489 | 544 | menu.add("-"); |
---|
490 | | - cutItem = menu.add(new MenuItem("Cut")); |
---|
| 545 | + cutItem = oe.jTree.popup.add(new JMenuItem("Cut")); |
---|
491 | 546 | cutItem.addActionListener(this); |
---|
492 | | - copyItem = menu.add(new MenuItem("Copy")); |
---|
| 547 | + copyItem = oe.jTree.popup.add(new JMenuItem("Copy")); |
---|
493 | 548 | copyItem.addActionListener(this); |
---|
494 | 549 | pasteItem = menu.add(new MenuItem("Paste")); |
---|
495 | 550 | pasteItem.addActionListener(this); |
---|
496 | 551 | |
---|
497 | | - menu.add("-"); |
---|
498 | | - pasteIntoItem = menu.add(new MenuItem("Paste into")); |
---|
| 552 | + oe.jTree.popup.addSeparator(); |
---|
| 553 | + //menu.add("-"); |
---|
| 554 | + pasteIntoItem = oe.jTree.popup.add(new JMenuItem("Paste into")); |
---|
499 | 555 | pasteIntoItem.addActionListener(this); |
---|
500 | | - pasteLinkItem = menu.add(new MenuItem("Paste link")); |
---|
| 556 | + pasteLinkItem = oe.jTree.popup.add(new JMenuItem("Paste link")); |
---|
501 | 557 | pasteLinkItem.addActionListener(this); |
---|
502 | | - pasteCloneItem = menu.add(new MenuItem("Paste clone")); |
---|
| 558 | + pasteCloneItem = oe.jTree.popup.add(new JMenuItem("Paste clone")); |
---|
503 | 559 | pasteCloneItem.addActionListener(this); |
---|
504 | | -// pasteExpandItem = menu.add(new MenuItem("Paste expand")); |
---|
505 | | -// pasteExpandItem.addActionListener(this); |
---|
506 | | - menu.add("-"); |
---|
507 | | - deleteItem = menu.add(new MenuItem("Delete")); |
---|
508 | | - deleteItem.addActionListener(this); |
---|
| 560 | +// CRASH |
---|
| 561 | + pasteExpandItem = oe.jTree.popup.add(new JMenuItem("Paste expand")); |
---|
| 562 | +// |
---|
| 563 | + pasteExpandItem.addActionListener(this); |
---|
| 564 | + //menu.add("-"); |
---|
| 565 | + oe.jTree.popup.addSeparator(); |
---|
509 | 566 | |
---|
510 | 567 | if (Globals.ADVANCED) |
---|
511 | 568 | { |
---|
.. | .. |
---|
591 | 648 | oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); |
---|
592 | 649 | //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); |
---|
593 | 650 | //cameraMenu.add(switchViewItem = new MenuItem("Reverse View")); |
---|
594 | | - editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf")); |
---|
595 | 651 | oe.cameraMenu.add("-"); |
---|
596 | 652 | openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy...")); |
---|
597 | 653 | openWindowItem.addActionListener(this); |
---|
598 | | - editLeafItem.addActionListener(this); |
---|
599 | 654 | lookAtItem.addActionListener(this); |
---|
600 | 655 | //lookFromItem.addActinoListener(this); |
---|
601 | 656 | //switchViewItem.addActionListener(this); |
---|
.. | .. |
---|
642 | 697 | setMasterItem.addActionListener(this); |
---|
643 | 698 | } |
---|
644 | 699 | |
---|
645 | | - oe.menuBar.add(menu = new Menu("Group")); |
---|
646 | | -// grabItem = menu.add(new MenuItem("Grab")); |
---|
647 | | -// grabItem.addActionListener(this); |
---|
| 700 | + oe.menuBar.add(menu = new Menu("Order")); |
---|
| 701 | + |
---|
648 | 702 | backItem = menu.add(new MenuItem("Back")); |
---|
649 | 703 | backItem.addActionListener(this); |
---|
650 | 704 | frontItem = menu.add(new MenuItem("Front")); |
---|
.. | .. |
---|
652 | 706 | // compositeItem = menu.add(new MenuItem("Composite")); |
---|
653 | 707 | // compositeItem.addActionListener(this); |
---|
654 | 708 | |
---|
| 709 | + grabItem = oe.jTree.popup.add(new JMenuItem("Group")); |
---|
| 710 | + grabItem.addActionListener(this); |
---|
| 711 | + |
---|
655 | 712 | if (Globals.ADVANCED) |
---|
656 | 713 | { |
---|
657 | 714 | hideItem = menu.add(new MenuItem("Hidden Group")); |
---|
658 | 715 | hideItem.addActionListener(this); |
---|
659 | 716 | } |
---|
660 | | - ungroupItem = menu.add(new MenuItem("Ungroup")); |
---|
| 717 | + ungroupItem = oe.jTree.popup.add(new JMenuItem("Ungroup")); |
---|
661 | 718 | ungroupItem.addActionListener(this); |
---|
| 719 | + |
---|
| 720 | + oe.jTree.popup.addSeparator(); |
---|
| 721 | + |
---|
| 722 | + deleteItem = oe.jTree.popup.add(new JMenuItem("Delete")); |
---|
| 723 | + deleteItem.addActionListener(this); |
---|
662 | 724 | |
---|
663 | 725 | // menu.add("-"); |
---|
664 | 726 | // |
---|
.. | .. |
---|
695 | 757 | shadowYItem.addActionListener(this); |
---|
696 | 758 | shadowZItem = menu.add(new MenuItem("Shadow Blue")); |
---|
697 | 759 | shadowZItem.addActionListener(this); |
---|
| 760 | + |
---|
698 | 761 | attributeItem = menu.add(new MenuItem("Attribute")); |
---|
699 | 762 | attributeItem.addActionListener(this); |
---|
700 | | - |
---|
701 | 763 | if (Globals.ADVANCED) |
---|
702 | 764 | { |
---|
703 | 765 | menu.add("-"); |
---|
.. | .. |
---|
709 | 771 | pointflowItem.addActionListener(this); |
---|
710 | 772 | } |
---|
711 | 773 | menu.add("-"); |
---|
| 774 | + textureRatioRItem = menu.add(new MenuItem("Texture Ratio Red")); |
---|
| 775 | + textureRatioRItem.addActionListener(this); |
---|
| 776 | + textureRatioGItem = menu.add(new MenuItem("Texture Ratio Green")); |
---|
| 777 | + textureRatioGItem.addActionListener(this); |
---|
| 778 | + textureRatioBItem = menu.add(new MenuItem("Texture Ratio Blue")); |
---|
| 779 | + textureRatioBItem.addActionListener(this); |
---|
| 780 | + menu.add("-"); |
---|
712 | 781 | resetTransformItem = menu.add(new MenuItem("Reset Transform")); |
---|
713 | 782 | resetTransformItem.addActionListener(this); |
---|
714 | 783 | resetCentroidItem = menu.add(new MenuItem("Reset Centroid")); |
---|
715 | 784 | resetCentroidItem.addActionListener(this); |
---|
716 | | - resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XY")); |
---|
| 785 | + resetCentroidXZItem = menu.add(new MenuItem("Reset Centroid XZ")); |
---|
717 | 786 | resetCentroidXZItem.addActionListener(this); |
---|
718 | 787 | transformGeometryItem = menu.add(new MenuItem("Transform Geometry")); |
---|
719 | 788 | transformGeometryItem.addActionListener(this); |
---|
.. | .. |
---|
765 | 834 | } |
---|
766 | 835 | |
---|
767 | 836 | oe.menuBar.add(menu = new Menu("Attributes")); |
---|
| 837 | + clearVersionsItem = menu.add(new MenuItem("Clear Versions")); |
---|
| 838 | + clearVersionsItem.addActionListener(this); |
---|
768 | 839 | clearMaterialsItem = menu.add(new MenuItem("Clear Materials")); |
---|
769 | 840 | clearMaterialsItem.addActionListener(this); |
---|
770 | 841 | resetAllItem = menu.add(new MenuItem("Reset All")); |
---|
.. | .. |
---|
787 | 858 | hideleavesItem.addActionListener(this); |
---|
788 | 859 | showleavesItem = menu.add(new MenuItem("Show Leaves")); |
---|
789 | 860 | showleavesItem.addActionListener(this); |
---|
790 | | - markleavesItem = menu.add(new MenuItem("Mark Leaves")); |
---|
| 861 | + markleavesItem = menu.add(new MenuItem("Anim Leaves")); |
---|
791 | 862 | markleavesItem.addActionListener(this); |
---|
792 | | - unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves")); |
---|
| 863 | + unmarkleavesItem = menu.add(new MenuItem("Unanim Leaves")); |
---|
793 | 864 | unmarkleavesItem.addActionListener(this); |
---|
794 | 865 | rewindleavesItem = menu.add(new MenuItem("Rewind Leaves")); |
---|
795 | 866 | rewindleavesItem.addActionListener(this); |
---|
.. | .. |
---|
843 | 914 | shareGeometriesItem.addActionListener(this); |
---|
844 | 915 | mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries")); |
---|
845 | 916 | mergeGeometriesItem.addActionListener(this); |
---|
| 917 | + menu.add("-"); |
---|
| 918 | + editLeafItem = menu.add(new MenuItem("Edit leaf...")); |
---|
| 919 | + editLeafItem.addActionListener(this); |
---|
846 | 920 | if (Globals.ADVANCED) |
---|
847 | 921 | { |
---|
848 | 922 | // Pretty much the same as duplicate and clone. |
---|
.. | .. |
---|
859 | 933 | buildToolsMenu(menu); |
---|
860 | 934 | } |
---|
861 | 935 | |
---|
| 936 | + JTabbedPane resourcecontainer; |
---|
| 937 | + cGridBag currenttab; |
---|
| 938 | + //boolean added; // patch for jar |
---|
| 939 | + |
---|
| 940 | + int totalcount = 0; |
---|
| 941 | + |
---|
| 942 | + int tabcount = 0; |
---|
| 943 | + int colcount = 0; |
---|
| 944 | + int rowcount = 0; |
---|
| 945 | + int texturecount = 0; |
---|
| 946 | + |
---|
| 947 | + int columns = 5; |
---|
| 948 | + int rows = 7; |
---|
| 949 | + |
---|
| 950 | + public void ResourceCallBack(String[] path) |
---|
| 951 | + { |
---|
| 952 | +// for (int i = 0; i < path.length; i++) |
---|
| 953 | +// System.out.print(path[i] + "/"); |
---|
| 954 | +// System.out.println(); |
---|
| 955 | + |
---|
| 956 | + if (//rowcount == 0 || |
---|
| 957 | + path.length == 1 && !path[0].equals("") && !path[0].equals(".DS_Store")) |
---|
| 958 | + { |
---|
| 959 | + currenttab = new cGridBag(); |
---|
| 960 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 961 | + currenttab.setName(tabname); |
---|
| 962 | + //added = false; |
---|
| 963 | + resourcecontainer.add(currenttab); |
---|
| 964 | + resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
| 965 | + rowcount = 1; |
---|
| 966 | + colcount = 0; |
---|
| 967 | + texturecount = 0; |
---|
| 968 | + } |
---|
| 969 | + |
---|
| 970 | + if (path.length > 2 && (path[2].toLowerCase().endsWith(".jpg") || path[2].toLowerCase().endsWith(".png"))) |
---|
| 971 | + { |
---|
| 972 | + //if (!added) |
---|
| 973 | + { |
---|
| 974 | + //added = true; |
---|
| 975 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
| 976 | + currenttab = (cGridBag)resourcecontainer.getComponentAt(resourcecontainer.indexOfTab(tabname)); |
---|
| 977 | + } |
---|
| 978 | + |
---|
| 979 | + AddTextureButton(path[0], path[1], path[2], ++texturecount, currenttab); |
---|
| 980 | + totalcount++; |
---|
| 981 | + |
---|
| 982 | + if (++colcount >= columns) |
---|
| 983 | + { |
---|
| 984 | + colcount = 0; |
---|
| 985 | + currenttab.Return(); |
---|
| 986 | + |
---|
| 987 | + if (rowcount++ >= rows) |
---|
| 988 | + { |
---|
| 989 | + rowcount = 0; |
---|
| 990 | + } |
---|
| 991 | + } |
---|
| 992 | + } |
---|
| 993 | + else |
---|
| 994 | + { |
---|
| 995 | +// if (!path[path.length-1].equals("icons")) |
---|
| 996 | +// resourcecontainer.Return(); |
---|
| 997 | + } |
---|
| 998 | + } |
---|
| 999 | + |
---|
| 1000 | + void CreateTexturePanel(cGridBag container) |
---|
| 1001 | + { |
---|
| 1002 | + resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); |
---|
| 1003 | + container.add(resourcecontainer); |
---|
| 1004 | + |
---|
| 1005 | + Grafreed.ParseResources("textures", this); |
---|
| 1006 | + |
---|
| 1007 | + // 935. System.out.println("Total = " + totalcount); |
---|
| 1008 | + } |
---|
862 | 1009 | |
---|
863 | 1010 | void SetupUI2(ObjEditor oe) |
---|
864 | 1011 | { |
---|
.. | .. |
---|
877 | 1024 | //new Exception().printStackTrace(); |
---|
878 | 1025 | |
---|
879 | 1026 | oe.radioPanel = new JPanel(new GridBagLayout()); |
---|
880 | | - oe.aConstraints.weightx = 1; |
---|
881 | | - oe.aConstraints.weighty = 0; |
---|
882 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
883 | | - oe.aConstraints.gridwidth = 100; |
---|
884 | | - oe.aConstraints.gridheight = 1; |
---|
885 | 1027 | // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
886 | 1028 | |
---|
887 | 1029 | oe.buttonGroup = new ButtonGroup(); |
---|
.. | .. |
---|
902 | 1044 | oe.radioPanel.add(dummyButton); |
---|
903 | 1045 | oe.buttonGroup.add(dummyButton); |
---|
904 | 1046 | */ |
---|
905 | | - cGridBag copyOptionsPanel = new cGridBag(); |
---|
| 1047 | + cGridBag versionManagerPanel = new cGridBag(); |
---|
906 | 1048 | |
---|
907 | | - copyOptionsPanel.preferredHeight = 2; |
---|
| 1049 | + versionManagerPanel.preferredHeight = 4; |
---|
908 | 1050 | |
---|
909 | 1051 | //this.AddOptions(oe.toolbarPanel, oe.aConstraints); |
---|
910 | 1052 | |
---|
.. | .. |
---|
914 | 1056 | |
---|
915 | 1057 | if (Globals.ADVANCED) |
---|
916 | 1058 | { |
---|
917 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
918 | | - maxButton.setToolTipText("Maximize window"); |
---|
919 | | - maxButton.addActionListener(this); |
---|
| 1059 | +// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1060 | +// maxButton.setToolTipText("Maximize window"); |
---|
| 1061 | +// maxButton.addActionListener(this); |
---|
920 | 1062 | } |
---|
921 | 1063 | |
---|
922 | | - oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
923 | | - fullButton.setToolTipText("Full-screen window"); |
---|
924 | | - fullButton.addActionListener(this); |
---|
| 1064 | + cButton gcButton; |
---|
925 | 1065 | |
---|
926 | | - oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1066 | +// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1067 | +// gcButton.setToolTipText("Garbage collect"); |
---|
| 1068 | +// gcButton.addActionListener(new ActionListener() |
---|
| 1069 | +// { |
---|
| 1070 | +// public void actionPerformed(ActionEvent e) |
---|
| 1071 | +// { |
---|
| 1072 | +// System.gc(); |
---|
| 1073 | +// } |
---|
| 1074 | +// }); |
---|
| 1075 | + |
---|
| 1076 | + oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1077 | + fullScreenButton.setToolTipText("Full-screen window"); |
---|
| 1078 | + fullScreenButton.addActionListener(this); |
---|
| 1079 | + |
---|
| 1080 | + oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1081 | + collapseButton.setToolTipText("Collapse toolbar"); |
---|
| 1082 | + collapseButton.addActionListener(this); |
---|
| 1083 | + |
---|
| 1084 | +// oe.toolbarPanel.add(maximize3DButton = GetButton("icons/square.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1085 | +// maximize3DButton.setToolTipText("Maximize 3D view"); |
---|
| 1086 | +// maximize3DButton.addActionListener(this); |
---|
| 1087 | + |
---|
| 1088 | + oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1089 | + twoButton.setToolTipText("Show 3D view only"); |
---|
| 1090 | + twoButton.addActionListener(this); |
---|
| 1091 | + this.fullscreenLayout = twoButton; |
---|
| 1092 | + |
---|
| 1093 | + oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1094 | + threeButton.setToolTipText("Show controls and 3D view"); |
---|
| 1095 | + threeButton.addActionListener(this); |
---|
| 1096 | + if (Globals.ADVANCED) |
---|
| 1097 | + { |
---|
| 1098 | + oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1099 | + sixButton.setToolTipText("Show 3D view and controls"); |
---|
| 1100 | + sixButton.addActionListener(this); |
---|
| 1101 | + } |
---|
| 1102 | +// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1103 | +// sevenButton.setToolTipText("3-column layout"); |
---|
| 1104 | +// sevenButton.addActionListener(this); |
---|
| 1105 | + // |
---|
| 1106 | + |
---|
| 1107 | + oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
927 | 1108 | screenfitButton.setToolTipText("Screen fit"); |
---|
928 | 1109 | screenfitButton.addActionListener(this); |
---|
929 | 1110 | |
---|
930 | | - oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1111 | + oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
931 | 1112 | restoreCameraButton.setToolTipText("Restore viewpoint"); |
---|
932 | 1113 | restoreCameraButton.addActionListener(this); |
---|
933 | 1114 | |
---|
934 | | - copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
935 | | - saveButton.setToolTipText("Duplicate current version"); |
---|
936 | | - saveButton.addActionListener(this); |
---|
| 1115 | + versionManagerPanel.add(saveVersionButton = GetButton("icons/down_arrow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1116 | + saveVersionButton.setToolTipText("Duplicate current version"); |
---|
| 1117 | + saveVersionButton.addActionListener(this); |
---|
937 | 1118 | |
---|
938 | | - copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
939 | | - undoButton.setToolTipText("Previous version"); |
---|
940 | | - undoButton.addActionListener(this); |
---|
941 | | - undoButton.setEnabled(false); |
---|
| 1119 | + versionManagerPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1120 | + deleteVersionButton.setToolTipText("Delete current version"); |
---|
| 1121 | + deleteVersionButton.addActionListener(this); |
---|
| 1122 | + deleteVersionButton.setEnabled(false); |
---|
| 1123 | + |
---|
| 1124 | + versionManagerPanel.add(previousVersionButton = GetButton("icons/undo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1125 | + previousVersionButton.setToolTipText("Previous version"); |
---|
| 1126 | + previousVersionButton.addActionListener(this); |
---|
| 1127 | + previousVersionButton.setEnabled(false); |
---|
942 | 1128 | |
---|
943 | 1129 | cGridBag updown = new cGridBag().setVertical(true); |
---|
944 | | - updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
945 | | - restoreButton.setToolTipText("Restore current version (undo latest change)"); |
---|
| 1130 | + updown.add(restoreButton = GetButton("icons/restore.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1131 | + restoreButton.setToolTipText("Undo (restore current version)"); |
---|
946 | 1132 | restoreButton.addActionListener(this); |
---|
947 | 1133 | restoreButton.setEnabled(false); |
---|
948 | 1134 | |
---|
949 | | - updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
950 | | - replaceButton.setToolTipText("Replace current version (save latest change)"); |
---|
| 1135 | + updown.add(replaceButton = GetButton("icons/replace.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1136 | + replaceButton.setToolTipText("Save (replace current version)"); |
---|
951 | 1137 | replaceButton.addActionListener(this); |
---|
952 | 1138 | replaceButton.setEnabled(false); |
---|
953 | 1139 | |
---|
954 | | - copyOptionsPanel.add(updown); |
---|
| 1140 | + versionManagerPanel.add(updown); |
---|
955 | 1141 | |
---|
956 | | - copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
957 | | - redoButton.setToolTipText("Next version"); |
---|
958 | | - redoButton.addActionListener(this); |
---|
959 | | - redoButton.setEnabled(false); |
---|
| 1142 | + versionManagerPanel.add(nextVersionButton = GetButton("icons/redo.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1143 | + nextVersionButton.setToolTipText("Next version"); |
---|
| 1144 | + nextVersionButton.addActionListener(this); |
---|
| 1145 | + nextVersionButton.setEnabled(false); |
---|
| 1146 | + |
---|
| 1147 | + oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1148 | + oneStepButton.setToolTipText("Animate one step forward"); |
---|
| 1149 | + oneStepButton.addActionListener(this); |
---|
960 | 1150 | |
---|
961 | 1151 | oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
962 | 1152 | liveCB.setToolTipText("Enable animation"); |
---|
963 | 1153 | liveCB.addItemListener(this); |
---|
964 | 1154 | |
---|
965 | | - oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
966 | | - oneStepButton.setToolTipText("Animate one step forward"); |
---|
967 | | - oneStepButton.addActionListener(this); |
---|
968 | | - |
---|
969 | 1155 | oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
970 | 1156 | fastCB.setToolTipText("Fast mode"); |
---|
971 | 1157 | fastCB.addItemListener(this); |
---|
.. | .. |
---|
981 | 1167 | |
---|
982 | 1168 | if (Globals.ADVANCED) |
---|
983 | 1169 | { |
---|
984 | | - oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1170 | + oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
985 | 1171 | snapobjectButton.addActionListener(this); |
---|
986 | 1172 | snapobjectButton.setToolTipText("Snap Object"); |
---|
987 | 1173 | |
---|
988 | | - oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1174 | + oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
989 | 1175 | fourButton.addActionListener(this); |
---|
990 | 1176 | fourButton.setToolTipText("Show control panel only"); |
---|
991 | 1177 | } |
---|
992 | 1178 | |
---|
993 | 1179 | //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
994 | 1180 | |
---|
995 | | - oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
996 | | - twoButton.setToolTipText("Show 3D view only"); |
---|
997 | | - twoButton.addActionListener(this); |
---|
998 | | - this.fullscreenLayout = twoButton; |
---|
999 | | - |
---|
1000 | | - oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1001 | | - threeButton.setToolTipText("Show controls and 3D view"); |
---|
1002 | | - threeButton.addActionListener(this); |
---|
1003 | | - oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1004 | | - sixButton.setToolTipText("Show 3D view and controls"); |
---|
1005 | | - sixButton.addActionListener(this); |
---|
1006 | | -// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1007 | | -// sevenButton.setToolTipText("3-column layout"); |
---|
1008 | | -// sevenButton.addActionListener(this); |
---|
1009 | | - // |
---|
1010 | 1181 | |
---|
1011 | | - oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1182 | + oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1012 | 1183 | rootButton.setToolTipText("Open selection in new tab"); |
---|
1013 | 1184 | rootButton.addActionListener(this); |
---|
1014 | 1185 | |
---|
1015 | | - oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1186 | + oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1016 | 1187 | closeButton.setToolTipText("Close tab"); |
---|
1017 | 1188 | closeButton.addActionListener(this); |
---|
1018 | 1189 | //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); |
---|
.. | .. |
---|
1021 | 1192 | cGridBag row1 = new cGridBag(); |
---|
1022 | 1193 | |
---|
1023 | 1194 | // INSERT |
---|
1024 | | - row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1025 | | - gridButton.setToolTipText("Create grid"); |
---|
| 1195 | + row1.add(gridButton = GetButton("icons/grid.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1196 | + gridButton.setToolTipText("Create ground"); |
---|
1026 | 1197 | gridButton.addActionListener(this); |
---|
1027 | 1198 | |
---|
1028 | | - row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1199 | + row1.add(boxButton = GetButton("icons/box.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1029 | 1200 | boxButton.setToolTipText("Create box"); |
---|
1030 | 1201 | boxButton.addActionListener(this); |
---|
1031 | 1202 | |
---|
1032 | | - row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1033 | | - sphereButton.setToolTipText("Create sphere"); |
---|
1034 | | - sphereButton.addActionListener(this); |
---|
1035 | | - |
---|
1036 | | - row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1037 | | - coneButton.setToolTipText("Create cone"); |
---|
1038 | | - coneButton.addActionListener(this); |
---|
1039 | | - |
---|
1040 | | - row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1041 | | - torusButton.setToolTipText("Create torus"); |
---|
1042 | | - torusButton.addActionListener(this); |
---|
1043 | | - |
---|
1044 | | - row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1203 | + row1.add(superButton = GetButton("icons/super.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1045 | 1204 | superButton.setToolTipText("Create superellipsoid"); |
---|
1046 | 1205 | superButton.addActionListener(this); |
---|
1047 | 1206 | |
---|
1048 | | - if (Globals.ADVANCED) |
---|
| 1207 | + row1.add(sphereButton = GetButton("icons/sphere.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1208 | + sphereButton.setToolTipText("Create sphere"); |
---|
| 1209 | + sphereButton.addActionListener(this); |
---|
| 1210 | + |
---|
| 1211 | + row1.add(coneButton = GetButton("icons/cone.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1212 | + coneButton.setToolTipText("Create cone"); |
---|
| 1213 | + coneButton.addActionListener(this); |
---|
| 1214 | + |
---|
| 1215 | + row1.add(torusButton = GetButton("icons/torus.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1216 | + torusButton.setToolTipText("Create torus"); |
---|
| 1217 | + torusButton.addActionListener(this); |
---|
| 1218 | + |
---|
| 1219 | + if (false) //Globals.ADVANCED) |
---|
1049 | 1220 | { |
---|
1050 | | - oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1221 | + oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1051 | 1222 | kleinButton.setToolTipText("Create Klein bottle"); |
---|
1052 | 1223 | kleinButton.addActionListener(this); |
---|
1053 | 1224 | } |
---|
1054 | 1225 | |
---|
1055 | | - row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1226 | + row1.add(particlesButton = GetButton("icons/particles.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1056 | 1227 | particlesButton.setToolTipText("Create particle system"); |
---|
1057 | 1228 | particlesButton.addActionListener(this); |
---|
1058 | 1229 | |
---|
.. | .. |
---|
1060 | 1231 | |
---|
1061 | 1232 | cGridBag row2 = new cGridBag(); |
---|
1062 | 1233 | |
---|
1063 | | - row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1234 | + row2.add(groupButton = GetButton("icons/group.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1064 | 1235 | groupButton.setToolTipText("Create group"); |
---|
1065 | 1236 | groupButton.addActionListener(this); |
---|
1066 | 1237 | |
---|
1067 | | - row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1238 | + row2.add(compositeButton = GetButton("icons/composite.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1068 | 1239 | compositeButton.setToolTipText("Create composite"); |
---|
1069 | 1240 | compositeButton.addActionListener(this); |
---|
1070 | 1241 | |
---|
1071 | | - row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1242 | + row2.add(switchButton = GetButton("icons/switch.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1072 | 1243 | switchButton.setToolTipText("Create item switcher"); |
---|
1073 | 1244 | switchButton.addActionListener(this); |
---|
1074 | 1245 | |
---|
1075 | | - row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1246 | + row2.add(loopButton = GetButton("icons/loop.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1076 | 1247 | loopButton.setToolTipText("Create loop"); |
---|
1077 | 1248 | loopButton.addActionListener(this); |
---|
1078 | 1249 | |
---|
1079 | | - row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1250 | + row2.add(textureButton = GetButton("icons/texture.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1080 | 1251 | textureButton.setToolTipText("Create texture"); |
---|
1081 | 1252 | textureButton.addActionListener(this); |
---|
1082 | 1253 | |
---|
1083 | | - row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1254 | + row2.add(overlayButton = GetButton("icons/overlay.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1084 | 1255 | overlayButton.setToolTipText("Create overlay"); |
---|
1085 | 1256 | overlayButton.addActionListener(this); |
---|
1086 | 1257 | |
---|
1087 | | - row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1258 | + row2.add(lightButton = GetButton("icons/light-bulb.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1088 | 1259 | lightButton.setToolTipText("Create light"); |
---|
1089 | 1260 | lightButton.addActionListener(this); |
---|
1090 | 1261 | |
---|
1091 | 1262 | oe.toolboxPanel.add(row2); |
---|
1092 | 1263 | |
---|
1093 | | - // ENVYMAPS |
---|
1094 | | - cGridBag skyboxpane = new cGridBag(); |
---|
1095 | | - skyboxpane.preferredHeight = 100; |
---|
| 1264 | + cGridBag textures = new cGridBag(); |
---|
1096 | 1265 | |
---|
1097 | | - oe.toolboxPanel.add(skyboxpane); |
---|
| 1266 | + CreateTexturePanel(textures); |
---|
1098 | 1267 | |
---|
1099 | | - JTabbedPane skyboxpanel = new JTabbedPane(); |
---|
1100 | | - skyboxpane.add(skyboxpanel); |
---|
| 1268 | + int tabCount = resourcecontainer.getTabCount(); |
---|
1101 | 1269 | |
---|
1102 | | - AddSkyboxTab0(skyboxpanel); |
---|
1103 | | - AddSkyboxTab1(skyboxpanel); |
---|
1104 | | - AddSkyboxTab2(skyboxpanel); |
---|
1105 | | - AddSkyboxTab3(skyboxpanel); |
---|
| 1270 | + if (tabCount > 0) |
---|
| 1271 | + resourcecontainer.setSelectedIndex((int)(Math.random() * tabCount)); |
---|
| 1272 | + |
---|
| 1273 | + oe.toolboxPanel.add(textures); |
---|
| 1274 | + |
---|
| 1275 | + textures.preferredHeight = 100; |
---|
| 1276 | + |
---|
| 1277 | + CreateSkyboxPanel(oe.skyboxPanel); |
---|
1106 | 1278 | |
---|
1107 | 1279 | // EDIT panel |
---|
1108 | | - editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1280 | + editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1109 | 1281 | editButton.setToolTipText("Pin selection controls"); |
---|
1110 | 1282 | editButton.addActionListener(this); |
---|
1111 | 1283 | |
---|
1112 | | - editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1113 | | - uneditButton.setToolTipText("Remove selection controls"); |
---|
| 1284 | + editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1285 | + uneditButton.setToolTipText("Unpin and remove selection controls"); |
---|
1114 | 1286 | uneditButton.addActionListener(this); |
---|
1115 | 1287 | |
---|
1116 | 1288 | editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints); |
---|
1117 | | - allParamsButton.setToolTipText("Show all controle"); |
---|
| 1289 | + allParamsButton.setToolTipText("Show all controls"); |
---|
1118 | 1290 | allParamsButton.addActionListener(this); |
---|
1119 | 1291 | |
---|
1120 | | - editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1121 | | - clearPanelButton.setToolTipText("Clear edit panel"); |
---|
| 1292 | + editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1293 | + clearPanelButton.setToolTipText("Clear all controls"); |
---|
1122 | 1294 | clearPanelButton.addActionListener(this); |
---|
1123 | 1295 | |
---|
1124 | | - editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1125 | | - unselectButton.setToolTipText("Unselect"); |
---|
1126 | | - unselectButton.addActionListener(this); |
---|
| 1296 | + //editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1297 | + //unselectButton.setToolTipText("Unselect"); |
---|
| 1298 | + //unselectButton.addActionListener(this); |
---|
1127 | 1299 | |
---|
1128 | | - editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1300 | + editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); |
---|
1129 | 1301 | flashSelectionButton.setToolTipText("Highlight selection"); |
---|
1130 | 1302 | flashSelectionButton.addActionListener(this); |
---|
1131 | 1303 | |
---|
.. | .. |
---|
1148 | 1320 | |
---|
1149 | 1321 | cGridBag jSPPanel = new cGridBag(); |
---|
1150 | 1322 | |
---|
| 1323 | + jSPPanel.preferredHeight = 20; |
---|
| 1324 | + |
---|
1151 | 1325 | JScrollPane jSP; |
---|
1152 | 1326 | //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints); |
---|
1153 | 1327 | jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints); |
---|
.. | .. |
---|
1156 | 1330 | oe.treePanel.add(jSPPanel); |
---|
1157 | 1331 | oe.treePanel.Return(); |
---|
1158 | 1332 | |
---|
1159 | | - oe.treePanel.add(copyOptionsPanel); |
---|
| 1333 | + oe.treePanel.add(versionManagerPanel); |
---|
1160 | 1334 | oe.treePanel.Return(); |
---|
1161 | | - cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
1162 | | - versionSlider = (cNumberSlider)sliderPane.getComponent(1); |
---|
1163 | | - sliderPane.preferredHeight = 1; |
---|
| 1335 | + |
---|
| 1336 | + versionSliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0); |
---|
| 1337 | + versionSlider = (cNumberSlider)versionSliderPane.getComponent(1); |
---|
| 1338 | + versionSliderPane.preferredHeight = 3; |
---|
1164 | 1339 | |
---|
1165 | 1340 | // mainPanel.setDividerLocation(0.1); //1.0); |
---|
1166 | 1341 | mainPanel.setResizeWeight(0.4); |
---|
.. | .. |
---|
1318 | 1493 | |
---|
1319 | 1494 | void EditObject(Object3D obj) |
---|
1320 | 1495 | { |
---|
| 1496 | + //assert(obj instanceof Composite); |
---|
| 1497 | + |
---|
| 1498 | +// if (obj.versionlist == null) |
---|
| 1499 | +// { |
---|
| 1500 | +// obj.versionlist = new Object3D[100]; |
---|
| 1501 | +// obj.versionindex = -1; |
---|
| 1502 | +// } |
---|
| 1503 | + |
---|
1321 | 1504 | cRadio radioButton = new cRadio(obj.name); |
---|
1322 | 1505 | |
---|
1323 | 1506 | // June 2019. Patch to avoid bug with transparency. |
---|
.. | .. |
---|
1342 | 1525 | |
---|
1343 | 1526 | oe.SetupViews(); |
---|
1344 | 1527 | |
---|
| 1528 | + if (Globals.DEBUG) |
---|
1345 | 1529 | System.out.println("SetupViews"); |
---|
1346 | 1530 | DragSource.getDefaultDragSource().createDefaultDragGestureRecognizer( |
---|
1347 | 1531 | oe.cameraView, DnDConstants.ACTION_COPY_OR_MOVE, this); // ACTION_LINK ?? |
---|
.. | .. |
---|
1708 | 1892 | TreePath path; |
---|
1709 | 1893 | |
---|
1710 | 1894 | public TransferableTreePath(TreePath tp) { |
---|
1711 | | - path = tp; |
---|
| 1895 | + Object[] objs = new Object[tp.getPathCount()]; |
---|
| 1896 | + for (int i=0; i<objs.length; i++) |
---|
| 1897 | + { |
---|
| 1898 | + objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID(); |
---|
| 1899 | + } |
---|
| 1900 | + path = new TreePath(objs); |
---|
1712 | 1901 | } |
---|
1713 | 1902 | |
---|
1714 | 1903 | public synchronized DataFlavor[] getTransferDataFlavors() { |
---|
.. | .. |
---|
1940 | 2129 | switch(axis) |
---|
1941 | 2130 | { |
---|
1942 | 2131 | case 0 : |
---|
1943 | | - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; |
---|
1944 | | - vert2.x = minima.x; vert2.y = maxima.y; vert2.z = minima.z; |
---|
1945 | | - vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z; |
---|
1946 | | - vert4.x = minima.x; vert4.y = maxima.y; vert4.z = maxima.z; |
---|
| 2132 | + vert1.x = minima.x + 0.001f; vert1.y = minima.y; vert1.z = minima.z; |
---|
| 2133 | + vert2.x = minima.x + 0.001f; vert2.y = maxima.y; vert2.z = minima.z; |
---|
| 2134 | + vert3.x = minima.x + 0.001f; vert3.y = minima.y; vert3.z = maxima.z; |
---|
| 2135 | + vert4.x = minima.x + 0.001f; vert4.y = maxima.y; vert4.z = maxima.z; |
---|
1947 | 2136 | norm = cVector.X; |
---|
1948 | 2137 | break; |
---|
1949 | 2138 | case 1 : |
---|
1950 | | - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; |
---|
1951 | | - vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z; |
---|
1952 | | - vert3.x = minima.x; vert3.y = minima.y; vert3.z = maxima.z; |
---|
1953 | | - vert4.x = maxima.x; vert4.y = minima.y; vert4.z = maxima.z; |
---|
| 2139 | + vert1.x = minima.x; vert1.y = minima.y + 0.001f; vert1.z = minima.z; |
---|
| 2140 | + vert2.x = maxima.x; vert2.y = minima.y + 0.001f; vert2.z = minima.z; |
---|
| 2141 | + vert3.x = minima.x; vert3.y = minima.y + 0.001f; vert3.z = maxima.z; |
---|
| 2142 | + vert4.x = maxima.x; vert4.y = minima.y + 0.001f; vert4.z = maxima.z; |
---|
1954 | 2143 | norm = cVector.Y; |
---|
1955 | 2144 | break; |
---|
1956 | 2145 | case 2 : |
---|
1957 | | - vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z; |
---|
1958 | | - vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z; |
---|
1959 | | - vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z; |
---|
1960 | | - vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z; |
---|
| 2146 | + vert1.x = minima.x; vert1.y = minima.y; vert1.z = minima.z + 0.001f; |
---|
| 2147 | + vert2.x = maxima.x; vert2.y = minima.y; vert2.z = minima.z + 0.001f; |
---|
| 2148 | + vert3.x = minima.x; vert3.y = maxima.y; vert3.z = minima.z + 0.001f; |
---|
| 2149 | + vert4.x = maxima.x; vert4.y = maxima.y; vert4.z = minima.z + 0.001f; |
---|
1961 | 2150 | norm = cVector.Z; |
---|
1962 | 2151 | break; |
---|
1963 | 2152 | } |
---|
.. | .. |
---|
1998 | 2187 | shadow.material = new cMaterial(obj.material); |
---|
1999 | 2188 | shadow.material.diffuse = 0.0001f; |
---|
2000 | 2189 | shadow.material.specular = 0.0001f; |
---|
2001 | | - //shadow.projectedVertices[1].x = 300; |
---|
| 2190 | + shadow.material.opacity = 0.75f; |
---|
| 2191 | + |
---|
| 2192 | + AllocProjectedVertices(shadow); |
---|
| 2193 | + |
---|
| 2194 | + shadow.projectedVertices[1].x = 300; |
---|
2002 | 2195 | |
---|
2003 | 2196 | makeSomething(shadow); |
---|
2004 | 2197 | } |
---|
.. | .. |
---|
2519 | 2712 | } else |
---|
2520 | 2713 | if (source == loopItem || source == loopButton) |
---|
2521 | 2714 | { |
---|
| 2715 | + if (!group.selection.isEmpty()) |
---|
| 2716 | + { |
---|
2522 | 2717 | Composite csg = new GroupLeaf(); |
---|
2523 | | - csg.count = 5; |
---|
2524 | 2718 | group(csg); |
---|
| 2719 | + csg.count = 5; |
---|
2525 | 2720 | Composite child = new cGroup("Branch"); |
---|
2526 | 2721 | csg.addChild(child); |
---|
2527 | 2722 | child.addChild(csg); |
---|
| 2723 | + } |
---|
2528 | 2724 | } else |
---|
2529 | 2725 | if (source == doubleItem) |
---|
2530 | 2726 | { |
---|
| 2727 | + if (!group.selection.isEmpty()) |
---|
| 2728 | + { |
---|
2531 | 2729 | Composite csg = new GroupLeaf("Fork"); |
---|
2532 | | - csg.count = 5; |
---|
2533 | 2730 | group(csg); |
---|
| 2731 | + csg.count = 5; |
---|
2534 | 2732 | Composite child = new cGroup("Branch A"); |
---|
2535 | 2733 | csg.addChild(child); |
---|
2536 | 2734 | child.addChild(csg); |
---|
2537 | 2735 | child = new cGroup("Branch B"); |
---|
2538 | 2736 | csg.addChild(child); |
---|
2539 | 2737 | child.addChild(csg); |
---|
| 2738 | + } |
---|
2540 | 2739 | } else |
---|
2541 | 2740 | if (source == tripleItem) |
---|
2542 | 2741 | { |
---|
| 2742 | + if (!group.selection.isEmpty()) |
---|
| 2743 | + { |
---|
2543 | 2744 | Composite csg = new GroupLeaf("Trident"); |
---|
2544 | 2745 | csg.count = 4; |
---|
2545 | 2746 | group(csg); |
---|
.. | .. |
---|
2552 | 2753 | child = new cGroup(); |
---|
2553 | 2754 | csg.addChild(child); |
---|
2554 | 2755 | child.addChild(csg); |
---|
| 2756 | + } |
---|
2555 | 2757 | } else |
---|
2556 | 2758 | if (source == computeAOItem) |
---|
2557 | 2759 | { |
---|
.. | .. |
---|
2571 | 2773 | if (source == invariantsItem) |
---|
2572 | 2774 | { |
---|
2573 | 2775 | System.out.println("Invariants:"); |
---|
2574 | | - Grafreed.grafreeD.universe.invariants(); |
---|
| 2776 | + Grafreed.grafreed.universe.invariants(); |
---|
2575 | 2777 | } else |
---|
2576 | 2778 | if (source == memoryItem) |
---|
2577 | 2779 | { |
---|
.. | .. |
---|
2598 | 2800 | { |
---|
2599 | 2801 | Maximize(); |
---|
2600 | 2802 | } else |
---|
2601 | | - if (source == fullButton) |
---|
| 2803 | + if (source == fullScreenButton) |
---|
2602 | 2804 | { |
---|
2603 | 2805 | ToggleFullScreen(); |
---|
2604 | 2806 | } else |
---|
2605 | | - if (source == undoButton) |
---|
| 2807 | + if (source == collapseButton) |
---|
| 2808 | + { |
---|
| 2809 | + this.expandedLayout = radio.layout; |
---|
| 2810 | + CollapseToolbar(); |
---|
| 2811 | + } else |
---|
| 2812 | +// if (source == maximize3DButton) |
---|
| 2813 | +// { |
---|
| 2814 | +// this.expandedLayout = radio.layout; |
---|
| 2815 | +// radio.layout = twoButton; |
---|
| 2816 | +// CollapseToolbar(); |
---|
| 2817 | +// Show3DView(); |
---|
| 2818 | +// } else |
---|
| 2819 | + if (source == previousVersionButton) |
---|
2606 | 2820 | { |
---|
2607 | 2821 | // Go to previous version |
---|
2608 | 2822 | //if (!Undo()) |
---|
2609 | 2823 | //java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
2610 | | - Undo(); |
---|
| 2824 | + PreviousVersion(); |
---|
2611 | 2825 | } else |
---|
2612 | 2826 | if (source == restoreButton) |
---|
2613 | 2827 | { |
---|
2614 | 2828 | // Restore current version |
---|
2615 | 2829 | Restore(); |
---|
| 2830 | + //restoreButton.setEnabled(false); |
---|
2616 | 2831 | } else |
---|
2617 | 2832 | if (source == replaceButton) |
---|
2618 | 2833 | { |
---|
2619 | 2834 | // Overwrite current version |
---|
2620 | 2835 | Replace(); |
---|
| 2836 | + //replaceButton.setEnabled(false); |
---|
2621 | 2837 | } else |
---|
2622 | | - if (source == redoButton) |
---|
| 2838 | + if (source == nextVersionButton) |
---|
2623 | 2839 | { |
---|
2624 | 2840 | // Go to next version |
---|
2625 | | - Redo(); |
---|
| 2841 | + NextVersion(); |
---|
2626 | 2842 | } else |
---|
2627 | | - if (source == saveButton) |
---|
| 2843 | + if (source == saveVersionButton) |
---|
2628 | 2844 | { |
---|
2629 | 2845 | // Save a new version |
---|
2630 | 2846 | if (!Save(true)) |
---|
2631 | 2847 | java.awt.Toolkit.getDefaultToolkit().beep(); |
---|
| 2848 | + } else |
---|
| 2849 | + if (source == deleteVersionButton) |
---|
| 2850 | + { |
---|
| 2851 | + // Delete a new version |
---|
| 2852 | + DeleteVersion(); |
---|
2632 | 2853 | } else |
---|
2633 | 2854 | if (source == oneStepButton) |
---|
2634 | 2855 | { |
---|
.. | .. |
---|
2683 | 2904 | } else |
---|
2684 | 2905 | if (source == undoItem) |
---|
2685 | 2906 | { |
---|
2686 | | - Undo(); |
---|
| 2907 | + PreviousVersion(); |
---|
2687 | 2908 | } else |
---|
2688 | 2909 | if (source == redoItem) |
---|
2689 | 2910 | { |
---|
2690 | | - Redo(); |
---|
| 2911 | + NextVersion(); |
---|
2691 | 2912 | } else |
---|
2692 | 2913 | if (source == duplicateItem) |
---|
2693 | 2914 | { |
---|
.. | .. |
---|
3168 | 3389 | } else |
---|
3169 | 3390 | if (source == ungroupItem || source == ungroupButton) |
---|
3170 | 3391 | { |
---|
3171 | | - boolean hasRoot = false; |
---|
| 3392 | + boolean canUngroup = true; |
---|
3172 | 3393 | |
---|
3173 | 3394 | for (int i=0; i<group.selection.size(); i++) |
---|
3174 | 3395 | { |
---|
3175 | | - if (group.selection.get(i) == group) |
---|
| 3396 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3397 | + |
---|
| 3398 | + if (selectedItem.Size() == 0) |
---|
3176 | 3399 | { |
---|
3177 | | - hasRoot = true; |
---|
| 3400 | + // Cannot ungroup leaves |
---|
| 3401 | + canUngroup = false; |
---|
| 3402 | + break; |
---|
| 3403 | + } |
---|
| 3404 | + |
---|
| 3405 | + if (selectedItem == group) |
---|
| 3406 | + { |
---|
| 3407 | + // Cannot ungroup root |
---|
| 3408 | + canUngroup = false; |
---|
3178 | 3409 | break; |
---|
3179 | 3410 | } |
---|
3180 | 3411 | } |
---|
3181 | 3412 | |
---|
3182 | | - if (!hasRoot) |
---|
| 3413 | + if (canUngroup) |
---|
3183 | 3414 | { |
---|
3184 | 3415 | for (int i=0; i<group.selection.size(); i++) |
---|
3185 | 3416 | { |
---|
3186 | | - Ungroup(group.selection.get(i)); |
---|
| 3417 | + Object3D selectedItem = group.selection.get(i); |
---|
| 3418 | + |
---|
| 3419 | + Ungroup(selectedItem); |
---|
3187 | 3420 | } |
---|
3188 | 3421 | |
---|
3189 | 3422 | ClearSelection(false); |
---|
.. | .. |
---|
3234 | 3467 | if (source == clearMaterialsItem) |
---|
3235 | 3468 | { |
---|
3236 | 3469 | ClearMaterials(); |
---|
| 3470 | + } else |
---|
| 3471 | + if (source == clearVersionsItem) |
---|
| 3472 | + { |
---|
| 3473 | + ClearVersions(); |
---|
3237 | 3474 | } else |
---|
3238 | 3475 | if (source == liveleavesItem) |
---|
3239 | 3476 | { |
---|
.. | .. |
---|
3374 | 3611 | if (source == transformChildrenItem) |
---|
3375 | 3612 | { |
---|
3376 | 3613 | TransformChildren(); |
---|
| 3614 | + } else |
---|
| 3615 | + if (source == textureRatioRItem) |
---|
| 3616 | + { |
---|
| 3617 | + TextureRatio(0); |
---|
| 3618 | + } else |
---|
| 3619 | + if (source == textureRatioGItem) |
---|
| 3620 | + { |
---|
| 3621 | + TextureRatio(1); |
---|
| 3622 | + } else |
---|
| 3623 | + if (source == textureRatioBItem) |
---|
| 3624 | + { |
---|
| 3625 | + TextureRatio(2); |
---|
3377 | 3626 | } else |
---|
3378 | 3627 | if (source == resetTransformItem) |
---|
3379 | 3628 | { |
---|
.. | .. |
---|
3546 | 3795 | if (CameraPane.FULLSCREEN) |
---|
3547 | 3796 | fullscreenLayout = radio.layout; |
---|
3548 | 3797 | |
---|
3549 | | - // bug |
---|
3550 | | - //gridPanel.setDividerLocation(1.0); |
---|
3551 | | - //bigPanel.setDividerLocation(0.0); |
---|
3552 | | -// bigThree.remove(scenePanel); |
---|
3553 | | -// bigThree.remove(centralPanel); |
---|
3554 | | -// bigThree.remove(XYZPanel); |
---|
3555 | | -// aWindowConstraints.gridx = 0; |
---|
3556 | | -// aWindowConstraints.gridy = 0; |
---|
3557 | | -// aWindowConstraints.gridwidth = 1; |
---|
3558 | | -// // aConstraints.gridheight = 3; |
---|
3559 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3560 | | -// aWindowConstraints.weightx = 0; |
---|
3561 | | -// aWindowConstraints.weighty = 1; |
---|
3562 | | -// //bigThree.add(jtp, aWindowConstraints); |
---|
3563 | | -// aWindowConstraints.weightx = 1; |
---|
3564 | | -// aWindowConstraints.gridwidth = 3; |
---|
3565 | | -// // aConstraints.gridheight = 3; |
---|
3566 | | -// aWindowConstraints.gridx = 1; |
---|
3567 | | -// aWindowConstraints.fill = GridBagConstraints.BOTH; |
---|
3568 | | -// bigThree.add(centralPanel, aWindowConstraints); |
---|
3569 | | -// aWindowConstraints.weightx = 0; |
---|
3570 | | -// aWindowConstraints.gridx = 4; |
---|
3571 | | -// aWindowConstraints.gridwidth = 1; |
---|
3572 | | -// // aConstraints.gridheight = 3; |
---|
3573 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3574 | | -// //bigThree.add(XYZPanel, aWindowConstraints); |
---|
3575 | | -// scenePanel.setVisible(false); |
---|
3576 | | -// centralPanel.setVisible(true); |
---|
3577 | | -// XYZPanel.setVisible(false); |
---|
3578 | | - bigThree.ClearUI(); |
---|
3579 | | - bigThree.add(centralPanel); |
---|
3580 | | - bigThree.FlushUI(); |
---|
| 3798 | + Show3DView(); |
---|
3581 | 3799 | |
---|
3582 | 3800 | cameraView.requestFocusInWindow(); |
---|
3583 | 3801 | |
---|
.. | .. |
---|
3763 | 3981 | } else |
---|
3764 | 3982 | if (source == rootButton) |
---|
3765 | 3983 | { |
---|
| 3984 | + Replace(); |
---|
3766 | 3985 | Object3D obj; |
---|
3767 | 3986 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
3768 | 3987 | { |
---|
.. | .. |
---|
3777 | 3996 | if (source == closeButton) |
---|
3778 | 3997 | { |
---|
3779 | 3998 | //System.out.println("CLOSE: " + buttonGroup.getSelection()); |
---|
| 3999 | + if (copy.versionlist != null) |
---|
| 4000 | + Replace(); |
---|
| 4001 | + |
---|
3780 | 4002 | cRadio ab; |
---|
3781 | 4003 | for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();) |
---|
3782 | 4004 | { |
---|
.. | .. |
---|
3820 | 4042 | { |
---|
3821 | 4043 | Object3D child = (Object3D)e.nextElement(); |
---|
3822 | 4044 | if(child.editWindow != null) |
---|
3823 | | - objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
3824 | 4045 | child.pinned = false; |
---|
3825 | 4046 | child.CloseUI(); |
---|
3826 | 4047 | listUI.remove(child); |
---|
| 4048 | +// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit")); |
---|
3827 | 4049 | |
---|
3828 | 4050 | //child.editWindow = null; // ??????????? |
---|
3829 | 4051 | } |
---|
.. | .. |
---|
3842 | 4064 | obj.CloseUI(); |
---|
3843 | 4065 | } |
---|
3844 | 4066 | listUI.clear(); |
---|
| 4067 | + SetPinStates(group.selection.size() > 0); |
---|
3845 | 4068 | refreshContents(true); |
---|
3846 | 4069 | } else |
---|
3847 | 4070 | if (source == allParamsButton) |
---|
.. | .. |
---|
3874 | 4097 | } else |
---|
3875 | 4098 | if(source instanceof cRadio) |
---|
3876 | 4099 | { |
---|
| 4100 | + if (copy.versionlist != null) |
---|
| 4101 | + Replace(); |
---|
| 4102 | + |
---|
3877 | 4103 | group.parent = keepparent; |
---|
3878 | 4104 | group.attributes = 0; |
---|
3879 | 4105 | //group.editWindow = null; |
---|
.. | .. |
---|
3898 | 4124 | |
---|
3899 | 4125 | copy = group; |
---|
3900 | 4126 | |
---|
3901 | | - SetUndoStates(); |
---|
3902 | | - |
---|
3903 | 4127 | //Globals.theRenderer.object = group; |
---|
3904 | 4128 | if(!useclient) |
---|
3905 | 4129 | { |
---|
.. | .. |
---|
3927 | 4151 | */ |
---|
3928 | 4152 | radio.layout.doClick(); |
---|
3929 | 4153 | |
---|
| 4154 | + //assert(copy instanceof Composite); |
---|
| 4155 | + |
---|
| 4156 | + if (copy.versionlist == null) |
---|
| 4157 | + { |
---|
| 4158 | + copy.versionindex = -1; |
---|
| 4159 | + |
---|
| 4160 | + // Cannot work with loops |
---|
| 4161 | + // To fix this issue, we first mark all nodes above the root, |
---|
| 4162 | + // and check if any of these nodes are reachable below the root. |
---|
| 4163 | + Grafreed.grafreed.universe.TagObjects(copy, true); |
---|
| 4164 | + |
---|
| 4165 | + if (copy instanceof Composite && !copy.HasTags()) |
---|
| 4166 | + { |
---|
| 4167 | + if (copy.versionlist == null) |
---|
| 4168 | + copy.versionlist = new Object3D[100]; |
---|
| 4169 | + |
---|
| 4170 | + //Save(true); |
---|
| 4171 | + } |
---|
| 4172 | + else |
---|
| 4173 | + copy.versionindex = -2; |
---|
| 4174 | + |
---|
| 4175 | + Grafreed.grafreed.universe.TagObjects(copy, false); |
---|
| 4176 | + } |
---|
| 4177 | + |
---|
| 4178 | + SetVersionStates(); |
---|
| 4179 | + |
---|
3930 | 4180 | ClearUnpinned(); |
---|
| 4181 | + |
---|
3931 | 4182 | //Grafreed.Assert(group != null); |
---|
3932 | 4183 | //Grafreed.Assert(group.selection != null); |
---|
3933 | 4184 | SetPinStates(group.selection == null || group.selection.size() > 0); |
---|
.. | .. |
---|
4039 | 4290 | refreshContents(); |
---|
4040 | 4291 | } |
---|
4041 | 4292 | |
---|
| 4293 | + void TextureRatio(int axis) |
---|
| 4294 | + { |
---|
| 4295 | + Object3D obj; |
---|
| 4296 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 4297 | + { |
---|
| 4298 | + obj = (Object3D)e.nextElement(); |
---|
| 4299 | + obj.TextureRatio(axis); |
---|
| 4300 | + } |
---|
| 4301 | + |
---|
| 4302 | + refreshContents(); |
---|
| 4303 | + } |
---|
| 4304 | + |
---|
4042 | 4305 | void ResetTransform() |
---|
4043 | 4306 | { |
---|
4044 | 4307 | ResetTransform(-1); |
---|
| 4308 | + } |
---|
| 4309 | + |
---|
| 4310 | + void ScaleSelection(int scale) |
---|
| 4311 | + { |
---|
| 4312 | + Object3D obj; |
---|
| 4313 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 4314 | + { |
---|
| 4315 | + obj = (Object3D)e.nextElement(); |
---|
| 4316 | + |
---|
| 4317 | + if (obj.toParent == null) |
---|
| 4318 | + continue; |
---|
| 4319 | + |
---|
| 4320 | + obj.Scale(scale); |
---|
| 4321 | + |
---|
| 4322 | + if (obj.parent == null) |
---|
| 4323 | + { |
---|
| 4324 | + System.out.println("NULL PARENT!"); |
---|
| 4325 | + // new Exception().printStackTrace(); |
---|
| 4326 | + } |
---|
| 4327 | + else |
---|
| 4328 | + TouchTransform(obj); |
---|
| 4329 | + //obj.parent.Touch(); |
---|
| 4330 | + } |
---|
| 4331 | + |
---|
| 4332 | + refreshContents(); |
---|
4045 | 4333 | } |
---|
4046 | 4334 | |
---|
4047 | 4335 | void ResetTransform(int mask) |
---|
.. | .. |
---|
4054 | 4342 | if (obj.toParent == null) |
---|
4055 | 4343 | continue; |
---|
4056 | 4344 | |
---|
4057 | | - if (mask == -1) |
---|
4058 | | - { |
---|
4059 | | - if (obj instanceof Camera) // jan 2014 |
---|
4060 | | - { |
---|
4061 | | - LA.matIdentity(obj.toParent); |
---|
4062 | | - LA.matIdentity(obj.fromParent); |
---|
4063 | | - } |
---|
4064 | | - else |
---|
4065 | | - { |
---|
4066 | | - obj.toParent = null; // jan 2014 LA.matIdentity(obj.toParent); |
---|
4067 | | - obj.fromParent = null; // LA.matIdentity(obj.fromParent); |
---|
4068 | | - } |
---|
4069 | | - TouchTransform(obj); |
---|
4070 | | - continue; |
---|
4071 | | - } |
---|
4072 | | - if ((mask&2) != 0) // Scale |
---|
4073 | | - { |
---|
4074 | | - obj.toParent[0][0] = obj.toParent[1][1] = obj.toParent[2][2] = 1; |
---|
4075 | | - obj.toParent[0][1] = obj.toParent[1][0] = obj.toParent[2][0] = 0; |
---|
4076 | | - obj.toParent[0][2] = obj.toParent[1][2] = obj.toParent[2][1] = 0; |
---|
4077 | | - obj.fromParent[0][0] = obj.fromParent[1][1] = obj.fromParent[2][2] = 1; |
---|
4078 | | - obj.fromParent[0][1] = obj.fromParent[1][0] = obj.fromParent[2][0] = 0; |
---|
4079 | | - obj.fromParent[0][2] = obj.fromParent[1][2] = obj.fromParent[2][1] = 0; |
---|
4080 | | - } |
---|
4081 | | - if ((mask&4) != 0) // Rotation |
---|
4082 | | - { |
---|
4083 | | - // ? |
---|
4084 | | - } |
---|
4085 | | - if ((mask&1) != 0) // Translation |
---|
4086 | | - { |
---|
4087 | | - if (obj.toParent != null) |
---|
4088 | | - { |
---|
4089 | | - obj.toParent[3][0] = obj.toParent[3][1] = obj.toParent[3][2] = 0; |
---|
4090 | | - obj.fromParent[3][0] = obj.fromParent[3][1] = obj.fromParent[3][2] = 0; |
---|
4091 | | - } |
---|
4092 | | - } |
---|
| 4345 | + obj.ResetTransform(mask); |
---|
| 4346 | + |
---|
4093 | 4347 | if (obj.parent == null) |
---|
4094 | 4348 | { |
---|
4095 | 4349 | System.out.println("NULL PARENT!"); |
---|
.. | .. |
---|
4598 | 4852 | { |
---|
4599 | 4853 | Object3D obj = group.selection.get(i); |
---|
4600 | 4854 | |
---|
| 4855 | + if (obj.toParent == null) |
---|
| 4856 | + { |
---|
| 4857 | + obj.toParent = LA.newMatrix(); |
---|
| 4858 | + obj.fromParent = LA.newMatrix(); |
---|
| 4859 | + } |
---|
| 4860 | + |
---|
4601 | 4861 | LA.matTranslate(obj.toParent, i * scale, 0, 0); |
---|
4602 | 4862 | LA.matTranslateInv(obj.fromParent, -i * scale, 0, 0); |
---|
4603 | 4863 | } |
---|
.. | .. |
---|
4889 | 5149 | refreshContents(); |
---|
4890 | 5150 | } |
---|
4891 | 5151 | |
---|
| 5152 | + void ClearVersions() |
---|
| 5153 | + { |
---|
| 5154 | + group.selection.ClearVersions(); |
---|
| 5155 | + refreshContents(); |
---|
| 5156 | + } |
---|
| 5157 | + |
---|
4892 | 5158 | void FlipV(boolean flip) |
---|
4893 | 5159 | { |
---|
4894 | 5160 | group.selection.FlipV(flip); |
---|
.. | .. |
---|
5083 | 5349 | |
---|
5084 | 5350 | freezemodel = false; |
---|
5085 | 5351 | } |
---|
5086 | | - |
---|
5087 | | - boolean flashIt = true; |
---|
5088 | | - |
---|
| 5352 | + |
---|
5089 | 5353 | public void valueChanged(TreeSelectionEvent e) |
---|
5090 | 5354 | //public boolean handleEvent(Event event) |
---|
5091 | 5355 | { |
---|
.. | .. |
---|
5129 | 5393 | if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera) |
---|
5130 | 5394 | // a camera |
---|
5131 | 5395 | { |
---|
5132 | | - if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace |
---|
| 5396 | + if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crashes the camera because of invalid lightspace |
---|
5133 | 5397 | { |
---|
5134 | 5398 | CameraPane.camerachangeframe = 0; // don't refuse it |
---|
5135 | 5399 | Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); |
---|
.. | .. |
---|
5158 | 5422 | { |
---|
5159 | 5423 | editButton.setEnabled(enabled); |
---|
5160 | 5424 | uneditButton.setEnabled(enabled); |
---|
5161 | | - unselectButton.setEnabled(enabled); |
---|
| 5425 | + //unselectButton.setEnabled(enabled); |
---|
5162 | 5426 | flashSelectionButton.setEnabled(enabled); |
---|
| 5427 | + |
---|
| 5428 | + clearPanelButton.setEnabled(!listUI.isEmpty()); |
---|
| 5429 | + |
---|
| 5430 | + boolean allComposites = true; |
---|
| 5431 | + |
---|
| 5432 | + if (group.selection != null) |
---|
| 5433 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 5434 | + { |
---|
| 5435 | + Object next = e.nextElement(); |
---|
| 5436 | + if (!(next instanceof Composite)) // || (next instanceof GroupLeaf)) |
---|
| 5437 | + { |
---|
| 5438 | + allComposites = false; |
---|
| 5439 | + break; |
---|
| 5440 | + } |
---|
| 5441 | + } |
---|
| 5442 | + |
---|
| 5443 | + rootButton.setEnabled(true); // allComposites); |
---|
5163 | 5444 | } |
---|
5164 | 5445 | |
---|
5165 | 5446 | void refreshContents(boolean cp) |
---|
5166 | 5447 | { |
---|
5167 | | - if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
| 5448 | + if (Globals.SHOWINFO) |
---|
| 5449 | + //if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info")) |
---|
5168 | 5450 | if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING) |
---|
5169 | 5451 | { |
---|
5170 | 5452 | objEditor.ClearInfo(); // .GetMaterial()); |
---|
.. | .. |
---|
5174 | 5456 | Object3D child = (Object3D) group.selection.get(i); |
---|
5175 | 5457 | |
---|
5176 | 5458 | objEditor.AddInfo(child, this, true); |
---|
5177 | | - System.err.println("info : " + child.GetPath()); |
---|
| 5459 | +// System.err.println("info : " + child.GetPath()); |
---|
5178 | 5460 | } |
---|
5179 | 5461 | |
---|
5180 | 5462 | objEditor.SetText(); // jan 2014 |
---|
.. | .. |
---|
6000 | 6282 | |
---|
6001 | 6283 | cButton restoreCameraButton; |
---|
6002 | 6284 | |
---|
6003 | | - cButton saveButton; |
---|
6004 | 6285 | cButton oneStepButton; |
---|
6005 | 6286 | |
---|
6006 | 6287 | cButton groupButton; |
---|
.. | .. |
---|
6058 | 6339 | private MenuItem lookAtItem; |
---|
6059 | 6340 | private MenuItem lookFromItem; |
---|
6060 | 6341 | private MenuItem switchViewItem; |
---|
6061 | | - private MenuItem cutItem; |
---|
| 6342 | + private JMenuItem cutItem; |
---|
6062 | 6343 | private MenuItem undoItem; |
---|
6063 | 6344 | private MenuItem redoItem; |
---|
6064 | 6345 | private JMenuItem duplicateItem; |
---|
6065 | | - private MenuItem cloneItem; |
---|
| 6346 | + private JMenuItem cloneItem; |
---|
6066 | 6347 | private MenuItem cloneSupportItem; |
---|
6067 | 6348 | private MenuItem overwriteGeoItem; |
---|
6068 | 6349 | private MenuItem overwriteMatItem; |
---|
.. | .. |
---|
6083 | 6364 | private MenuItem cloneGeometriesItem; |
---|
6084 | 6365 | private MenuItem shareGeometriesItem; |
---|
6085 | 6366 | private MenuItem mergeGeometriesItem; |
---|
6086 | | - private MenuItem copyItem; |
---|
| 6367 | + private JMenuItem copyItem; |
---|
6087 | 6368 | private MenuItem pasteItem; |
---|
6088 | | - private MenuItem pasteIntoItem; |
---|
6089 | | - private MenuItem pasteLinkItem; |
---|
6090 | | - private MenuItem pasteCloneItem; |
---|
6091 | | - private MenuItem pasteExpandItem; |
---|
6092 | | - private MenuItem deleteItem; |
---|
| 6369 | + private JMenuItem pasteIntoItem; |
---|
| 6370 | + private JMenuItem pasteLinkItem; |
---|
| 6371 | + private JMenuItem pasteCloneItem; |
---|
| 6372 | + private JMenuItem pasteExpandItem; |
---|
| 6373 | + private JMenuItem deleteItem; |
---|
6093 | 6374 | private MenuItem clearAllItem; |
---|
6094 | 6375 | private MenuItem genUVItem; |
---|
6095 | 6376 | private MenuItem genNormalsMESHItem; |
---|
.. | .. |
---|
6115 | 6396 | private MenuItem clipMeshItem; |
---|
6116 | 6397 | private MenuItem smoothMeshItem; |
---|
6117 | 6398 | private MenuItem clearMaterialsItem; |
---|
| 6399 | + private MenuItem clearVersionsItem; |
---|
6118 | 6400 | |
---|
6119 | 6401 | private MenuItem liveleavesItem; |
---|
6120 | 6402 | private MenuItem unliveleavesItem; |
---|
.. | .. |
---|
6138 | 6420 | private MenuItem maxTexturesItem; |
---|
6139 | 6421 | private MenuItem panoTexturesItem; |
---|
6140 | 6422 | |
---|
| 6423 | + private MenuItem textureRatioRItem; |
---|
| 6424 | + private MenuItem textureRatioGItem; |
---|
| 6425 | + private MenuItem textureRatioBItem; |
---|
6141 | 6426 | private MenuItem resetCentroidItem; |
---|
6142 | 6427 | private MenuItem resetCentroidXZItem; |
---|
6143 | 6428 | private MenuItem resetTransformItem; |
---|
6144 | 6429 | private MenuItem transformGeometryItem; |
---|
6145 | 6430 | private MenuItem transformChildrenItem; |
---|
6146 | 6431 | private MenuItem hideItem; |
---|
6147 | | - private MenuItem grabItem; |
---|
| 6432 | + private JMenuItem grabItem; |
---|
6148 | 6433 | private MenuItem backItem; |
---|
6149 | 6434 | private MenuItem frontItem; |
---|
6150 | 6435 | private MenuItem cameraItem; |
---|
.. | .. |
---|
6157 | 6442 | private MenuItem switchTransfoItem; |
---|
6158 | 6443 | private MenuItem morphItem; |
---|
6159 | 6444 | private MenuItem linkerItem; |
---|
6160 | | - private MenuItem ungroupItem; |
---|
| 6445 | + private JMenuItem ungroupItem; |
---|
6161 | 6446 | private MenuItem editItem; |
---|
6162 | 6447 | private MenuItem openWindowItem; |
---|
6163 | 6448 | private MenuItem editLeafItem; |
---|