static void
TestPrimQueries()
{
    printf("TestPrimQueries...\n");

    auto stage = UsdStage::CreateInMemory("TestPrimQueries.usd");
    auto path = SdfPath("/p");
    auto prim = stage->DefinePrim(path);
    
    printf("--------Ensuring no schemas are applied -------\n");
    assert(!prim.HasAPI<UsdCollectionAPI>());

    printf("--------Applying UsdCollectionAPI -------\n");

    UsdCollectionAPI coll = UsdCollectionAPI::ApplyCollection(prim, 
            TfToken("testColl"));
    assert(prim.HasAPI<UsdCollectionAPI>());

    assert(prim.HasAPI<UsdCollectionAPI>(/*instanceName*/ TfToken("testColl")));

    assert(!prim.HasAPI<UsdCollectionAPI>(
            /*instanceName*/ TfToken("nonExistentColl")));
}
Пример #2
0
static void
TestPrimQueries()
{
    printf("TestPrimQueries...\n");

    auto stage = UsdStage::CreateInMemory("TestPrimQueries.usd");
    auto path = SdfPath("/p");
    auto prim = stage->DefinePrim(path);
    
    printf("--------Ensuring no schemas are applied -------\n");
    assert(!prim.HasAPI<UsdClipsAPI>());
    assert(!prim.HasAPI<UsdModelAPI>());
    
    printf("--------Applying UsdModelAPI -------\n");
    UsdModelAPI::Apply(stage, path);
    assert(!prim.HasAPI<UsdClipsAPI>());
    assert(prim.HasAPI<UsdModelAPI>());

    printf("--------Applying UsdClipsAPI -------\n");
    UsdClipsAPI::Apply(stage, path);
    assert(prim.HasAPI<UsdClipsAPI>());
    assert(prim.HasAPI<UsdModelAPI>());
}