Fix #111169: PointerProperty ignores poll function when setting value #111189
No reviewers
Labels
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#111189
Loading…
Reference in New Issue
No description provided.
Delete Branch "lichtwerk/blender:111169"
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?
According to docs, a pointer PointerProperty poll function should
"determine whether an item is valid for this property".
This was only used for filtering in the UI templates though, setting
(e.g. from python) ignored this entirely.
There was a comment about this in code (so I assume this was somewhat
known), however there doesnt seem to be a reason not to run the poll
when setting the value as well afaict.
Report was about python defined ID properties, but this was also true for
other properties.
For example, you could run the following (even though
rna_Brush_imagetype_poll
explicitly forbids this)So now run the poll in
RNA_property_pointer_set
(this should not beperformance critical since pointers cannot be animated).
Alternatively, we could have the "set" callback that would be
capable of "determine whether an item is valid for this property" for python
defined properties as well (regular
RNA_def_property_pointer_funcs
have this,but then again "poll" actually seems like the right place for this already).
@blender-bot package
Package build started. Download here when ready.
LGTM in principal. But I (very) vaguely seem to remember that there was a reason for the current behavior, and the comment in the
rna_internal_types.h
also seems to imply that the poll function only has very restricted usages.@ideasman42 @brecht maybe you guys remember better the rational behind current behavior?
I'd rather not have poll used for checking if a value can be set for a few reasons.
So I rather keep poll as advice which works usefully for a UI filter, but keep the "set" callback as the function which can reject an assignment.
That would mean exposing "set" for
PointerProperty
, right? (atm. this is not available)I agree with the points Campbell made.
I would not do anything here at all and consider this not a bug. Any conditions that a poll/set function checks can be violated afterwards by modifying the datablock that is being pointed to.
Fine with that, I can close #111169 referring to the discussion here. However:
I am confused,
set
is not available forPointerProperty
?OK, coming back to this I think we can close this try at a solution.
I have been asking the following before, and it looks to me that when you want this kind of control over python-defined properties, you would need the
set
callback [which at the moment of writing is not available for PointerProperty]:Pull request closed