Page MenuHome

Rigid body simulation does not bake when using Python API to create and remove mesh data in frame_change_pre_handler
Open, Needs TriagePublic

Description

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 = bpy.data.meshes.new("mesh_name")
    bpy.data.meshes.remove(new_mesh_data)
    
bpy.app.handlers.frame_change_pre.append(frame_change_pre)

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

Details

Type
Bug

Event Timeline