Reference/Release Notes/2.81/Python API
Blender 2.81: Python API
Python has been upgraded from 3.7.0 to version, 3.7.4.
IDMaterials.pop()no longer have an
update_dataparameter. It now always behave as if
update_data=Truewas passed. (c70f975d5c3b961e0c)
EditBone.use_inherit_scaleare deprecated in favor of the new
inherit_scaleenum property. (fcf2a712)
CopyRotationConstraint.use_offsetis deprecated in favor of the new
CyclesShaderWrapperhas been removed developers should be using
ShaderNodeMappingwas rewritten to have dynamic inputs, so direct access to
scalehas been removed and is now done via
maxwas removed entirely and should be replaced by access to the
Extensionparameter of the Texture node (, )
Boneproperties related to its position and orientation have been marked read only, because modifying them was never expected by the code and resulted in inconsistent state. The rest pose should only be modified through
Meshes can now be cleared of all geometry by calling
mesh.clear_geometry() (6d2f9b1dfa98). This allows the reuse of existing mesh datablocks, by clearing with
mesh.clear_geometry() and subsequently recreating with, for example,
mesh.from_pydata(). Not only is it faster than creating a new mesh and swapping out the old one, but this also makes it easier for exporters to understand this actually represents the same logical mesh (instead of exporting a different static mesh for every frame).
Shape keys are not freed by this function. Freeing those would require tagging the depsgraph for relations update, which is an expensive operation. They should be removed explicitly if necessary.
Material slots are also not cleared by this function, in the same way that they are not cleared when manually removing all geometry from a mesh.
- Support for displaying node sockets with square and diamond shapes, using the new
- Constraint collections of objects and bones now have a
move()method for reordering the stack. (36e23c95)
lengthproperty of bones is now implemented in C and available for use in drivers and UI. (d4f8bc80)
Shadow map refactor removed some properties from the API. (d8aaf25c23fa)
contact_shadow_soft_sizehave been removed for all light data types.
SunLight.shadow_buffer_clip_endhave been removed due to sunlight now having auto clip distances.
SceneEEVEE.shadow_methodhave also been removed.
Operators can now have a dynamic tooltip that changes based on the context and operator parameters. (9ecbd67d)
With an operator defined as (irrelevant parts omitted):
class WM_OT_tooltip_test(bpy.types.Operator): arg: bpy.props.StringProperty() @classmethod def description(cls, context, properties): return "Arg is: " + properties.arg
The following button would have a tooltip that says "Arg is: FOO".
layout.operator('wm.tooltip_test').arg = 'FOO'
This is mainly intended for cases when multiple similar but distinct operations are implemented for technical reasons as one operator with a mode switch parameter.
frame_change_post handlers are now receiving an optional
depsgraph argument which allows to access evaluated datablocks within corresponding dependency graph. This can be used, for example, to alter scene prior it gets rendered.
The new function signatures are:
def depsgraph_update_post_handler(scene, depsgraph): pass def frame_change_post_handler(scene, depsgraph): pass
depsgraph argument is optional and can be left out. This keeps compatibility with existing scripts.
Details about access of evaluated datablocks can be found in the API documentation.
Mathutils - Geometry
mathutils.geometry.delaunay_2d_cdt(vert_coords, edges, faces, output_type, epsilon) function will do a Constrained Delaunay Triangulation of a set of 2d points, edges, and faces. Such a triangulation makes nice triangles (not long and skinny) while making sure that the input edges and faces are in the triangulation (perhaps divided into pieces). As a side effect, all of the input geometry is intersected with itself and other input geometry, so this routine can also be used for doing general 2d intersection, handling all of the degenerate cases gracefully. (b91643c71135)