Expand H3 scene image helpers to 9 slots

This commit is contained in:
2026-08-25 17:42:10 +00:00
parent 34e9bea6d9
commit 30c7128810
3 changed files with 67 additions and 16 deletions
+34 -2
View File
@@ -524,6 +524,8 @@ class DumasImageNodeTests(unittest.TestCase):
image_1 = FakeTensorBatch()
image_2 = FakeTensorBatch(width=12, height=9)
image_3 = FakeTensorBatch(width=8, height=8)
image_4 = FakeTensorBatch(width=16, height=16)
image_5 = FakeTensorBatch(width=20, height=12)
plan_after_first, _connected = attach_node.attach(plan=plan, scene_index=1, image2=image_1)
plan_after_second, _connected = attach_node.attach(
@@ -531,6 +533,8 @@ class DumasImageNodeTests(unittest.TestCase):
scene_index=2,
image6=image_2,
image7=image_3,
image8=image_4,
image9=image_5,
)
scene1 = extract_node.extract(plan_after_second, 1)
@@ -540,10 +544,12 @@ class DumasImageNodeTests(unittest.TestCase):
self.assertEqual(scene1[-1], 1)
self.assertIs(scene2[6], image_2)
self.assertIs(scene2[7], image_3)
self.assertEqual(scene2[-1], 2)
self.assertIs(scene2[8], image_4)
self.assertIs(scene2[9], image_5)
self.assertEqual(scene2[-1], 4)
self.assertEqual(
plan_after_second["_dumas_scene_image_bindings"]["scene_counts"],
{"1": 1, "2": 2},
{"1": 1, "2": 4},
)
def test_h3_plan_scene_images_metadata_is_json_serializable(self):
@@ -559,6 +565,32 @@ class DumasImageNodeTests(unittest.TestCase):
self.assertEqual(connected, 1)
json.dumps(attached_plan)
def test_h3_plan_scene_images_support_nine_slots(self):
attach_node = self.image_nodes.DumasH3PlanAttachSceneImagesNode()
extract_node = self.image_nodes.DumasH3PlanExtractSceneImagesNode()
plan = {"shots": [{"id": "one"}]}
images = [FakeTensorBatch(width=8 + index, height=8 + index) for index in range(9)]
attached_plan, connected = attach_node.attach(
plan=plan,
scene_index=1,
image1=images[0],
image2=images[1],
image3=images[2],
image4=images[3],
image5=images[4],
image6=images[5],
image7=images[6],
image8=images[7],
image9=images[8],
)
extracted = extract_node.extract(attached_plan, 1)
self.assertEqual(connected, 9)
for index, image in enumerate(images, start=1):
self.assertIs(extracted[index], image)
self.assertEqual(extracted[-1], 9)
def test_h3_plan_scene_images_can_clear_a_scene_binding(self):
attach_node = self.image_nodes.DumasH3PlanAttachSceneImagesNode()
extract_node = self.image_nodes.DumasH3PlanExtractSceneImagesNode()