Page MenuHome

Editing mesh.vertices.co in frame_change_pre handler and export mesh as alembic causes random crash and results in a static mesh
Closed, ArchivedPublic

Description

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[i].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

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

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

Event Timeline

Ankit Meel (ankitm) changed the task status from Needs Triage to Needs Information from User.Mar 19 2020, 5:52 PM
Ankit Meel (ankitm) added a project: Alembic.

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 ?

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.

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

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

Then export the alembic.

Ankit Meel (ankitm) changed the task status from Needs Information from User to Needs Triage.Mar 22 2020, 7:43 AM
Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Needs Information from User.May 5 2020, 3:13 PM

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/

songwiki (MoePus) added a comment.EditedMay 12 2020, 2:59 PM

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

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

Ankit Meel (ankitm) changed the task status from Needs Information from User to Needs Triage.EditedMay 12 2020, 6:22 PM

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

Richard Antalik (ISS) changed the task status from Needs Triage to Needs Information from User.Jun 16 2020, 6:39 PM

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.

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)

Richard Antalik (ISS) closed this task as Archived.Jun 22 2020, 4:31 AM
Richard Antalik (ISS) claimed this task.

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.