Hi Benjamin,

TL;DR: We did that in 2.7x, it’s not possible anymore in 2.8x (not without **huge** changes in a large part of RNA, and adding significant complication to the API).

Technical explanation:

This decision was taken because selection status **is not an Object data**, not at all. It is stored in the object 'instantiation' data (called Base, and not exposed to Python) used to 'link' an object to a ViewLayer. Hence it is context-dependent info, which cannot be retrieved through our RNA property system.

Ideally, there should be no access at all to that status in RNA, at least no setter, it should be something let to operators, or alternatively, we’d have to expose the whole Base concept to python. But that would add some noise and confusion to something already rather complicated (whole viewlayer/collection/object system).

We have other similar accessors in Object API, like `visible_get()`, which follow the same principle (and do not have any setter).

Note that pure-python things like @property are totally irrelevant here, this is using the semi-auto-generated binding to C code/data (through RNA), which has its own rules and limitations on top of python C API.

Bastien


On 05/11/2018 18:37, Benjamin Humpherys wrote:
I saw on the recent changes page on the wiki that the object selection API (https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Scene_and_Object_API#Object_Selection_and_Hiding) has changed from a simple `obj.select` property to `select_get()` and `select_set(’SELECT’)`. I strongly urge this decision to be reconsidered because it is not idiomatic Python to use getter and setter functions, let alone setting a boolean property with a string argument!

Instead of getters and setters please consider making `select` a @property, or utilizing `PyGetSetDef`(https://docs.python.org/3/c-api/structures.html#c.PyGetSetDef) to hide any new getter/setter logic instead of putting it in the user-facing API.


_______________________________________________
Bf-python mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-python

_______________________________________________
Bf-python mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-python

Reply via email to