Exporting procedural mesh animation with Alembic results in a crash #67627

Closed
opened 2019-07-25 00:22:30 +02:00 by Ryan Guy · 7 comments

System Information
Operating system: Windows 10 Home
Graphics card: GTX 1070 8GB

Blender Version
Broken: 2.80, 4fe0fafb87, 2019-07-24
Worked: 2.79, 5bd8ac9, 2017-09-11

Short description of error

Exporting a procedural mesh to Alembic that is updated in the frame_change_pre handler results in a crash. This is an issue that is being encountered in the FLIP Fluids addon. I have created a small script that reproduces this issue.

The script and steps to reproduce this issue are similar to this report: #65816

import bpy

def frame_change_pre(scene):
    # A triangle that shifts in the z direction
    zshift = scene.frame_current * 0.1
    vertices = [(-1, -1, zshift), (1, -1, zshift), (0, 1, zshift)]
    triangles = [(0, 1, 2)]
    
    new_mesh_data = bpy.data.meshes.new("mesh_data" + str(scene.frame_current))
    new_mesh_data.from_pydata(vertices, [], triangles)
    
    mesh_cache = bpy.data.objects.get("mesh_cache")
    old_mesh_data = mesh_cache.data
    mesh_cache.data = new_mesh_data
    bpy.data.meshes.remove(old_mesh_data)
    
bpy.app.handlers.frame_change_pre.append(frame_change_pre)

This is the error output after the crash:

Read blend: C:\Users\ryanl\Downloads\procedural_alembic_export.blend
find_node component: Could not find ID MEmesh_data272
add_relation(Object Geometry Base Data) - Could not find op_from (ComponentKey(MEmesh_data272, GEOMETRY))
add_relation(Object Geometry Base Data) - Failed, but op_to (ComponentKey(OBmesh_cache, GEOMETRY)) was ok
find_node_operation: Failed for (PARAMETERS_ENTRY, '')
find_node_operation: Failed for (PARAMETERS_EVAL, '')
add_relation(Entry -> Eval) - Could not find op_from (OperationKey(type: PARAMETERS, component name: '', operation code: PARAMETERS_ENTRY))
add_relation(Entry -> Eval) - Could not find op_to (OperationKey(type: PARAMETERS, component name: '', operation code: PARAMETERS_EVAL))
find_node_operation: Failed for (PARAMETERS_EVAL, '')
find_node_operation: Failed for (PARAMETERS_EXIT, '')
add_relation(Entry -> Exit) - Could not find op_from (OperationKey(type: PARAMETERS, component name: '', operation code: PARAMETERS_EVAL))
add_relation(Entry -> Exit) - Could not find op_to (OperationKey(type: PARAMETERS, component name: '', operation code: PARAMETERS_EXIT))
find_node_operation: Failed for (GEOMETRY_EVAL, '')
find_node_operation: Failed for (GEOMETRY_EVAL_DONE, '')
add_relation(ObData Geom Eval Done) - Could not find op_from (OperationKey(type: GEOMETRY, component name: '', operation code: GEOMETRY_EVAL))
add_relation(ObData Geom Eval Done) - Could not find op_to (OperationKey(type: GEOMETRY, component name: '', operation code: GEOMETRY_EVAL_DONE))
find_node_operation: Failed for (GEOMETRY_SELECT_UPDATE, '')
add_relation(Data Selection -> Object Selection) - Could not find op_from (OperationKey(type: BATCH_CACHE, component name: '', operation code: GEOMETRY_SELECT_UPDATE))
add_relation(Data Selection -> Object Selection) - Failed, but op_to (OperationKey(type: BATCH_CACHE, component name: '', operation code: GEOMETRY_SELECT_UPDATE)) was ok
find_node_operation: Failed for (COPY_ON_WRITE, '')
add_relation(Eval Order) - Could not find op_from (OperationKey(type: COPY_ON_WRITE, component name: '', operation code: COPY_ON_WRITE))
add_relation(Eval Order) - Failed, but op_to (OperationKey(type: COPY_ON_WRITE, component name: '', operation code: COPY_ON_WRITE)) was ok
Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FF70639C627
Error   : EXCEPTION_ACCESS_VIOLATION
Module  : C:\Users\ryanl\Downloads\blender-2.80.0-git.4fe0fafb8755-windows64\blender.exe

Sometimes the error output is this:

Read blend: C:\Users\ryanl\Downloads\procedural_alembic_export.blend
Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FF70650CD40
Module  : C:\Users\ryanl\Downloads\blender-2.80.0-git.4fe0fafb8755-windows64\blender.exe

