Record the three failed Swat yaw attempts and keep the guard on the worker base
This commit is contained in:
1 parent
b18236f9b4
commit
d3a87acf2d
4 files changed
+22
-10
No files matched your search
@@ -363,12 +363,19 @@ def make_base(family_dir: Path, out: Path, yaw: float = 0.0):
|
||||
# mesh as well double-applies the skin, and baking the rotation into an already
|
||||
# bound mesh collapses the character.
|
||||
if abs(yaw) > 0.01:
|
||||
# World-space rotation: the FBX armature carries its own -90 X, so
|
||||
# `rotate_axis("Z")` would turn about that local axis and lay the character
|
||||
# flat instead of facing the other way.
|
||||
# Rotate in *data* space, after the object transforms are baked: turning the
|
||||
# exported armature node rotates with the skin and renders headless, and
|
||||
# rotating the object pair on top of a bound skin collapses it. Rotating the
|
||||
# vertices and the rest bones by the same matrix keeps the bind intact.
|
||||
from mathutils import Matrix # type: ignore
|
||||
keep.matrix_world = (Matrix.Rotation(math.radians(yaw), 4, "Z")
|
||||
@ keep.matrix_world)
|
||||
rotation = Matrix.Rotation(math.radians(yaw), 4, "Z")
|
||||
body.data.transform(rotation)
|
||||
bpy.context.view_layer.objects.active = keep
|
||||
bpy.ops.object.mode_set(mode="EDIT")
|
||||
for bone in keep.data.edit_bones:
|
||||
bone.head = rotation @ bone.head
|
||||
bone.tail = rotation @ bone.tail
|
||||
bpy.ops.object.mode_set(mode="OBJECT")
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
Reference in new issue
Block a user