num0005 / Osoyoos-Launcher

A W.I.P launcher aiming to support all current and future versions & revisions of the Halo Editing Kit.
Other
64 stars 14 forks source link

Auto FBX #20

Closed infernoplus closed 2 years ago

infernoplus commented 2 years ago

Automatically finds and converts FBX files to JMS or ASS when you run commands like collision, physics, or structure. Also, if you place an fbx file in the root of a directory with the extension ".all.fbx" it will be used for render, collision, and physics. EX: "data/objects/vehicles/test/test.fbx.all" This should make the workflow a lot smoother.

Let me know if I should adjust anything. A bit messy.

Adding support for H1/H2 should be a real easy copy paste job but I need to know the folder structure and commands for each game.

infernoplus commented 2 years ago

I think you could move the implementation to a separate static class or something like that and use the interfaces setup for FBX to make it work for all games. Maybe there is a more natural way to do that in C# just the best thing I can think of right now. Really wish C# had multiple inheritance.

Moved it to it's own class and added support for all games. Someone else should test the support for the other games because I don't have them installed. I just looked at the wiki for differences in the folder names and commands. Hopefully I got it all right haha.

Cleaned up all the other things you commented on as well.

infernoplus commented 2 years ago

Just found an odd issue with tool.exe in Halo 3 at least that I need to address. Made a post here about it. Gonna write a util to solve this. If you get a chance can either of you confirm this bug exists in Halo 1/2 tool?

https://steamcommunity.com/app/976730/discussions/3/3120423877859517091/?ctp=5#c3200370471664585592

num0005 commented 2 years ago

That's an interesting bug, will look into it.

infernoplus commented 2 years ago

Went down some rabbit holes and wrote a rather uh... interesting... class that can load an FBX, strip parts out of it, and write it back to file.

It does seem to solve the bug, though I was initially off. It's the physics that are getting copied into the render JMS, not the collision. No idea why.

I'll commit changes with this new stuff soonish.

-e

Committed changes. Seems to be stable for me but I only tested against what 3DS Max 2015 exports. Hopefully it will work with other versions but it should be tested.

As for the H1A UI, I actually don't know how to add that. What do?

num0005 commented 2 years ago

As for the H1A UI, I actually don't know how to add that. What do?

Not actually sure right now that code is a bit convoluted and could use a cleanup, I think it would be fine to handle adding that in a different PR.

infernoplus commented 2 years ago

Heh, fixed the function names. Trying to find an api to read & write FBX left me pretty tilted.

As for writing binary vs ascii, I found that the binary doesn't always play nice on export so I'm using ascii. The ascii file is temporary though and is automatically deleted after compiling. It only exists on the drive for a few moments.

Reading binary is fine though, writing just doesn't work for whatever reason.

And on the subject of that, I have an exception catch on the fbx strip code, but no actual logging. How should I handle logging for warnings/errors?

num0005 commented 2 years ago

I don't think logging is setup yet but just use Trace https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.trace.traceerror?view=net-6.0 When it gets setup it will use it too.