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

Katana plugin v0.7.6: crashes when expanding Usd PointInstances #239

Closed
bfloch opened this issue Jul 13, 2017 · 3 comments
Closed

Katana plugin v0.7.6: crashes when expanding Usd PointInstances #239

bfloch opened this issue Jul 13, 2017 · 3 comments

Comments

@bfloch
Copy link

bfloch commented Jul 13, 2017

Description of Issue

When a point instancing usd file is loaded in Katana and expanded to the instancer
katana crashes with:

0x00007fffbaa626e5 in pxrInternal_v0_7__pxrReserved__::PxrUsdInShipped_PointInstancerUtils::ComputeInstanceTransformsAtTime(
    std::vector<std::vector<pxr
::GfMatrix4d> >,
    std::allocator<std::vector<pxrInternal_v0_7__pxrReserved__::GfMatrix4d, 
    std::allocator<pxrInternal_v0_7__pxrReserved__::GfMatrix4d> > ::vector<pxrInternal_v0_7__pxrReserved__::UsdTimeCode, 
    std::allocator<pxrInternal_v0_7__pxrReserved__::UsdTimeCode> > const&, pxrInternal_v0_7__pxrReserved__::UsdTimeCode)
() from /.../third_party/katana/plugin/Libs/pxrUsdInShipped.so

Looks related to the changes at: 5740c6b

Same file works with 0.7.5.

Steps to Reproduce

  1. In Katana drop a pxrUsdIn node.
  2. Set the fileName to an usd file with pointInstances
  3. In the Scene Graph expand the tree until the point instancer should be loaded in the Viewer
  4. Crash.

System Information (OS, Hardware)

Linux, CentOS 7.3

Package Versions

Katana 2.6v1
Usd 0.7.6

Build Flags

Pretty much default.

@bfloch
Copy link
Author

bfloch commented Jul 14, 2017

I found the issue.
We do not have Scale Attributes in our point instances.
This will fix it:

--- a/third_party/katana/plugin/pxrUsdInShipped/pointInstancerUtils.cpp
+++ b/third_party/katana/plugin/pxrUsdInShipped/pointInstancerUtils.cpp
@@ -83,8 +83,8 @@ PxrUsdInShipped_PointInstancerUtils::ComputeInstanceTransformsAtTime(
         if (positions.size() != numInstances) {
             break;
         }
-        scalesAttr.Get(&scales, sampleTimes[a]);
-        orientationsAttr.Get(&orientations, sampleTimes[a]);
+        bool hasScales = scalesAttr.Get(&scales, sampleTimes[a]);
+        bool hasOrientations = orientationsAttr.Get(&orientations, sampleTimes[a]);
         if (scales.size() > 0 and scales.size() != numInstances) {
             break;
         }
@@ -95,8 +95,14 @@ PxrUsdInShipped_PointInstancerUtils::ComputeInstanceTransformsAtTime(
         for (auto i = decltype(numInstances){0}; i < numInstances; ++i) {
             GfTransform transform;
             transform.SetTranslation(positions[i]);
-            transform.SetScale(scales[i]);
-            transform.SetRotation(GfRotation(orientations[i]));
+            if(hasScales)
+            {
+                transform.SetScale(scales[i]);
+            }
+            if(hasOrientations)
+            {
+                transform.SetRotation(GfRotation(orientations[i]));
+            }
             curr.push_back(transform.GetMatrix());
         }

You care for a PR or is it ok for you guys handling it?

@spiffmon
Copy link
Member

spiffmon commented Jul 14, 2017 via email

@jtran56
Copy link

jtran56 commented Jul 17, 2017

Filed as internal issue #148741.

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

3 participants