Is there any way to retrieve chosen color value from randomizer?
I want to change object semantic based on that color.
Randomizer return ReplicatorItem object which has Node object with different attributes but I can’t find which attribute to use or this is wrong approach. Also is there anywhere docs for ReplicatorItem class, I can’t find it?
I apologize for the late response. One way to do this is to assign the same seed to two distributions so that the two samples always correspond to the same index:
import omni.replicator.core as rep
COLORS = [(0,1,0), (1,0,0), (0,0,1)]
COLORS_TXT = [("class:Green"), ("class:Red"), ("class:Blue")]
with rep.trigger.on_frame():
with rep.create.sphere():
rep.randomizer.color(colors=rep.distribution.choice(COLORS, seed=123))
mod_semantics = rep.modify.semantics(rep.distribution.choice(COLORS_TXT, seed=123), mode="replace")
# Temporary workaround for bug in semantics modifier in current version
mod_semantics.set_input("mode", "replace")