PyAPI: support returning non ID types when accessing Context.property

Previously accessing properties without an associated ID would return
None, even when the non-ID data was available.

Ref !116981
This commit is contained in:
Campbell Barton
2024-01-10 22:31:10 +11:00
parent 20ccaa9d67
commit 59dc67974a
3 changed files with 35 additions and 13 deletions

View File

@@ -1,6 +1,11 @@
"""
Get the property associated with a hovered button.
Returns a tuple of the datablock, data path to the property, and array index.
Returns a tuple of the data-block, data path to the property, and array index.
.. note::
When the property doesn't have an associated :class:`bpy.types.ID` non-ID data may be returned.
This may occur when accessing windowing data, for example, operator properties.
"""
# Example inserting keyframe for the hovered property.

View File

@@ -1217,7 +1217,7 @@ context_type_map = {
"particle_settings": ("ParticleSettings", False),
"particle_system": ("ParticleSystem", False),
"particle_system_editable": ("ParticleSystem", False),
"property": ("(:class:`bpy.types.ID`, :class:`string`, :class:`int`)", False),
"property": ("(:class:`bpy.types.AnyType`, :class:`string`, :class:`int`)", False),
"pointcloud": ("PointCloud", False),
"pose_bone": ("PoseBone", False),
"pose_object": ("Object", False),