.. | .. |
---|
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; |
---|
.. | .. |
---|
394 | 410 | { |
---|
395 | 411 | copy.versionlist = new Object3D[100]; |
---|
396 | 412 | copy.versionindex = -1; |
---|
| 413 | + |
---|
| 414 | + Save(true); |
---|
397 | 415 | } |
---|
398 | 416 | |
---|
399 | 417 | if(ui) |
---|
.. | .. |
---|
625 | 643 | oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest")); |
---|
626 | 644 | //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection")); |
---|
627 | 645 | //cameraMenu.add(switchViewItem = new MenuItem("Reverse View")); |
---|
628 | | - editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf")); |
---|
629 | 646 | oe.cameraMenu.add("-"); |
---|
630 | 647 | openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy...")); |
---|
631 | 648 | openWindowItem.addActionListener(this); |
---|
632 | | - editLeafItem.addActionListener(this); |
---|
633 | 649 | lookAtItem.addActionListener(this); |
---|
634 | 650 | //lookFromItem.addActinoListener(this); |
---|
635 | 651 | //switchViewItem.addActionListener(this); |
---|
.. | .. |
---|
877 | 893 | shareGeometriesItem.addActionListener(this); |
---|
878 | 894 | mergeGeometriesItem = menu.add(new MenuItem("Merge Geometries")); |
---|
879 | 895 | mergeGeometriesItem.addActionListener(this); |
---|
| 896 | + menu.add("-"); |
---|
| 897 | + editLeafItem = menu.add(new MenuItem("Edit leaf...")); |
---|
| 898 | + editLeafItem.addActionListener(this); |
---|
880 | 899 | if (Globals.ADVANCED) |
---|
881 | 900 | { |
---|
882 | 901 | // Pretty much the same as duplicate and clone. |
---|
.. | .. |
---|
900 | 919 | int tabcount = 0; |
---|
901 | 920 | int colcount = 0; |
---|
902 | 921 | int rowcount = 0; |
---|
| 922 | + int texturecount = 0; |
---|
903 | 923 | |
---|
904 | 924 | int columns = 5; |
---|
905 | 925 | int rows = 7; |
---|
906 | 926 | |
---|
907 | 927 | public void ResourceCallBack(String[] path) |
---|
908 | 928 | { |
---|
909 | | - for (int i = 0; i < path.length; i++) |
---|
910 | | - System.out.print(path[i] + "/"); |
---|
911 | | - System.out.println(); |
---|
912 | | - if (rowcount == 0) |
---|
| 929 | +// for (int i = 0; i < path.length; i++) |
---|
| 930 | +// System.out.print(path[i] + "/"); |
---|
| 931 | +// System.out.println(); |
---|
| 932 | + |
---|
| 933 | + if (//rowcount == 0 || |
---|
| 934 | + path.length == 1) |
---|
913 | 935 | { |
---|
914 | 936 | currenttab = new cGridBag(); |
---|
915 | 937 | added = false; |
---|
916 | | - String tabname = String.valueOf((char)('A'+tabcount)); |
---|
| 938 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
917 | 939 | currenttab.setName(tabname); |
---|
918 | 940 | rowcount = 1; |
---|
| 941 | + colcount = 0; |
---|
| 942 | + texturecount = 0; |
---|
919 | 943 | } |
---|
920 | 944 | |
---|
921 | | - if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg")) |
---|
| 945 | + if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) |
---|
922 | 946 | { |
---|
923 | 947 | if (!added) |
---|
924 | 948 | { |
---|
925 | 949 | added = true; |
---|
926 | 950 | resourcecontainer.add(currenttab); |
---|
927 | | - String tabname = String.valueOf((char)('A'+tabcount)); |
---|
| 951 | + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); |
---|
928 | 952 | resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); |
---|
929 | 953 | } |
---|
930 | 954 | |
---|
931 | | - AddTextureButton(path[0], path[1], currenttab); |
---|
| 955 | + AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); |
---|
| 956 | + |
---|
932 | 957 | if (++colcount >= columns) |
---|
933 | 958 | { |
---|
934 | 959 | colcount = 0; |
---|
.. | .. |
---|
949 | 974 | |
---|
950 | 975 | void CreateTexturePanel(cGridBag container) |
---|
951 | 976 | { |
---|
952 | | - resourcecontainer = new JTabbedPane(); |
---|
| 977 | + resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); |
---|
953 | 978 | container.add(resourcecontainer); |
---|
954 | 979 | |
---|
955 | 980 | Grafreed.ParseResources("textures", this); |
---|
.. | .. |
---|
972 | 997 | //new Exception().printStackTrace(); |
---|
973 | 998 | |
---|
974 | 999 | 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 | 1000 | // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints); |
---|
981 | 1001 | |
---|
982 | 1002 | oe.buttonGroup = new ButtonGroup(); |
---|
.. | .. |
---|
1009 | 1029 | |
---|
1010 | 1030 | if (Globals.ADVANCED) |
---|
1011 | 1031 | { |
---|
1012 | | - oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1013 | | - maxButton.setToolTipText("Maximize window"); |
---|
1014 | | - maxButton.addActionListener(this); |
---|
| 1032 | +// oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1033 | +// maxButton.setToolTipText("Maximize window"); |
---|
| 1034 | +// maxButton.addActionListener(this); |
---|
1015 | 1035 | } |
---|
| 1036 | + |
---|
| 1037 | +// cButton gcButton; |
---|
| 1038 | +// |
---|
| 1039 | +// oe.toolbarPanel.add(gcButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1040 | +// gcButton.setToolTipText("Garbage collect"); |
---|
| 1041 | +// gcButton.addActionListener(new ActionListener() |
---|
| 1042 | +// { |
---|
| 1043 | +// public void actionPerformed(ActionEvent e) |
---|
| 1044 | +// { |
---|
| 1045 | +// System.gc(); |
---|
| 1046 | +// } |
---|
| 1047 | +// }); |
---|
| 1048 | + |
---|
| 1049 | + oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1050 | + collapseButton.setToolTipText("Collapse toolbar"); |
---|
| 1051 | + collapseButton.addActionListener(this); |
---|
| 1052 | + |
---|
| 1053 | + oe.toolbarPanel.add(maximize3DButton = GetButton("", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1054 | + maximize3DButton.setToolTipText("Maximize 3D view"); |
---|
| 1055 | + maximize3DButton.addActionListener(this); |
---|
| 1056 | + |
---|
| 1057 | + oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1058 | + twoButton.setToolTipText("Show 3D view only"); |
---|
| 1059 | + twoButton.addActionListener(this); |
---|
| 1060 | + this.fullscreenLayout = twoButton; |
---|
| 1061 | + |
---|
| 1062 | + oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1063 | + threeButton.setToolTipText("Show controls and 3D view"); |
---|
| 1064 | + threeButton.addActionListener(this); |
---|
| 1065 | + if (Globals.ADVANCED) |
---|
| 1066 | + { |
---|
| 1067 | + oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1068 | + sixButton.setToolTipText("Show 3D view and controls"); |
---|
| 1069 | + sixButton.addActionListener(this); |
---|
| 1070 | + } |
---|
| 1071 | +// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
| 1072 | +// sevenButton.setToolTipText("3-column layout"); |
---|
| 1073 | +// sevenButton.addActionListener(this); |
---|
| 1074 | + // |
---|
1016 | 1075 | |
---|
1017 | 1076 | oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1018 | 1077 | fullButton.setToolTipText("Full-screen window"); |
---|
.. | .. |
---|
1057 | 1116 | nextVersionButton.addActionListener(this); |
---|
1058 | 1117 | nextVersionButton.setEnabled(false); |
---|
1059 | 1118 | |
---|
1060 | | - oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
1061 | | - liveCB.setToolTipText("Enable animation"); |
---|
1062 | | - liveCB.addItemListener(this); |
---|
1063 | | - |
---|
1064 | 1119 | oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1065 | 1120 | oneStepButton.setToolTipText("Animate one step forward"); |
---|
1066 | 1121 | oneStepButton.addActionListener(this); |
---|
1067 | 1122 | |
---|
| 1123 | + oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints); |
---|
| 1124 | + liveCB.setToolTipText("Enable animation"); |
---|
| 1125 | + liveCB.addItemListener(this); |
---|
| 1126 | + |
---|
1068 | 1127 | oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints); |
---|
1069 | 1128 | fastCB.setToolTipText("Fast mode"); |
---|
1070 | 1129 | fastCB.addItemListener(this); |
---|
.. | .. |
---|
1091 | 1150 | |
---|
1092 | 1151 | //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); |
---|
1093 | 1152 | |
---|
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 | 1153 | |
---|
1110 | 1154 | oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1111 | 1155 | rootButton.setToolTipText("Open selection in new tab"); |
---|
.. | .. |
---|
1121 | 1165 | |
---|
1122 | 1166 | // INSERT |
---|
1123 | 1167 | row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
1124 | | - gridButton.setToolTipText("Create grid"); |
---|
| 1168 | + gridButton.setToolTipText("Create ground"); |
---|
1125 | 1169 | gridButton.addActionListener(this); |
---|
1126 | 1170 | |
---|
1127 | 1171 | row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); |
---|
.. | .. |
---|
1413 | 1457 | |
---|
1414 | 1458 | void EditObject(Object3D obj) |
---|
1415 | 1459 | { |
---|
| 1460 | + assert(obj instanceof Composite); |
---|
| 1461 | + |
---|
| 1462 | + if (obj.versionlist == null) |
---|
| 1463 | + { |
---|
| 1464 | + obj.versionlist = new Object3D[100]; |
---|
| 1465 | + obj.versionindex = -1; |
---|
| 1466 | + } |
---|
| 1467 | + |
---|
1416 | 1468 | cRadio radioButton = new cRadio(obj.name); |
---|
1417 | 1469 | |
---|
1418 | 1470 | // June 2019. Patch to avoid bug with transparency. |
---|
.. | .. |
---|
1803 | 1855 | TreePath path; |
---|
1804 | 1856 | |
---|
1805 | 1857 | public TransferableTreePath(TreePath tp) { |
---|
1806 | | - path = tp; |
---|
| 1858 | + Object[] objs = new Object[tp.getPathCount()]; |
---|
| 1859 | + for (int i=0; i<objs.length; i++) |
---|
| 1860 | + { |
---|
| 1861 | + objs[i] = ((Object3D)tp.getPathComponent(i)).GetUUID(); |
---|
| 1862 | + } |
---|
| 1863 | + path = new TreePath(objs); |
---|
1807 | 1864 | } |
---|
1808 | 1865 | |
---|
1809 | 1866 | public synchronized DataFlavor[] getTransferDataFlavors() { |
---|
.. | .. |
---|
2696 | 2753 | if (source == fullButton) |
---|
2697 | 2754 | { |
---|
2698 | 2755 | ToggleFullScreen(); |
---|
| 2756 | + } else |
---|
| 2757 | + if (source == collapseButton) |
---|
| 2758 | + { |
---|
| 2759 | + this.expandedLayout = radio.layout; |
---|
| 2760 | + CollapseToolbar(); |
---|
| 2761 | + } else |
---|
| 2762 | + if (source == maximize3DButton) |
---|
| 2763 | + { |
---|
| 2764 | + this.expandedLayout = radio.layout; |
---|
| 2765 | + radio.layout = twoButton; |
---|
| 2766 | + Show3DView(); |
---|
| 2767 | + CollapseToolbar(); |
---|
2699 | 2768 | } else |
---|
2700 | 2769 | if (source == previousVersionButton) |
---|
2701 | 2770 | { |
---|
.. | .. |
---|
3648 | 3717 | if (CameraPane.FULLSCREEN) |
---|
3649 | 3718 | fullscreenLayout = radio.layout; |
---|
3650 | 3719 | |
---|
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(); |
---|
| 3720 | + Show3DView(); |
---|
3683 | 3721 | |
---|
3684 | 3722 | cameraView.requestFocusInWindow(); |
---|
3685 | 3723 | |
---|
.. | .. |
---|
3865 | 3903 | } else |
---|
3866 | 3904 | if (source == rootButton) |
---|
3867 | 3905 | { |
---|
| 3906 | + Replace(); |
---|
3868 | 3907 | Object3D obj; |
---|
3869 | 3908 | for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
3870 | 3909 | { |
---|
.. | .. |
---|
4001 | 4040 | |
---|
4002 | 4041 | copy = group; |
---|
4003 | 4042 | |
---|
4004 | | - SetUndoStates(); |
---|
4005 | | - |
---|
4006 | 4043 | //Globals.theRenderer.object = group; |
---|
4007 | 4044 | if(!useclient) |
---|
4008 | 4045 | { |
---|
.. | .. |
---|
4030 | 4067 | */ |
---|
4031 | 4068 | radio.layout.doClick(); |
---|
4032 | 4069 | |
---|
| 4070 | + SetUndoStates(); |
---|
| 4071 | + |
---|
4033 | 4072 | ClearUnpinned(); |
---|
4034 | 4073 | |
---|
4035 | 4074 | //Grafreed.Assert(group != null); |
---|
.. | .. |
---|
5264 | 5303 | flashSelectionButton.setEnabled(enabled); |
---|
5265 | 5304 | |
---|
5266 | 5305 | clearPanelButton.setEnabled(!listUI.isEmpty()); |
---|
| 5306 | + |
---|
| 5307 | + boolean allComposites = true; |
---|
| 5308 | + |
---|
| 5309 | + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) |
---|
| 5310 | + { |
---|
| 5311 | + if (!(e.nextElement() instanceof Composite)) |
---|
| 5312 | + { |
---|
| 5313 | + allComposites = false; |
---|
| 5314 | + break; |
---|
| 5315 | + } |
---|
| 5316 | + } |
---|
| 5317 | + |
---|
| 5318 | + rootButton.setEnabled(allComposites); |
---|
5267 | 5319 | } |
---|
5268 | 5320 | |
---|
5269 | 5321 | void refreshContents(boolean cp) |
---|
.. | .. |
---|
5278 | 5330 | Object3D child = (Object3D) group.selection.get(i); |
---|
5279 | 5331 | |
---|
5280 | 5332 | objEditor.AddInfo(child, this, true); |
---|
5281 | | - System.err.println("info : " + child.GetPath()); |
---|
| 5333 | +// System.err.println("info : " + child.GetPath()); |
---|
5282 | 5334 | } |
---|
5283 | 5335 | |
---|
5284 | 5336 | objEditor.SetText(); // jan 2014 |
---|