Correct way to check if alembic file primitive has UV information

35 views
Skip to first unread message

Nicholas Yue

unread,
Nov 20, 2022, 9:18:45 PM11/20/22
to alembic-discussion
Hi,

  The following code always return true so I am certain this is not the correct way to check if a primitive has UV so I'd like to know what is the correct way

```
 Alembic::AbcGeom::IPolyMeshSchema::Sample samp;
if (pmesh.getSchema().getNumSamples() > 0) {
// Geometry face area information
const Alembic::AbcGeom::IPolyMeshSchema &ipms = pmesh.getSchema();
ipms.get(samp);

        Alembic::AbcGeom::IV2fGeomParam uvParams = ipms.getUVsParam();
        size_t extent = uvParams.getArrayExtent();
        size_t sampleCount = uvParams.getNumSamples();
        std::string name = uvParams.getName();
        bool haveUVs = uvParams.valid();
```

Lucas Miller

unread,
Nov 20, 2022, 9:29:09 PM11/20/22
to alembic-d...@googlegroups.com
uvParams was valid?  How many samples did it have?

--
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/CADYXiJ%2BKnj0L_iFrgcVsjShuAezO8kCGbxakiRQswMOoM5tGBA%40mail.gmail.com.

Nicholas Yue

unread,
Nov 20, 2022, 9:37:09 PM11/20/22
to alembic-d...@googlegroups.com

Lucas Miller

unread,
Nov 21, 2022, 1:22:43 AM11/21/22
to alembic-d...@googlegroups.com
The UVs are only created if you provide a sample for them since they are optional so uvParams.valid() has traditionally been the way to check this.

What are you seeing for cases where you think the UVs are NOT valid?

Lucas

Nicholas Yue

unread,
Nov 21, 2022, 12:00:26 PM11/21/22
to alembic-d...@googlegroups.com
Thanks for the heads up. I believe the problem stems from a badly converted Alembic file from a Houdini BGEO file.

I shall follow up with SideEffects in this case.

Thank you.

Reply all
Reply to author
Forward
0 new messages