HAPI won't return the expected number of attribute values

   559   0   1
User Avatar
Member
5 posts
Joined: April 2024
Offline
Hello,
I'm creating 2 tetrahedrons in my geo, with a Prim attribute named 'X', of type float.
The first tetra has 'X' = 4 and the 2nd one has 'X' = 42, as you can see here :


Later on, I'm using HAPI in C++ to retrieve the value of this attribute in my geo.

Surprisingly, I get an array such as: {4, 4, 4, 4, 42, 42, 42, 42} when I'm expecting {4, 42}

From what I understand, this is because my 2 tetras have 8 points in total:


I'm saying this because I had only 1 tetra in my geo in the first place, and I got 4 values instead of 1.
But I don't get how the number of points can have an impact on the number of values of my 'X' attribute?
I wonder if I'm missing the big picture here and simply not getting the philosophy of Houdini.
I think it's pretty unlikely that HAPI has a bug on such a core feature.

As a matter of fact, when using HAPI in python, with the code:
geo.primFloatAttribValues('X')
I do get the expected values:
(4.0, 42.0)

But that's not the case with the C++ HAPI which is returning {4, 4, 4, 4, 42, 42, 42, 42} as I said earlier.
And I'm only interested in a C++ solution.

What am I doing wrong then? Thanks.
Edited by arthur.cousseau - May 30, 2024 09:46:26

Attachments:
2024-05-30 15_23_35-untitled.hip - Houdini Core 18.5.759 - Python 3.png (9.4 KB)
2024-05-30 15_29_30-untitled.hip - Houdini Core 18.5.759 - Python 3.png (10.1 KB)

  • Quick Links