Repository navigation
[FR] Refactor Variant JSON Structure #289
Copy link
Copy link
Open
Labels
✨ EnhancementNew feature or requestNew feature or request🔌 Plugin ModeThis issue pertains to blueprints in plugin modeThis issue pertains to blueprints in plugin mode
Description
Proposed Changes:
-
Extract the default variant as
base_model:- This change eliminates the need for the
is_default, asbase_modelnow clearly defines the default state base_modelshould not have anamefield since renaming it doesn’t provide value. For example, if the base model is a pirate and a variant has the pirate without a hat, the variant should be namedhatless, while the base model remainsdefault. The base model represents the default state, while variants represent deviations. This implies that in Blockbench the default variant name should be fixed
- This change eliminates the need for the
-
Remove
modelsandcustom_model_datafield from variants:- Plugin developers should generate the models based on the provided
texture_mapandexcluded_nodeswith reference to thebase_model - Plugin developers should generate
custom_model_datathemselves
- Plugin developers should generate the models based on the provided
Example of the Refactored JSON Structure:
{
"base_model": {
"79f0e939-8793-c578-03f7-91463de693a6": {
"textures": {
"0": "afba6232-5beb-cdd2-2c5f-00ccb09c6ca7",
"1": "4c8a3125-a2ga-7fb8-fc21-e55470d610db"
},
"elements": [
{
"from": [7, 8, 7],
"to": [9, 16, 9],
"faces": {
"north": {
"uv": [0, 0, 2, 8],
"texture": "#0"
},
"east": {
"uv": [2, 0, 4, 8],
"texture": "#0"
},
"south": {
"uv": [4, 0, 6, 8],
"texture": "#0"
},
"west": {
"uv": [6, 0, 8, 8],
"texture": "#0"
},
"up": {
"uv": [2, 10, 0, 8],
"texture": "#0"
},
"down": {
"uv": [10, 0, 8, 2],
"texture": "#0"
}
}
}
]
}
},
"variants": {
"c21b5e0a-f496-1893-b446-b3159808f5bb": {
"name": "New Variant",
"uuid": "c21b5e0a-f496-1893-b446-b3159808f5bb",
"excluded_bone_nodes": [],
"texture_map": {
"afba6232-5beb-cdd2-2c5f-00ccb09c6ca7": "3c7a9155-b4aa-3fd8-fb91-e58770d610da"
}
}
}
}Embedding base_model in nodes
Since base_model essentially maps data to individual bone nodes, the structure can be further simplified by embedding a model field directly within each bone node:
"79f0e939-8793-c578-03f7-91463de693a6": {
"type": "bone",
"name": "my_bone",
"uuid": "79f0e939-8793-c578-03f7-91463de693a6",
"model": {
"textures": {
"0": "afba6232-5beb-cdd2-2c5f-00ccb09c6ca7",
"1": "4c8a3125-a2ga-7fb8-fc21-e55470d610db"
},
"elements": [
{
"from": [7, 8, 7],
"to": [9, 16, 9],
"faces": {
"north": {
"uv": [0, 0, 2, 8],
"texture": "#0"
},
"east": {
"uv": [2, 0, 4, 8],
"texture": "#0"
},
"south": {
"uv": [4, 0, 6, 8],
"texture": "#0"
},
"west": {
"uv": [6, 0, 8, 8],
"texture": "#0"
},
"up": {
"uv": [2, 10, 0, 8],
"texture": "#0"
},
"down": {
"uv": [10, 0, 8, 2],
"texture": "#0"
}
}
}
]
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
✨ EnhancementNew feature or requestNew feature or request🔌 Plugin ModeThis issue pertains to blueprints in plugin modeThis issue pertains to blueprints in plugin mode
Activity
Dearliet commentedon Aug 31, 2024
When a variant texture is mapped to transparent it should be mapped to
nullin the exported JSON:{ "variants": { "c21b5e0a-f496-1893-b446-b3159808f5bb": { "name": "New Variant", "uuid": "c21b5e0a-f496-1893-b446-b3159808f5bb", "excluded_bone_nodes": [], "texture_map": { "afba6232-5beb-cdd2-2c5f-00ccb09c6ca7": null } } } }Dearliet commentedon Aug 31, 2024
Actually, whether and how the transparent texture is represented is determined by #295