1111#include " pxr/base/tf/stringUtils.h"
1212#include " pxr/usd/sdf/path.h"
1313
14+ #include < prmanapi.h>
15+
1416PXR_NAMESPACE_OPEN_SCOPE
1517
1618namespace HdPrmanDebugUtil {
1719
1820static const int cw = 3 ; // length of "─"
1921static const char empty[] = " " ;
2022static const char line[] = " ────────────────────" ;
21- static const char fmt[] =
23+ static const char fmt[] =
2224 " %01$+*20$.*17$f %02$+*21$.*17$f %03$+*22$.*17$f │ %04$+*23$.*17$f\n "
2325 " %19$*18$s%05$+*20$.*17$f %06$+*21$.*17$f %07$+*22$.*17$f │ %08$+*23$.*17$f\n "
2426 " %19$*18$s%09$+*20$.*17$f %10$+*21$.*17$f %11$+*22$.*17$f │ %12$+*23$.*17$f\n "
@@ -40,8 +42,8 @@ MatrixToString(const GfMatrix4d& mat, const int indent, const int precision)
4042 mat[0 ][0 ], mat[1 ][0 ], mat[2 ][0 ], mat[3 ][0 ],
4143 mat[0 ][1 ], mat[1 ][1 ], mat[2 ][1 ], mat[3 ][1 ],
4244 mat[0 ][2 ], mat[1 ][2 ], mat[2 ][2 ], mat[3 ][2 ],
43- mat[0 ][3 ], mat[1 ][3 ], mat[2 ][3 ], mat[3 ][3 ],
44- precision, indent, empty,
45+ mat[0 ][3 ], mat[1 ][3 ], mat[2 ][3 ], mat[3 ][3 ],
46+ precision, indent, empty,
4547 width[0 ], width[1 ], width[2 ], width[3 ],
4648 cw * width[0 ], cw * width[1 ], cw * width[2 ], cw * width[3 ],
4749 line);
@@ -62,8 +64,8 @@ MatrixToString(const RtMatrix4x4& mat, const int indent, const int precision)
6264 mat.m [0 ][0 ], mat.m [1 ][0 ], mat.m [2 ][0 ], mat.m [3 ][0 ],
6365 mat.m [0 ][1 ], mat.m [1 ][1 ], mat.m [2 ][1 ], mat.m [3 ][1 ],
6466 mat.m [0 ][2 ], mat.m [1 ][2 ], mat.m [2 ][2 ], mat.m [3 ][2 ],
65- mat.m [0 ][3 ], mat.m [1 ][3 ], mat.m [2 ][3 ], mat.m [3 ][3 ],
66- precision, indent, empty,
67+ mat.m [0 ][3 ], mat.m [1 ][3 ], mat.m [2 ][3 ], mat.m [3 ][3 ],
68+ precision, indent, empty,
6769 width[0 ], width[1 ], width[2 ], width[3 ],
6870 cw * width[0 ], cw * width[1 ], cw * width[2 ], cw * width[3 ],
6971 line);
@@ -98,6 +100,9 @@ _GetParamPrefix(const RtParamList::ParamInfo& info)
98100 case RtDataType::k_samplefilter: out += " samplefilter" ; break ;
99101 case RtDataType::k_displayfilter: out += " displayfilter" ; break ;
100102 case RtDataType::k_struct: out += " struct" ; break ;
103+ #if _PRMANAPI_VERSION_MAJOR_ >= 27
104+ case RtDataType::k_volumefilter: out += " volumefilter" ; break ;
105+ #endif
101106 default :
102107 TF_WARN (" Unknown type %d" , static_cast <int >(info.type ));
103108 }
@@ -115,15 +120,15 @@ _GetParamPrefix(const RtParamList::ParamInfo& info)
115120 return out;
116121}
117122
118- std::string
123+ std::string
119124_FormatParam (
120125 const RtParamList::ParamInfo& info,
121126 const RtParamList& _params,
122127 const int indent = 0 ) {
123128
124129 static const char * Vec3Fmt = " (%f, %f, %f)" ;
125130 static const char * Vec4Fmt = " (%f, %f, %f, %f)" ;
126-
131+
127132 const std::string prefix = _GetParamPrefix (info);
128133 const int fullIndent = indent + (int )prefix.size ();
129134 RtParamList& params = const_cast <RtParamList&>(_params);
@@ -562,7 +567,7 @@ _FormatParam(
562567 }
563568 break ;
564569 }
565- case RtDataType::k_struct:
570+ case RtDataType::k_struct:
566571 {
567572 if (info.detail == RtDetailType::k_reference) {
568573 RtUString value;
@@ -572,6 +577,29 @@ _FormatParam(
572577 }
573578 break ;
574579 }
580+ #if _PRMANAPI_VERSION_MAJOR_ >= 27
581+ case RtDataType::k_volumefilter: {
582+ if (info.array && info.detail == RtDetailType::k_reference) {
583+ const RtUString* value = params.GetVolumeFilterReferenceArray (
584+ info.name , info.length );
585+ for (uint32_t i = 0 ; i < info.length ; ++i) {
586+ if (!val.empty ()) {
587+ val += " , " ;
588+ } else {
589+ val += " [" ;
590+ }
591+ val += TfStringPrintf (" <%s>" , (*(value+i)).CStr ());
592+ }
593+ val += " ]" ;
594+ } else if (info.detail == RtDetailType::k_reference) {
595+ RtUString value;
596+ if (params.GetVolumeFilterReference (info.name , value)) {
597+ val = TfStringPrintf (" <%s>" , value.CStr ());
598+ }
599+ }
600+ break ;
601+ }
602+ #endif
575603 default :
576604 {
577605 TF_WARN (" Unknown type %d" , static_cast <int >(info.type ));
@@ -596,7 +624,7 @@ RtParamListToString(const RtParamList& params, const int indent)
596624 out += " \n " ;
597625 }
598626 out += TfStringPrintf (
599- " %*s%s" , (pi == 0 ? 0 : indent), " " ,
627+ " %*s%s" , (pi == 0 ? 0 : indent), " " ,
600628 _FormatParam (info, params, indent).c_str ());
601629 }
602630 }
@@ -615,7 +643,7 @@ GetCallerAsString(const TfCallContext& ctx)
615643 }
616644 if (i < 9 ) {
617645 const std::string& line = lines[i+1 ];
618- return line.substr (28 , line.find_first_of (" (" ) - 28 ) + " at " +
646+ return line.substr (28 , line.find_first_of (" (" ) - 28 ) + " at " +
619647 line.substr (line.find_last_of (" /" ) + 1 );
620648 }
621649 return " *** couldn't find caller ***" ;
0 commit comments