Alembic point cloud, how to copy detail to points

   3982   4   1
User Avatar
Member
25 posts
Joined: 4月 2015
Offline
Hi
I have alembic with point cloud exported from Max tyflow , and age of particles is stored in detail. It looks like I need to read _age and assign it to corresponding point, but I can read only first value. There is everything in spreadsheet but can't read chosen value. If I use

f@age = detail(0,“_age”,0);
I will get first _age and that is correct but if I use

f@age = detail(0,"_age",0);
I get 0 and that is wrong.

There is different value in spreadsheet on detail _age. Same problem if color is exported it also lands in detail in this form. If Velocity is exported it's stored on points as usually

Scene with simple alembic in attachment.

Thanks

Attachments:
Pc_Particles.zip (761.7 KB)

User Avatar
Member
52 posts
Joined: 6月 2016
Offline
It's because your details attribute is an Array “_age”
If you want to read it, you need to get the array in a
float _age[] = detail(0, "_age")
; and then read it with
f@age = _age[index]

try to paste this is a detailwrangle :

float value;
int pNum = attribsize(0, "detail", "_age");
float _age[] = detail(0, "_age");

for (int i = 0; i < pNum; i++)
{
    value = _age[i];
    setpointattrib(0, "age", i, value, "set");
}
Edited by c0y - 2020年11月27日 07:53:36
User Avatar
Member
25 posts
Joined: 4月 2015
Offline
You helped me a lot! Now I know what was wrong.
Thanks!
User Avatar
Member
8 posts
Joined: 10月 2013
Offline
Hey! felt lucky to find this.

I'm having the same issue but trying to get the orientation from tyflow.

It also comes as a string out of values in the detail, except since its a vector4 how would I loop through every four values and convert them to an vector4 orient attribute?

Thanks!!

Attachments:
orientationprob.png (449.2 KB)

User Avatar
Member
25 posts
Joined: 4月 2015
Offline
Hey,

I did it like this:


vector4 valueq;
int pNum = attribsize(0, "detail", "_orientation");
vector4 _orientation[] = detail(0, "_orientation");

for (int i = 0; i < pNum; i++)
{
    valueq = _orientation[i];
    setpointattrib(0, "orient", i, valueq, "set");
}

Hope it helps
  • Quick Links