Scatter_2d does not work with multiple surfaces prims in omni.replicator.core1.2.4 and omniverse 2022.1.3

I have already made two topics but I didn’t actually narrow down the source of the problem until now.
The topics were: /scatter-2d-randomizer-works-in-2022-1-1-but-does-not-in-2022-1-2/and hydrarenderer-failed-to-render-frame-after-crash (can’t put more than one link it seems)

https://docs.omniverse.nvidia.com/app_code/prod_extensions/ext_replicator/randomizer_details.html#scattering-objects-in-a-surface
Based on this example while working with 0.0.10 in omniverse 2022.1.1

The code looks something like this. And this used to work in 0.0.10

planesList=[('class','Plane1'),('class','Plane2')]
objectList=[('class','Object1'), ('class', 'Object2')]

Object=rep.get.prims(semantics=objectList)
Planes=rep.get.prims(semantics=planesList)
with Object:
	rep.randomizer.scatter_2d(Planes)
return Object.node

This does not work but it works with: planesList=[('class','Plane1')]

Another way to phrase the question is: How do I scatter objects on multiple surfaces.

Weird thing it does is if I give it a second surface that is invalid like so:
planesList=[('class','Plane1'), ('class','IDontExist')] it will actually work but just one the one surface.

Hello @vlad.crehul! I am reaching out to the Replicator team to help you with your questions!

1 Like

Hello @vlad.crehul, I apologize for the time taken to get an answer to you. On the current version of Code (2022.3.1) I am able to produce the correct graph by wrapping the code in a rep.utils.sequential():

import omni.replicator.core as rep

planesList=[('class','Plane1'),('class','Plane2')]
objectList=[('class','Object1'), ('class', 'Object2')]

with rep.utils.sequential():
	Object=rep.get.prims(semantics=objectList)
	Planes=rep.get.prims(semantics=planesList)
	with Object:
		rep.randomizer.scatter_2d(Planes)

The cause of this appears to be a bug when using multiple rep.get.prims() as inputs and will be investigated so that the addition of sequential() is unnecessary in future updates. Thank you for bringing this to our attention!