Normand Briere
2019-08-12 b1d79b74514041a059b454a9f6fc3970773c0cb8
GroupEditor.java
....@@ -42,12 +42,12 @@
4242 });
4343 }
4444
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)
4646 {
4747 cButton textureButton;
48
- final String path = "textures/" + f + "/"; // + t;
48
+ final String path = "textures/" + f + "/" + c + "/"; // + t;
4949 row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF));
50
- textureButton.setToolTipText(f + "s");
50
+ textureButton.setToolTipText(c + count);
5151 textureButton.addActionListener(new ActionListener()
5252 {
5353 @Override
....@@ -350,7 +350,23 @@
350350
351351 public void ChangeTexture(String texture)
352352 {
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();
354370 }
355371
356372 //ObjEditor objEditor;
....@@ -900,35 +916,41 @@
900916 int tabcount = 0;
901917 int colcount = 0;
902918 int rowcount = 0;
919
+ int texturecount = 0;
903920
904921 int columns = 5;
905922 int rows = 7;
906923
907924 public void ResourceCallBack(String[] path)
908925 {
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)
913932 {
914933 currenttab = new cGridBag();
915934 added = false;
916
- String tabname = String.valueOf((char)('A'+tabcount));
935
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
917936 currenttab.setName(tabname);
918937 rowcount = 1;
938
+ colcount = 0;
939
+ texturecount = 0;
919940 }
920941
921
- if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg"))
942
+ if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg"))
922943 {
923944 if (!added)
924945 {
925946 added = true;
926947 resourcecontainer.add(currenttab);
927
- String tabname = String.valueOf((char)('A'+tabcount));
948
+ String tabname = path[0]; // String.valueOf((char)('A'+tabcount));
928949 resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname);
929950 }
930951
931
- AddTextureButton(path[0], path[1], currenttab);
952
+ AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab);
953
+
932954 if (++colcount >= columns)
933955 {
934956 colcount = 0;
....@@ -949,7 +971,7 @@
949971
950972 void CreateTexturePanel(cGridBag container)
951973 {
952
- resourcecontainer = new JTabbedPane();
974
+ resourcecontainer = new JTabbedPane(JTabbedPane.LEFT);
953975 container.add(resourcecontainer);
954976
955977 Grafreed.ParseResources("textures", this);
....@@ -972,11 +994,6 @@
972994 //new Exception().printStackTrace();
973995
974996 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;
980997 // oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
981998
982999 oe.buttonGroup = new ButtonGroup();
....@@ -1013,6 +1030,45 @@
10131030 maxButton.setToolTipText("Maximize window");
10141031 maxButton.addActionListener(this);
10151032 }
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
+ //
10161072
10171073 oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10181074 fullButton.setToolTipText("Full-screen window");
....@@ -1057,14 +1113,14 @@
10571113 nextVersionButton.addActionListener(this);
10581114 nextVersionButton.setEnabled(false);
10591115
1060
- oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1061
- liveCB.setToolTipText("Enable animation");
1062
- liveCB.addItemListener(this);
1063
-
10641116 oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
10651117 oneStepButton.setToolTipText("Animate one step forward");
10661118 oneStepButton.addActionListener(this);
10671119
1120
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
1121
+ liveCB.setToolTipText("Enable animation");
1122
+ liveCB.addItemListener(this);
1123
+
10681124 oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
10691125 fastCB.setToolTipText("Fast mode");
10701126 fastCB.addItemListener(this);
....@@ -1091,21 +1147,6 @@
10911147
10921148 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
10931149
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
- //
11091150
11101151 oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
11111152 rootButton.setToolTipText("Open selection in new tab");
....@@ -1803,7 +1844,12 @@
18031844 TreePath path;
18041845
18051846 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);
18071853 }
18081854
18091855 public synchronized DataFlavor[] getTransferDataFlavors() {
....@@ -2696,6 +2742,18 @@
26962742 if (source == fullButton)
26972743 {
26982744 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();
26992757 } else
27002758 if (source == previousVersionButton)
27012759 {
....@@ -3648,38 +3706,7 @@
36483706 if (CameraPane.FULLSCREEN)
36493707 fullscreenLayout = radio.layout;
36503708
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();
36833710
36843711 cameraView.requestFocusInWindow();
36853712
....@@ -5278,7 +5305,7 @@
52785305 Object3D child = (Object3D) group.selection.get(i);
52795306
52805307 objEditor.AddInfo(child, this, true);
5281
- System.err.println("info : " + child.GetPath());
5308
+// System.err.println("info : " + child.GetPath());
52825309 }
52835310
52845311 objEditor.SetText(); // jan 2014