I have list of objects have primitive attribute : instance (Image : Highlighted in Yellow)
how could I append the instance attribute by unique value into an array prim attribute ? (Image : In green text)
Thanks a lot
VEX: How do I append a list of attribute into an array prim attribute
13383 4 1- cgmagic.sunhe
- Member
- 42 posts
- Joined: Aug. 2016
- Offline
- BabaJ
- Member
- 2024 posts
- Joined: Sept. 2015
- Offline
Is this what your looking for?
Put the following in a wrangle for primitives run over.
You say you want to append, which is why what I wrote takes the existing instance value puts it as the first value of the corresponding new primitive array attribute.
Put the following in a wrangle for primitives run over.
You say you want to append, which is why what I wrote takes the existing instance value puts it as the first value of the corresponding new primitive array attribute.
i[]@Instance_Array;
int Transfered_Instance;
Transfered_Instance = prim(geoself(), "instance", @primnum) ;
push(@Instance_Array, Transfered_Instance);
push(@Instance_Array, 1);
push(@Instance_Array, 2);
- cgmagic.sunhe
- Member
- 42 posts
- Joined: Aug. 2016
- Offline
Sorry, maybe I could explain better. I am looking for
// Get each @instance from each prim.
// Make a new array attribute for each prim called @instance_array.
// only push each @instance from prim into the new @instance_array, if the item is not already in the list. For example, if there are more than one @instance==1, only push one of them into the array.in the array you won't have the same value twice.
// Get each @instance from each prim.
// Make a new array attribute for each prim called @instance_array.
// only push each @instance from prim into the new @instance_array, if the item is not already in the list. For example, if there are more than one @instance==1, only push one of them into the array.in the array you won't have the same value twice.
- tamte
- Member
- 8444 posts
- Joined: July 2007
- Offline
since the array will be the same, there is no need to store it on each primitive
so I suggest running this in Detail mode
however if you want you can over Primitives
so I suggest running this in Detail mode
however if you want you can over Primitives
int n = nuniqueval(0, "primitive", "instance"); for (int i=0; i<n; i++){ int inst = uniqueval(0, "primitive", "instance", i); append(i[]@instarray, inst); }
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- BabaJ
- Member
- 2024 posts
- Joined: Sept. 2015
- Offline
-
- Quick Links