Reference/Release Notes/4.1/Python API
< Reference | Release Notes | 4.1
Python API & Text Editor
Enum ID Properties
Support for enum items has been added to integer properties. 92cf9dd2f2
There is no support yet for editing enum items through the UI (see commit message for technical reasons).
Enum items can be added to an integer property using the id_properties_ui python method. The as_dict method can be used to retrieve a list of enum items of a property.
my_object["my_prop"] = 2
ui_data = my_object.id_properties_ui("my_prop")
ui_data.update(items=[
("TOMATOES", "Tomatoes", "Solanum lycopersicum"),
("CUCUMBERS", "Cucumbers", "Cucumis sativus"),
("RADISHES", "Radishes", "Raphanus raphanistrum"),
])
print(ui_data.as_dict())
Int properties with enum items are shown as a dropdown button in the UI.
Breaking Changes
Foreach
foreach_getandforeach_sethave been optimized for cases where internal storage is 8, 16 or 64 bit. (PR #115761)foreach_setnow performs more accurate bounds checks, and raises anOverflowErrorin cases where the value was previously silently written incorrectly.
Light Probes
- The Lightprobe type items have been renamed. It affects
bpy.types.LightProbe.type,bpy.types.BlendDataProbes.new()andbpy.ops.object.lightprobe_add().CUBEMAP->SPHEREPLANAR->PLANEGRID->VOLUME
show_datahas been deprecated. Useuse_data_displayinstead.- Each
LightProbenow has its owndata_display_sizeproperty.
Mesh
- Sculpt mask values are stored in a generic attribute (f2bcd73bd2).
- The name is ".sculpt_mask", with the
FLOATtype. - Accessing, adding, and removing masks is done in a simpler way:
- The
Mesh.vertex_paint_maskproperty returns the attribute directly, rather than a collection. - The
Mesh.vertex_paint_mask_ensure()andMesh.vertex_paint_mask_remove()functions add and remove the attribute.
- The
- The name is ".sculpt_mask", with the
- The
Meshauto_smoothproperty has been replaced by a modifier node group asset (89e3ba4e25).use_auto_smoothis removed. Face corner normals are now used automatically if there are mixed smooth vs. not smooth tags. Meshes now always use custom normals if they exist.auto_smooth_angleis removed. Replaced by a modifier (or operator) controlling the"sharp_edge"attribute. This means the mesh itself (without an object) doesn't know anything about automatically smoothing by angle anymore.create_normals_split,calc_normals_split, andfree_normals_splitare removed, and are replaced by the simplerMesh.corner_normalscollection property. Since it gives access to the normals cache, it is automatically updated when relevant data changes.MeshLoop.normalis now a read-only property. Custom normals should be created bynormals_split_custom_setornormals_split_custom_set_from_vertices.
Material
- The
displacement_methodproperty has moved fromcycles.properties.CyclesMaterialSettingstobpy.types.Materiala001cf9f2b