# MPL - MMD Pose Language
MPL is a rule-based Domain-Specific Language for controlling MMD bones and creating animations using natural language commands.

[Gallery](https://popo.love/gallery) and [playground](https://popo.love/playground)
## Why MPL?
Instead of manually calculating quaternions and dealing with bone direction complexities, MPL provides intuitive pose descriptions and structured animation creation.
## Latest Syntax
MPL now supports structured pose definitions and animation sequences:
### Pose Definitions
```
@pose kick_left {
leg_l bend forward 30;
knee_l bend backward 0;
leg_r bend backward 20;
knee_r bend backward 15;
}
@pose kick_right {
leg_r bend forward 30;
knee_r bend backward 0;
leg_l bend backward 20;
knee_l bend backward 15;
}
```
### Animation Sequences
```
@animation walk {
0: kick_left;
0.3: kick_right;
0.6: kick_left;
0.9: kick_right;
}
```
### Main Execution Block
```
main {
walk;
}
```
## Bone Command Format
**Format:** `bone action direction amount`
**Actions:** `bend`, `turn`, `sway`, `move`
**Directions:** `forward`, `backward`, `left`, `right`, `up`, `down`
## Built-in Safety
- **Anatomical constraints**: Prevents impossible poses (elbows can't bend backward)
- **Range limits**: Automatically clamps values to realistic human movement ranges
- **Action validation**: Only allows anatomically correct bone movements
- **Quaternion mathematics**: Properly combines multiple rotations on the same bone
## Supported Bones
**Body Core:** `base`, `center`, `upper_body`, `waist`, `neck`, `head`
**Arms:** `shoulder_l/r`, `arm_l/r`, `arm_twist_l/r`, `elbow_l/r`, `wrist_l/r`, `wrist_twist_l/r`
**Legs:** `leg_l/r`, `knee_l/r`, `ankle_l/r`, `toe_l/r`
**Fingers:** `thumb_0/1/2_l/r`, `index_0/1/2_l/r`, `middle_0/1/2_l/r`, `ring_0/1/2_l/r`, `pinky_0/1/2_l/r`
## 📄 License
GPL-3.0 License - see LICENSE for details.