Exporting procedural mesh animation with Alembic results in a static mesh and can cause crashes #65816

Closed
opened 2019-06-14 20:40:47 +02:00 by Ryan Guy · 17 comments

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

Blender Version
Broken: 2.80, 8ac0fef4df, 2019-06-14
Worked: 2.79, 5bd8ac9, 2017-09-11

Short description of error

I have created a small script that updates an object mesh geometry within a frame_change_pre handler. Now I want to export the animation using the Alembic exporter. I have added a modifier to the object so that it is recognized as an animated mesh during Alembic export (according to this comment ).

In Blender 2.79, the exported mesh is animated, but in Blender 2.80 the exported mesh is static.

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)

Exact steps for others to reproduce the error

I have attached a .blend file that will reproduce the issue and that will run in both 2.79 and 2.80.

procedural_alembic_export.blend

  • Open .blend file in Blender 2.80
  • Run the script
  • File > Export > Alembic
  • Import the Alembic cache into the scene

Result: the Alembic cache is not animated

**System Information** Operating system: Windows 10 Home Graphics card: GTX 1070 8GB **Blender Version** Broken: 2.80, 8ac0fef4dfd1, 2019-06-14 Worked: 2.79, 5bd8ac9, 2017-09-11 **Short description of error** I have created a small script that updates an object mesh geometry within a frame_change_pre handler. Now I want to export the animation using the Alembic exporter. I have added a modifier to the object so that it is recognized as an animated mesh during Alembic export ([according to this comment ](https://developer.blender.org/T51351#431087)). In Blender 2.79, the exported mesh is animated, but in Blender 2.80 the exported mesh is static. ``` 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) ``` **Exact steps for others to reproduce the error** I have attached a .blend file that will reproduce the issue and that will run in both 2.79 and 2.80. [procedural_alembic_export.blend](https://archive.blender.org/developer/F7103097/procedural_alembic_export.blend) - Open .blend file in Blender 2.80 - Run the script - File > Export > Alembic - Import the Alembic cache into the scene Result: the Alembic cache is not animated
Author

Added subscriber: @rlguy

Added subscriber: @rlguy

Added subscriber: @ZedDB

Added subscriber: @ZedDB
Sybren A. Stüvel was assigned by Sebastian Parborg 2019-06-20 14:30:23 +02:00

I'm getting an assert on export:

BLI_assert failed: /home/zed/prog/blender/source/blender/blenkernel/intern/object.c:3358, BKE_object_get_pre_modified_mesh(), at 'object->runtime.mesh_orig->id.orig_id == ((Object *)object->id.orig_id)->data'

If I ignore that, I get an other assert when opening the exported file:

blender: /usr/include/boost/smart_ptr/shared_ptr.hpp:734: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = Alembic::Abc::v11::TypedArraySample<Alembic::Abc::v11::V2fTPTraits>; typename boost::detail::sp_member_access<T>::type = Alembic::Abc::v11::TypedArraySample<Alembic::Abc::v11::V2fTPTraits>*]: Assertion `px != 0' failed.

If I ignore that too, I get a segfault on import:

Thread 36 "blender" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffcdffe700 (LWP 18292)]
read_mpolys (config=..., mesh_data=...) at /home/zed/prog/blender/source/blender/alembic/intern/abc_mesh.cc:833
833	  const size_t uvs_size = uvs->size();
(gdb) bt
- 0  read_mpolys (config=..., mesh_data=...) at /home/zed/prog/blender/source/blender/alembic/intern/abc_mesh.cc:833
- 1  0x0000555556a962e5 in read_mesh_sample (settings=<synthetic pointer>, do_normals=<synthetic pointer>: <optimized out>, config=..., selector=...,
    schema=..., iobject_full_name="/mesh_cache/mesh_cacheShape") at /home/zed/prog/blender/source/blender/alembic/intern/abc_mesh.cc:1030
#2  AbcMeshReader::read_mesh (this=0x7fffce86f400, existing_mesh=0x7fffce80ed08, sample_sel=..., read_flag=<optimized out>, err_str=<optimized out>)
    at /home/zed/prog/blender/source/blender/alembic/intern/abc_mesh.cc:1175
#3  0x0000555556a955c5 in AbcMeshReader::readObjectData (this=0x7fffce86f400, bmain=0x7fffd32fd808, sample_sel=...)
    at /home/zed/prog/blender/source/blender/alembic/intern/abc_mesh.cc:1081
#4  0x0000555556a64631 in import_startjob (user_data=0x7fffd2ddb200, stop=<optimized out>, do_update=<optimized out>, progress=<optimized out>)
    at /home/zed/prog/blender/source/blender/alembic/intern/alembic_capi.cc:713
- 5  0x000055555652560f in do_job_thread (job_v=0x7fffd0016dc8) at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_jobs.c:376
- 6  0x00007ffff6a09458 in start_thread () from /lib64/libpthread.so.0
#7  0x00007ffff326b71f in clone () from /lib64/libc.so.6

I'm guessing this is related to reported issue here.

I'm getting an assert on export: ``` BLI_assert failed: /home/zed/prog/blender/source/blender/blenkernel/intern/object.c:3358, BKE_object_get_pre_modified_mesh(), at 'object->runtime.mesh_orig->id.orig_id == ((Object *)object->id.orig_id)->data' ``` If I ignore that, I get an other assert when opening the exported file: ``` blender: /usr/include/boost/smart_ptr/shared_ptr.hpp:734: typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = Alembic::Abc::v11::TypedArraySample<Alembic::Abc::v11::V2fTPTraits>; typename boost::detail::sp_member_access<T>::type = Alembic::Abc::v11::TypedArraySample<Alembic::Abc::v11::V2fTPTraits>*]: Assertion `px != 0' failed. ``` If I ignore that too, I get a segfault on import: ``` Thread 36 "blender" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffcdffe700 (LWP 18292)] read_mpolys (config=..., mesh_data=...) at /home/zed/prog/blender/source/blender/alembic/intern/abc_mesh.cc:833 833 const size_t uvs_size = uvs->size(); (gdb) bt - 0 read_mpolys (config=..., mesh_data=...) at /home/zed/prog/blender/source/blender/alembic/intern/abc_mesh.cc:833 - 1 0x0000555556a962e5 in read_mesh_sample (settings=<synthetic pointer>, do_normals=<synthetic pointer>: <optimized out>, config=..., selector=..., schema=..., iobject_full_name="/mesh_cache/mesh_cacheShape") at /home/zed/prog/blender/source/blender/alembic/intern/abc_mesh.cc:1030 #2 AbcMeshReader::read_mesh (this=0x7fffce86f400, existing_mesh=0x7fffce80ed08, sample_sel=..., read_flag=<optimized out>, err_str=<optimized out>) at /home/zed/prog/blender/source/blender/alembic/intern/abc_mesh.cc:1175 #3 0x0000555556a955c5 in AbcMeshReader::readObjectData (this=0x7fffce86f400, bmain=0x7fffd32fd808, sample_sel=...) at /home/zed/prog/blender/source/blender/alembic/intern/abc_mesh.cc:1081 #4 0x0000555556a64631 in import_startjob (user_data=0x7fffd2ddb200, stop=<optimized out>, do_update=<optimized out>, progress=<optimized out>) at /home/zed/prog/blender/source/blender/alembic/intern/alembic_capi.cc:713 - 5 0x000055555652560f in do_job_thread (job_v=0x7fffd0016dc8) at /home/zed/prog/blender/source/blender/windowmanager/intern/wm_jobs.c:376 - 6 0x00007ffff6a09458 in start_thread () from /lib64/libpthread.so.0 #7 0x00007ffff326b71f in clone () from /lib64/libc.so.6 ``` I'm guessing this is related to reported issue here.

