skelform-python 0.2.0__tar.gz → 0.2.1__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.
- {skelform_python-0.2.0 → skelform_python-0.2.1}/PKG-INFO +1 -1
- {skelform_python-0.2.0 → skelform_python-0.2.1}/pyproject.toml +1 -1
- {skelform_python-0.2.0 → skelform_python-0.2.1}/skelform_python/__init__.py +28 -1
- {skelform_python-0.2.0 → skelform_python-0.2.1}/.gitignore +0 -0
- {skelform_python-0.2.0 → skelform_python-0.2.1}/README.md +0 -0
- {skelform_python-0.2.0 → skelform_python-0.2.1}/readme.md +0 -0
- {skelform_python-0.2.0 → skelform_python-0.2.1}/skelform_python/tests.py +0 -0
- {skelform_python-0.2.0 → skelform_python-0.2.1}/uv.lock +0 -0
|
@@ -116,9 +116,36 @@ def animate(
|
|
|
116
116
|
bone.scale.x = ikf(3, bone.scale.x, bone.init_scale.x, kf, frames[a], id, bf)
|
|
117
117
|
bone.scale.y = ikf(4, bone.scale.y, bone.init_scale.y, kf, frames[a], id, bf)
|
|
118
118
|
|
|
119
|
+
for bone in bones:
|
|
120
|
+
bone = reset_bone(bone, animations, bone.id, frames[0], blend_frames[0])
|
|
121
|
+
|
|
119
122
|
return bones
|
|
120
123
|
|
|
121
124
|
|
|
125
|
+
def is_animated(anims: [Animation], bone_id: int, element: int) -> bool:
|
|
126
|
+
for anim in anims:
|
|
127
|
+
for kf in anim.keyframes:
|
|
128
|
+
if kf.bone_id == bone_id and kf.element == element:
|
|
129
|
+
return True
|
|
130
|
+
|
|
131
|
+
return False
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def reset_bone(
|
|
135
|
+
bone: Bone, anims: [Animation], bone_id: int, frame: int, blend_frame: int
|
|
136
|
+
):
|
|
137
|
+
if not is_animated(anims, bone_id, 0):
|
|
138
|
+
interpolate(frame, blend_frame, bone.pos.x, bone.init_pos.x)
|
|
139
|
+
if not is_animated(anims, bone_id, 1):
|
|
140
|
+
interpolate(frame, blend_frame, bone.pos.y, bone.init_pos.y)
|
|
141
|
+
if not is_animated(anims, bone_id, 2):
|
|
142
|
+
interpolate(frame, blend_frame, bone.rot, bone.init_rot)
|
|
143
|
+
if not is_animated(anims, bone_id, 3):
|
|
144
|
+
interpolate(frame, blend_frame, bone.scale.x, bone.init_scale.x)
|
|
145
|
+
if not is_animated(anims, bone_id, 4):
|
|
146
|
+
interpolate(frame, blend_frame, bone.scale.y, bone.init_scale.y)
|
|
147
|
+
|
|
148
|
+
|
|
122
149
|
def rotate(point: Vec2, rot: float):
|
|
123
150
|
return Vec2(
|
|
124
151
|
point.x * math.cos(rot) - point.y * math.sin(rot),
|
|
@@ -177,7 +204,7 @@ def inverse_kinematics(bones: list[Bone], ik_root_ids: list[int]):
|
|
|
177
204
|
if (
|
|
178
205
|
family.ik_target_id == -1
|
|
179
206
|
or not family.ik_bone_ids
|
|
180
|
-
or
|
|
207
|
+
or family.ik_target_id == -1
|
|
181
208
|
):
|
|
182
209
|
continue
|
|
183
210
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|