Skip to content

Commit 65402ee

Browse files
authored
Ignore abstract prims (#USDU-3 part 1) (#259)
* Ignore abstract prims when getting paths by type. * Update bindings binaries * Update win-10 yamato image
1 parent 35d97f8 commit 65402ee

File tree

6 files changed

+29
-6
lines changed

6 files changed

+29
-6
lines changed

.yamato/upm-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test_editors:
66
test_platforms:
77
- name: win
88
type: Unity::VM
9-
image: package-ci/win10:stable
9+
image: package-ci/win10:v1.15.0
1010
flavor: b1.large
1111
- name: mac
1212
type: Unity::VM::osx
Binary file not shown.
Binary file not shown.
Binary file not shown.

package/com.unity.formats.usd/Tests/USD.NET/StageTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,29 @@ public static void BadPrimTest()
311311
stage.Dispose();
312312
}
313313

314+
[Test]
315+
public static void GetAllPathByType_IgnoreAbstract()
316+
{
317+
var s = UsdStage.CreateInMemory();
318+
var meshToken = new TfToken("Mesh");
319+
320+
var classPrim = s.DefinePrim(new SdfPath("/thisIsAClass"), meshToken);
321+
classPrim.SetSpecifier(SdfSpecifier.SdfSpecifierClass);
322+
323+
var instancePrim = s.DefinePrim(new SdfPath("/inheritedPrim"));
324+
instancePrim.GetInherits().AddInherit(classPrim.GetPath());
325+
326+
var meshPrim = s.DefinePrim(new SdfPath("/meshPrim"), meshToken);
327+
328+
Assert.True(classPrim.IsAbstract());
329+
Assert.AreEqual(meshToken, classPrim.GetTypeName());
330+
Assert.False(instancePrim.IsAbstract());
331+
Assert.AreEqual(meshToken, instancePrim.GetTypeName());
332+
Assert.AreEqual(meshToken, meshPrim.GetTypeName());
333+
var allPaths = s.GetAllPathsByType(meshToken, SdfPath.AbsoluteRootPath());
334+
Assert.AreEqual(2, allPaths.Count);
335+
}
336+
314337
[Test]
315338
public void WritingInvalidPrims_ShouldNotCrash()
316339
{

src/Swig/pxr/usd/usd/usdStage.i

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ class string;
3535
%typemap(in, canthrow=1) std::string *
3636
%{ //typemap in
3737
std::string temp;
38-
$1 = &temp;
38+
$1 = &temp;
3939
%}
4040

4141
//C++
4242
%typemap(argout) std::string *
43-
%{
43+
%{
4444
//Typemap argout in c++ file.
4545
//This will convert c++ string to c# string
4646
*$input = SWIG_csharp_string_callback($1->c_str());
4747
%}
4848

4949
%typemap(argout) const std::string *
50-
%{
50+
%{
5151
//argout typemap for const std::string*
5252
%}
5353

@@ -94,7 +94,7 @@ class string;
9494
TfType schemaBaseType = TfType::Find<UsdSchemaBase>();
9595

9696
TfType baseType = schemaBaseType.FindDerivedByName(typeName);
97-
97+
9898
if (schemaBaseType == TfType::GetUnknownType()) {
9999
TF_RUNTIME_ERROR("Schema base type is unknown. This should never happen.");
100100
return targets;
@@ -123,7 +123,7 @@ class string;
123123
if (curType == TfType::GetUnknownType()) {
124124
continue;
125125
}
126-
if (curType.IsA(baseType)) {
126+
if (curType.IsA(baseType) && !p.IsAbstract()) {
127127
targets.push_back(p.GetPath());
128128
}
129129
}

0 commit comments

Comments
 (0)