How to distinguish between different kinds of array property in Alembic.

49 views
Skip to first unread message

jiang fan

unread,
May 27, 2022, 11:27:47 AM5/27/22
to alembic-discussion
Hello,
I'm importing .abc data to my programme with this example: 

For now I can distinguish the data by using iProp.getName() as line 87. 

For example, when I want to get the point array in my alembic data, I can do :


 if(iProp.getName() == "P") {   //by the way, this is the exact data that I use.
      float* tempFloat = (float*)(samp->getData());
      nbPoints = totalValues;
      for (index_t x = 0; x < totalValues; x++) {
        std::cout<<tempFloat[m] <<std::endl;
      }
    }
I want to know if in Alembic, the name of points array is always "P" (I've tried 2 .abc files and I can correctly read the points array with the name "p"). Am I using the right way to read array property data? If not, what is the right way to distinguish them. thanks. 


Lucas Miller

unread,
May 27, 2022, 12:45:27 PM5/27/22
to alembic-d...@googlegroups.com
It's pretty safe to assume  P is point data, however you can find out more about a particular IArrayProperty by getting its DataType info.  (iProp.getDataType() from the AbcEcho example)


For many general applications you would normally use the I*Schema to read a particular IObjects data, in your case you might use IPolymeshSchema to read all the relevant polymesh information.

See:

If you are making something more specialized, like say something that were to ONLY look at point data, then your approach is a good one.

Lucas

--
You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/alembic-discussion/6c1a4aa8-bfb9-4a5f-a6fe-e924a8284c0dn%40googlegroups.com.

jiang fan

unread,
May 31, 2022, 4:23:15 AM5/31/22
to alembic-discussion
Thanks, I think I'll need to use I*Schema.
Reply all
Reply to author
Forward
0 new messages