Page MenuHome

Changing properties of an object from a frame_change_post handler blocks animation
Closed, DuplicatePublicBUG

Description

System Information
Operating system: Linux-4.15.0-91-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 390.116

Blender Version
Broken: version: 2.81, 2.83 (sub 13), branch: master, commit date: 2020-04-11 15:16, hash: rB85de07e64c96
Worked: 2.80

Short description of error
Writing to ob.color of all objects in the view layer breaks keyframe animation.

Exact steps for others to reproduce the error

  • Open Blender with blender --factory-startup --enable-autoexec bug.blend
  • Press Space to see the animation (three spheres rising)
  • Press Ctrl+F12 to render the animation
  • See that one sphere remains in the position it had before pressing Ctrl+F12, instead of being animated. This is the ball that had its color set in the frame change handler.

Bisecting showed that this was caused by commit rBf7fce0029769.

The blend file contains the following code:

import bpy

@bpy.app.handlers.persistent
def _update(_, context=None):
    ob = context.view_layer.objects['GEO-drone_001']
    ob.color = (1, 1, 1, 1)

def register():
    print("Bug-causing code registering!")
    bpy.app.handlers.frame_change_post.append(_update)


if __name__ == '__main__':
    register()

Note that this behaviour isn't specific to the color property; I changed the code to set ob.pass_index = 3 and it has the same result.

Event Timeline

Sybren A. Stüvel (sybren) changed the task status from Needs Triage to Needs Information from Developers.Apr 11 2020, 7:42 PM
Sybren A. Stüvel (sybren) changed the subtype of this task from "Report" to "Bug".
Sybren A. Stüvel (sybren) renamed this task from Changing properties of an object blocks from a frame_change_post handler blocks animation to Changing properties of an object from a frame_change_post handler blocks animation.Apr 14 2020, 11:48 AM