Motion transfer setup #1

Manually merged
Sybren A. Stüvel merged 18 commits from cgtinker/powership:motion_transfer into main 2023-06-05 12:06:15 +02:00
Showing only changes of commit 0658fb153a - Show all commits

View File

@ -228,6 +228,7 @@ class AbstractPowerShipNode(bpy.types.Node):
def run(self, depsgraph: bpy.types.Depsgraph) -> None: def run(self, depsgraph: bpy.types.Depsgraph) -> None:
assert not self.has_run, "a node can only run once, reset it first" assert not self.has_run, "a node can only run once, reset it first"
if self.mute: if self.mute:
# Skip execution of this node, it's muted. # Skip execution of this node, it's muted.
self._first_input_to_output() self._first_input_to_output()
@ -270,6 +271,7 @@ class AbstractPowerShipNode(bpy.types.Node):
def _first_input_to_output(self) -> None: def _first_input_to_output(self) -> None:
"""Copy the first input's default value to the output, if the sockets are compatible.""" """Copy the first input's default value to the output, if the sockets are compatible."""
cgtinker marked this conversation as resolved Outdated

Keep formatting changes out of the patch. You can use git gui or some other tool to cherry-pick which lines you do (not) want to include in a commit. That way you can exclude such changes, commit the rest, then revert the unwanted formatting changes to get rid of them.

Keep formatting changes out of the patch. You can use `git gui` or some other tool to cherry-pick which lines you do (not) want to include in a commit. That way you can exclude such changes, commit the rest, then revert the unwanted formatting changes to get rid of them.
if not self.inputs or not self.outputs: if not self.inputs or not self.outputs:
return return
@ -976,7 +978,6 @@ class SetBoneNode(AbstractPowerShipNode):
arm_eval: bpy.types.Object = arm_ob.evaluated_get(depsgraph) arm_eval: bpy.types.Object = arm_ob.evaluated_get(depsgraph)
arm_matrix = arm_eval.matrix_world arm_matrix = arm_eval.matrix_world
bone_mat_world: Matrix = arm_matrix @ bone.matrix bone_mat_world: Matrix = arm_matrix @ bone.matrix
loc, rot, scale = bone_mat_world.decompose() loc, rot, scale = bone_mat_world.decompose()
if control_location is not None: if control_location is not None:
@ -1369,8 +1370,7 @@ _register, _unregister = bpy.utils.register_classes_factory(classes)
def register() -> None: def register() -> None:
_register() _register()
nodeitems_utils.register_node_categories( nodeitems_utils.register_node_categories("POWERSHIP_NODES", node_categories)
"POWERSHIP_NODES", node_categories)
def unregister() -> None: def unregister() -> None: