Skip to content

Commit

Permalink
Update GetAttr to consistently return const reference where possible.
Browse files Browse the repository at this point in the history
Fixes #2617

(Internal change: 2305766)
  • Loading branch information
diyajoy authored and pixar-oss committed Nov 28, 2023
1 parent 8f0d000 commit 11dcc1b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pxr/usd/usdShade/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class UsdShadeOutput
static bool IsOutput(const UsdAttribute &attr);

/// Explicit UsdAttribute extractor.
UsdAttribute GetAttr() const { return _attr; }
const UsdAttribute &GetAttr() const { return _attr; }

/// Allow UsdShadeOutput to auto-convert to UsdAttribute, so you can
/// pass a UsdShadeOutput to any function that accepts a UsdAttribute or
Expand Down
3 changes: 2 additions & 1 deletion pxr/usd/usdShade/wrapOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ void wrapUsdShadeOutput()
.def("ClearSdrMetadataByKey",
&Output::ClearSdrMetadataByKey, (arg("key")))

.def("GetAttr", &Output::GetAttr)
.def("GetAttr", &Output::GetAttr,
return_value_policy<return_by_value>())

.def("CanConnect", CanConnect_1,
(arg("source")))
Expand Down

0 comments on commit 11dcc1b

Please sign in to comment.