Page MenuHome

bpy.ops.nla.bake() floods terminal with output like "quat_prev <Quaternion (w=1.0, x=0.0, y=0.0, z=0.0)>"
Closed, ResolvedPublic

Description

System Information
Operating system: Darwin-18.7.0-x86_64-i386-64bit 64 Bits
Graphics card: AMD Radeon Pro 570 OpenGL Engine ATI Technologies Inc. 4.1 ATI-2.11.20

Blender Version
Broken: version: 2.83.0, branch: master, commit date: 2020-06-03 12:23, hash: rB82e3bd4bbb82
Worked: -

Short description of error
Calling bpy.ops.nla.bake() in Python with rotation_mode of the corresponding objects set to QUATERNION, Blender floods the terminal/console with:

quat_prev <Quaternion (w=1.0000, x=0.0000, y=0.0000, z=0.0000)>
quat_prev <Quaternion (w=1.0000, x=0.0000, y=0.0000, z=0.0000)>
quat_prev <Quaternion (w=1.0000, x=0.0000, y=0.0000, z=0.0000)>
quat_prev <Quaternion (w=1.0000, x=0.0000, y=0.0000, z=0.0000)>
quat_prev <Quaternion (w=1.0000, x=0.0000, y=0.0000, z=0.0000)>
[...]

An additional line for each frame that gets baked.
This makes it hard to read other debug information when printing to console.

Exact steps for others to reproduce the error

Partial code used to call bpy.ops.nla.bake():

obj.rotation_mode = 'QUATERNION'
bpy.ops.object.mode_set(mode='POSE')

bpy.ops.nla.bake(
    frame_start=0,
    frame_end=action.frame_range[1],
    step=1,
    only_selected=False,
    visual_keying=True,
    clear_constraints=False,
    clear_parents=False,
    use_current_action=False,
    bake_types=bake_types,
)

There probably is a print command in Blender's bpy.ops.nla.bake() originally used for debugging.

Event Timeline

Could you provide a file showing the problem?


You can find a quick setup in the attached file. Totally forgot this issue can also be reproduced directly in Blender without Python code.
Here are the steps to reproduce (I started Blender from within the macOS terminal):

  • Make sure Armature and Cube rotation mode are set to Quaternion
  • Select the Armature
  • Set the action named "Action" as the active one
  • Top menu "Object" -> "Animation" -> "Bake Action"
  • Deselect "Only Selected Bones", select "Visual Keying" and in "Bake Data" select both "Pose" and "Object"
  • Bake -> Terminal gets flooded here