From 912749d2520afedd9b56458d771400c261fe2b88 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Thu, 08 Aug 2019 20:56:19 -0400 Subject: [PATCH] All textures working. --- GroupEditor.java | 38 +++++++++++++++++++++++++------------- 1 files changed, 25 insertions(+), 13 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index 074be71..953d129 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -42,12 +42,12 @@ }); } - public void AddTextureButton(String f, final String t, cGridBag row) + public void AddTextureButton(String f, String c, final String t, int count, cGridBag row) { cButton textureButton; - final String path = "textures/" + f + "/"; // + t; + final String path = "textures/" + f + "/" + c + "/"; // + t; row.add(textureButton = GetButton(path + "icons/" + t, !Grafreed.NIMBUSLAF)); - textureButton.setToolTipText(f + "s"); + textureButton.setToolTipText(c + count); textureButton.addActionListener(new ActionListener() { @Override @@ -350,7 +350,13 @@ public void ChangeTexture(String texture) { - cameraView.repaint(); + for (int i=0; i<group.selection.size(); i++) + { + Object3D obj = group.selection.get(i); + obj.SetPigmentTexture("@" + texture); + } + + refreshContents(); } //ObjEditor objEditor; @@ -900,35 +906,41 @@ int tabcount = 0; int colcount = 0; int rowcount = 0; + int texturecount = 0; int columns = 5; int rows = 7; public void ResourceCallBack(String[] path) { - for (int i = 0; i < path.length; i++) - System.out.print(path[i] + "/"); - System.out.println(); - if (rowcount == 0) +// for (int i = 0; i < path.length; i++) +// System.out.print(path[i] + "/"); +// System.out.println(); + + if (//rowcount == 0 || + path.length == 1) { currenttab = new cGridBag(); added = false; - String tabname = String.valueOf((char)('A'+tabcount)); + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); currenttab.setName(tabname); rowcount = 1; + colcount = 0; + texturecount = 0; } - if (path.length > 1 && path[1].toLowerCase().endsWith(".jpg")) + if (path.length > 2 && path[2].toLowerCase().endsWith(".jpg")) { if (!added) { added = true; resourcecontainer.add(currenttab); - String tabname = String.valueOf((char)('A'+tabcount)); + String tabname = path[0]; // String.valueOf((char)('A'+tabcount)); resourcecontainer.setToolTipTextAt(tabcount++, "Texture Group " + tabname); } - AddTextureButton(path[0], path[1], currenttab); + AddTextureButton(path[0], path[1], path[2], texturecount++, currenttab); + if (++colcount >= columns) { colcount = 0; @@ -949,7 +961,7 @@ void CreateTexturePanel(cGridBag container) { - resourcecontainer = new JTabbedPane(); + resourcecontainer = new JTabbedPane(JTabbedPane.LEFT); container.add(resourcecontainer); Grafreed.ParseResources("textures", this); -- Gitblit v1.6.2