Add model bundle export (Cast + textures) for DS2#38
Open
UncleRito wants to merge 1 commit into
Open
Conversation
Exporting a model as Cast today drops just the geometry — material slots are split per-mesh but the actual textures live behind 10+ ref hops the user has to walk by hand. This change adds a "bundle" export that emits a Cast file alongside every TextureSet transitively reachable from the source object, preserving each TextureSet's surviving directory tree (work:ds/models/.../foo.psd → ds/models/.../foo.dds). Two new exporters appear in the Export As popup whenever a model is selected: "Cast + DDS textures" and "Cast + PNG textures". Both walk outgoing refs from the source via PathTypeVisitor, collect every reachable TextureSet (which catches variation textures like ArtPartsVariationReplaceTextureSetResource — muddy face etc.), and delegate to the existing single-file Cast / DDS / PNG exporters via the Exporter SPI by id, so there's no duplicated serialization logic. The ref walk is deferred until the exporter actually asks for the textures — convert() only does the Scene conversion (which the existing pipeline already does) and packages a memoized supplier. This keeps the new converter free during anything that probes converters eagerly (Show As menu visibility, etc.). DS2 only for now; HFW model containers differ enough that a separate implementation is warranted later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When you export a model as Cast today, you get the geometry and per-material mesh pieces — but the actual textures live behind ~10 ref hops the user has to walk by hand for every model. This change adds two new export formats — Cast + DDS textures and Cast + PNG textures — that ship the Cast file alongside every TextureSet transitively reachable from the source object, preserving the surviving directory tree from
TextureSetTextureDesc.path:Variation TextureSets (e.g. muddy face via
ArtPartsVariationReplaceTextureSetResource) come along automatically because they're reachable via outgoing refs.Design notes
ExporterSPI.AbstractModelBundleExporteris the shared orchestration; concrete subclasses only declare which texture exporter id to use and which extension to emit.ModelBundleholds a memoizedSupplier<List<TextureSet>>rather than an eager list.ModelToModelBundleConverter.convert()only does the Scene conversion (delegating to the existing converter) and packages the supplier — the BFS runs only whenbundle.textureSets()is called inside the exporter. This matters because anything that probes converters eagerly (action visibility checks, viewer discovery, etc.) shouldn't pay the walk cost.ArtPartsDataResourceand its model containers differ enough that a separate implementation is warranted later. The intermediateModelBundletype lives inodradek-gameso a future HFW converter can reuse it.Test plan
./mvnw clean packagesucceeds against JDK 25.model.castplus the expectedds/models/...tree.🤖 Generated with Claude Code