.. | .. |
---|
42 | 42 | }); |
---|
43 | 43 | } |
---|
44 | 44 | |
---|
45 | | - public void AddTextureButton(String f, final String t, cGridBag row) |
---|
| 45 | + public void AddTextureButton(String f, String c, final String t, int count, cGridBag row) |
---|
46 | 46 | { |
---|
47 | 47 | cButton textureButton; |
---|
48 | | - final String path = "textures/" + f + "/"; // + t; |
---|
| 48 | + final String path = "textures/" + f + "/" + c + "/"; // + t; |
---|
49 | 49 | row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF)); |
---|
50 | | - textureButton.setToolTipText(f + "s"); |
---|
| 50 | + textureButton.setToolTipText(c + count); |
---|
51 | 51 | textureButton.addActionListener(new ActionListener() |
---|
52 | 52 | { |
---|
53 | 53 | @Override |
---|
.. | .. |
---|
350 | 350 | |
---|
351 | 351 | public void ChangeTexture(String texture) |
---|
352 | 352 | { |
---|
353 | | - cameraView.repaint(); |
---|
| 353 | + for (int i=0; i<group.selection.size(); i++) |
---|
| 354 | + { |
---|
| 355 | + Object3D obj = group.selection.get(i); |
---|
| 356 | + obj.SetPigmentTexture("@" + texture); |
---|
| 357 | + } |
---|
| 358 | + |
---|
| 359 | + refreshContents(); |
---|
| 360 | + } |
---|
| 361 | + |
---|
| 362 | + public void Show3DView() |
---|
| 363 | + { |
---|
| 364 | + // bug |
---|
| 365 | + //gridPanel.setDividerLocation(1.0); |
---|
| 366 | + //bigPanel.setDividerLocation(0.0); |
---|
| 367 | + bigThree.ClearUI(); |
---|
| 368 | + bigThree.add(centralPanel); |
---|
| 369 | + bigThree.FlushUI(); |
---|
354 | 370 | } |
---|
355 | 371 | |
---|
356 | 372 | //ObjEditor objEditor; |
---|
.. | .. |
---|
900 | 916 | int tabcount = 0; |
---|
901 | 917 | int colcount = 0; |
---|
902 | 918 | int rowcount = 0; |
---|
| 919 | + int texturecount = 0; |
---|
903 | 920 | |
---|
904 | 921 | int columns = 5; |
---|
905 | 922 | int rows = 7; |
---|
906 | 923 | |
---|
907 | 924 | public void ResourceCallBack(String[] path) |
---|
908 | 925 | { |
---|
909 | | - for (int i = 0; i < path.length; i++) |
---|
910 | | - System.out.print(path[i] + "/"); |
---|
911 | | - System.out.println(); |
---|
912 | | - if (rowcount == 0) |
---|
| 926 | +// for (int i = 0; i < path.length; i++) |
---|
| 927 | +// System.out.print(path[i] + "/"); |
---|
| 928 | +// System.out.println(); |
---|
| 929 | + |
---|
| 930 | + if (//rowcount == 0 || |
---|
| 931 | + path.length == 1) |
---|
913 | 932 | { |
---|
914 | 933 | currenttab = new cGridBag(); |
---|
915 | 934 | added = false; |
---|
916 | | - String tabname = String.valueOf((char)('A'+tabcount)); |
---|
| 935 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
917 | 936 | currenttab.setName(tabname); |
---|
918 | 937 | rowcount = 1; |
---|
| 938 | + colcount = 0; |
---|
| 939 | + texturecount = 0; |
---|
919 | 940 | } |
---|
920 | 941 | |
---|
921 | | - if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg")) |
---|
| 942 | + if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
922 | 943 | { |
---|
923 | 944 | if (!added) |
---|
924 | 945 | { |
---|
925 | 946 | added = true; |
---|
926 | 947 | resourcecontainer.add(currenttab); |
---|
927 | | - String tabname = String.valueOf((char)('A'+tabcount)); |
---|
| 948 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
928 | 949 | resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
929 | 950 | } |
---|
930 | 951 | |
---|
931 | | - AddTextureButton(path[0], path[1], currenttab); |
---|
| 952 | + AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
| 953 | + |
---|
932 | 954 | if (++colcount >= columns) |
---|
933 | 955 | { |
---|
934 | 956 | colcount = 0; |
---|
.. | .. |
---|
949 | 971 | |
---|
950 | 972 | void CreateTexturePanel(cGridBag container) |
---|
951 | 973 | { |
---|
952 | | - resourcecontainer = new JTabbedPane(); |
---|
| 974 | + resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); |
---|
953 | 975 | container.add(resourcecontainer); |
---|
954 | 976 | |
---|
955 | 977 | Grafreed.ParseResources("textures", this); |
---|
.. | .. |
---|
972 | 994 | //new Exception().printStackTrace(); |
---|
973 | 995 | |
---|
974 | 996 | oe.radioPanel = new JPanel(new GridBagLayout()); |
---|
975 | | - oe.aConstraints.weightx = 1; |
---|
976 | | - oe.aConstraints.weighty = 0; |
---|
977 | | - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL; |
---|
978 | | - oe.aConstraints.gridwidth = 100; |
---|
979 | | - oe.aConstraints.gridheight = 1; |
---|
980 | 997 | // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
981 | 998 | |
---|
982 | 999 | oe.buttonGroup = new ButtonGroup(); |
---|
.. | .. |
---|
1013 | 1030 | maxButton.setToolTipText("Maximize window"); |
---|
1014 | 1031 | maxButton.addActionListener(this); |
---|
1015 | 1032 | } |
---|
| 1033 | + |
---|
| 1034 | + cButton gcButton; |
---|
| 1035 | + |
---|
| 1036 | + oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1037 | + gcButton.setToolTipText("Garbage collect"); |
---|
| 1038 | + gcButton.addActionListener(new ActionListener() |
---|
| 1039 | + { |
---|
| 1040 | + public void actionPerformed(ActionEvent e) |
---|
| 1041 | + { |
---|
| 1042 | + System.gc(); |
---|
| 1043 | + } |
---|
| 1044 | + }); |
---|
| 1045 | + |
---|
| 1046 | + oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1047 | + collapseButton.setToolTipText("Collapse toolbar"); |
---|
| 1048 | + collapseButton.addActionListener(this); |
---|
| 1049 | + |
---|
| 1050 | + oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1051 | + maximize3DButton.setToolTipText("Maximize 3D view"); |
---|
| 1052 | + maximize3DButton.addActionListener(this); |
---|
| 1053 | + |
---|
| 1054 | + oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1055 | + twoButton.setToolTipText("Show 3D view only"); |
---|
| 1056 | + twoButton.addActionListener(this); |
---|
| 1057 | + this.fullscreenLayout = twoButton; |
---|
| 1058 | + |
---|
| 1059 | + oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1060 | + threeButton.setToolTipText("Show controls and 3D view"); |
---|
| 1061 | + threeButton.addActionListener(this); |
---|
| 1062 | + if (Globals.ADVANCED) |
---|
| 1063 | + { |
---|
| 1064 | + oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1065 | + sixButton.setToolTipText("Show 3D view and controls"); |
---|
| 1066 | + sixButton.addActionListener(this); |
---|
| 1067 | + } |
---|
| 1068 | +// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1069 | +// sevenButton.setToolTipText("3-column layout"); |
---|
| 1070 | +// sevenButton.addActionListener(this); |
---|
| 1071 | + // |
---|
1016 | 1072 | |
---|
1017 | 1073 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1018 | 1074 | fullButton.setToolTipText("Full-screen window"); |
---|
.. | .. |
---|
1057 | 1113 | nextVersionButton.addActionListener(this); |
---|
1058 | 1114 | nextVersionButton.setEnabled(false); |
---|
1059 | 1115 | |
---|
1060 | | - oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
1061 | | - liveCB.setToolTipText("Enable animation"); |
---|
1062 | | - liveCB.addItemListener(this); |
---|
1063 | | - |
---|
1064 | 1116 | oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1065 | 1117 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
1066 | 1118 | oneStepButton.addActionListener(this); |
---|
1067 | 1119 | |
---|
| 1120 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
| 1121 | + liveCB.setToolTipText("Enable animation"); |
---|
| 1122 | + liveCB.addItemListener(this); |
---|
| 1123 | + |
---|
1068 | 1124 | oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
1069 | 1125 | fastCB.setToolTipText("Fast mode"); |
---|
1070 | 1126 | fastCB.addItemListener(this); |
---|
.. | .. |
---|
1091 | 1147 | |
---|
1092 | 1148 | //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
1093 | 1149 | |
---|
1094 | | - oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1095 | | - twoButton.setToolTipText("Show 3D view only"); |
---|
1096 | | - twoButton.addActionListener(this); |
---|
1097 | | - this.fullscreenLayout = twoButton; |
---|
1098 | | - |
---|
1099 | | - oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1100 | | - threeButton.setToolTipText("Show controls and 3D view"); |
---|
1101 | | - threeButton.addActionListener(this); |
---|
1102 | | - oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1103 | | - sixButton.setToolTipText("Show 3D view and controls"); |
---|
1104 | | - sixButton.addActionListener(this); |
---|
1105 | | -// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1106 | | -// sevenButton.setToolTipText("3-column layout"); |
---|
1107 | | -// sevenButton.addActionListener(this); |
---|
1108 | | - // |
---|
1109 | 1150 | |
---|
1110 | 1151 | oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1111 | 1152 | rootButton.setToolTipText("Open selection in new tab"); |
---|
.. | .. |
---|
1803 | 1844 | TreePath path; |
---|
1804 | 1845 | |
---|
1805 | 1846 | public TransferableTreePath(TreePath tp) { |
---|
1806 | | - path = tp; |
---|
| 1847 | + Object[] objs = new Object[tp.getPathCount()]; |
---|
| 1848 | + for (int i=0; i<objs.length; i++) |
---|
| 1849 | + { |
---|
| 1850 | + objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID(); |
---|
| 1851 | + } |
---|
| 1852 | + path = new TreePath(objs); |
---|
1807 | 1853 | } |
---|
1808 | 1854 | |
---|
1809 | 1855 | public synchronized DataFlavor[] getTransferDataFlavors() { |
---|
.. | .. |
---|
2696 | 2742 | if (source == fullButton) |
---|
2697 | 2743 | { |
---|
2698 | 2744 | ToggleFullScreen(); |
---|
| 2745 | + } else |
---|
| 2746 | + if (source == collapseButton) |
---|
| 2747 | + { |
---|
| 2748 | + this.expandedLayout = radio.layout; |
---|
| 2749 | + CollapseToolbar(); |
---|
| 2750 | + } else |
---|
| 2751 | + if (source == maximize3DButton) |
---|
| 2752 | + { |
---|
| 2753 | + this.expandedLayout = radio.layout; |
---|
| 2754 | + radio.layout = twoButton; |
---|
| 2755 | + Show3DView(); |
---|
| 2756 | + CollapseToolbar(); |
---|
2699 | 2757 | } else |
---|
2700 | 2758 | if (source == previousVersionButton) |
---|
2701 | 2759 | { |
---|
.. | .. |
---|
3648 | 3706 | if (CameraPane.FULLSCREEN) |
---|
3649 | 3707 | fullscreenLayout = radio.layout; |
---|
3650 | 3708 | |
---|
3651 | | - // bug |
---|
3652 | | - //gridPanel.setDividerLocation(1.0); |
---|
3653 | | - //bigPanel.setDividerLocation(0.0); |
---|
3654 | | -// bigThree.remove(scenePanel); |
---|
3655 | | -// bigThree.remove(centralPanel); |
---|
3656 | | -// bigThree.remove(XYZPanel); |
---|
3657 | | -// aWindowConstraints.gridx = 0; |
---|
3658 | | -// aWindowConstraints.gridy = 0; |
---|
3659 | | -// aWindowConstraints.gridwidth = 1; |
---|
3660 | | -// // aConstraints.gridheight = 3; |
---|
3661 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3662 | | -// aWindowConstraints.weightx = 0; |
---|
3663 | | -// aWindowConstraints.weighty = 1; |
---|
3664 | | -// //bigThree.add(jtp, aWindowConstraints); |
---|
3665 | | -// aWindowConstraints.weightx = 1; |
---|
3666 | | -// aWindowConstraints.gridwidth = 3; |
---|
3667 | | -// // aConstraints.gridheight = 3; |
---|
3668 | | -// aWindowConstraints.gridx = 1; |
---|
3669 | | -// aWindowConstraints.fill = GridBagConstraints.BOTH; |
---|
3670 | | -// bigThree.add(centralPanel, aWindowConstraints); |
---|
3671 | | -// aWindowConstraints.weightx = 0; |
---|
3672 | | -// aWindowConstraints.gridx = 4; |
---|
3673 | | -// aWindowConstraints.gridwidth = 1; |
---|
3674 | | -// // aConstraints.gridheight = 3; |
---|
3675 | | -// aWindowConstraints.fill = GridBagConstraints.VERTICAL; |
---|
3676 | | -// //bigThree.add(XYZPanel, aWindowConstraints); |
---|
3677 | | -// scenePanel.setVisible(false); |
---|
3678 | | -// centralPanel.setVisible(true); |
---|
3679 | | -// XYZPanel.setVisible(false); |
---|
3680 | | - bigThree.ClearUI(); |
---|
3681 | | - bigThree.add(centralPanel); |
---|
3682 | | - bigThree.FlushUI(); |
---|
| 3709 | + Show3DView(); |
---|
3683 | 3710 | |
---|
3684 | 3711 | cameraView.requestFocusInWindow(); |
---|
3685 | 3712 | |
---|
.. | .. |
---|
5278 | 5305 | Object3D child = (Object3D) group.selection.get(i); |
---|
5279 | 5306 | |
---|
5280 | 5307 | objEditor.AddInfo(child, this, true); |
---|
5281 | | - System.err.println("info : " + child.GetPath()); |
---|
| 5308 | +// System.err.println("info : " + child.GetPath()); |
---|
5282 | 5309 | } |
---|
5283 | 5310 | |
---|
5284 | 5311 | objEditor.SetText(); // jan 2014 |
---|