From aa6ef7a6ffa31ed87a29129d0c23c662592bc064 Mon Sep 17 00:00:00 2001 From: Dylancyclone Date: Sun, 28 Jun 2020 13:47:46 -0700 Subject: [PATCH 1/3] Add support for multiple external paths Resolves Issue #7 --- README.md | 7 ++++--- src/main/java/com/lathrum/VMF2OBJ/App.java | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ab608c5..8625616 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,9 @@ From the root directory, run: ``` usage: vmf2obj [VMF_FILE] [OUTPUT_FILE] [VPK_PATHS] [args...] - -e,--externalPath Folder for external custom content (such as - materials or models) + -e,--externalPath Semi-colon separated list of folders for + external custom content (such as materials or + models) -h,--help Show this message -q,--quiet Suppress warnings -t,--tools Ignore tool brushes @@ -24,7 +25,7 @@ usage: vmf2obj [VMF_FILE] [OUTPUT_FILE] [VPK_PATHS] [args...] Example: ``` -java -jar .\vmf2obj.jar .\input.vmf .\output "C:\Program Files (x86)\Steam\steamapps\common\Half-Life 2\hl2\pak01_dir.vpk" -e "C:\path\to\custom\content" -t +java -jar .\vmf2obj.jar .\input.vmf .\output "D:\SteamLibrary\steamapps\common\Half-Life 2\hl2\hl2_misc_dir.vpk;D:\SteamLibrary\steamapps\common\Half-Life 2\hl2\hl2_textures_dir.vpk" -e "C:\path\to\custom\content\;C:\path\to\more\custom\content\" -t ``` ## Packaged Dependencies diff --git a/src/main/java/com/lathrum/VMF2OBJ/App.java b/src/main/java/com/lathrum/VMF2OBJ/App.java index 0ecfed1..3fce225 100644 --- a/src/main/java/com/lathrum/VMF2OBJ/App.java +++ b/src/main/java/com/lathrum/VMF2OBJ/App.java @@ -276,7 +276,7 @@ public static void main(String args[]) throws Exception { CommandLineParser parser = new DefaultParser(); Options options = new Options(); options.addOption("h", "help", false, "Show this message"); - options.addOption("e", "externalPath", true, "Folder for external custom content (such as materials or models)"); + options.addOption("e", "externalPath", true, "Semi-colon separated list of folders for external custom content (such as materials or models)"); options.addOption("q", "quiet", false, "Suppress warnings"); options.addOption("t", "tools", false, "Ignore tool brushes"); @@ -303,7 +303,10 @@ public static void main(String args[]) throws Exception { System.exit(0); } if (cmd.hasOption("e")) { - vpkEntries.addAll(addExtraFiles(formatPath(cmd.getOptionValue("e")), new File(cmd.getOptionValue("e")))); + String[] externalFolders = cmd.getOptionValue("e").split(";"); + for (String path : externalFolders) { + vpkEntries.addAll(addExtraFiles(path, new File(path))); + } } if (cmd.hasOption("q")) { quietMode = true; From 482ffa74e6548975a80b2d6c73c9ae78119a41c1 Mon Sep 17 00:00:00 2001 From: Dylancyclone Date: Sun, 28 Jun 2020 14:21:09 -0700 Subject: [PATCH 2/3] Add support for CS:GO's unformscale prop keyvalue This one's unique to CS:GO, but somehow I still forgot it exists. Resolves Issue #9 --- src/main/java/com/lathrum/VMF2OBJ/App.java | 2 ++ src/main/java/com/lathrum/VMF2OBJ/dataStructure/map/Entity.java | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/java/com/lathrum/VMF2OBJ/App.java b/src/main/java/com/lathrum/VMF2OBJ/App.java index 3fce225..26b0093 100644 --- a/src/main/java/com/lathrum/VMF2OBJ/App.java +++ b/src/main/java/com/lathrum/VMF2OBJ/App.java @@ -909,6 +909,7 @@ public static void main(String args[]) throws Exception { radAngles[0] = Double.parseDouble(angles[0]) * Math.PI / 180; radAngles[1] = (Double.parseDouble(angles[1]) + 90) * Math.PI / 180; radAngles[2] = Double.parseDouble(angles[2]) * Math.PI / 180; + double scale = entity.uniformscale != null ? Double.parseDouble(entity.uniformscale) : 1.0; String[] origin = entity.origin.split(" "); Vector3 transform = new Vector3(Double.parseDouble(origin[0]), Double.parseDouble(origin[1]), Double.parseDouble(origin[2])); @@ -922,6 +923,7 @@ public static void main(String args[]) throws Exception { // Or what would normally be read as XZY temp.points[j].position = temp.points[j].position.rotate3D(radAngles[0], radAngles[2], radAngles[1]); + temp.points[j].position = temp.points[j].position.multiply(scale); temp.points[j].position = temp.points[j].position.add(transform); verticies.add(temp.points[j].position); } diff --git a/src/main/java/com/lathrum/VMF2OBJ/dataStructure/map/Entity.java b/src/main/java/com/lathrum/VMF2OBJ/dataStructure/map/Entity.java index 2a9efe6..7c84f99 100644 --- a/src/main/java/com/lathrum/VMF2OBJ/dataStructure/map/Entity.java +++ b/src/main/java/com/lathrum/VMF2OBJ/dataStructure/map/Entity.java @@ -5,6 +5,7 @@ public class Entity { public String classname; public String angles; public String origin; + public String uniformscale; public String model; public String skin; From e2d83a1f66430f0f25153cb9a46aebe2f4ebef16 Mon Sep 17 00:00:00 2001 From: Dylancyclone Date: Sun, 28 Jun 2020 14:30:03 -0700 Subject: [PATCH 3/3] Bump version to v1.1.0 and add details to the readme --- README.md | 6 +++++- pom.xml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8625616..407bce0 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Watch a demonstration video: From the root directory, run: -`mvn package;java -jar ./target/VMF2OBJ-1.0.0-jar-with-dependencies.jar [VMF_FILE] [OUTPUT_FILE] [VPK_PATHS]` +`mvn package;java -jar ./target/VMF2OBJ-1.1.0-jar-with-dependencies.jar [VMF_FILE] [OUTPUT_FILE] [VPK_PATHS]` ``` usage: vmf2obj [VMF_FILE] [OUTPUT_FILE] [VPK_PATHS] [args...] @@ -61,3 +61,7 @@ These are features that I don't have any plans to implement, either because I do - infodecal entities don't store any data about where the decal is displayed, meaning it is projected from it's origin to the brush and clipped/sized accordingly. I personally don't know enough about how this process is done, and I don't feel comfortable trying to brute force it. I looked around for the source code associated with it, but I could not find anything to reverse engineer. I know it's a pretty important feature, but I don't know how to make it work _correctly_. - [ ] info_overlay - info_overlay is basically nextgen infodecal. Instead of just projecting to one side, an info_overlay can be projected to multiple faces, including different orientations and brushes so that the decal can "wrap" around. Again, I honestly don't really know how to approach this without brute forcing every face to create a seperate object with it's own UV wrapping. And that doesn't even include the fact that info_overlays can be distorted before being placed. + +## Other Notes + +Depending on where you import the converted result to, you might run into a problem where all the geometry looks very dark. This is due to the Source engine using additional normal data that might cause side effects in other software. In Blender, this can be solved with [this quick script](https://gist.github.com/Dylancyclone/d9bd1b53dbdd02702814661d8d82be5d). Simply select all the objects, and run this script in a new text editor. See [this](https://youtu.be/3CgoCSRIGqI?t=334) for more information. diff --git a/pom.xml b/pom.xml index 6681248..ca12f4b 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.lathrum.VMF2OBJ VMF2OBJ - 1.0.0 + 1.1.0 jar VMF2OBJ