A Python tool for baking root motion data from PNG sequence frames into JSON format
Project description
Paper2D Root Motion Baker
A Python tool for baking root motion data from PNG sequence frames into JSON format.
Requirements
- This tool is implemented in Python to bake sequential PNG frame data into JSON format.
Implementation Principles
- PNG images arranged according to naming rules, with consistent resolution.
- The first PNG image is designated as the baseline root motion image.
- Detect a unique marker color point and set its coordinates as the root motion X/Y origin (0, 0).
- Process each image in sequence and calculate X/Y coordinate changes based on the relative point.
- Export a JSON file containing coordinates for each frame.
Usage Example
python main.py --marker-color 251 242 54 "E:\KXHWL\Source" "E:\KXHWL\Source\motion_data.json"
Installation
You can install the package via pip:
pip install paper2d-root-motion-baker
Requirements
- Python 3.7+
- Pillow (PIL)
- NumPy
Installation
- Clone this repository
- Install dependencies:
pip install -r requirements.txt
Usage
python main.py <input_directory> <output_json> [--marker-color R G B]
Arguments
input_directory: Directory containing PNG sequence framesoutput_json: Path for the output JSON file--marker-color: RGB values for the marker color (default: 255 0 0 for red)
Example
prmb ./sprite_sequence output.json --marker-color 255 0 0
Input Requirements
- PNG sequence frames must:
- Be in the same directory
- Have consistent dimensions
- Be named in a sortable sequence
- Each frame must contain exactly one marker point of the specified color
- The first frame is used as the reference frame (0,0)
Output Format
The tool generates a JSON file with the following structure:
{
"frames": [
{
"frame": 0,
"position": {
"x": 0,
"y": 0
}
},
{
"frame": 1,
"position": {
"x": 10,
"y": 5
}
}
// ... more frames
],
"metadata": {
"frame_count": 2,
"version": "1.0"
}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paper2d_root_motion_baker-0.1.2.tar.gz.
File metadata
- Download URL: paper2d_root_motion_baker-0.1.2.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ce7287839f41999eb664a7de3e218491fcaab6b90ad3ab85ccdb6b65aab4552
|
|
| MD5 |
64b17bc2d8f10d6e26fe83afba88ebd6
|
|
| BLAKE2b-256 |
a2a0ae6b14731e6c62a39ef945aa77a19dfc3ed96054b3de2153c9d1b5b58f1c
|
File details
Details for the file paper2d_root_motion_baker-0.1.2-py3-none-any.whl.
File metadata
- Download URL: paper2d_root_motion_baker-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b1fb1e02212d9b99d332715320965d3da735066e885e5617e7ffc1a2314f707
|
|
| MD5 |
c435208c0dd8ca9e8804af7fa6f9d99a
|
|
| BLAKE2b-256 |
d553ed307abb730d8135336f1fbf2a72b9d999e992169ebaa8d117ac64c7a7b1
|