Skip to content

Added controller preset support#14

Open
ailenneko wants to merge 2 commits intoQuestionableM:mainfrom
ailenneko:controller_presets
Open

Added controller preset support#14
ailenneko wants to merge 2 commits intoQuestionableM:mainfrom
ailenneko:controller_presets

Conversation

@ailenneko
Copy link

Added the ability to pre-apply controller preset bearing rotations and piston extensions onto the exported model.
To use this, simply check Apply Controller Presets when converting a blueprint.

Why this was made:
I frequently convert vehicles and mechs from the workshop, and these creations tend to rely heavily on controller + bearing setups for shaping body panels, steering columns, and other structural details. Since the tool currently exports everything in its resting state, I'd have to manually set origins and rotate parts in Blender to match how they actually look in-game — which gets tedious pretty quickly. So I decided to implement this.

How it works:
Full disclosure — I have zero programming experience, but I do have some experience with AI-assisted coding. This was implemented entirely using the Claude Code CLI tool with the Claude Opus 4.6 model, followed by multiple rounds of AI-driven code review. Please bear with me on that front.
During blueprint loading, the JSON controller fields are parsed to extract bearing pre-rotation angles and piston extension settings. A body hierarchy graph is then built from the joints connection data, and BFS is used starting from the root body to accumulate transformation matrices layer by layer. The resulting transforms are then applied to every entity belonging to the corresponding body. The entire process reuses the already-parsed JSON DOM, so no redundant file parsing is needed.
Five new files were added (ControllerData.hpp, ControllerParser.hpp/cpp, ControllerTransform.hpp/cpp), along with a m_preTransform matrix on the SMEntity base class that gets injected during OBJ writing. The feature is off by default and only takes effect when enabled — existing conversion behavior is completely unaffected.

How it was tested:
Built and tested with MSVC v143 (VS 2022) on Windows 11, Release configuration.
Tested with several high-quality vehicle blueprints and mech blueprints from the workshop, as well as small purpose-built test blueprints. Everything works as expected, with no major or obvious issues found so far.
One minor issue: the scoring heuristic for identifying the root body may not be optimal in all cases — on certain mechs, most parts are oriented correctly but the feet may end up not being perpendicular to the ground. That said, this doesn't significantly detract from the overall usefulness of the feature.

Screenshots:
2000 GT classic sports car (pop-up headlights, steering wheel, exhaust pipes):
image
image
Porsche (A-pillar, steering wheel):
image
Titan mech:
image
image

UI change:
Added a new setting, placed separately from the existing ones:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant