Frame Change App Handler does not update animated data when rendering #75364

Closed
opened 2020-04-04 01:26:19 +02:00 by Sam Brubaker · 6 comments

Version: 2.82a (Linux 64-bit)
This is my first python-related bug report so I apologize if my code is actually bad.

app_handler_bug.blend

How to reproduce:

  • open blender in the console
  • open the attached file
  • run the script
  • scrub/change frames and observe the console output (it works correctly).

now render an animation and observe the console output

The app handler continues to run and print the correct scene number, but does not update the values which are animated. This makes no sense.

import bpy

cube = bpy.data.objects['Cube']

def frame_change(dummy):
    print("The current frame is " + str(bpy.context.scene.frame_current))
    print("Cube's X location is " + str(cube.location.x))
    print("Cube's custom property is " + str(cube['prop']))
    
bpy.app.handlers.frame_change_post.append(frame_change)
Version: 2.82a (Linux 64-bit) This is my first python-related bug report so I apologize if my code is actually bad. [app_handler_bug.blend](https://archive.blender.org/developer/F8446692/app_handler_bug.blend) How to reproduce: - open blender in the console - open the attached file - run the script - scrub/change frames and observe the console output (it works correctly). # now render an animation and observe the console output The app handler continues to run and print the correct scene number, but does not update the values which are animated. This makes no sense. ``` import bpy cube = bpy.data.objects['Cube'] def frame_change(dummy): print("The current frame is " + str(bpy.context.scene.frame_current)) print("Cube's X location is " + str(cube.location.x)) print("Cube's custom property is " + str(cube['prop'])) bpy.app.handlers.frame_change_post.append(frame_change) ```
Author

Added subscriber: @rocketman

Added subscriber: @rocketman
Author

I should also add that this issue does not only affect console output. If a script affects scene data based on animated values, it will work in viewport playback but not when rendering.

I should also add that this issue does not only affect console output. If a script affects scene data based on animated values, it will work in viewport playback but not when rendering.
Author

The issue also appears to affect multiple app handlers? Not just frame_change_post but any handler which is called between rendered frames.

The issue also appears to affect multiple app handlers? Not just frame_change_post but any handler which is called between rendered frames.
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Philipp Oeser self-assigned this 2020-04-05 13:09:04 +02:00
Member

Have a look at blender/blender#71234 (Custom property doesnt update when rendering animation) also.
Or here (under Handlers): https://wiki.blender.org/wiki/Reference/Release_Notes/2.81/Python_API

Basically it boils down to having to do something like this instead:

import bpy

cube = bpy.data.objects['Cube']

def frame_change(scene, depsgraph):

    # access evaluated objects prop [these are updated fine in frame_change_post]
    cube_eval = cube.evaluated_get(depsgraph)
    print("Cube's X location is " + str(cube_eval.location.x))
    print("Cube's custom property is " + str(cube_eval['prop']))

bpy.app.handlers.frame_change_post.append(frame_change)

Think we have to close this (feel free though to comment again if issues persist...)

Have a look at blender/blender#71234 (Custom property doesnt update when rendering animation) also. Or here (under Handlers): https://wiki.blender.org/wiki/Reference/Release_Notes/2.81/Python_API Basically it boils down to having to do something like this instead: ``` import bpy cube = bpy.data.objects['Cube'] def frame_change(scene, depsgraph): # access evaluated objects prop [these are updated fine in frame_change_post] cube_eval = cube.evaluated_get(depsgraph) print("Cube's X location is " + str(cube_eval.location.x)) print("Cube's custom property is " + str(cube_eval['prop'])) bpy.app.handlers.frame_change_post.append(frame_change) ``` Think we have to close this (feel free though to comment again if issues persist...)
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#75364
No description provided.