Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usdImaging engine can't do AOV's with period in them #1215

Closed
spitzak opened this issue May 20, 2020 · 3 comments
Closed

usdImaging engine can't do AOV's with period in them #1215

spitzak opened this issue May 20, 2020 · 3 comments

Comments

@spitzak
Copy link

spitzak commented May 20, 2020

Description of Issue

AOV's with various characters (space and period at least) in them produce errors and never make the bprim. I think what is needed is to fix HdxTaskController::_GetAovPath() but need more info on what characters are valid, probably replacing all of them with underscore will work and not produce collisions.

Steps to Reproduce

  1. In usdview, pick AOV/other and type "foo:a.b" as the AOV name

System Information (OS, Hardware)

Linux

Package Versions

USD 20.02

@spitzak
Copy link
Author

spitzak commented May 20, 2020

Actually it fails on almost all punctuation marks, which makes it pretty impossible to use the proposed lpe: aov names.

@spitzak
Copy link
Author

spitzak commented May 21, 2020

The following patch does fix it, though I think it could be improved with more accuracy as to what characters are allowed in a path component:

--- a/pxr/imaging/hdx/taskController.cpp
+++ b/pxr/imaging/hdx/taskController.cpp
@@ -819,8 +819,15 @@ HdxTaskController::GetPickingTasks() const
 SdfPath
 HdxTaskController::_GetAovPath(TfToken const& aov) const
 {
-    std::string str = TfStringPrintf("aov_%s", aov.GetText());
-    std::replace(str.begin(), str.end(), ':', '_');
+    std::string str = "aov_";
+    str.reserve(4 + aov.GetString().length());
+    for (char c : aov.GetString()) {
+        if (std::isalnum(c) || (c&0x80 /*assume UTF-8 is ok*/)) {
+            str.push_back(c);
+        } else {
+            str.push_back('_');
+        }
+    }
     return GetControllerId().AppendChild(TfToken(str));
 }
 

@jtran56
Copy link

jtran56 commented May 22, 2020

Filed as internal issue #USD-6085.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants