Here’s a simple example of using an ICE attribute to drive a procedural texture. In this case, I’m using a random integer to drive the number of repeats of a checkerboard:
To set it up, I ran this script to programmatically add an ICE attribute. Unfortunately, I found I had to add an ICE tree to get the attribute to show up in the render tree.
import random si = Application for o in si.Selection: # Long, Single, Singleton a = o.ActivePrimitive.Geometry.AddICEAttribute("_random", 2, 1, 1 ) a.DataArray = [ (random.randint(1,8))] si.ApplyOp("ICETree", o, "siNode", "", "", 0)
Then in the render tree I used Integer Attribute node to get the attribute value. This same material is applied to every cube in my example.
And if you wanted to update the ICE attribute later, eg increase the range of random values, you could do something like this:
import random si = Application for o in si.Selection: a = o.ActivePrimitive.Geometry.ICEAttributes("_random") a.DataArray = [ (random.randint(1,12))]
hey thx,
thats actually a very nice thing! 🙂
greetings