Python API: add bpy.context.property, for property under the mouse cursor
This can be useful for example to add custom operators to the property context menu. Pull Request: https://projects.blender.org/blender/blender/pulls/107280
This commit is contained in:
committed by
Brecht Van Lommel
parent
ea937b304d
commit
6ba0346797
10
doc/python_api/examples/bpy.context.property.py
Normal file
10
doc/python_api/examples/bpy.context.property.py
Normal file
@@ -0,0 +1,10 @@
|
||||
"""
|
||||
Get the property associated with a hovered button.
|
||||
Returns a tuple of the datablock, data path to the property, and array index.
|
||||
"""
|
||||
|
||||
# Example inserting keyframe for the hovered property.
|
||||
active_property = bpy.context.property
|
||||
if active_property:
|
||||
datablock, data_path, index = active_property
|
||||
datablock.keyframe_insert(data_path=data_path, index=index, frame=1)
|
||||
Reference in New Issue
Block a user