self is self.id_data
is inconsistent.
#86170
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#86170
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
System Information
Operating system: Linux
Graphics card: Intel
Blender Version
Broken: 2.91.0
Worked: never
Short description of error
When the driver code
self is self.id_data
is evaluated on an Object property (E.G. Transform) in a file that contains in multiple drivers, it will sometimes returnTrue
and sometimes returnFalse
, for different updates on the same driver channel.I'm not sure whether this is a bug, as the behaviour seems somewhat reasonable given the strictness of identity comparison and the complexity of Blender's API— The object might get moved around in memory or destroyed and re-made or something.
But on the other hand, I also think it seems reasonable to expect a single code line, executed sequentially, to behave consistently in that regard.
I think I was also confused because the behaviour seems much more consistent when the number of drivers is fewer and their relationship is simpler, and because this behaviour doesn't seem to occur in the interactive console (E.G.
all(C.active_object is C.active_object.id_data for i in range(10000)) == True
). So when testing the expression to figure out whether it's safe to use, I easily concluded that it seems fine, only to have problems once the scene was complex enough for it to be harder to track down the cause.Also, if you assign
self
andself.id_data
to variables before comparing them, and you print out the variables, then it will actually show that do in fact they have the same memory address (E.G.a, b = self, self.id_data; c = a is b; print(a, b, c)
can produce<bpy_struct, Object("ObjectName") at 0x7f4b07a76208, evaluated> <bpy_struct, Object("ObjectName") at 0x7f4b07a76208, evaluated> False
, where both Python objects are apparently at0x7f4b07a76208
.)Exact steps for others to reproduce the error
Open the attached
.blend
file, then rapidly click "Update Dependencies" on a transform channel's driver until theCube
's location starts jumping around.SelfIsntNotSelfIDData.blend
Added subscriber: @WCN
Added subscriber: @Mets
From the PyAPI:
id_data: The bpy.types.ID object this datablock is from or None, (not available for all data types)
So, on a driver placed on a Constraint property, where
self
refers to the constraint,self.id_data
will refer to the bpy.types.Object that holds the constraint. self != self.id_data.On a driver placed on an Object property, where
self
refers to the object, self==self.id_data.That said, I find the nomenclature around what's an "ID" and what's a "datablock" very confusing, so I would be interested to hear some developer input on that, but I don't think there is a bug here.
Oh yeah, I'm aware of that. Sorry, I should have been clearer in my original post.
The inconsistency occurs when the driver is placed on the
Object
datablock. As you can see from my screenshots,self is self.id_data
will sometimes beTrue
and sometimes beFalse
on drivers for the.location- [ ]
property of the object— It's the same driver on the sameObject
property that evaluates differently every couple updates, even though both sides always refer to the same BlenderObject()
with apparently the same memory address.It's a non-issue on Constraints, Modifiers, etc. because, as you note, there it will always return
False
anyway. Also, I should note that onlyis
is inconsistent (and presumablyis not
is as well);==
seems to work fine as I can tell. (But==
is a magic method whileis
is a language feature, so especially since the memory addresses andstr()
ofself
andself.id_data
seem to be the same even whereis
returnsFalse
and sinceis
appears to work perfectly in all situations where a user could reasonably test it, there may be an argument for reasonably usingis
instead of==
.)Oh I see, thanks for the clarification! That does sound like a bug indeed :)
Added subscriber: @lichtwerk
Changed status from 'Needs Triage' to: 'Confirmed'
Thx for the detailed report.
For me
==
can also fail (although apparently less often.This issue was referenced by
47cc05471d
This issue was referenced by
a23e49c696
Changed status from 'Confirmed' to: 'Resolved'