GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [FR] Refactor Variant JSON Structure · Issue #289 · Animated-Java/animated-java

[FR] Refactor Variant JSON Structure #289

New issue
Copy link
New issue
Copy link
Open
Open
[FR] Refactor Variant JSON Structure#289
Copy link
Assignees
SnaveSutit
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

@Dearliet
Dearliet
opened on Aug 26, 2024
Issue body actions

Proposed Changes:

  1. Extract the default variant as base_model:

    • This change eliminates the need for the is_default, as base_model now clearly defines the default state
    • base_model should not have a name field 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 named hatless, while the base model remains default. The base model represents the default state, while variants represent deviations. This implies that in Blockbench the default variant name should be fixed
  2. Remove models and custom_model_data field from variants:

    • Plugin developers should generate the models based on the provided texture_map and excluded_nodes with reference to the base_model
    • Plugin developers should generate custom_model_data themselves

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"
               }
            }
         }
      ]
   }
}

Activity

  1. Dearliet
    assigned
    SnaveSutit
    on Aug 26, 2024
  2. SnaveSutit
    added
    🐛 BugSomething isn't workingSomething isn't working
    ✨ EnhancementNew feature or requestNew feature or request
    🔌 Plugin ModeThis issue pertains to blueprints in plugin modeThis issue pertains to blueprints in plugin mode
    and removed
    🐛 BugSomething isn't workingSomething isn't working
    on Aug 26, 2024
  3. Dearliet commented on Aug 31, 2024

    @Dearliet
    Dearliet
    on Aug 31, 2024
    CollaboratorAuthor
    More actions

    When a variant texture is mapped to transparent it should be mapped to null in 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
             }
          }
       }
    }
  4. Dearliet commented on Aug 31, 2024

    @Dearliet
    Dearliet
    on Aug 31, 2024
    CollaboratorAuthor
    More actions

    Actually, whether and how the transparent texture is represented is determined by #295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @SnaveSutit
    SnaveSutit

Labels

✨ EnhancementNew feature or requestNew feature or request🔌 Plugin ModeThis issue pertains to blueprints in plugin modeThis issue pertains to blueprints in plugin mode

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.