@ZedDB that segfault isn't related, and is fixed in 964e319a39.

@ZedDB that segfault isn't related, and is fixed in 964e319a39ab.

@dr.sybren But you can reproduce the issue mentioned here?

@dr.sybren But you can reproduce the issue mentioned here?

I can. A solution is more tricky, though; I'm working on a new way to iterate the depsgraph and properly use evaluated data for exporting to USD, which we can also use to export to Alembic. However, such a major change is probably too major to put into the 2.80 release.

I can. A solution is more tricky, though; I'm working on a new way to iterate the depsgraph and properly use evaluated data for exporting to USD, which we can also use to export to Alembic. However, such a major change is probably too major to put into the 2.80 release.

Added subscriber: @juang3d

Added subscriber: @juang3d

How is this going?

This is preventing from being able to properly export a fluid simulation to alembic, Blender crashes, this is the terminal output, on windows 10 x64, today's master from build bot:

image.png

Is there a workaround?
It's a pretty big bug and an important one if we have to work with a fluids project (as we have to do right now)

Cheers.

How is this going? This is preventing from being able to properly export a fluid simulation to alembic, Blender crashes, this is the terminal output, on windows 10 x64, today's master from build bot: ![image.png](https://archive.blender.org/developer/F7623133/image.png) Is there a workaround? It's a pretty big bug and an important one if we have to work with a fluids project (as we have to do right now) Cheers.

@juang3d What you describe is not the same problem as is discussed here. If you have a crash, please write a separate bug report via the "Report Bug" item in the "Help" menu.

@juang3d What you describe is not the same problem as is discussed here. If you have a crash, please write a separate bug report via the "Report Bug" item in the "Help" menu.

I’ve been directed towards this bug by the Flip Fluids Addon developer, that is why I assumed that this is the same bug.
I’ll report a different bug if you think it’s a different one :)

Thanks!

I’ve been directed towards this bug by the Flip Fluids Addon developer, that is why I assumed that this is the same bug. I’ll report a different bug if you think it’s a different one :) Thanks!
Author

