File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments