feature/gltf-pipeline-v2 #18

Merged
NotEvil merged 19 commits from feature/gltf-pipeline-v2 into develop 2026-04-17 02:07:45 +00:00
2 changed files with 23 additions and 11 deletions
Showing only changes of commit 7ef85b4e92 - Show all commits

View File

@@ -103,7 +103,8 @@ public record DataDrivenItemDefinition(
* is not present in this map (or null), the item falls back to its full
* {@code ownedParts}.</p>
*
* <p>This field is required in the JSON definition. Never null, never empty.</p>
* <p>Optional in JSON. When absent, defaults to empty map (= all owned bones
* enabled for all animations, no filtering).</p>
*/
Map<String, Set<String>> animationBones,
@@ -111,9 +112,10 @@ public record DataDrivenItemDefinition(
Map<ComponentType, JsonObject> componentConfigs
) {
/** Compact constructor: default null componentConfigs to empty immutable map. */
/** Compact constructor: default null maps to empty immutable maps. */
public DataDrivenItemDefinition {
if (componentConfigs == null) componentConfigs = Map.of();
if (animationBones == null) animationBones = Map.of();
}
/** Check whether this definition declares a given component type. */

View File

@@ -261,18 +261,28 @@ public final class DataDrivenItemParser {
// Optional: creator (author name for tooltip)
String creator = getStringOrNull(root, "creator");
// Required: animation_bones (per-animation bone whitelist)
Map<String, Set<String>> animationBones = parseAnimationBones(
root,
// Optional: animation_bones (per-animation bone whitelist)
// When absent, all owned bones are enabled for all animations.
Map<String, Set<String>> animationBones;
if (!root.has("animation_bones")) {
// Not an error — absent means "permissive" (all owned bones, all animations)
animationBones = null;
LOGGER.info(
"[DataDrivenItems] {}: animation_bones not declared — all owned bones enabled for all animations",
fileId
);
// null is fine — the record constructor defaults it to Map.of()
} else {
animationBones = parseAnimationBones(root, fileId);
if (animationBones == null) {
// Field was present but malformed — parseAnimationBones already logged details
LOGGER.error(
"[DataDrivenItems] Skipping {}: missing or invalid 'animation_bones'",
"[DataDrivenItems] Skipping {}: 'animation_bones' is present but invalid",
fileId
);
return null;
}
}
// Optional: components (per-component JSON configs)
Map<ComponentType, JsonObject> componentConfigs =