pypmxvmd 2.8.1__tar.gz → 2.8.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/MANIFEST.in +3 -3
- {pypmxvmd-2.8.1/pypmxvmd.egg-info → pypmxvmd-2.8.2}/PKG-INFO +53 -4
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/README.md +251 -202
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/docs/API.md +762 -762
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/docs/API_CN.md +660 -660
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/__init__.py +1147 -1147
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/expressions/__init__.py +1 -1
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/expressions/expression_profile.py +370 -370
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/expressions/expression_profile_io.py +190 -190
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/expressions/expression_resolution.py +426 -426
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/expressions/pmx_expression_profile.py +135 -135
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/expressions/tda_expression_profile.py +138 -138
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/io/vmd_codec.py +132 -132
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/models/pmx.py +2019 -2019
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/morph/__init__.py +1 -1
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/morph/expression_controller.py +55 -55
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/morph/eye_controller.py +236 -236
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/morph/morph_control_plan.py +143 -143
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/morph/morph_control_planner.py +247 -247
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/morph/morph_controller.py +253 -253
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/morph/morph_rig_profile.py +233 -233
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/morph/mouth_controller.py +55 -55
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/__init__.py +496 -496
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/cursor.py +415 -415
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/document.py +903 -903
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/editing.py +2749 -2749
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/errors.py +165 -165
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/legacy_patch.py +628 -628
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/limits.py +33 -33
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/material_compatibility.py +532 -532
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/motion_diagnostics.py +1001 -1001
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/motion_repair.py +2189 -2189
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/outfit.py +8243 -8243
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/report.py +114 -114
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/transaction.py +3479 -3479
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/types.py +127 -127
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/validator.py +1143 -1143
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/pmx/writer.py +478 -478
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/vmd/__init__.py +1 -1
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/vmd/vmd_bone_editor.py +134 -134
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/vmd/vmd_edit_plan.py +198 -198
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/vmd/vmd_frame_codec.py +286 -286
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/vmd/vmd_rotation.py +94 -94
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/vmd/vmd_sampler.py +341 -341
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/vmd/vmd_track_operations.py +436 -436
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2/pypmxvmd.egg-info}/PKG-INFO +53 -4
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd.egg-info/SOURCES.txt +0 -1
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pyproject.toml +2 -6
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/setup.py +54 -54
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_api_compatibility.py +178 -178
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_api_integration.py +94 -94
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_complete_coverage.py +1288 -1288
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_expression_profiles.py +212 -212
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_expression_resolution.py +230 -230
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_io_utils.py +150 -150
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_morph_controller.py +252 -252
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_parser_optimization.py +114 -114
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_0047_ik_contract.py +295 -295
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_21.py +357 -357
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_binary_layout.py +113 -113
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_bone_editing.py +342 -342
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_bone_morph_items.py +159 -159
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_bone_reader.py +298 -298
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_cursor.py +163 -163
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_document.py +162 -162
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_integrity.py +219 -219
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_joint_editing.py +267 -267
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_legacy_patch.py +310 -310
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_material_compatibility.py +332 -332
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_material_editing.py +445 -445
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_model_fields.py +191 -191
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_model_validation.py +131 -131
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_motion_diagnostics.py +374 -374
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_motion_repair.py +1103 -1103
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_outfit_api.py +1996 -1996
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_patch.py +152 -152
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_physics_components.py +371 -371
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_rigid_body_editing.py +271 -271
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_roundtrip.py +139 -139
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_sections_reader.py +358 -358
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_transactions.py +553 -553
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_validator.py +644 -644
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_writer.py +125 -125
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_writer_canonical.py +118 -118
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_quick_integration.py +31 -31
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_vmd_comparison.py +36 -36
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_vmd_comprehensive.py +71 -71
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_vmd_document.py +141 -141
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_vmd_editing.py +315 -315
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_vmd_format_baseline.py +197 -197
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_vmd_parser.py +33 -33
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_vmd_sampler.py +91 -91
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_vmd_section_editing.py +154 -154
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_vmd_track_operations.py +120 -120
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_vpd_parser.py +37 -37
- pypmxvmd-2.8.1/LICENSE +0 -21
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/docs/index.md +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/__init__.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/io/__init__.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/io/_fast_binary.c +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/io/_fast_binary.pyi +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/io/_fast_binary.pyx +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/io/binary_io.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/io/file_utils.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/io/text_io.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/io/vmd_layout.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/models/__init__.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/models/base.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/models/vmd.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/models/vpd.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/__init__.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/_fast_pmx.c +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/_fast_pmx.pyi +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/_fast_pmx.pyx +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/_fast_vmd.c +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/_fast_vmd.pyi +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/_fast_vmd.pyx +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/pmx_parser.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/pmx_parser_nuthouse.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/vmd_parser.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/vmd_parser_nuthouse.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/parsers/vpd_parser.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/vmd/vmd_document.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/vmd/vmd_edit_transaction.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/common/vmd/vmd_record_index.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd/py.typed +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd.egg-info/dependency_links.txt +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd.egg-info/not-zip-safe +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd.egg-info/requires.txt +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/pypmxvmd.egg-info/top_level.txt +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/setup.cfg +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_corpus_parsers.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_cython_parsers.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_comprehensive.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_high_level_editing.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_malformed.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_pmx_vertex_reader.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_text_processing.py +0 -0
- {pypmxvmd-2.8.1 → pypmxvmd-2.8.2}/tests/test_vmd_header.py +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
include docs/API.md
|
|
2
|
-
include docs/API_CN.md
|
|
3
|
-
include docs/index.md
|
|
1
|
+
include docs/API.md
|
|
2
|
+
include docs/API_CN.md
|
|
3
|
+
include docs/index.md
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: pypmxvmd
|
|
3
|
-
Version: 2.8.
|
|
3
|
+
Version: 2.8.2
|
|
4
4
|
Summary: Wrapper for reading and modifying VMD and PMX files
|
|
5
5
|
Author-email: PythonImporter <271374667@qq.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/271374667/pypmxvmd
|
|
@@ -29,9 +29,9 @@ Requires-Dist: scipy>=1.17.1; extra == "all"
|
|
|
29
29
|
|
|
30
30
|
Python MikuMikuDance File Parser Library
|
|
31
31
|
|
|
32
|
-
[](https://www.python.org/downloads/)
|
|
32
|
+
[](https://www.python.org/downloads/)
|
|
33
33
|
[](LICENSE)
|
|
34
|
-
[](https://github.com/271374667/pypmxvmd)
|
|
35
35
|
|
|
36
36
|
PyPMXVMD is a Python library for parsing and modifying MikuMikuDance (MMD) files, supporting the following formats:
|
|
37
37
|
|
|
@@ -44,13 +44,20 @@ PyPMXVMD is a Python library for parsing and modifying MikuMikuDance (MMD) files
|
|
|
44
44
|
- Complete PMX 2.0 reading and canonical writing through Spring 6DOF Joint
|
|
45
45
|
- PMX 2.1 QDEF, Flip/Impulse Morph, all six Joint types, and full Soft Body records
|
|
46
46
|
- Validating, atomic PMX 2.0/2.1 output with semantic round-trip coverage
|
|
47
|
+
- Transactional VMD editing: track index/selection, time transform, remap and merge,
|
|
48
|
+
segmented sampling, local morph editing and atomic save-as
|
|
49
|
+
- Transactional PMX extensions: bone, rigid body, joint, material, texture, IK target and
|
|
50
|
+
bone-morph appends, bulk vertex-weight batches and `atomic_batch()`
|
|
51
|
+
- Facial control: `MorphController` with eye, expression and mouth controllers, the built-in
|
|
52
|
+
69-entry Tda V4X catalog, custom presets and cross-model pose resolution
|
|
53
|
+
- Outfit observation and weight transfer, motion diagnostics and protected repair plans
|
|
47
54
|
- Conversion between binary and text formats
|
|
48
55
|
- Object-oriented API design, easy to use
|
|
49
56
|
- Distributed type information via `py.typed`
|
|
50
57
|
- Optional Cython acceleration for core parsing and binary I/O; PMX currently uses the canonical Cursor model for complete public results
|
|
51
58
|
- PMX core parsing remains dependency-light; surface fitting is available with
|
|
52
59
|
the optional `all` extra (`numpy` and `scipy`)
|
|
53
|
-
-
|
|
60
|
+
- Supports Python 3.11, 3.12 and 3.13; 3.11 remains the development baseline
|
|
54
61
|
|
|
55
62
|
## Installation
|
|
56
63
|
|
|
@@ -114,6 +121,29 @@ pose = pypmxvmd.load_vpd("pose.vpd")
|
|
|
114
121
|
print(f"Bone poses: {len(pose.bone_poses)}")
|
|
115
122
|
```
|
|
116
123
|
|
|
124
|
+
### Facial Control
|
|
125
|
+
|
|
126
|
+
`MorphController` binds one PMX model and queues gaze, eyelid, expression and mouth requests
|
|
127
|
+
into a single reviewable plan:
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from pypmxvmd import BlinkTiming, MorphController, apply_vmd_edit, load_vmd_document
|
|
131
|
+
|
|
132
|
+
face = MorphController.from_pmx("model.pmx")
|
|
133
|
+
face.look_at((0.8, 0.1, -4.0), frame=30)
|
|
134
|
+
face.blink(40, timing=BlinkTiming(2, 1, 3))
|
|
135
|
+
face.set_expression("笑い", frame=45, strength=0.8)
|
|
136
|
+
face.set_mouth_open(0.4, frame=46).close_mouth(frame=51)
|
|
137
|
+
|
|
138
|
+
plan = face.plan(load_vmd_document("motion.vmd"))
|
|
139
|
+
apply_vmd_edit(plan.require_edit_plan(), "motion-face.vmd")
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`face.eyes`, `face.expressions` and `face.mouth` expose the per-part controllers for exact
|
|
143
|
+
keys. Models other than the built-in Tda V4X Ver1.00 profile require an explicit
|
|
144
|
+
`MorphRigProfile` for the controls they expose; `plan()` reports capacity gaps instead of
|
|
145
|
+
silently skipping them. See the API reference for the full method and field tables.
|
|
146
|
+
|
|
117
147
|
### Automatic Format Detection
|
|
118
148
|
|
|
119
149
|
```python
|
|
@@ -375,6 +405,8 @@ docs/ # Documentation
|
|
|
375
405
|
scripts/ # Build helpers
|
|
376
406
|
build_cython.py
|
|
377
407
|
build_wheels.py
|
|
408
|
+
change_version.py
|
|
409
|
+
verify_wheel.py
|
|
378
410
|
tests/ # Tests + fixtures
|
|
379
411
|
```
|
|
380
412
|
|
|
@@ -411,6 +443,23 @@ uv build
|
|
|
411
443
|
|
|
412
444
|
## Changelog
|
|
413
445
|
|
|
446
|
+
### v2.8.2
|
|
447
|
+
- `scripts/build_wheels.py` now builds each supported Python (3.11/3.12/3.13) with `uv build`
|
|
448
|
+
and clears previous `outputs/01_dist` artifacts first
|
|
449
|
+
- Release rules require English notes and every supported wheel; builds below the minimum
|
|
450
|
+
supported Python are untested and must not be published
|
|
451
|
+
|
|
452
|
+
### v2.8.1
|
|
453
|
+
- Added `MorphController` with eye, expression and mouth controllers, the built-in Tda V4X
|
|
454
|
+
69-entry catalog and cross-model expression resolution
|
|
455
|
+
- Added general VMD editing: track index/selection, time transform, remap, merge and
|
|
456
|
+
segmented sampling
|
|
457
|
+
- Extended PMX transactions to bone, rigid body, joint, material, texture, IK target and
|
|
458
|
+
bone-morph appends, plus bulk vertex-weight batches and `atomic_batch()`
|
|
459
|
+
- Added outfit observation and weight transfer, motion diagnostics and protected repair plans
|
|
460
|
+
- Added `scripts/change_version.py` and published Windows wheels for CPython 3.11, 3.12 and 3.13
|
|
461
|
+
- Fixed setuptools writing `License-File` into `Metadata-Version: 2.2`, which blocked PyPI uploads
|
|
462
|
+
|
|
414
463
|
### v2.7.1
|
|
415
464
|
- Updated core parsers and binary I/O with Cython fast paths
|
|
416
465
|
- Restored the Windows CPython 3.11 native wheel build
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
Python MikuMikuDance File Parser Library
|
|
8
8
|
|
|
9
|
-
[](https://www.python.org/downloads/)
|
|
9
|
+
[](https://www.python.org/downloads/)
|
|
10
10
|
[](LICENSE)
|
|
11
|
-
[](https://github.com/271374667/pypmxvmd)
|
|
12
12
|
|
|
13
13
|
PyPMXVMD is a Python library for parsing and modifying MikuMikuDance (MMD) files, supporting the following formats:
|
|
14
14
|
|
|
@@ -18,52 +18,59 @@ PyPMXVMD is a Python library for parsing and modifying MikuMikuDance (MMD) files
|
|
|
18
18
|
|
|
19
19
|
## Features
|
|
20
20
|
|
|
21
|
-
- Complete PMX 2.0 reading and canonical writing through Spring 6DOF Joint
|
|
22
|
-
- PMX 2.1 QDEF, Flip/Impulse Morph, all six Joint types, and full Soft Body records
|
|
23
|
-
- Validating, atomic PMX 2.0/2.1 output with semantic round-trip coverage
|
|
21
|
+
- Complete PMX 2.0 reading and canonical writing through Spring 6DOF Joint
|
|
22
|
+
- PMX 2.1 QDEF, Flip/Impulse Morph, all six Joint types, and full Soft Body records
|
|
23
|
+
- Validating, atomic PMX 2.0/2.1 output with semantic round-trip coverage
|
|
24
|
+
- Transactional VMD editing: track index/selection, time transform, remap and merge,
|
|
25
|
+
segmented sampling, local morph editing and atomic save-as
|
|
26
|
+
- Transactional PMX extensions: bone, rigid body, joint, material, texture, IK target and
|
|
27
|
+
bone-morph appends, bulk vertex-weight batches and `atomic_batch()`
|
|
28
|
+
- Facial control: `MorphController` with eye, expression and mouth controllers, the built-in
|
|
29
|
+
69-entry Tda V4X catalog, custom presets and cross-model pose resolution
|
|
30
|
+
- Outfit observation and weight transfer, motion diagnostics and protected repair plans
|
|
24
31
|
- Conversion between binary and text formats
|
|
25
32
|
- Object-oriented API design, easy to use
|
|
26
|
-
- Distributed type information via `py.typed`
|
|
27
|
-
- Optional Cython acceleration for core parsing and binary I/O; PMX currently uses the canonical Cursor model for complete public results
|
|
28
|
-
- PMX core parsing remains dependency-light; surface fitting is available with
|
|
29
|
-
the optional `all` extra (`numpy` and `scipy`)
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
## Installation
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
# Core parser/writer only
|
|
36
|
-
pip install pypmxvmd
|
|
37
|
-
|
|
38
|
-
# Include surface fitting and other numeric features
|
|
39
|
-
pip install "pypmxvmd[all]"
|
|
40
|
-
|
|
41
|
-
# Add the released package to a uv project
|
|
42
|
-
uv add pypmxvmd
|
|
43
|
-
|
|
44
|
-
# Prepare a source checkout for development
|
|
45
|
-
git clone https://github.com/271374667/pypmxvmd.git
|
|
46
|
-
cd pypmxvmd
|
|
47
|
-
uv sync --group dev --python 3.11.12
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
The core package has no mandatory third-party runtime dependencies. Install the
|
|
51
|
-
`all` extra when using `fit_part_to_surface()` or
|
|
52
|
-
`PmxVariantBuilder(surface_fit=...)`.
|
|
33
|
+
- Distributed type information via `py.typed`
|
|
34
|
+
- Optional Cython acceleration for core parsing and binary I/O; PMX currently uses the canonical Cursor model for complete public results
|
|
35
|
+
- PMX core parsing remains dependency-light; surface fitting is available with
|
|
36
|
+
the optional `all` extra (`numpy` and `scipy`)
|
|
37
|
+
- Supports Python 3.11, 3.12 and 3.13; 3.11 remains the development baseline
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Core parser/writer only
|
|
43
|
+
pip install pypmxvmd
|
|
44
|
+
|
|
45
|
+
# Include surface fitting and other numeric features
|
|
46
|
+
pip install "pypmxvmd[all]"
|
|
47
|
+
|
|
48
|
+
# Add the released package to a uv project
|
|
49
|
+
uv add pypmxvmd
|
|
50
|
+
|
|
51
|
+
# Prepare a source checkout for development
|
|
52
|
+
git clone https://github.com/271374667/pypmxvmd.git
|
|
53
|
+
cd pypmxvmd
|
|
54
|
+
uv sync --group dev --python 3.11.12
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The core package has no mandatory third-party runtime dependencies. Install the
|
|
58
|
+
`all` extra when using `fit_part_to_surface()` or
|
|
59
|
+
`PmxVariantBuilder(surface_fit=...)`.
|
|
53
60
|
|
|
54
61
|
### Optional: Build Cython Accelerators
|
|
55
62
|
|
|
56
|
-
The core parsing path supports Cython-accelerated modules for VMD/PMX and binary I/O.
|
|
57
|
-
`uv sync` builds the three native extensions through the project's setuptools backend.
|
|
58
|
-
The runtime automatically falls back to pure Python when compiled modules are unavailable.
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
uv run --python 3.11.12 --no-sync python scripts/build_cython.py
|
|
62
|
-
uv run --python 3.11.12 --no-sync pytest tests/test_cython_parsers.py -m "cython and not benchmark" -ra
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Set `PYPMXVMD_BUILD_CYTHON=0` before `uv sync` when a pure-Python environment is
|
|
66
|
-
required explicitly.
|
|
63
|
+
The core parsing path supports Cython-accelerated modules for VMD/PMX and binary I/O.
|
|
64
|
+
`uv sync` builds the three native extensions through the project's setuptools backend.
|
|
65
|
+
The runtime automatically falls back to pure Python when compiled modules are unavailable.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
uv run --python 3.11.12 --no-sync python scripts/build_cython.py
|
|
69
|
+
uv run --python 3.11.12 --no-sync pytest tests/test_cython_parsers.py -m "cython and not benchmark" -ra
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Set `PYPMXVMD_BUILD_CYTHON=0` before `uv sync` when a pure-Python environment is
|
|
73
|
+
required explicitly.
|
|
67
74
|
|
|
68
75
|
## Quick Start
|
|
69
76
|
|
|
@@ -80,17 +87,40 @@ print(f"Morph frames: {len(motion.morph_frames)}")
|
|
|
80
87
|
# Modify and save
|
|
81
88
|
pypmxvmd.save_vmd(motion, "modified_motion.vmd")
|
|
82
89
|
|
|
83
|
-
# Load PMX model file
|
|
84
|
-
model = pypmxvmd.load_pmx("model.pmx")
|
|
85
|
-
print(f"Vertices: {len(model.vertices)}")
|
|
86
|
-
print(f"Materials: {len(model.materials)}")
|
|
87
|
-
pypmxvmd.save_pmx(model, "canonical-model.pmx")
|
|
90
|
+
# Load PMX model file
|
|
91
|
+
model = pypmxvmd.load_pmx("model.pmx")
|
|
92
|
+
print(f"Vertices: {len(model.vertices)}")
|
|
93
|
+
print(f"Materials: {len(model.materials)}")
|
|
94
|
+
pypmxvmd.save_pmx(model, "canonical-model.pmx")
|
|
88
95
|
|
|
89
96
|
# Load VPD pose file
|
|
90
97
|
pose = pypmxvmd.load_vpd("pose.vpd")
|
|
91
98
|
print(f"Bone poses: {len(pose.bone_poses)}")
|
|
92
99
|
```
|
|
93
100
|
|
|
101
|
+
### Facial Control
|
|
102
|
+
|
|
103
|
+
`MorphController` binds one PMX model and queues gaze, eyelid, expression and mouth requests
|
|
104
|
+
into a single reviewable plan:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from pypmxvmd import BlinkTiming, MorphController, apply_vmd_edit, load_vmd_document
|
|
108
|
+
|
|
109
|
+
face = MorphController.from_pmx("model.pmx")
|
|
110
|
+
face.look_at((0.8, 0.1, -4.0), frame=30)
|
|
111
|
+
face.blink(40, timing=BlinkTiming(2, 1, 3))
|
|
112
|
+
face.set_expression("笑い", frame=45, strength=0.8)
|
|
113
|
+
face.set_mouth_open(0.4, frame=46).close_mouth(frame=51)
|
|
114
|
+
|
|
115
|
+
plan = face.plan(load_vmd_document("motion.vmd"))
|
|
116
|
+
apply_vmd_edit(plan.require_edit_plan(), "motion-face.vmd")
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
`face.eyes`, `face.expressions` and `face.mouth` expose the per-part controllers for exact
|
|
120
|
+
keys. Models other than the built-in Tda V4X Ver1.00 profile require an explicit
|
|
121
|
+
`MorphRigProfile` for the controls they expose; `plan()` reports capacity gaps instead of
|
|
122
|
+
silently skipping them. See the API reference for the full method and field tables.
|
|
123
|
+
|
|
94
124
|
### Automatic Format Detection
|
|
95
125
|
|
|
96
126
|
```python
|
|
@@ -101,118 +131,118 @@ data = pypmxvmd.load("file.vmd") # Returns VmdMotion
|
|
|
101
131
|
data = pypmxvmd.load("file.pmx") # Returns PmxModel
|
|
102
132
|
data = pypmxvmd.load("file.vpd") # Returns VpdPose
|
|
103
133
|
|
|
104
|
-
# Automatically detect data type and save
|
|
105
|
-
pypmxvmd.save(motion, "output.vmd")
|
|
106
|
-
pypmxvmd.save(model, "output.pmx")
|
|
107
|
-
pypmxvmd.save(pose, "output.vpd")
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
PMX 2.0/2.1 binary loading and canonical saving consume every version-required
|
|
111
|
-
section through Joint/Soft Body. Saving validates the full model before
|
|
112
|
-
atomically replacing the target;
|
|
113
|
-
canonical output chooses deterministic index widths and is semantically stable,
|
|
114
|
-
but is not promised to be byte-identical to the source. Semantic validation is
|
|
115
|
-
available through `PmxModel.validate()`. PMX 2.1 support covers QDEF,
|
|
116
|
-
Flip/Impulse Morphs, Spring 6DOF/6DOF/P2P/ConeTwist/Slider/Hinge Joint records,
|
|
117
|
-
and all Soft Body Config/Cluster/Iteration/Material/Anchor/Pin fields. This
|
|
118
|
-
evidence currently comes from independent synthetic fixed-byte fixtures; no
|
|
119
|
-
redistributable real PMX 2.1 corpus is claimed.
|
|
120
|
-
|
|
121
|
-
PMX binary modes are explicit and keyword-only, so existing positional calls
|
|
122
|
-
remain compatible:
|
|
123
|
-
|
|
124
|
-
```python
|
|
125
|
-
# Complete model or IncompletePmxError
|
|
126
|
-
model = pypmxvmd.load_pmx("model.pmx", mode="strict")
|
|
127
|
-
|
|
128
|
-
# Diagnostic model plus section/EOF evidence
|
|
129
|
-
result = pypmxvmd.load_pmx("model.pmx", mode="partial")
|
|
130
|
-
|
|
131
|
-
# Canonical PMX 2.0/2.1 output
|
|
132
|
-
pypmxvmd.write_pmx(model, "output.pmx", mode="canonical")
|
|
133
|
-
|
|
134
|
-
# Source-backed fixed-width editing
|
|
135
|
-
document = pypmxvmd.load_pmx_document("model.pmx")
|
|
136
|
-
document.model.bones[0].deform_layer = 1
|
|
137
|
-
pypmxvmd.write_pmx(document, "patched.pmx", mode="lossless_patch")
|
|
138
|
-
|
|
139
|
-
# Transactional editing of an existing Bone record, including variable layouts
|
|
140
|
-
document = pypmxvmd.load_pmx_document("model.pmx")
|
|
141
|
-
editor = document.edit_bones()
|
|
142
|
-
editor.set_deform_layer(0, 2)
|
|
143
|
-
editor.set_tail_offset(0, [0.0, 1.0, 0.0])
|
|
144
|
-
editor.write_file("bone-edited.pmx")
|
|
145
|
-
|
|
146
|
-
# Transactional editing of an existing Rigid Body record
|
|
147
|
-
editor = document.edit_rigid_bodies()
|
|
148
|
-
editor.set_bone(0, -1) # legal no-Bone sentinel
|
|
149
|
-
editor.set_collision(0, collision_group=0, collision_mask=0xFFFE)
|
|
150
|
-
editor.set_physical_parameters(0, mass=1.0, friction=0.5)
|
|
151
|
-
editor.write_file("rigid-body-edited.pmx")
|
|
152
|
-
|
|
153
|
-
# Transactional editing of an existing PMX 2.0 Spring 6DOF Joint
|
|
154
|
-
editor = document.edit_joints()
|
|
155
|
-
editor.set_rigid_body_references(0, -1, 1)
|
|
156
|
-
editor.set_rotation_limits(0, [-0.5, -0.25, -0.1], [0.5, 0.25, 0.1])
|
|
157
|
-
editor.set_rotation_spring(0, [0.2, 0.3, 0.4])
|
|
158
|
-
editor.write_file("joint-edited.pmx")
|
|
159
|
-
|
|
160
|
-
# Transactional editing of an existing Material record
|
|
161
|
-
editor = document.edit_materials()
|
|
162
|
-
editor.set_diffuse_color(0, [0.8, 0.6, 0.5, 1.0])
|
|
163
|
-
editor.sync_ambient_from_diffuse(0) # explicit; never happens on ordinary save
|
|
164
|
-
editor.set_shared_toon(0, 0) # built-in toon01.bmp
|
|
165
|
-
editor.write_file("material-edited.pmx")
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
`document`/field-span reads and fixed-width `lossless_patch` writes are available
|
|
169
|
-
for selected directly mapped Material, Bone, Rigid Body, and Joint fields. Every patch is
|
|
170
|
-
range/before-byte checked, strict-reparsed, and compared against the edited model.
|
|
171
|
-
The Bone, Rigid Body, Joint, and Material transactions below can rebuild their
|
|
172
|
-
existing variable-length records. Other variable-length fields, record
|
|
173
|
-
insertion/deletion, global index renumbering, and PMX 2.1-specific high-level
|
|
174
|
-
editing remain unsupported; `preserve_layout` also remains unsupported.
|
|
175
|
-
Lossless mode never silently falls back to canonical output.
|
|
176
|
-
|
|
177
|
-
Legacy fixed-width consumers can migrate one allowlisted operation at a time
|
|
178
|
-
without adding a runtime dependency in this package. Objects that provide the
|
|
179
|
-
existing `PatchRecord.to_dict()` shape are accepted directly. Use
|
|
180
|
-
`write_legacy_patches(..., mode="dual")` to require byte-for-byte agreement
|
|
181
|
-
between the old algorithm and the registered `PmxDocument` engine before an
|
|
182
|
-
atomic output, then change the explicit mode to `document` for single-write
|
|
183
|
-
cutover. `legacy` remains the rollback mode. All modes reject the source path
|
|
184
|
-
and existing targets unless overwrite is explicitly allowed. The current
|
|
185
|
-
allowlist remains PMX 2.0 `bones[*].parent_index`; other Rebuilder patch
|
|
186
|
-
families fail closed pending field-span and semantic approval.
|
|
187
|
-
|
|
188
|
-
`PmxBoneEditor` additionally supports all PMX 2.0 fields of existing Bone
|
|
189
|
-
records: variable-length names, position/parent/deform layer, basic flags, both
|
|
190
|
-
tail modes, inheritance, fixed/local axes, external parent, and IK links/limits.
|
|
191
|
-
It rebuilds only changed Bone records, validates the complete model, strict-
|
|
192
|
-
reparses the result, and writes atomically. Bone insertion, deletion, replacement,
|
|
193
|
-
reordering, and global index renumbering remain unsupported and fail closed.
|
|
194
|
-
|
|
195
|
-
`PmxRigidBodyEditor` supports all fields of existing PMX 2.0 Rigid Body
|
|
196
|
-
records: variable-length names, Bone reference including `-1`, three shapes and
|
|
197
|
-
physics modes, raw collision group/mask, size/position/rotation in source units,
|
|
198
|
-
and all five physical parameters. It rebuilds only changed records and preserves
|
|
199
|
-
existing Joint index semantics. Rigid Body insertion, deletion, replacement, and
|
|
200
|
-
reordering remain unsupported and fail closed.
|
|
201
|
-
|
|
202
|
-
`PmxJointEditor` supports every field of existing PMX 2.0 Spring 6DOF Joint
|
|
203
|
-
records: variable-length names, the A/B Rigid Body references including `-1`,
|
|
204
|
-
position/rotation, translation/rotation min/max limits, and both spring vectors.
|
|
205
|
-
Rotation values remain raw radians. Limit setters require component-wise
|
|
206
|
-
`minimum <= maximum`; unchanged legacy source axes are preserved. Joint insertion,
|
|
207
|
-
deletion, replacement, reordering, and PMX 2.1 Joint types remain unsupported.
|
|
208
|
-
|
|
209
|
-
`PmxMaterialEditor` supports every serialized field of existing PMX 2.0
|
|
210
|
-
Material records: variable-length names/comments, colors, all eight draw flags,
|
|
211
|
-
edge settings, Texture/Sphere/Toon modes and references, and face-index counts.
|
|
212
|
-
Texture display paths remain derived from the serialized indices. Face counts
|
|
213
|
-
are updated as one validated collection, and ambient/diffuse synchronization is
|
|
214
|
-
an explicit command only. Material or texture-table insertion, deletion,
|
|
215
|
-
replacement, and reordering remain unsupported.
|
|
134
|
+
# Automatically detect data type and save
|
|
135
|
+
pypmxvmd.save(motion, "output.vmd")
|
|
136
|
+
pypmxvmd.save(model, "output.pmx")
|
|
137
|
+
pypmxvmd.save(pose, "output.vpd")
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
PMX 2.0/2.1 binary loading and canonical saving consume every version-required
|
|
141
|
+
section through Joint/Soft Body. Saving validates the full model before
|
|
142
|
+
atomically replacing the target;
|
|
143
|
+
canonical output chooses deterministic index widths and is semantically stable,
|
|
144
|
+
but is not promised to be byte-identical to the source. Semantic validation is
|
|
145
|
+
available through `PmxModel.validate()`. PMX 2.1 support covers QDEF,
|
|
146
|
+
Flip/Impulse Morphs, Spring 6DOF/6DOF/P2P/ConeTwist/Slider/Hinge Joint records,
|
|
147
|
+
and all Soft Body Config/Cluster/Iteration/Material/Anchor/Pin fields. This
|
|
148
|
+
evidence currently comes from independent synthetic fixed-byte fixtures; no
|
|
149
|
+
redistributable real PMX 2.1 corpus is claimed.
|
|
150
|
+
|
|
151
|
+
PMX binary modes are explicit and keyword-only, so existing positional calls
|
|
152
|
+
remain compatible:
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
# Complete model or IncompletePmxError
|
|
156
|
+
model = pypmxvmd.load_pmx("model.pmx", mode="strict")
|
|
157
|
+
|
|
158
|
+
# Diagnostic model plus section/EOF evidence
|
|
159
|
+
result = pypmxvmd.load_pmx("model.pmx", mode="partial")
|
|
160
|
+
|
|
161
|
+
# Canonical PMX 2.0/2.1 output
|
|
162
|
+
pypmxvmd.write_pmx(model, "output.pmx", mode="canonical")
|
|
163
|
+
|
|
164
|
+
# Source-backed fixed-width editing
|
|
165
|
+
document = pypmxvmd.load_pmx_document("model.pmx")
|
|
166
|
+
document.model.bones[0].deform_layer = 1
|
|
167
|
+
pypmxvmd.write_pmx(document, "patched.pmx", mode="lossless_patch")
|
|
168
|
+
|
|
169
|
+
# Transactional editing of an existing Bone record, including variable layouts
|
|
170
|
+
document = pypmxvmd.load_pmx_document("model.pmx")
|
|
171
|
+
editor = document.edit_bones()
|
|
172
|
+
editor.set_deform_layer(0, 2)
|
|
173
|
+
editor.set_tail_offset(0, [0.0, 1.0, 0.0])
|
|
174
|
+
editor.write_file("bone-edited.pmx")
|
|
175
|
+
|
|
176
|
+
# Transactional editing of an existing Rigid Body record
|
|
177
|
+
editor = document.edit_rigid_bodies()
|
|
178
|
+
editor.set_bone(0, -1) # legal no-Bone sentinel
|
|
179
|
+
editor.set_collision(0, collision_group=0, collision_mask=0xFFFE)
|
|
180
|
+
editor.set_physical_parameters(0, mass=1.0, friction=0.5)
|
|
181
|
+
editor.write_file("rigid-body-edited.pmx")
|
|
182
|
+
|
|
183
|
+
# Transactional editing of an existing PMX 2.0 Spring 6DOF Joint
|
|
184
|
+
editor = document.edit_joints()
|
|
185
|
+
editor.set_rigid_body_references(0, -1, 1)
|
|
186
|
+
editor.set_rotation_limits(0, [-0.5, -0.25, -0.1], [0.5, 0.25, 0.1])
|
|
187
|
+
editor.set_rotation_spring(0, [0.2, 0.3, 0.4])
|
|
188
|
+
editor.write_file("joint-edited.pmx")
|
|
189
|
+
|
|
190
|
+
# Transactional editing of an existing Material record
|
|
191
|
+
editor = document.edit_materials()
|
|
192
|
+
editor.set_diffuse_color(0, [0.8, 0.6, 0.5, 1.0])
|
|
193
|
+
editor.sync_ambient_from_diffuse(0) # explicit; never happens on ordinary save
|
|
194
|
+
editor.set_shared_toon(0, 0) # built-in toon01.bmp
|
|
195
|
+
editor.write_file("material-edited.pmx")
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
`document`/field-span reads and fixed-width `lossless_patch` writes are available
|
|
199
|
+
for selected directly mapped Material, Bone, Rigid Body, and Joint fields. Every patch is
|
|
200
|
+
range/before-byte checked, strict-reparsed, and compared against the edited model.
|
|
201
|
+
The Bone, Rigid Body, Joint, and Material transactions below can rebuild their
|
|
202
|
+
existing variable-length records. Other variable-length fields, record
|
|
203
|
+
insertion/deletion, global index renumbering, and PMX 2.1-specific high-level
|
|
204
|
+
editing remain unsupported; `preserve_layout` also remains unsupported.
|
|
205
|
+
Lossless mode never silently falls back to canonical output.
|
|
206
|
+
|
|
207
|
+
Legacy fixed-width consumers can migrate one allowlisted operation at a time
|
|
208
|
+
without adding a runtime dependency in this package. Objects that provide the
|
|
209
|
+
existing `PatchRecord.to_dict()` shape are accepted directly. Use
|
|
210
|
+
`write_legacy_patches(..., mode="dual")` to require byte-for-byte agreement
|
|
211
|
+
between the old algorithm and the registered `PmxDocument` engine before an
|
|
212
|
+
atomic output, then change the explicit mode to `document` for single-write
|
|
213
|
+
cutover. `legacy` remains the rollback mode. All modes reject the source path
|
|
214
|
+
and existing targets unless overwrite is explicitly allowed. The current
|
|
215
|
+
allowlist remains PMX 2.0 `bones[*].parent_index`; other Rebuilder patch
|
|
216
|
+
families fail closed pending field-span and semantic approval.
|
|
217
|
+
|
|
218
|
+
`PmxBoneEditor` additionally supports all PMX 2.0 fields of existing Bone
|
|
219
|
+
records: variable-length names, position/parent/deform layer, basic flags, both
|
|
220
|
+
tail modes, inheritance, fixed/local axes, external parent, and IK links/limits.
|
|
221
|
+
It rebuilds only changed Bone records, validates the complete model, strict-
|
|
222
|
+
reparses the result, and writes atomically. Bone insertion, deletion, replacement,
|
|
223
|
+
reordering, and global index renumbering remain unsupported and fail closed.
|
|
224
|
+
|
|
225
|
+
`PmxRigidBodyEditor` supports all fields of existing PMX 2.0 Rigid Body
|
|
226
|
+
records: variable-length names, Bone reference including `-1`, three shapes and
|
|
227
|
+
physics modes, raw collision group/mask, size/position/rotation in source units,
|
|
228
|
+
and all five physical parameters. It rebuilds only changed records and preserves
|
|
229
|
+
existing Joint index semantics. Rigid Body insertion, deletion, replacement, and
|
|
230
|
+
reordering remain unsupported and fail closed.
|
|
231
|
+
|
|
232
|
+
`PmxJointEditor` supports every field of existing PMX 2.0 Spring 6DOF Joint
|
|
233
|
+
records: variable-length names, the A/B Rigid Body references including `-1`,
|
|
234
|
+
position/rotation, translation/rotation min/max limits, and both spring vectors.
|
|
235
|
+
Rotation values remain raw radians. Limit setters require component-wise
|
|
236
|
+
`minimum <= maximum`; unchanged legacy source axes are preserved. Joint insertion,
|
|
237
|
+
deletion, replacement, reordering, and PMX 2.1 Joint types remain unsupported.
|
|
238
|
+
|
|
239
|
+
`PmxMaterialEditor` supports every serialized field of existing PMX 2.0
|
|
240
|
+
Material records: variable-length names/comments, colors, all eight draw flags,
|
|
241
|
+
edge settings, Texture/Sphere/Toon modes and references, and face-index counts.
|
|
242
|
+
Texture display paths remain derived from the serialized indices. Face counts
|
|
243
|
+
are updated as one validated collection, and ambient/diffuse synchronization is
|
|
244
|
+
an explicit command only. Material or texture-table insertion, deletion,
|
|
245
|
+
replacement, and reordering remain unsupported.
|
|
216
246
|
|
|
217
247
|
### Text Format Conversion
|
|
218
248
|
|
|
@@ -250,10 +280,10 @@ vmd_parser = VmdParser()
|
|
|
250
280
|
motion = vmd_parser.parse_file("motion.vmd", more_info=True)
|
|
251
281
|
vmd_parser.write_file(motion, "output.vmd")
|
|
252
282
|
|
|
253
|
-
# PMX Parser
|
|
254
|
-
pmx_parser = PmxParser()
|
|
255
|
-
model = pmx_parser.parse_file("model.pmx", more_info=True)
|
|
256
|
-
pmx_parser.write_file(model, "canonical-model.pmx")
|
|
283
|
+
# PMX Parser
|
|
284
|
+
pmx_parser = PmxParser()
|
|
285
|
+
model = pmx_parser.parse_file("model.pmx", more_info=True)
|
|
286
|
+
pmx_parser.write_file(model, "canonical-model.pmx")
|
|
257
287
|
|
|
258
288
|
# VPD Parser
|
|
259
289
|
vpd_parser = VpdParser()
|
|
@@ -309,16 +339,16 @@ class VpdPose:
|
|
|
309
339
|
|------|------|
|
|
310
340
|
| `load_vmd(path)` | Load VMD file |
|
|
311
341
|
| `save_vmd(motion, path)` | Save VMD file |
|
|
312
|
-
| `load_pmx(path)` | Load PMX file |
|
|
313
|
-
| `load_pmx(path, mode="partial")` | Load PMX with completeness evidence |
|
|
314
|
-
| `load_pmx_document(path)` | Load exact source bytes and fixed-field spans |
|
|
315
|
-
| `save_pmx(model, path)` | Save PMX file |
|
|
316
|
-
| `write_pmx(model, path, mode="canonical")` | Canonical PMX writer |
|
|
317
|
-
| `write_pmx(document, path, mode="lossless_patch")` | Audited fixed-field patch |
|
|
318
|
-
| `adapt_legacy_patches(document, records)` | Map approved legacy fixed-width records |
|
|
319
|
-
| `dual_write_legacy_patches(document, records)` | Compare legacy and lossless outputs |
|
|
320
|
-
| `verify_legacy_patch_engines(document, records)` | Compare legacy and document engines without a mirrored model edit |
|
|
321
|
-
| `write_legacy_patches(document, records, path, mode="dual")` | Atomically run the legacy/dual/document migration stage |
|
|
342
|
+
| `load_pmx(path)` | Load PMX file |
|
|
343
|
+
| `load_pmx(path, mode="partial")` | Load PMX with completeness evidence |
|
|
344
|
+
| `load_pmx_document(path)` | Load exact source bytes and fixed-field spans |
|
|
345
|
+
| `save_pmx(model, path)` | Save PMX file |
|
|
346
|
+
| `write_pmx(model, path, mode="canonical")` | Canonical PMX writer |
|
|
347
|
+
| `write_pmx(document, path, mode="lossless_patch")` | Audited fixed-field patch |
|
|
348
|
+
| `adapt_legacy_patches(document, records)` | Map approved legacy fixed-width records |
|
|
349
|
+
| `dual_write_legacy_patches(document, records)` | Compare legacy and lossless outputs |
|
|
350
|
+
| `verify_legacy_patch_engines(document, records)` | Compare legacy and document engines without a mirrored model edit |
|
|
351
|
+
| `write_legacy_patches(document, records, path, mode="dual")` | Atomically run the legacy/dual/document migration stage |
|
|
322
352
|
| `load_vpd(path)` | Load VPD file |
|
|
323
353
|
| `save_vpd(pose, path)` | Save VPD file |
|
|
324
354
|
| `load(path)` | Auto-detect and load |
|
|
@@ -346,51 +376,70 @@ pypmxvmd/ # Main package
|
|
|
346
376
|
io/ # Binary/text IO (+ Cython accel)
|
|
347
377
|
models/ # Data models (VMD/PMX/VPD)
|
|
348
378
|
parsers/ # Parsers (+ fast modules)
|
|
349
|
-
docs/ # Documentation
|
|
379
|
+
docs/ # Documentation
|
|
350
380
|
API.md # English API
|
|
351
381
|
API_CN.md # 中文 API
|
|
352
382
|
scripts/ # Build helpers
|
|
353
383
|
build_cython.py
|
|
354
384
|
build_wheels.py
|
|
385
|
+
change_version.py
|
|
386
|
+
verify_wheel.py
|
|
355
387
|
tests/ # Tests + fixtures
|
|
356
388
|
```
|
|
357
389
|
|
|
358
390
|
|
|
359
|
-
## Testing
|
|
360
|
-
|
|
361
|
-
```bash
|
|
362
|
-
# Run correctness tests, including a local corpus when present
|
|
363
|
-
uv run --python 3.11.12 --no-sync pytest -m "not benchmark" -ra
|
|
364
|
-
|
|
365
|
-
# Run the local PMX/VMD corpus only
|
|
366
|
-
uv run --python 3.11.12 --no-sync pytest -m corpus -ra
|
|
367
|
-
|
|
368
|
-
# Run coverage test
|
|
369
|
-
uv run --python 3.11.12 --no-sync pytest --cov=pypmxvmd --cov-report=html
|
|
370
|
-
```
|
|
391
|
+
## Testing
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
# Run correctness tests, including a local corpus when present
|
|
395
|
+
uv run --python 3.11.12 --no-sync pytest -m "not benchmark" -ra
|
|
396
|
+
|
|
397
|
+
# Run the local PMX/VMD corpus only
|
|
398
|
+
uv run --python 3.11.12 --no-sync pytest -m corpus -ra
|
|
399
|
+
|
|
400
|
+
# Run coverage test
|
|
401
|
+
uv run --python 3.11.12 --no-sync pytest --cov=pypmxvmd --cov-report=html
|
|
402
|
+
```
|
|
371
403
|
|
|
372
404
|
## Development
|
|
373
405
|
|
|
374
|
-
```bash
|
|
375
|
-
# Resolve and install the locked development environment
|
|
376
|
-
uv sync --group dev --python 3.11.12
|
|
377
|
-
|
|
378
|
-
# Code formatting and linting (including import sorting)
|
|
379
|
-
uv run --python 3.11.12 --no-sync ruff format --check pypmxvmd tests scripts
|
|
380
|
-
uv run --python 3.11.12 --no-sync ruff check pypmxvmd tests scripts
|
|
381
|
-
|
|
382
|
-
# Type checking
|
|
383
|
-
uv run --python 3.11.12 --no-sync ty check pypmxvmd
|
|
384
|
-
|
|
385
|
-
# Build sdist and the platform wheel
|
|
386
|
-
uv build
|
|
387
|
-
```
|
|
406
|
+
```bash
|
|
407
|
+
# Resolve and install the locked development environment
|
|
408
|
+
uv sync --group dev --python 3.11.12
|
|
409
|
+
|
|
410
|
+
# Code formatting and linting (including import sorting)
|
|
411
|
+
uv run --python 3.11.12 --no-sync ruff format --check pypmxvmd tests scripts
|
|
412
|
+
uv run --python 3.11.12 --no-sync ruff check pypmxvmd tests scripts
|
|
413
|
+
|
|
414
|
+
# Type checking
|
|
415
|
+
uv run --python 3.11.12 --no-sync ty check pypmxvmd
|
|
416
|
+
|
|
417
|
+
# Build sdist and the platform wheel
|
|
418
|
+
uv build
|
|
419
|
+
```
|
|
388
420
|
|
|
389
421
|
## Changelog
|
|
390
422
|
|
|
423
|
+
### v2.8.2
|
|
424
|
+
- `scripts/build_wheels.py` now builds each supported Python (3.11/3.12/3.13) with `uv build`
|
|
425
|
+
and clears previous `outputs/01_dist` artifacts first
|
|
426
|
+
- Release rules require English notes and every supported wheel; builds below the minimum
|
|
427
|
+
supported Python are untested and must not be published
|
|
428
|
+
|
|
429
|
+
### v2.8.1
|
|
430
|
+
- Added `MorphController` with eye, expression and mouth controllers, the built-in Tda V4X
|
|
431
|
+
69-entry catalog and cross-model expression resolution
|
|
432
|
+
- Added general VMD editing: track index/selection, time transform, remap, merge and
|
|
433
|
+
segmented sampling
|
|
434
|
+
- Extended PMX transactions to bone, rigid body, joint, material, texture, IK target and
|
|
435
|
+
bone-morph appends, plus bulk vertex-weight batches and `atomic_batch()`
|
|
436
|
+
- Added outfit observation and weight transfer, motion diagnostics and protected repair plans
|
|
437
|
+
- Added `scripts/change_version.py` and published Windows wheels for CPython 3.11, 3.12 and 3.13
|
|
438
|
+
- Fixed setuptools writing `License-File` into `Metadata-Version: 2.2`, which blocked PyPI uploads
|
|
439
|
+
|
|
391
440
|
### v2.7.1
|
|
392
441
|
- Updated core parsers and binary I/O with Cython fast paths
|
|
393
|
-
- Restored the Windows CPython 3.11 native wheel build
|
|
442
|
+
- Restored the Windows CPython 3.11 native wheel build
|
|
394
443
|
- Improved text format auto-detection and test coverage
|
|
395
444
|
|
|
396
445
|
### v2.5.1
|