From 02322d04ccab5c1279e8634b76f520f4bb835aca Mon Sep 17 00:00:00 2001 From: shadowislord Date: Tue, 24 Feb 2015 20:35:02 -0500 Subject: [PATCH] J3MLoader: fix negative signs ("-") inside mat params - Also move the "-LINEAR" directive to be associated with the parameter declaration instead of parameter default value --- .../com/jme3/material/plugins/J3MLoader.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java b/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java index 23310f12f..48159df39 100644 --- a/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java +++ b/jme3-core/src/plugins/java/com/jme3/material/plugins/J3MLoader.java @@ -217,21 +217,13 @@ public class J3MLoader implements AssetLoader { } } - // [ "(" ")" ] [ ":" ] [-LINEAR] + // [ "(" ")" ] [-LINEAR] [ ":" ] private void readParam(String statement) throws IOException{ String name; String defaultVal = null; ColorSpace colorSpace = null; - String[] split = statement.split("-"); - if(split.length>1){ - if(split[1].equalsIgnoreCase("LINEAR")){ - colorSpace = ColorSpace.Linear; - } - statement = split[0].trim(); - } - - split = statement.split(":"); + String[] split = statement.split(":"); // Parse default val if (split.length == 1){ @@ -244,6 +236,11 @@ public class J3MLoader implements AssetLoader { defaultVal = split[1].trim(); } + if (statement.endsWith("-LINEAR")) { + colorSpace = ColorSpace.Linear; + statement = statement.substring(0, statement.length() - "-LINEAR".length()); + } + // Parse ffbinding int startParen = statement.indexOf("("); if (startParen != -1){