Rigid body simulation does not bake when using Python API to create and remove mesh data in frame_change_pre_handler #60136

Closed
opened 2019-01-04 00:17:18 +01:00 by Ryan Guy · 13 comments

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

Blender Version
Broken: 2.80, 11f2c65128, 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: blender/blender-addons#60094

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

rigid_body_bug.blend

**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: blender/blender-addons#60094 **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 [rigid_body_bug.blend](https://archive.blender.org/developer/F6165406/rigid_body_bug.blend)
Author

Added subscriber: @rlguy

Added subscriber: @rlguy

#60893 was marked as duplicate of this issue

#60893 was marked as duplicate of this issue

#60919 was marked as duplicate of this issue

#60919 was marked as duplicate of this issue
Campbell Barton was assigned by Sebastian Parborg 2019-01-25 12:09:11 +01:00

Added subscribers: @toxsickcity, @ZedDB

Added subscribers: @toxsickcity, @ZedDB

Added subscriber: @nacioss

Added subscriber: @nacioss

Seems like frame_change_post is having issues as well.

Seems like `frame_change_post` is having issues as well.
Campbell Barton was unassigned by Brecht Van Lommel 2019-03-18 14:57:35 +01:00
Sergey Sharybin was assigned by Brecht Van Lommel 2019-03-18 14:57:35 +01:00

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Added subscriber: @brecht

Added subscriber: @brecht

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 blender/blender-addons#60094, the design here should be clarified.

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 blender/blender-addons#60094, the design here should be clarified.

Added subscriber: @Klutz

Added subscriber: @Klutz

Added subscriber: @TodorNikolov

Added subscriber: @TodorNikolov

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Was fixed by 27441c7. Thanks for the report, closing.

Was fixed by 27441c7. Thanks for the report, closing.
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
7 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#60136
No description provided.