API, Changing part of evaluated object.original resets all attributes #77008

Closed
opened 2020-05-23 23:42:51 +02:00 by M Z · 8 comments

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: f1aa4d18d4
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. textcouer-test.blend

**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: `f1aa4d18d4` 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. [textcouer-test.blend](https://archive.blender.org/developer/F8549866/textcouer-test.blend)
Author

Added subscriber: @theres1

Added subscriber: @theres1

Added subscriber: @LeoMoon

Added subscriber: @LeoMoon

Added subscriber: @iss

Added subscriber: @iss

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

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

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 #71908 and check if this isn't actually duplicate report.

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 #71908 and check if this isn't actually duplicate report.
Author

I made a bare bones version of the script.
textcounter-test1.blend

It looks similar to #71908 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.

I made a bare bones version of the script. [textcounter-test1.blend](https://archive.blender.org/developer/F8553532/textcounter-test1.blend) It looks similar to #71908 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.

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

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

Closed as duplicate of #71908

Closed as duplicate of #71908
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
3 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#77008
No description provided.