feature/gltf-pipeline-v2 #18
@@ -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. */
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user