mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
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
This commit is contained in:
parent
22a91bb0bd
commit
32d5d127cb
15 changed files with 282 additions and 108 deletions
|
|
@ -194,6 +194,7 @@ class SimpleImportTest(AbstractAlembicTest):
|
|||
self.assertAlmostEqual(-1, mesh.vertices[0].co.x)
|
||||
self.assertAlmostEqual(-1, mesh.vertices[0].co.y)
|
||||
self.assertAlmostEqual(0.5905638933181763, mesh.vertices[0].co.z)
|
||||
plane_eval.to_mesh_clear()
|
||||
|
||||
# Change path from absolute to relative. This should not break the animation.
|
||||
scene.frame_set(1)
|
||||
|
|
@ -205,6 +206,7 @@ class SimpleImportTest(AbstractAlembicTest):
|
|||
self.assertAlmostEqual(1, mesh.vertices[3].co.x)
|
||||
self.assertAlmostEqual(1, mesh.vertices[3].co.y)
|
||||
self.assertAlmostEqual(0.5905638933181763, mesh.vertices[3].co.z)
|
||||
plane_eval.to_mesh_clear()
|
||||
|
||||
def test_import_long_names(self):
|
||||
# This file contains very long names. The longest name is 4047 chars.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue