Editing mesh.vertices.co in frame_change_pre handler and export mesh as alembic causes random crash and results in a static mesh #74339

Closed
opened 2020-03-01 18:06:00 +01:00 by songwiki · 22 comments

System Information
Operating system: Windows 10.0.18363.657
Graphics card: GeForce RTX 2080

Blender Version
Broken: version: 2.82 (sub 7), branch: master, commit date: 2020-02-12 16:20, hash: 77d23b0bd7, type: Release
build date: 2020-02-13, 01:56:46

Short description of error
I made an addon that reads obj file per frame and changes an object.data.vertices- [x].co by a for loop.
blender plays well in viewport
but when i try to export an alembic. it outputs a static mesh.and sometimes blender goes crash

Exact steps for others to reproduce the error
full addon is in the zip
T74339_edit.blend

Run this script and click play(changes timeline). The monkey should be deformed.
GIF.gif

Then export the alembic. Import it back, it is static.

@persistent
def frame_step(scene):
    depsgraph = bpy.context.evaluated_depsgraph_get()
    try:
        for obj in bpy.data.objects:
            if obj.objseq_settings.loaded:
                with SimpleWaveFront(obj.objseq_settings, scene.frame_current) as vertices:
                    for i in range(min(len(obj.data.vertices), len(vertices))):
                        obj.data.vertices[i].co = vertices[i]
                    obj.data = obj.data
                obj = obj.evaluated_get(depsgraph)
    except Exception as e:
        raise e

demo.zip

