Hi
I would like to randomize(scatter) a subset of prims, selected with a Distribution.Choice node.
The following Code instantiates an almost correct randomization graph, however it fails to connect the samples output from the Distribution node to the Prims input of the Scatter node.
As can be seen below:
When I add the connection manually, the graph works as expected.
Does anybody have an idea why the behavior of my code is not as expected?
def register_distractor_randomizer(
workspace: dict = {"center": (0, 0, 0), "dimensions": (0, 0, 0)},
):
def randomize_distractors():
with rep.new_layer("distractors"):
plane = rep.create.plane(
position=workspace["center"],
scale=workspace["dimensions"],
visible=False,
)
distractors = rep.get.prims(semantics=[("class", "distractor")])
subset = rep.distribution.choice(
distractors,
num_samples=rep.distribution.uniform(
0, len(distractors.get_outputs()["prims"])
),
with_replacements=False,
)
rep.randomizer.scatter_2d(
surface_prims=plane,
check_for_collisions=True,
input_prims=subset.get_outputs()["samples"],
)
return subset.node