Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylancyclone committed May 31, 2024
2 parents 71dd02e + 0175c7f commit 99571f2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
5/22/2024 2.0.3:
* Improve error handling and handle more edge cases

5/11/2024 2.0.2:
* Fix build error

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.lathrum.VMF2OBJ</groupId>
<artifactId>VMF2OBJ</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
<packaging>jar</packaging>

<name>VMF2OBJ</name>
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/lathrum/VMF2OBJ/VMF2OBJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,14 @@ public void run() {
if (crowbarSubfolderSetting) {
path += File.separator + entity.modelName;
}
String smdText = readFile(formatPath(
String smdText = "";
try {
smdText = readFile(formatPath(
tempDir + File.separator + "models" + path + File.separator + bodyGroup));
} catch (IOException e) {
printProgressBar("Error: Could not find SMD file for model, skipping bodygroup: " + bodyGroup);
continue;
}

SMDTriangles.addAll(Arrays.asList(SMDTriangle.parseSMD(smdText)));
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/lathrum/VMF2OBJ/dataStructure/model/QC.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public static QC parseQC(String text) {
text = text.replaceAll("//(.*)", ""); // Remove all commented lines
text = text.replaceAll("\\$[^\" \\t]+\\n", ""); // Remove all keyless values
text = text.replaceAll("[^\"](\\$[^\" \\t]+)", "\"$1\""); // fix unquoted keys
text = text.replaceAll("(\".+\"[ \\t]+)([^\" \\t\\s].*)", "$1\"$2\""); // fix unquoted values
text = text.replaceAll("(\".+\"[ \\t]+)([^\" \\t\\s\\{].*)", "$1\"$2\""); // fix unquoted values
text = text.replaceAll("\\$", ""); // Remove all key prefixes
text = text.replaceAll("\\{ (\".+\") +\"\\}\"", "$1"); // Fix texturegroup formatting
text = text.replaceAll("[\\t\\r\\n]", ""); // Remove all whitespaces and newlines not in quotes
text = text.replaceAll("\" +\"", "\"\""); // Remove all whitespaces and newlines not in quotes
// text = text.replaceAll("\\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)", ""); // Remove all whitespaces and newlines not in quotes

Matcher modelNameMatcher = Pattern.compile("\"modelname\"\"([a-zA-Z0-9._/-]+)\"").matcher(text);
String modelName = "";
Matcher modelNameMatcher = Pattern.compile("\"modelname\"\"([,a-zA-Z0-9._/-]+)\"").matcher(text);
String modelName = "model.smd";
if (modelNameMatcher.find()) {
modelName = modelNameMatcher.group(1);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public static VMT parseVMT(String text) {
text = text.replaceAll("//(.*)", ""); // Remove all commented lines
text = text.replaceAll("\\x1B", ""); // Remove all illegal characters
text = text.replaceAll("!?srgb\\?", ""); // Remove all weirdos
text = text.replaceAll("360\\?", ""); // Remove all weirdos
text = text.replaceAll("!*360\\?", ""); // Remove all weirdos
text = text.replaceAll("-dx10", ""); // Remove all dx10 fallback textures
text = text.replaceAll("GPU[<>=]{1,2}[0-3]\\?", ""); // Remove all GPU conditional textures
text = text.replaceAll("[^\"](\\$[^\" \\t]+)", "\"$1\""); // fix unquoted keys
text = text.replaceAll("(\".+\"[ \\t]+)([^\" \\t\\s].*)", "$1\"$2\""); // fix unquoted values
text = text.replaceAll("(\".+\"[ \\t]+)([^\" \\t\\s\\{].*)", "$1\"$2\""); // fix unquoted values
text = text.replaceAll("\\$", ""); // Remove all key prefixes
text = text.replaceAll("\"%.+", ""); // Remove all lines with keys that start with percentage signs
text = text.replaceAll("\"*%.+", ""); // Remove all lines with keys that start with percentage signs
// text = text.replaceAll("(\".+)[{}](.+\")", "$1$2"); // Remove brackets in quotes
text = text.replaceAll("[\\t\\r\\n]", ""); // Remove all whitespaces and newlines not in quotes
text = text.replaceAll("\" +\"", "\"\""); // Remove all whitespaces and newlines not in quotes
Expand Down

0 comments on commit 99571f2

Please sign in to comment.