Exact steps for others to reproduce the error

I have attached a .blend file that will reproduce the issue.

procedural_alembic_export.blend

  • Open .blend file
  • Run the script

File > Export > Alembic

Blender does not crash 100% of the time. It seems that the chance of a crash occurring increases as the frame range increases. I have the end frame set to 2000, which results in a crash most of the time on my system.

**System Information** Operating system: Windows 10 Home Graphics card: GTX 1070 8GB **Blender Version** Broken: 2.80, 4fe0fafb8755, 2019-07-24 Worked: 2.79, 5bd8ac9, 2017-09-11 **Short description of error** Exporting a procedural mesh to Alembic that is updated in the frame_change_pre handler results in a crash. This is an issue that is being encountered in the FLIP Fluids addon. I have created a small script that reproduces this issue. The script and steps to reproduce this issue are similar to this report: #65816 ``` import bpy def frame_change_pre(scene): # A triangle that shifts in the z direction zshift = scene.frame_current * 0.1 vertices = [(-1, -1, zshift), (1, -1, zshift), (0, 1, zshift)] triangles = [(0, 1, 2)] new_mesh_data = bpy.data.meshes.new("mesh_data" + str(scene.frame_current)) new_mesh_data.from_pydata(vertices, [], triangles) mesh_cache = bpy.data.objects.get("mesh_cache") old_mesh_data = mesh_cache.data mesh_cache.data = new_mesh_data bpy.data.meshes.remove(old_mesh_data) bpy.app.handlers.frame_change_pre.append(frame_change_pre) ``` This is the error output after the crash: ``` Read blend: C:\Users\ryanl\Downloads\procedural_alembic_export.blend find_node component: Could not find ID MEmesh_data272 add_relation(Object Geometry Base Data) - Could not find op_from (ComponentKey(MEmesh_data272, GEOMETRY)) add_relation(Object Geometry Base Data) - Failed, but op_to (ComponentKey(OBmesh_cache, GEOMETRY)) was ok find_node_operation: Failed for (PARAMETERS_ENTRY, '') find_node_operation: Failed for (PARAMETERS_EVAL, '') add_relation(Entry -> Eval) - Could not find op_from (OperationKey(type: PARAMETERS, component name: '', operation code: PARAMETERS_ENTRY)) add_relation(Entry -> Eval) - Could not find op_to (OperationKey(type: PARAMETERS, component name: '', operation code: PARAMETERS_EVAL)) find_node_operation: Failed for (PARAMETERS_EVAL, '') find_node_operation: Failed for (PARAMETERS_EXIT, '') add_relation(Entry -> Exit) - Could not find op_from (OperationKey(type: PARAMETERS, component name: '', operation code: PARAMETERS_EVAL)) add_relation(Entry -> Exit) - Could not find op_to (OperationKey(type: PARAMETERS, component name: '', operation code: PARAMETERS_EXIT)) find_node_operation: Failed for (GEOMETRY_EVAL, '') find_node_operation: Failed for (GEOMETRY_EVAL_DONE, '') add_relation(ObData Geom Eval Done) - Could not find op_from (OperationKey(type: GEOMETRY, component name: '', operation code: GEOMETRY_EVAL)) add_relation(ObData Geom Eval Done) - Could not find op_to (OperationKey(type: GEOMETRY, component name: '', operation code: GEOMETRY_EVAL_DONE)) find_node_operation: Failed for (GEOMETRY_SELECT_UPDATE, '') add_relation(Data Selection -> Object Selection) - Could not find op_from (OperationKey(type: BATCH_CACHE, component name: '', operation code: GEOMETRY_SELECT_UPDATE)) add_relation(Data Selection -> Object Selection) - Failed, but op_to (OperationKey(type: BATCH_CACHE, component name: '', operation code: GEOMETRY_SELECT_UPDATE)) was ok find_node_operation: Failed for (COPY_ON_WRITE, '') add_relation(Eval Order) - Could not find op_from (OperationKey(type: COPY_ON_WRITE, component name: '', operation code: COPY_ON_WRITE)) add_relation(Eval Order) - Failed, but op_to (OperationKey(type: COPY_ON_WRITE, component name: '', operation code: COPY_ON_WRITE)) was ok Error : EXCEPTION_ACCESS_VIOLATION Address : 0x00007FF70639C627 Error : EXCEPTION_ACCESS_VIOLATION Module : C:\Users\ryanl\Downloads\blender-2.80.0-git.4fe0fafb8755-windows64\blender.exe ``` Sometimes the error output is this: ``` Read blend: C:\Users\ryanl\Downloads\procedural_alembic_export.blend Error : EXCEPTION_ACCESS_VIOLATION Address : 0x00007FF70650CD40 Module : C:\Users\ryanl\Downloads\blender-2.80.0-git.4fe0fafb8755-windows64\blender.exe ``` **Exact steps for others to reproduce the error** I have attached a .blend file that will reproduce the issue. [procedural_alembic_export.blend](https://archive.blender.org/developer/F7627291/procedural_alembic_export.blend) - Open .blend file - Run the script # File > Export > Alembic Blender does not crash 100% of the time. It seems that the chance of a crash occurring increases as the frame range increases. I have the end frame set to 2000, which results in a crash most of the time on my system.
Author

