I have created a basic geometry by instanciating a spheres using a pop. Is there a way to access and control single instances’ attributes through code?
For now, I can only access genera attributes this way:
pop = op(‘null2’)
p = pop.pointAttributes\[‘P’\]
At this point, I would like to access single index of P.x, P.y and P.z and modify them, for example.
Is that possible?
Hi Tommella,
I’m assuming that ‘null2’ is a Null POP that’s forwarding the output of another POP. In this case your problem is that pointAttributes returns a readonly object, so you wouldn’t be able to update attribute values.
I can think of two ways to update point attributes when working with POPs:
- The “POP native” way, using POPs like
- Attribute POP, to create, rename, or delete attributes
- Math, Math Combine, Math Mix POPs, to do various math functions
- Noise, Phaser, Twist POPs, to do basic animations
- GLSL, GLSL Advanced POP, to do more complex changes using your own code
- The “long way around”, by converting to DAT using the POP to DAT then back to POP using DAT to POP. Note that this is very inefficient as it’s shuttling information back and forth between the CPU and GPU, negating all the benefits of using POPs. However, this might let you use Python if you’re more comfortable with that.
If you want to do basic changes to the attributes, go with option 1.2. If you want to do complex changes using custom code, go with option 1.4. If you really want to use Python and you don’t care about performance, go with option 2.