Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

take thumbnails / thumbnail script #7

Open
madjin opened this issue Jan 25, 2024 · 1 comment
Open

take thumbnails / thumbnail script #7

madjin opened this issue Jan 25, 2024 · 1 comment

Comments

@madjin
Copy link
Member

madjin commented Jan 25, 2024

atm using screenshot glb + bash script, maybe can have blender script for thumbnailer?

@madjin
Copy link
Member Author

madjin commented Jan 25, 2024

would be great to export thumbnails + manifest.json. some reference pseudocode

import os
import sys
import json

# Copy and run this in the directory you want to generate JSON for
# For example: cp _utilities/add_manifest.py character-assets/anata/HAIR/
# Then run like python3 add_manifest.py HAIR *.vrm

def generate_json_data(vrm_directory, vrm_files):
    json_data = []

    for vrm_file in vrm_files:
        id = vrm_file.split(".")[0]
        name = id.replace("_", " ")
        directory = os.path.join(vrm_directory, vrm_file)
        thumbnail = os.path.join(vrm_directory, id + ".png")

        vrm_data = {
            "id": id,
            "name": name,
            "directory": directory,
            "thumbnail": thumbnail
        }

        json_data.append(vrm_data)

    return json_data

if __name__ == "__main__":
    if len(sys.argv) < 3:
        print("Usage: python generate_json.py <vrm_directory> <vrm_file1> <vrm_file2> ...")
        sys.exit(1)

    vrm_directory = sys.argv[1]
    vrm_files = sys.argv[2:]

    json_data = generate_json_data(vrm_directory, vrm_files)

    # Print the generated JSON data
    print(json.dumps(json_data, indent=2))

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

No branches or pull requests

1 participant