Custom property doesnt update when rendering animation #71234

Closed
opened 2019-10-31 01:17:31 +01:00 by Rombout Versluijs · 22 comments

System Information
Operating system: Darwin-15.6.0-x86_64-i386-64bit 64 Bits
Graphics card: Intel Iris Pro OpenGL Engine Intel Inc. 4.1 INTEL-10.14.74

Blender Version
Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-10-28 18:34, hash: 7c1fbe24ca

Short description of error
Using custom properties with drivers or use animation data doesnt seem to be updated when the animation is rendered. It works fine in the viewport and also rendering single frames

Exact steps for others to reproduce the error

  1. open attached file and register script
  2. Playing animation in viewport works fine, still frame renders fine, rendering animation shows single frame over and over.

Side note
I initially posted in this task because i thought it was related to the dependency graph as well. However, a user there said its related to frame_change_post. I had a file that uses an addon as an example and he made a simpler version of this showing the issue. See attached file

textcounter-bug-MWE.blend

**System Information** Operating system: Darwin-15.6.0-x86_64-i386-64bit 64 Bits Graphics card: Intel Iris Pro OpenGL Engine Intel Inc. 4.1 INTEL-10.14.74 **Blender Version** Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-10-28 18:34, hash: `7c1fbe24ca` **Short description of error** Using custom properties with drivers or use animation data doesnt seem to be updated when the animation is rendered. It works fine in the viewport and also rendering single frames **Exact steps for others to reproduce the error** 01. open attached file and register script 02. Playing animation in viewport works fine, still frame renders fine, rendering animation shows single frame over and over. **Side note** I initially posted in this [task ](https://developer.blender.org/T68332#801768) because i thought it was related to the dependency graph as well. However, a user there said its related to `frame_change_post`. I had a file that uses an addon as an example and he made a simpler version of this showing the issue. See attached file [textcounter-bug-MWE.blend](https://archive.blender.org/developer/F7874328/textcounter-bug-MWE.blend)

Added subscriber: @RomboutVersluijs

Added subscriber: @RomboutVersluijs

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

For reference this is the script:

import bpy
from bpy.app.handlers import persistent


@persistent  
def textcounter_text_update_frame(scene):
    text = bpy.data.objects['Text']
    text.update_tag(refresh={'DATA'})
    text.data.body = str(text.data['prop'])
    

def register():
    bpy.app.handlers.frame_change_post.append(textcounter_text_update_frame)

if __name__ == "__main__":
    register()

The issue is that text is the original object, and that the modification doesn't get propagated to the evaluated copy that's used for rendering.

For reference this is the script: ``` import bpy from bpy.app.handlers import persistent @persistent def textcounter_text_update_frame(scene): text = bpy.data.objects['Text'] text.update_tag(refresh={'DATA'}) text.data.body = str(text.data['prop']) def register(): bpy.app.handlers.frame_change_post.append(textcounter_text_update_frame) if __name__ == "__main__": register() ``` The issue is that `text` is the original object, and that the modification doesn't get propagated to the evaluated copy that's used for rendering.

First i thought that custum properties would not update as well, but they work fine. Its with the frame_change_post when it does not work.

custom-property_frame_handler.blend

First i thought that custum properties would not update as well, but they work fine. Its with the frame_change_post when it does not work. [custom-property_frame_handler.blend](https://archive.blender.org/developer/F7884867/custom-property_frame_handler.blend)

Added subscriber: @LeoMoon

Added subscriber: @LeoMoon
Member

Added subscribers: @Sergey, @lichtwerk

Added subscribers: @Sergey, @lichtwerk
Member

Reading this (under Handlers): https://wiki.blender.org/wiki/Reference/Release_Notes/2.81/Python_API
it looks we have to do something like this

import bpy
from bpy.app.handlers import persistent


@persistent
def textcounter_text_update_frame(scene, depsgraph):
    text = bpy.data.objects['Text']
    
    # access evaluated objects prop [these are updated fine in frame_change_post]
    text_eval = text.evaluated_get(depsgraph)
    prop_eval = text_eval.data['prop']
    
    # difference is that original objects prop is _not_ updated in frame_change_post
    print(prop_eval, text.data['prop'])
    
    # alter original object
    text.data.body = str(prop_eval)

def register():
    bpy.app.handlers.frame_change_post.append(textcounter_text_update_frame)

if __name__ == "__main__":
    register()

textcounter-bug-MWE_corrected.blend

@dr.sybren: so the issue doesnt seem to be that the modification is not propagated to the evaluated object used for rendering, but rather that we need to access the evaluated property the modification is based on, can you confirm?
@Sergey: am I right about this?

if so, I think this could be closed...

Reading this (under `Handlers`): https://wiki.blender.org/wiki/Reference/Release_Notes/2.81/Python_API it looks we have to do something like this ``` import bpy from bpy.app.handlers import persistent @persistent def textcounter_text_update_frame(scene, depsgraph): text = bpy.data.objects['Text'] # access evaluated objects prop [these are updated fine in frame_change_post] text_eval = text.evaluated_get(depsgraph) prop_eval = text_eval.data['prop'] # difference is that original objects prop is _not_ updated in frame_change_post print(prop_eval, text.data['prop']) # alter original object text.data.body = str(prop_eval) def register(): bpy.app.handlers.frame_change_post.append(textcounter_text_update_frame) if __name__ == "__main__": register() ``` [textcounter-bug-MWE_corrected.blend](https://archive.blender.org/developer/F8147754/textcounter-bug-MWE_corrected.blend) @dr.sybren: so the issue doesnt seem to be that the modification is not propagated to the evaluated object used for rendering, but rather that we need to access the **evaluated** property the modification is based on, can you confirm? @Sergey: am I right about this? if so, I think this could be closed...

@lichtwerk you read from evaluated. If you need to modify stuff you write to original.

@lichtwerk you read from evaluated. If you need to modify stuff you write to original.
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Philipp Oeser self-assigned this 2019-11-20 14:24:51 +01:00
Member

In #71234#813630, @Sergey wrote:
@lichtwerk you read from evaluated. If you need to modify stuff you write to original.

OKi, unless I totally misunderstand this, I guess the above solution is correct, and we can close...

> In #71234#813630, @Sergey wrote: > @lichtwerk you read from evaluated. If you need to modify stuff you write to original. OKi, unless I totally misunderstand this, I guess the above solution is correct, and we can close...

Added subscriber: @theres1

Added subscriber: @theres1

Though, custom property is animated indeed, it is still bugged.
All object animations get cancelled out when overwriting data.body.
textcounter-bug-MWE_corrected_animated.blend
Look at the file and compare 3d view with rendered animation.

Though, custom property is animated indeed, it is still bugged. All object animations get cancelled out when overwriting data.body. [textcounter-bug-MWE_corrected_animated.blend](https://archive.blender.org/developer/F8966779/textcounter-bug-MWE_corrected_animated.blend) Look at the file and compare 3d view with rendered animation.

Changed status from 'Resolved' to: 'Needs Developer To Reproduce'

Changed status from 'Resolved' to: 'Needs Developer To Reproduce'

Could someone please check this out?

The fix explained by Philipp Oeser will only fix the changing of data.body of the text object. but if you test the new blend file made by M Z you will see that location, rotation, scale and any other animated font property will not show up when rendering.

I've been waiting for a solution for this for a very long time to fix my plugin.

Could someone please check out the file made by M Z (the post above my post)?

Thanks.

Could someone please check this out? The fix explained by Philipp Oeser will only fix the changing of data.body of the text object. but if you test the new blend file made by M Z you will see that location, rotation, scale and any other animated font property will not show up when rendering. I've been waiting for a solution for this for a very long time to fix my plugin. Could someone please check out the file made by M Z (the post above my post)? Thanks.
Member

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'

Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'
Member

OK, checked this again.

All object animations get cancelled out when overwriting data.body.

I can confirm in 2.90, but this situation has improved in 2.91.
For some reason, I cant bisect this properly, but I assume it has to do with 5b021dff41, 263148dbac
So please check a fresh 2.91 build from https://builder.blender.org/download/

However, there seems to be a "one-frame-off" issue if you take a look at this file:
textcounter-bug-MWE_corrected_animated.blend
(frames one and two draw the body in the same place, even though its origin already moved -- this could be due to using frame_changed_post though)

In 2.91, it also doesnt seem necessary to read Custom Properties from the evaluated object anymore? (see the following file)
And to fix the "one-frame-off", you can actually use frame_changed_pre in 2.91 without issues:
textcounter-bug-MWE_frame_change_pre_animated.blend

Let me know if this is all working for you now in 2.91

OK, checked this again. > All object animations get cancelled out when overwriting data.body. I can confirm in 2.90, but this situation has improved in 2.91. For some reason, I cant bisect this properly, but I assume it has to do with 5b021dff41, 263148dbac So please check a fresh 2.91 build from https://builder.blender.org/download/ However, there seems to be a "one-frame-off" issue if you take a look at this file: [textcounter-bug-MWE_corrected_animated.blend](https://archive.blender.org/developer/F8970892/textcounter-bug-MWE_corrected_animated.blend) (frames one and two draw the body in the same place, even though its origin already moved -- this could be due to using `frame_changed_post` though) In 2.91, it also doesnt seem necessary to read Custom Properties from the evaluated object anymore? (see the following file) And to fix the "one-frame-off", you can actually use `frame_changed_pre` in 2.91 without issues: [textcounter-bug-MWE_frame_change_pre_animated.blend](https://archive.blender.org/developer/F8970914/textcounter-bug-MWE_frame_change_pre_animated.blend) Let me know if this is all working for you now in 2.91
Philipp Oeser removed their assignment 2020-10-09 12:51:46 +02:00
Member

In #71234#1031097, @lichtwerk wrote:
However, there seems to be a "one-frame-off" issue if you take a look at this file:
textcounter-bug-MWE_corrected_animated.blend
(frames one and two draw the body in the same place, even though its origin already moved -- this could be due to using frame_changed_post though)

In 2.91, it also doesnt seem necessary to read Custom Properties from the evaluated object anymore? (see the following file)
And to fix the "one-frame-off", you can actually use frame_changed_pre in 2.91 without issues:
textcounter-bug-MWE_frame_change_pre_animated.blend

In the meantime, maybe @Sergey or @dr.sybren can confirm the above ^^ (I'd be interested to know why/when this changed-- this also comes up in questions once in a while)?

> In #71234#1031097, @lichtwerk wrote: > However, there seems to be a "one-frame-off" issue if you take a look at this file: > [textcounter-bug-MWE_corrected_animated.blend](https://archive.blender.org/developer/F8970892/textcounter-bug-MWE_corrected_animated.blend) > (frames one and two draw the body in the same place, even though its origin already moved -- this could be due to using `frame_changed_post` though) > > In 2.91, it also doesnt seem necessary to read Custom Properties from the evaluated object anymore? (see the following file) > And to fix the "one-frame-off", you can actually use `frame_changed_pre` in 2.91 without issues: > [textcounter-bug-MWE_frame_change_pre_animated.blend](https://archive.blender.org/developer/F8970914/textcounter-bug-MWE_frame_change_pre_animated.blend) In the meantime, maybe @Sergey or @dr.sybren can confirm the above ^^ (I'd be interested to know why/when this changed-- this also comes up in questions once in a while)?

This comment was removed by @LeoMoon

*This comment was removed by @LeoMoon*

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'

Both files (frame_changed_post and frame_changed_pre) work in Blender 2.91.0 alpha. I also tested the plugin and it works in Blender 2.91.0 alpha.

Both files DO NOT work Blender 2.83.7 and Blender 2.90.1.

So this problem is not gonna get fixed in future LTS update of 2.83.x?

Both files (frame_changed_post and frame_changed_pre) work in Blender 2.91.0 alpha. I also tested the plugin and it works in Blender 2.91.0 alpha. Both files DO NOT work Blender 2.83.7 and Blender 2.90.1. So this problem is not gonna get fixed in future LTS update of 2.83.x?

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sybren A. Stüvel self-assigned this 2020-10-12 14:40:11 +02:00

In #71234#1030363, @theres1 wrote:
Though, custom property is animated indeed, it is still bugged.
All object animations get cancelled out when overwriting data.body.

That issue is already tracked in #71908 (Keyframed parameters are not preserved when frame_change_post handler is used).

@LeoMoon Don't update the status of this task, leave that to the developers who are actually working on it.

Folks, please take a second to describe the changes that are made from one blend file to the next. If there is a script in there, copy it in the comment field as well. That way it's possible to actually read through the comments and understand what's going on, without having to download and manually inspect each and every file. And please don't use the same filename to upload a different file, because that makes it impossible to download the files into a single directory and keep a reference to which comment they came from.

I'm marking this task as Resolved, as the original issue was resolved by reading from the evaluated data. If there are still other issues, those should be reported separately.

> In #71234#1030363, @theres1 wrote: > Though, custom property is animated indeed, it is still bugged. > All object animations get cancelled out when overwriting data.body. That issue is already tracked in #71908 (Keyframed parameters are not preserved when frame_change_post handler is used). @LeoMoon Don't update the status of this task, leave that to the developers who are actually working on it. Folks, please take a second to describe the changes that are made from one blend file to the next. If there is a script in there, copy it in the comment field as well. That way it's possible to actually read through the comments and understand what's going on, without having to download and manually inspect each and every file. And please don't use the same filename to upload a different file, because that makes it impossible to download the files into a single directory and keep a reference to which comment they came from. I'm marking this task as Resolved, as the original issue was resolved by reading from the evaluated data. If there are still other issues, those should be reported separately.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 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#71234
No description provided.