Skip to content

Commit 72a9eec

Browse files
committed
fix tests
Signed-off-by: Ashton Larkin <42042756+adlarkin@users.noreply.github.com>
1 parent 7a4ce0a commit 72a9eec

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

usd/src/usd_parser/USDStage_TEST.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ TEST(USDStage, Constructor)
3939

4040
EXPECT_EQ("Z", stage.UpAxis());
4141
EXPECT_DOUBLE_EQ(0.01, stage.MetersPerUnit());
42-
EXPECT_EQ(25u, stage.USDPaths().size());
42+
EXPECT_EQ(26u, stage.USDPaths().size());
4343
}
4444

4545
// Check up Axis equal to Y and metersPerUnit

usd/src/usd_parser/USDWorld.cc

+11-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <utility>
2424
#include <vector>
2525

26+
#include <ignition/common/Filesystem.hh>
2627
#include <ignition/common/Util.hh>
2728

2829
#pragma push_macro ("__DEPRECATED")
@@ -196,10 +197,18 @@ namespace usd
196197
{
197198
light->SetName(primName);
198199

200+
// assume this light belongs to the world unless the corresponding
201+
// model/link for this light are found
199202
bool worldLight = true;
200-
if (modelPtr)
203+
204+
// if the light prim we are parsing has no parent (or if its parent
205+
// is the root prim), this means the light belongs to the world
206+
const bool noModelAncestor = !prim.GetParent() ||
207+
(prim.GetParent().GetName().GetString() == "/");
208+
if (!noModelAncestor && modelPtr)
201209
{
202-
if (auto link = modelPtr->LinkByName(linkName))
210+
if (auto link =
211+
modelPtr->LinkByName(ignition::common::basename(linkName)))
203212
{
204213
link->AddLight(light.value());
205214
worldLight = false;

0 commit comments

Comments
 (0)