From d7bc8865056ea0d35df261e719f92e1422af7c6e Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 05 May 2019 09:00:26 -0400 Subject: [PATCH] Fix Windows issues. --- Object3D.java | 70 +++++++++++++++++++++++++++++++---- 1 files changed, 62 insertions(+), 8 deletions(-) diff --git a/Object3D.java b/Object3D.java index 70c7ead..2b543d0 100644 --- a/Object3D.java +++ b/Object3D.java @@ -2300,6 +2300,7 @@ { if (newWindow) { + new Exception().printStackTrace(); System.exit(0); if (parent != null) { @@ -5158,10 +5159,34 @@ // System.out.println("Fullname = " + fullname); - if (fullname.name.indexOf(":") == -1) - return fullname.name; + // Does not work on Windows due to C: +// if (fullname.name.indexOf(":") == -1) +// return fullname.name; +// +// return fullname.name.substring(0,fullname.name.indexOf(":")); - return fullname.name.substring(0,fullname.name.indexOf(":")); + String[] split = fullname.name.split(":"); + + if (split.length == 0) + { + return ""; + } + + if (split.length <= 2) + { + if (fullname.name.endsWith(":")) + { + // Windows + return fullname.name.substring(0, fullname.name.length()-1); + } + + return split[0]; + } + + // Windows + assert(split.length == 4); + + return split[0] + ":" + split[1]; } static String GetBump(cTexture fullname) @@ -5170,10 +5195,38 @@ return ""; // System.out.println("Fullname = " + fullname); - if (fullname.name.indexOf(":") == -1) - return ""; - - return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); + // Does not work on Windows due to C: +// if (fullname.name.indexOf(":") == -1) +// return ""; +// +// return fullname.name.substring(fullname.name.indexOf(":")+1,fullname.name.length()); + String[] split = fullname.name.split(":"); + + if (split.length == 0) + { + return ""; + } + + if (split.length == 1) + { + return ""; + } + + if (split.length == 2) + { + if (fullname.name.endsWith(":")) + { + // Windows + return ""; + } + + return split[1]; + } + + // Windows + assert(split.length == 4); + + return split[2] + ":" + split[3]; } String GetPigmentTexture() @@ -5247,7 +5300,7 @@ System.out.print("; textures = " + textures); System.out.println("; usedtextures = " + usedtextures); - if (GetTextures() == null) + if (GetTextures() == null) // What is that?? GetTextures().name = ":"; String texname = tex; @@ -7377,6 +7430,7 @@ objectUI.closeUI(); if (editWindow != null) { + editWindow.ctrlPanel.FlushUI(); editWindow.refreshContents(); } // ? new objectUI = null; -- Gitblit v1.6.2