Page MenuHome

Rigid body simulation does not bake when using Python API to create and remove mesh data in frame_change_pre_handler
Closed, ResolvedPublic


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

Blender Version
Broken: 2.80, 11f2c65128dc, 2019-01-03
Worked: 2.79b release

Short description of error

A rigid body simulation does not bake to completion when the frame_change_pre handler is used to create and then immediately remove a mesh data object. The simulation only bakes the first two frames and then stops.

Here is a short script that reproduces the issue:

import bpy

def frame_change_pre(scene):    
    new_mesh_data ="mesh_name")

I have also reported another issue related to unexpected behavior when using the frame_change_pre handler here: T60094

Exact steps for others to reproduce the error

I have attached a .blend file that includes the script to reproduce this issue.

To reproduce:

  1. Open the .blend file
  2. Press 'Run Script'
  3. Playback animation or attempt to bake the rigid body cache

To reproduce from a new .blend file:

  1. Add default cube as a rigid body object
  2. Run the script
  3. Playback animation or attempt to bake the rigid body cache

Event Timeline

Sebastian Parborg (zeddb) lowered the priority of this task from 90 to 50.

This sounds like a dependency graph issue, and more of a design issue.

I did not investigate the file, but the dependency graph is intended to reset the physics caches when the scene is edited. This makes sense for user edits, but less so for scripts that change the scene in the frame change handler.

Maybe those should not be considered user edits. As mention in T60094, the design here should be clarified.

Sergey Sharybin (sergey) changed the task status from Unknown Status to Resolved.Jun 13 2019, 4:51 PM

Was fixed by rB27441c7. Thanks for the report, closing.