From 11dcc1b426930cbd00e70a75e6e04b534cd96d29 Mon Sep 17 00:00:00 2001 From: diyajoy Date: Mon, 27 Nov 2023 16:02:45 -0800 Subject: [PATCH] Update GetAttr to consistently return const reference where possible. Fixes #2617 (Internal change: 2305766) --- pxr/usd/usdShade/output.h | 2 +- pxr/usd/usdShade/wrapOutput.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pxr/usd/usdShade/output.h b/pxr/usd/usdShade/output.h index 7eacd01d28..0d5a15d035 100644 --- a/pxr/usd/usdShade/output.h +++ b/pxr/usd/usdShade/output.h @@ -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 diff --git a/pxr/usd/usdShade/wrapOutput.cpp b/pxr/usd/usdShade/wrapOutput.cpp index d5b52ed796..050ca13127 100644 --- a/pxr/usd/usdShade/wrapOutput.cpp +++ b/pxr/usd/usdShade/wrapOutput.cpp @@ -145,7 +145,8 @@ void wrapUsdShadeOutput() .def("ClearSdrMetadataByKey", &Output::ClearSdrMetadataByKey, (arg("key"))) - .def("GetAttr", &Output::GetAttr) + .def("GetAttr", &Output::GetAttr, + return_value_policy()) .def("CanConnect", CanConnect_1, (arg("source")))