Fix #111169: PointerProperty ignores poll function when setting value #111189

Closed
Philipp Oeser wants to merge 1 commits from lichtwerk/blender:111169 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

1 Commits

Author SHA1 Message Date
Philipp Oeser e8301b0ab8 Fix #111169: PointerProperty ignores poll function when setting value
buildbot/vexp-code-patch-coordinator Build done. Details
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)
```
image = D.images['Render Result']
brush = D.brushes['Clone']
brush.clone_image = image
```

So now run the poll in `RNA_property_pointer_set`.

Alternatively, we could introduce a separate "set" method that would be
capable of "determine whether an item is valid for this property" (but
then again "poll" actually seems like the right place for this already).
2023-08-16 16:58:03 +02:00