Math Vis Console - fixed errors with invalid objects in console locals #104958
No reviewers
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#104958
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Andrej730/blender-addons:math_vis_fix_invalid_objects"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Noticed an error that sometimes gets in the way - it occurs if some blender object get's invalidated (whether when it's removed or it invalidated after undo).
When addon mets this kind of object in console's
locals()
it stops working.Way to reproduce:
Traceback:
@ -3,6 +3,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
import bpy
from _bpy import types as bpy_types
It looks like
bpy.types
works just as well, why not use that?Agreed, fixed.
Checking for instances of
ID
is not going to be enough, one can store all kind of other RNA structs in variables, that would become invalid once owner ID (or something else) is freed or re-allocated.Something like that should be more general and safe:
Would expect this code to work, provided it has been tested LGTM.
Have been testing version with
isinstance(var, bpy.types.ID):
for awhile now without issues.Tested the new version with
hasattr(var, "bl_rna")
on typical cases - no issues.@mont29 any other changes needed or it can be merged?
Would not mind @ideasman42 to have a look at this too, he understands this area of code better than I do...
It should be possible to run
isinstance(..)
on any data without raising exceptions.Committed an alternative fix blender/blender@e480b6a50c.
Pull request closed