Blender Git Loki

Git Commits -> Revision 32d5d12

Revision 32d5d12 by Sergey Sharybin (master)
May 16, 2019, 14:42 (GMT)
Tweak API to support adding evaluated meshes to main database

One of the usecases is to create mesh from an object is a manner similar to
how Apply Modifiers does it, and have it in the bmain so it can be referenced
by other objects.

This usecase is something what went unnoticed in the previous API changes, so
here is a followup.

Summary of changes:

* bpy.meshes.new_from_object() behaves almost the same as before this change.
The difference now is that it now ensures all referenced data-blocks are
original (for example, materials referenced by the mesh).

* object.to_mesh() now creates free-standing Mesh data-block which is outside
of any bmain. The object owns it, which guarantees the memory never leaks.

It is possible to force free memory by calling object.to_mesh_clear().

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D4875

Commit Details:

Full Hash: 32d5d127cb49743578e8e1e9882d8a707a4e848e
Parent Commit: 22a91bb
Lines Changed: +283, -109

1 Added Path:

/doc/python_api/examples/bpy.types.Depsgraph.6.py (+61, -0) (View)

14 Modified Paths:

/doc/python_api/examples/bpy.types.Depsgraph.4.py (+5, -5) (Diff)
/doc/python_api/examples/bpy.types.Depsgraph.5.py (+37, -41) (Diff)
/intern/cycles/blender/blender_util.h (+7, -5) (Diff)
/source/blender/blenkernel/BKE_mesh.h (+7, -1) (Diff)
/source/blender/blenkernel/BKE_object.h (+9, -0) (Diff)
/source/blender/blenkernel/intern/mesh_convert.c (+86, -28) (Diff)
/source/blender/blenkernel/intern/object.c (+19, -0) (Diff)
/source/blender/editors/object/object_bake_api.c (+11, -11) (Diff)
/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp (+3, -2) (Diff)
/source/blender/makesdna/DNA_object_types.h (+5, -0) (Diff)
/source/blender/makesrna/intern/rna_internal.h (+0, -3) (Diff)
/source/blender/makesrna/intern/rna_main_api.c (+2, -2) (Diff)
/source/blender/makesrna/intern/rna_object_api.c (+29, -11) (Diff)
/tests/python/bl_alembic_import_test.py (+2, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021