I have recently received a few reports from users of the FLIP Fluids addon that this issue is now resulting in crashes rather than the static exported Alembic caches reported in the original post. I have just had a chance to test this on the most recent Blender 2.80 build (02c5c091df) and have been able to confirm this crash using the .blend file and instructions in the original post.

This is the error that I receive:

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

find_node component: Could not find ID MEmesh_data217
add_relation(Object Geometry Base Data) - Could not find op_from (ComponentKey(MEmesh_data217, GEOMETRY))
add_relation(Object Geometry Base Data) - Failed, but op_to (ComponentKey(OBmesh_cache, GEOMETRY)) was ok
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 : 0x00007FF75D68CD20
Module  : C:\Users\ryanl\Downloads\blender-2.80.0-git.02c5c091dfd6-windows64\blender.exe

Sometimes running the test results in this error message instead:

Error   : EXCEPTION_ACCESS_VIOLATION
Address : 0x00007FF75D6B86CF
Module  : C:\Users\ryanl\Downloads\blender-2.80.0-git.02c5c091dfd6-windows64\blender.exe

Note: the crashes do not occur 100% of the time. The frequency of crashes seem to increase as the length of animation frames increases. Extending the end frame to 2000 rather than 30 in the default .blend file seems to result in a crash every time on my home system.

I have recently received a few reports from users of the FLIP Fluids addon that this issue is now resulting in crashes rather than the static exported Alembic caches reported in the original post. I have just had a chance to test this on the most recent Blender 2.80 build (02c5c091dfd6) and have been able to confirm this crash using the .blend file and instructions in the original post. This is the error that I receive: **System Information** Operating system: Windows 10 Home Graphics card: GTX 1070 8GB ``` find_node component: Could not find ID MEmesh_data217 add_relation(Object Geometry Base Data) - Could not find op_from (ComponentKey(MEmesh_data217, GEOMETRY)) add_relation(Object Geometry Base Data) - Failed, but op_to (ComponentKey(OBmesh_cache, GEOMETRY)) was ok 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 : 0x00007FF75D68CD20 Module : C:\Users\ryanl\Downloads\blender-2.80.0-git.02c5c091dfd6-windows64\blender.exe ``` Sometimes running the test results in this error message instead: ``` Error : EXCEPTION_ACCESS_VIOLATION Address : 0x00007FF75D6B86CF Module : C:\Users\ryanl\Downloads\blender-2.80.0-git.02c5c091dfd6-windows64\blender.exe ``` Note: the crashes do not occur 100% of the time. The frequency of crashes seem to increase as the length of animation frames increases. Extending the end frame to 2000 rather than 30 in the default .blend file seems to result in a crash every time on my home system.

Again, please read the original report. It is about Alembic exporting a static mesh. It's not about Blender crashing. If you have a crash, it's a different bug. If it's about fluid simulation, you're probably experiencing #52814 which has a fix in D5191, which will be included in Blender 2.81.

Again, please read the original report. It is about Alembic exporting a static mesh. It's not about Blender crashing. If you have a crash, it's a different bug. If it's about fluid simulation, you're probably experiencing #52814 which has a fix in [D5191](https://archive.blender.org/developer/D5191), which will be included in Blender 2.81.

I’ll report it later :)

I’ll report it later :)

So I've investigated this a bit more and it's a different bug for sure.

The current bug is still present, I don't experience any crahses using the sample blend file and the script, but there is no animation export in the alembic export, but I saw that the patch is not included in 2.80 (too risky), I'll add the patch to my own build and I'll try to export the Flip Fluid result to see if anything changes regarding the crashes (I assume the triangle export thing will work of course).

On the other hand, @rlguy will post another bug for the export crash, it only happens with Flip Fluids addon, Mantaflow (version built today) and Elbeem exports are correct.

Cheers.

So I've investigated this a bit more and it's a different bug for sure. The current bug is still present, I don't experience any crahses using the sample blend file and the script, but there is no animation export in the alembic export, but I saw that the patch is not included in 2.80 (too risky), I'll add the patch to my own build and I'll try to export the Flip Fluid result to see if anything changes regarding the crashes (I assume the triangle export thing will work of course). On the other hand, @rlguy will post another bug for the export crash, it only happens with Flip Fluids addon, Mantaflow (version built today) and Elbeem exports are correct. Cheers.

This issue depends on blender/blender-addons#60094 being fixed first.

This issue depends on blender/blender-addons#60094 being fixed first.

This issue was referenced by a9a8eedd16

This issue was referenced by a9a8eedd163e17fcf345726fd4c4db891771cac8
Sybren A. Stüvel changed title from Exporting procedural mesh animation with Alembic results in a static mesh to Exporting procedural mesh animation with Alembic results in a static mesh and can cause crashes 2019-09-18 17:01:06 +02:00

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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
5 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#65816
No description provided.