require_data
require_data(obj, data_type)
Return the object’s data-block, checked to be of the given type.
Object.data can be any of Blender’s data-block types (or None), so this helper narrows it to the expected type with a proper runtime check.
Parameters
| obj |
bpy.types.Object |
The object to get the data-block from. |
required |
| data_type |
type[DataBlockT] |
The expected type of the data-block (e.g. bpy.types.Mesh). |
required |
Returns
|
DataBlockT |
The object’s data-block, guaranteed to be of the given type. |
Raises
|
TypeError |
If the object’s data is not of the expected type. |