Object deletion fails in frame_change_pre handler when called from Render Image #80866

Closed
opened 2020-09-17 07:23:37 +02:00 by Tuomo Keskitalo · 4 comments

System Information
Operating system: Linux-5.4.0-47-generic-x86_64-with-debian-bullseye-sid 64 Bits
Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.100

Blender Version
Broken: version: 2.91.0 Alpha, branch: master, commit date: 2020-09-16 21:05, hash: 27660b3cd9
Worked: No idea

Short description of error
Rendering an image (F12) runs frame_change_pre handler() (I don't know why, but it seems to do so). The bug is: If frame change routine contains object deletion (using bpy.ops.object.delete()) then that deletion fails when image is rendered.

However, object deletion works correctly when frame_change_pre handler() is called when the frame is changed e.g. in Blender Timeline Editor. It is only the call from Render Image where deletion fails. This bug is an issue when object deletion is followed by object creation -> additional unwanted objects are created at every render.

Exact steps for others to reproduce the error

**System Information** Operating system: Linux-5.4.0-47-generic-x86_64-with-debian-bullseye-sid 64 Bits Graphics card: GeForce GTX 1060 6GB/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.100 **Blender Version** Broken: version: 2.91.0 Alpha, branch: master, commit date: 2020-09-16 21:05, hash: `27660b3cd9` Worked: No idea **Short description of error** Rendering an image (F12) runs frame_change_pre handler() (I don't know why, but it seems to do so). The bug is: If frame change routine contains object deletion (using bpy.ops.object.delete()) then that deletion fails when image is rendered. However, object deletion works correctly when frame_change_pre handler() is called when the frame is changed e.g. in Blender Timeline Editor. It is only the call from Render Image where deletion fails. This bug is an issue when object deletion is followed by object creation -> additional unwanted objects are created at every render. **Exact steps for others to reproduce the error** - Open attached file (from #79464) - Click Run Script - Render image The script in the callback should delete the "Cube" object (once it is selected), but no object is deleted. [frame_change_pre_data_altering_failure_002.blend](https://archive.blender.org/developer/F8738522/frame_change_pre_data_altering_failure_002.blend)

Added subscriber: @TuomoKeskitalo

Added subscriber: @TuomoKeskitalo

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Archived'

Changed status from 'Needs Triage' to: 'Archived'
Germano Cavalcante self-assigned this 2020-09-18 16:42:12 +02:00

bpy.ops.object.delete internally calls the C equivalent for bpy.context.select_objects.
However, the callbacks in frame_change_pre are not called in the main thread and therefore most members of bpy.context cannot be accessed (See cf64a5b6).
You can override the context, or not use operators

Closing since this is not a bug but it is by design.

`bpy.ops.object.delete` internally calls the C equivalent for `bpy.context.select_objects`. However, the callbacks in `frame_change_pre ` are not called in the main thread and therefore most members of bpy.context cannot be accessed (See cf64a5b6). You can override the context, or not use operators Closing since this is not a bug but it is by design.
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
2 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#80866
No description provided.