Skip to content

Add TextureSet browser and reverse model lookup#37

Open
UncleRito wants to merge 1 commit into
ShadelessFox:masterfrom
UncleRito:feature/textureset-browser
Open

Add TextureSet browser and reverse model lookup#37
UncleRito wants to merge 1 commit into
ShadelessFox:masterfrom
UncleRito:feature/textureset-browser

Conversation

@UncleRito

Copy link
Copy Markdown

Summary

Adds two related features to make finding a model from its (named) textures sane, plus a small reliability fix to LinkDatabase.

TextureSet browser panel. A new dockable secondary panel lists every TextureSet in the loaded archive with its surviving path name (from TextureSetTextureDesc.path minus the work: prefix), filterable by substring. Double-clicking a row fires a reverse BFS through the existing LinkDatabase incoming-link graph and surfaces every top-level model container that transitively references it — ArtPartsDataResource, ArtPartsCoverModelSettingResource, and variants for DS2.

Find Containing Model action. The same BFS is exposed as a right-click / Alt+Shift+F7 action on any ObjectIdHolder. Useful when you're staring at a TextureSet, RenderEffect, mesh, or any node mid-chain and want to jump to the model that owns it.

LinkDatabase.build fault tolerance. A single bad group (e.g. the Invalid boolean value: 111 reader error I hit on a current DS2 build) used to kill the whole scan. Now it logs and skips, and a final tally reports how many groups were lost. The reverse-BFS feature obviously depends on the database actually existing, so this was unblocking.

Design notes

The list of "container" types is per-game and configurable via a new ContainerTypeRegistry SPI in odradek-game-decima (ServiceLoader-discovered). Each game module supplies its own implementation listing the types BFS should stop at; the same SPI's nameOf(TypedObject) resolves display names for nodes that carry surviving names (currently just TextureSet), and the Usages panel renders those names alongside the existing [gid:idx] + type labels — so this also makes TextureSets readable in the existing "Show Usages" view.

DS2 lists ArtPartsDataResource and ArtPartsCoverModelSettingResource as containers. HFW has no ArtPartsDataResource in its types.json, so the HFW registry starts with SkinnedModelResource and StaticModelResource as the closest equivalents — happy to refine based on review.

BFS bounds default to maxDepth=20, maxResults=500; both are constants in UsagesToolPanel.FindContainersWorker. The chain depth in DS2 is around 10 hops so the depth cap is roomy. Results are bounded mostly to keep wildly-shared TextureSets from spraying a thousand rows; happy to tune.

Test plan

  • ./mvnw clean package succeeds against JDK 25.
  • Manual: TextureSet panel populates and filters; double-click on fgl_face_fuzzdeferred_v00_clr.psd returns the correct ArtPartsDataResource group.
  • Manual: LinkDatabase scan completes despite the Invalid boolean value: 111 group on the current DS2 build; WARN line lists the skipped group id.
  • HFW container-type list verified by someone with HFW context.

🤖 Generated with Claude Code

Decima archives strip most filenames at build time; only TextureSets keep
their surviving paths (via TextureSetTextureDesc.path). Finding a model
currently means manually walking 10+ ref hops backwards from a known
texture, which is painful at 4000+ unnamed ArtPartsDataResource files.

This change adds a TextureSet browser panel listing every named TextureSet
in the archive, plus a "Find Containing Model" action available on any
ObjectIdHolder selection. Both flows BFS the existing LinkDatabase
incoming-link graph and stop at game-configurable "container" types
(ArtPartsDataResource / ArtPartsCoverModelSettingResource for DS2;
SkinnedModelResource / StaticModelResource for HFW as a starting point),
then display the matches in the existing Usages panel.

The list of container types is exposed via a new ContainerTypeRegistry
SPI in odradek-game-decima so each game can declare its own set without
touching shared code. The same SPI resolves display names for objects
that carry surviving names (currently just TextureSet), and the Usages
panel uses it to label nodes with their texture path.

Also makes LinkDatabase.build tolerant of per-group read failures so a
single bad group no longer kills the whole scan.
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