renpy-rigging 0.3.2__py3-none-any.whl
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.
- renpy_rigging/__init__.py +241 -0
- renpy_rigging/animation.py +662 -0
- renpy_rigging/attachment.py +419 -0
- renpy_rigging/audio.py +80 -0
- renpy_rigging/io.py +450 -0
- renpy_rigging/math2d.py +261 -0
- renpy_rigging/overlay.py +175 -0
- renpy_rigging/pose.py +603 -0
- renpy_rigging/render.py +2360 -0
- renpy_rigging/rig.py +366 -0
- renpy_rigging/scene.py +364 -0
- renpy_rigging-0.3.2.dist-info/METADATA +588 -0
- renpy_rigging-0.3.2.dist-info/RECORD +15 -0
- renpy_rigging-0.3.2.dist-info/WHEEL +4 -0
- renpy_rigging-0.3.2.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"""
|
|
2
|
+
renpy-rigging: A 2D skeletal rigging, posing, and animation system for Ren'Py.
|
|
3
|
+
|
|
4
|
+
This package provides:
|
|
5
|
+
- Rig data structures for 2D skeletal characters
|
|
6
|
+
- Pose application and blending
|
|
7
|
+
- Animation playback
|
|
8
|
+
- Ren'Py-native displayable rendering
|
|
9
|
+
|
|
10
|
+
Basic Usage:
|
|
11
|
+
from renpy_rigging import Rig, PoseLibrary, AnimationLibrary, RigRenderer
|
|
12
|
+
|
|
13
|
+
# Load assets
|
|
14
|
+
rig = Rig.load("characters/vince/rig.json")
|
|
15
|
+
poses = PoseLibrary.load("characters/vince/poses.json")
|
|
16
|
+
anims = AnimationLibrary.load("characters/vince/animations.json")
|
|
17
|
+
|
|
18
|
+
# Create renderer
|
|
19
|
+
renderer = RigRenderer(rig, poses, anims)
|
|
20
|
+
|
|
21
|
+
# In Ren'Py script:
|
|
22
|
+
# show expression renderer.show_pose("neutral") at center
|
|
23
|
+
# show expression renderer.play_animation("idle", loop=True) at center
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
__version__ = "0.3.2"
|
|
27
|
+
|
|
28
|
+
# Core data structures
|
|
29
|
+
from .math2d import Vec2, Transform2D, lerp, lerp_angle
|
|
30
|
+
|
|
31
|
+
from .rig import (
|
|
32
|
+
BorderConfig,
|
|
33
|
+
Joint,
|
|
34
|
+
Part,
|
|
35
|
+
Rig,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
from .pose import (
|
|
39
|
+
JointDelta,
|
|
40
|
+
PartDelta,
|
|
41
|
+
Pose,
|
|
42
|
+
PoseLibrary,
|
|
43
|
+
apply_pose,
|
|
44
|
+
flip_posed_rig,
|
|
45
|
+
blend_poses,
|
|
46
|
+
combine_poses,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
from .animation import (
|
|
50
|
+
AnimationFrame,
|
|
51
|
+
AnimationSound,
|
|
52
|
+
AnimationTrack,
|
|
53
|
+
Animation,
|
|
54
|
+
AnimationLibrary,
|
|
55
|
+
AnimationPlayer,
|
|
56
|
+
PlayMode,
|
|
57
|
+
EaseType,
|
|
58
|
+
resolve_frame_toggles,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
from .overlay import (
|
|
62
|
+
OverlayPart,
|
|
63
|
+
Overlay,
|
|
64
|
+
OverlayLibrary,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
from .attachment import (
|
|
68
|
+
AttachmentConfig,
|
|
69
|
+
AttachmentPoseState,
|
|
70
|
+
AttachmentBinding,
|
|
71
|
+
AttachmentLibrary,
|
|
72
|
+
AttachmentInstance,
|
|
73
|
+
compute_attachment_transform,
|
|
74
|
+
get_attachment_part_world_transform,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
from .scene import (
|
|
78
|
+
SceneBackground,
|
|
79
|
+
SceneLayer,
|
|
80
|
+
SceneItem,
|
|
81
|
+
SceneCharacter,
|
|
82
|
+
SceneAttachment,
|
|
83
|
+
Scene,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Audio utilities
|
|
87
|
+
from .audio import (
|
|
88
|
+
CHANNEL_POSE,
|
|
89
|
+
CHANNEL_SCENE,
|
|
90
|
+
CHANNEL_SFX_PREFIX,
|
|
91
|
+
SFX_CHANNEL_COUNT,
|
|
92
|
+
register_channels,
|
|
93
|
+
play_sound,
|
|
94
|
+
stop_channel,
|
|
95
|
+
get_playing,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
# I/O utilities
|
|
99
|
+
from .io import (
|
|
100
|
+
load_json,
|
|
101
|
+
save_json,
|
|
102
|
+
load_rig,
|
|
103
|
+
save_rig,
|
|
104
|
+
load_poses,
|
|
105
|
+
save_poses,
|
|
106
|
+
load_animations,
|
|
107
|
+
save_animations,
|
|
108
|
+
load_overlays,
|
|
109
|
+
save_overlays,
|
|
110
|
+
load_attachments,
|
|
111
|
+
save_attachments,
|
|
112
|
+
list_attachments,
|
|
113
|
+
RigAssets,
|
|
114
|
+
load_scene,
|
|
115
|
+
save_scene,
|
|
116
|
+
list_scenes,
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
# Ren'Py rendering (only available inside Ren'Py)
|
|
120
|
+
try:
|
|
121
|
+
from .render import (
|
|
122
|
+
RigDisplayable,
|
|
123
|
+
DynamicRig,
|
|
124
|
+
RigRenderer,
|
|
125
|
+
SceneDisplayable,
|
|
126
|
+
SceneRenderer,
|
|
127
|
+
SceneManager,
|
|
128
|
+
)
|
|
129
|
+
except RuntimeError:
|
|
130
|
+
# Ren'Py not available - render classes won't work
|
|
131
|
+
RigDisplayable = None
|
|
132
|
+
DynamicRig = None
|
|
133
|
+
RigRenderer = None
|
|
134
|
+
SceneDisplayable = None
|
|
135
|
+
SceneRenderer = None
|
|
136
|
+
SceneManager = None
|
|
137
|
+
|
|
138
|
+
# Convenience loaders that mirror the API shown in the README
|
|
139
|
+
Rig.load = classmethod(lambda cls, path, base_path="": load_rig(path, base_path))
|
|
140
|
+
PoseLibrary.load = classmethod(lambda cls, path, base_path="": load_poses(path, base_path))
|
|
141
|
+
AnimationLibrary.load = classmethod(lambda cls, path, base_path="": load_animations(path, base_path))
|
|
142
|
+
OverlayLibrary.load = classmethod(lambda cls, path, base_path="": load_overlays(path, base_path))
|
|
143
|
+
AttachmentLibrary.load = classmethod(lambda cls, path, base_path="": load_attachments(path, base_path))
|
|
144
|
+
Scene.load = classmethod(lambda cls, path, base_path="": load_scene(path, base_path))
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
__all__ = [
|
|
148
|
+
# Version
|
|
149
|
+
"__version__",
|
|
150
|
+
|
|
151
|
+
# Math utilities
|
|
152
|
+
"Vec2",
|
|
153
|
+
"Transform2D",
|
|
154
|
+
"lerp",
|
|
155
|
+
"lerp_angle",
|
|
156
|
+
|
|
157
|
+
# Core data structures
|
|
158
|
+
"Joint",
|
|
159
|
+
"Part",
|
|
160
|
+
"Rig",
|
|
161
|
+
|
|
162
|
+
# Pose system
|
|
163
|
+
"JointDelta",
|
|
164
|
+
"PartDelta",
|
|
165
|
+
"Pose",
|
|
166
|
+
"PoseLibrary",
|
|
167
|
+
"apply_pose",
|
|
168
|
+
"flip_posed_rig",
|
|
169
|
+
"blend_poses",
|
|
170
|
+
"combine_poses",
|
|
171
|
+
|
|
172
|
+
# Animation system
|
|
173
|
+
"AnimationFrame",
|
|
174
|
+
"AnimationSound",
|
|
175
|
+
"AnimationTrack",
|
|
176
|
+
"Animation",
|
|
177
|
+
"AnimationLibrary",
|
|
178
|
+
"AnimationPlayer",
|
|
179
|
+
"PlayMode",
|
|
180
|
+
"EaseType",
|
|
181
|
+
"resolve_frame_toggles",
|
|
182
|
+
|
|
183
|
+
# Overlay system
|
|
184
|
+
"OverlayPart",
|
|
185
|
+
"Overlay",
|
|
186
|
+
"OverlayLibrary",
|
|
187
|
+
|
|
188
|
+
# Attachment system
|
|
189
|
+
"AttachmentConfig",
|
|
190
|
+
"AttachmentPoseState",
|
|
191
|
+
"AttachmentBinding",
|
|
192
|
+
"AttachmentLibrary",
|
|
193
|
+
"AttachmentInstance",
|
|
194
|
+
"compute_attachment_transform",
|
|
195
|
+
"get_attachment_part_world_transform",
|
|
196
|
+
|
|
197
|
+
# Scene system
|
|
198
|
+
"SceneBackground",
|
|
199
|
+
"SceneLayer",
|
|
200
|
+
"SceneItem",
|
|
201
|
+
"SceneCharacter",
|
|
202
|
+
"SceneAttachment",
|
|
203
|
+
"Scene",
|
|
204
|
+
|
|
205
|
+
# Audio utilities
|
|
206
|
+
"CHANNEL_POSE",
|
|
207
|
+
"CHANNEL_SCENE",
|
|
208
|
+
"CHANNEL_SFX_PREFIX",
|
|
209
|
+
"SFX_CHANNEL_COUNT",
|
|
210
|
+
"register_channels",
|
|
211
|
+
"play_sound",
|
|
212
|
+
"stop_channel",
|
|
213
|
+
"get_playing",
|
|
214
|
+
|
|
215
|
+
# I/O utilities
|
|
216
|
+
"load_json",
|
|
217
|
+
"save_json",
|
|
218
|
+
"load_rig",
|
|
219
|
+
"save_rig",
|
|
220
|
+
"load_poses",
|
|
221
|
+
"save_poses",
|
|
222
|
+
"load_animations",
|
|
223
|
+
"save_animations",
|
|
224
|
+
"load_overlays",
|
|
225
|
+
"save_overlays",
|
|
226
|
+
"load_attachments",
|
|
227
|
+
"save_attachments",
|
|
228
|
+
"list_attachments",
|
|
229
|
+
"load_scene",
|
|
230
|
+
"save_scene",
|
|
231
|
+
"list_scenes",
|
|
232
|
+
"RigAssets",
|
|
233
|
+
|
|
234
|
+
# Ren'Py rendering
|
|
235
|
+
"RigDisplayable",
|
|
236
|
+
"DynamicRig",
|
|
237
|
+
"RigRenderer",
|
|
238
|
+
"SceneDisplayable",
|
|
239
|
+
"SceneRenderer",
|
|
240
|
+
"SceneManager",
|
|
241
|
+
]
|