Added subscriber: @rlguy

Added subscriber: @rlguy

Added subscribers: @dr.sybren, @juang3d

Added subscribers: @dr.sybren, @juang3d

Hey @dr.sybren what do you think about this?

It seems that @rlguy tried to use any of these handlers:

frame_change_pre
frame_change_post
render_pre
render_post

But it seems the crash is there with any of those.
I tried with your patch for the other bug but the crash is still present in this case.

Hey @dr.sybren what do you think about this? It seems that @rlguy tried to use any of these handlers: frame_change_pre frame_change_post render_pre render_post But it seems the crash is there with any of those. I tried with your patch for the other bug but the crash is still present in this case.
Author

Note: render_pre and render_post handlers will not cause a crash in this issue since these are only called during render. I had tested the frame change and render handlers in issue blender/blender-addons#60094 which all resulted in a crash.

Note: *render_pre* and *render_post* handlers will not cause a crash in this issue since these are only called during render. I had tested the frame change and render handlers in issue blender/blender-addons#60094 which all resulted in a crash.
Sybren A. Stüvel self-assigned this 2019-07-30 10:49:32 +02:00

There are two things happening in the reported code:

  • The mesh object is replaced. This means the exporter is going to see it as a different mesh. Instead of having one mesh animated over time, you'll have a separate static mesh for every frame.
  • The changes in the data aren't seen by the export depsgraph, see blender/blender-addons#60094.
There are two things happening in the reported code: - The mesh object is replaced. This means the exporter is going to see it as a different mesh. Instead of having one mesh animated over time, you'll have a separate static mesh for every frame. - The changes in the data aren't seen by the export depsgraph, see blender/blender-addons#60094.

I've added a function (6d2f9b1dfa) to Blender that allows you to avoid replacing the mesh datablock. You can now write the code like this:

def frame_change_pre(scene):
    # A triangle that shifts in the z direction
    zshift = scene.frame_current * 0.1
    vertices = [(-1, -1, zshift), (1, -1, zshift), (0, 1, zshift)]
    triangles = [(0, 1, 2)]

    object = bpy.data.objects["The Object"]
    object.data.clear_geometry()
    object.data.from_pydata(vertices, [], triangles)

Note the new object.data.clear_geometry() function. This will erase all geometry from the mesh, and allow a subsequent from_pydata() call to fill it up again. It also just tags the mesh for geometry updates in the depsgraph; creating a new mesh datablock and deleting the old one will cause a complete rebuild of the relations in the depsgraph, which is more expensive.

The remaining part of this task is now the same as blender/blender-addons#60094, so I'll merge this task as a duplicate.

I've added a function (6d2f9b1dfa) to Blender that allows you to avoid replacing the mesh datablock. You can now write the code like this: ``` def frame_change_pre(scene): # A triangle that shifts in the z direction zshift = scene.frame_current * 0.1 vertices = [(-1, -1, zshift), (1, -1, zshift), (0, 1, zshift)] triangles = [(0, 1, 2)] object = bpy.data.objects["The Object"] object.data.clear_geometry() object.data.from_pydata(vertices, [], triangles) ``` Note the new `object.data.clear_geometry()` function. This will erase all geometry from the mesh, and allow a subsequent `from_pydata()` call to fill it up again. It also just tags the mesh for geometry updates in the depsgraph; creating a new mesh datablock and deleting the old one will cause a complete rebuild of the relations in the depsgraph, which is more expensive. The remaining part of this task is now the same as blender/blender-addons#60094, so I'll merge this task as a duplicate.

Closed as duplicate of blender/blender-addons#60094

Closed as duplicate of blender/blender-addons#60094
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#67627
No description provided.