mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix: Alembic: missing animation detection for points and curves
If points or curves only had their widths or velocities animated we would fail at detecting the need to automatically a cache modifier. This is because the default `has_animations` function, which is used for these types, checks whether the schema is constant but in those the default checks done by Alembic only include a subset of the properties held by the schema. This adds overloads to `has_animations` for curves and points to also verify if the widths or velocities attributes are animated. For curves, we could also include checks for other attributes (like the curve orders) but I'd rather see such animations in actual files, so this is left for later. Pull Request: https://projects.blender.org/blender/blender/pulls/162676
This commit is contained in:
parent
0729fe73e9
commit
a8ca7e5dd3
7 changed files with 91 additions and 0 deletions
|
|
@ -672,6 +672,40 @@ class AlembicAnimatedCameraImportTests(AbstractAlembicTest):
|
|||
msg=f"Frame {frame}: {camera_object.name} interocular_distance values do not match")
|
||||
|
||||
|
||||
class AlembicAnimatedSchemaImportTests(AbstractAlembicTest):
|
||||
def do_import_test(self, abc_file_name, first_frame, last_frame, object_name):
|
||||
res = bpy.ops.wm.alembic_import(
|
||||
filepath=str(self.testdir / abc_file_name),
|
||||
as_background_job=False)
|
||||
self.assertEqual({'FINISHED'}, res)
|
||||
|
||||
# The data stored in the attribute is random, so we check that the object
|
||||
# has a modifier (which should only be added if the data is animated) and
|
||||
# the frame range for the scene is detected properly.
|
||||
|
||||
scene = bpy.context.scene
|
||||
self.assertEqual(scene.frame_start, first_frame)
|
||||
self.assertEqual(scene.frame_end, last_frame)
|
||||
|
||||
ob = bpy.data.objects[object_name]
|
||||
self.assertEqual(len(ob.modifiers), 1)
|
||||
|
||||
modifier = ob.modifiers[0]
|
||||
self.assertEqual(modifier.type, 'MESH_SEQUENCE_CACHE')
|
||||
|
||||
def test_animated_point_width(self):
|
||||
self.do_import_test("point-width-animated.abc", 12, 144, "PointCloud")
|
||||
|
||||
def test_animated_point_velocity(self):
|
||||
self.do_import_test("point-velocity-animated.abc", 13, 169, "PointCloud")
|
||||
|
||||
def test_animated_curve_width(self):
|
||||
self.do_import_test("curve-width-animated.abc", 12, 144, "Curves")
|
||||
|
||||
def test_animated_curve_velocity(self):
|
||||
self.do_import_test("curve-velocity-animated.abc", 13, 169, "Curves")
|
||||
|
||||
|
||||
class AlembicImportComparisonTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue