Maniphest T77008

API, Changing part of evaluated object.original resets all attributes
Closed, Duplicate

Assigned To
None
Authored By
M Z (lemi)
May 23 2020, 11:42 PM
Tags
  • BF Blender
Subscribers
Amin Babaeipanah (leomoon)
M Z (lemi)
Richard Antalik (ISS)
Tokens
"Like" token, awarded by leomoon.

Description

System Information
Operating system: Windows-7-6.1.7601-SP1 64 Bits
Graphics card: GeForce GTX 780 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 442.59

Blender Version
Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-12-04 11:32, hash: rBf1aa4d18d49d
Worked: (optional)

Short description of error
Changing a part of evaluated object.original during animation resets all object attributes to those of the last visible frame before rendering of animation started.

Exact steps for others to reproduce the error

https://github.com/leomoon-studios/leomoon-textcounter/blob/master/src/leomoon-textcounter.py#L353
I enountered a problem (and possible bug) with API in this add-on. This script alters Font object text (body) on every frame.
This is achived by handler:

@persistent  
def textcounter_text_update_frame(scene, depsgraph=None):
    for object_inst in depsgraph.object_instances:
        text = object_inst.object
        if text.type == 'FONT' and text.data.text_counter_props.ifAnimated:
            textcounter_update_val(text, scene.evaluated_get(depsgraph))

Depsgraph is used to get evaluated object for each animation frame. Simply taking object from bpy.context.scene.objects will not work either in viewport or during rendering animation (don't remember which one). To be specific, PropertyGroup text_counter_props, that is part of Font object, will not refresh during animation until it is taken from evaluated object.

Then, new body (text) is assigned to the Font object:

text.original.data.body = out

At this moment all other properties of this object (like location, rotation, scale etc.) will reset to those of the last visible frame before rendering of animation started.

I think it is a bug because, in my understanding, only body attribute should be changed by this code.

To reproduce:

  1. Open file
  2. Run script
  3. Start animation in viewport - all works fine (timer counts and moves right to left)
  4. Start rendering animation - timer counts but sits still

Edit. I messed up file attachments.

Event Timeline

M Z (lemi) created this task.May 23 2020, 11:42 PM
M Z (lemi) updated the task description.May 23 2020, 11:46 PM
Amin Babaeipanah (leomoon) awarded a token.May 23 2020, 11:49 PM
Amin Babaeipanah (leomoon) added a subscriber: Amin Babaeipanah (leomoon).
Richard Antalik (ISS) changed the task status from Needs Triage to Needs Information from User.May 25 2020, 3:34 PM
Richard Antalik (ISS) added a subscriber: Richard Antalik (ISS).

Is it possible to create simple .blend file with a minimalistic script that would reproduce this issue?

From your description it sounds that you are using keyframes as well. Please have a look at T71908 and check if this isn't actually duplicate report.

M Z (lemi) added a comment.EditedMay 25 2020, 7:35 PM

I made a bare bones version of the script.

It looks similar to T71908 but I don't know Blender's internals deep enough to tell them apart. The couse might be the same but symptoms are a little different. In my case, I can read and use animated custom property but other standard properties reset when done so.

M Z (lemi) updated the task description.May 25 2020, 7:39 PM
Richard Antalik (ISS) added a comment.May 26 2020, 3:31 PM

Thanks for update. this looks like duplicate of report I have mentioned, so I will merge it