Page MenuHome

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

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) updated the task description. (Show Details)Sat, May 23, 11:46 PM
Richard Antalik (ISS) changed the task status from Needs Triage to Needs Information from User.Mon, May 25, 3:34 PM

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.EditedMon, May 25, 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. (Show Details)Mon, May 25, 7:39 PM

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