**System Information** Operating system: Windows 10.0.18363.657 Graphics card: GeForce RTX 2080 **Blender Version** Broken: version: 2.82 (sub 7), branch: master, commit date: 2020-02-12 16:20, hash: 77d23b0bd76f, type: Release build date: 2020-02-13, 01:56:46 **Short description of error** I made an addon that reads obj file per frame and changes an object.data.vertices- [x].co by a for loop. blender plays well in viewport but when i try to export an alembic. it outputs a static mesh.and sometimes blender goes crash **Exact steps for others to reproduce the error** *full addon is in the zip* [T74339_edit.blend](https://archive.blender.org/developer/F8421780/T74339_edit.blend) Run this script and click play(changes timeline). The monkey should be deformed. ![GIF.gif](https://archive.blender.org/developer/F8421787/GIF.gif) Then export the alembic. Import it back, it is static. ``` @persistent def frame_step(scene): depsgraph = bpy.context.evaluated_depsgraph_get() try: for obj in bpy.data.objects: if obj.objseq_settings.loaded: with SimpleWaveFront(obj.objseq_settings, scene.frame_current) as vertices: for i in range(min(len(obj.data.vertices), len(vertices))): obj.data.vertices[i].co = vertices[i] obj.data = obj.data obj = obj.evaluated_get(depsgraph) except Exception as e: raise e ``` [demo.zip](https://archive.blender.org/developer/F8381805/demo.zip)
Author

Added subscriber: @MoePus

Added subscriber: @MoePus
Member

Added subscriber: @ankitm

Added subscriber: @ankitm
Member

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

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

Not sure Bug tracker would be a good place to debug an Addon. Can the bug be redone with simpler steps ?

Not sure Bug tracker would be a good place to debug an Addon. Can the bug be redone with simpler steps ?
Author

In #74339#894618, @ankitm wrote:
Not sure Bug tracker would be a good place to debug an Addon. Can the bug be redone with simpler steps ?

Yes. A simple setup is:

  1. Add a monkey in the scene and name it Suzanne
  2. Run the following code in console
import bpy
from mathutils import Vector
def frame_step(scene):
    depsgraph = bpy.context.evaluated_depsgraph_get()
    try:
        for obj in bpy.data.objects:
            if obj.name == "Suzanne":
                for i in range(len(obj.data.vertices)):
                    co = obj.data.vertices[i].co
                    obj.data.vertices[i].co = Vector((co.x * 1.01, co.y * 1.01, co.z))
                obj.data = obj.data
                obj = obj.evaluated_get(depsgraph)
    except Exception as e:
        raise e

bpy.app.handlers.frame_change_pre.append(frame_step)
  1. Export Alembic
  2. Blender will either crash or export a static alembic.
> In #74339#894618, @ankitm wrote: > Not sure Bug tracker would be a good place to debug an Addon. Can the bug be redone with simpler steps ? Yes. A simple setup is: 1. Add a monkey in the scene and name it Suzanne 2. Run the following code in console ``` import bpy from mathutils import Vector def frame_step(scene): depsgraph = bpy.context.evaluated_depsgraph_get() try: for obj in bpy.data.objects: if obj.name == "Suzanne": for i in range(len(obj.data.vertices)): co = obj.data.vertices[i].co obj.data.vertices[i].co = Vector((co.x * 1.01, co.y * 1.01, co.z)) obj.data = obj.data obj = obj.evaluated_get(depsgraph) except Exception as e: raise e bpy.app.handlers.frame_change_pre.append(frame_step) ``` 3. Export Alembic 4. Blender will either crash or export a static alembic.
Member

Cannot redo. you find it static because there was no movement on the money before exporting?
I did the same steps, with some keyframes and here's the alembic and the blend file #74339.abc

#74339.blend

Cannot redo. you find it static because there was no movement on the money before exporting? I did the same steps, with some keyframes and here's the alembic and the blend file [#74339.abc](https://archive.blender.org/developer/F8421763/T74339.abc) [#74339.blend](https://archive.blender.org/developer/F8421766/T74339.blend)
Author

T74339_edit.blend

Run this script and click play(changes timeline). The monkey should be deformed.
GIF.gif

Then export the alembic.

[T74339_edit.blend](https://archive.blender.org/developer/F8421780/T74339_edit.blend) Run this script and click play(changes timeline). The monkey should be deformed. ![GIF.gif](https://archive.blender.org/developer/F8421787/GIF.gif) Then export the alembic.
Member

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

Changed status from 'Needs User Info' to: 'Needs Triage'
Member
Oh yeah. there's a static mesh. as a workaround, https://docs.blender.org/api/current/bpy.types.bpy_struct.html#bpy.types.bpy_struct.keyframe_insert

Added subscriber: @mano-wii

Added subscriber: @mano-wii

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

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

I can't reproduce the crash you can try the latest daily build: https://builder.blender.org/download/
I'm also not sure if the fact that alembic doesn't create an animated mesh with this script is a bug.
I suggest you ask on support sites: https://www.blender.org/support/

I can't reproduce the crash you can try the latest daily build: https://builder.blender.org/download/ I'm also not sure if the fact that alembic doesn't create an animated mesh with this script is a bug. I suggest you ask on support sites: https://www.blender.org/support/
Author

In #74339#924732, @mano-wii wrote:
I can't reproduce the crash you can try the latest daily build: https://builder.blender.org/download/
I'm also not sure if the fact that alembic doesn't create an animated mesh with this script is a bug.
I suggest you ask on support sites: https://www.blender.org/support/

Use T74339_edit.blend and add a Subdivision Modifier then apply.
Finally export alembic, Blender may crash.

Crash Log on 2.90-542ff416e274

https://developer.blender.org/P1386

> In #74339#924732, @mano-wii wrote: > I can't reproduce the crash you can try the latest daily build: https://builder.blender.org/download/ > I'm also not sure if the fact that alembic doesn't create an animated mesh with this script is a bug. > I suggest you ask on support sites: https://www.blender.org/support/ Use T74339_edit.blend and add a Subdivision Modifier then apply. Finally export alembic, Blender may crash. Crash Log on 2.90-542ff416e274 https://developer.blender.org/P1386
Member

Could you please edit that comment and replace the log with https://developer.blender.org/P1386 ?

Could you please edit that comment and replace the log with https://developer.blender.org/P1386 ?
Member

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

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

it does crash, around frame 42.
Not confirming because of the script.

it does crash, around frame 42. Not confirming because of the script.

Added subscriber: @iss

Added subscriber: @iss

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

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

I can not reproduce any crash here as well (using 2.90 build). Can not check 542ff416e274 to see if this has been resolved. Can you check again with latest 2.90 build?

The fact, that exported mesh is static is likely correct, since alembic exporter uses own dependency graph.

I can not reproduce any crash here as well (using 2.90 build). Can not check `542ff416e274` to see if this has been resolved. Can you check again with latest 2.90 build? The fact, that exported mesh is static is likely correct, since alembic exporter uses own dependency graph.
Author

In #74339#955112, @iss wrote:
I can not reproduce any crash here as well (using 2.90 build). Can not check 542ff416e274 to see if this has been resolved. Can you check again with latest 2.90 build?

The fact, that exported mesh is static is likely correct, since alembic exporter uses own dependency graph.

Thank you.
It does not crash in the lastest 2.90 build.
And is there any plan to support export abc of a python api modified mesh? (though i dont need it now)

> In #74339#955112, @iss wrote: > I can not reproduce any crash here as well (using 2.90 build). Can not check `542ff416e274` to see if this has been resolved. Can you check again with latest 2.90 build? > > The fact, that exported mesh is static is likely correct, since alembic exporter uses own dependency graph. Thank you. It does not crash in the lastest 2.90 build. And is there any plan to support export abc of a python api modified mesh? (though i dont need it now)

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

Changed status from 'Needs User Info' to: 'Archived'
Richard Antalik self-assigned this 2020-06-22 04:31:44 +02:00

Not sure about abc exporter, but AFAIK feature to access render depsgraph(which is also separate) would be nice to have, but I am not aware of any concrete plans.

If there is no crash I will close this report as there is no bug. Thanks for reporting anyway.

Not sure about abc exporter, but AFAIK feature to access render depsgraph(which is also separate) would be nice to have, but I am not aware of any concrete plans. If there is no crash I will close this report as there is no bug. Thanks for reporting anyway.
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
4 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#74339
No description provided.