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

Payloads selected by variant from class do not appear #156

Closed
aloysbaillet opened this issue Jan 24, 2017 · 8 comments
Closed

Payloads selected by variant from class do not appear #156

aloysbaillet opened this issue Jan 24, 2017 · 8 comments
Assignees

Comments

@aloysbaillet
Copy link
Contributor

Description of Issue

Hi,

When selecting a variant that brings in a payload, if the variant is selected via inheritance then the payload is not composed in. This was reported initially there: https://groups.google.com/forum/#!topic/usd-interest/XhIKmjrZsL4

Cheers,

Aloys

Steps to Reproduce

  1. Create these two usd files bob.usd and bob_geo.usd:

bob.usd

#usda 1.0

class "_class_geotype" (
    add variantSets = ["geotype_selector", "geotype"]
)
{
    variantSet "geotype_selector" = {
        "select_cube" (
              variants = {
                  string geotype = "cube"
              }
        ){
        }
        "select_sphere" (
              variants = {
                  string geotype = "sphere"
              }
        ){
        }
    }
}

def "bob"(
  add inherits = [</_class_geotype>]
  add variantSets = ["geotype"]
){
  variantSet "geotype" = {
    "sphere" (
        payload = @bob_geo.usd@</bob_root_sphere>
    )
    {
    }
    "cube" (
        payload = @bob_geo.usd@</bob_root_cube>
    )
    {
    }
  }
}

bob_geo.usd

#usda 1.0
(
)

def Xform "bob_root_sphere"(
){
  def Sphere "bob_body"(
  ){
  }
}

def Xform "bob_root_cube"(
){
  def Cube "bob_body"(
  ){
  }
}
  1. Open bob.usd in usdview, then select the "_class_geotype" class and select the variant "geotype_selector=select_cube", then select the "bob" prim, you'll see that the "geotype" variant has been correctly set to "cube" but the associated payload does not appear in the metadata tab, and you can't right-click->Load on the geo prim. If you then select "geotype=sphere" on the "bob" prim, the payload gets correctly composed and things go back to normal...

  2. Workaround can be to add a reference inbetween like this, but the additional prim is not desirable and looks wrong...

bob_working.usd

#usda 1.0

class "_class_geotype" (
    add variantSets = ["geotype_selector", "geotype"]
)
{
    variantSet "geotype_selector" = {
        "select_cube" (
              variants = {
                  string geotype = "cube"
              }
        ){
        }
        "select_sphere" (
              variants = {
                  string geotype = "sphere"
              }
        ){
        }
    }
}

def "bob"(
  add inherits = [</_class_geotype>]
  add references = [</bob_payloads>]
){
}

def "bob_payloads"(
  add variantSets = ["geotype"]
){
  variantSet "geotype" = {
    "sphere" (
        payload = @bob_geo.usd@</bob_root_sphere>
    )
    {
    }
    "cube" (
        payload = @bob_geo.usd@</bob_root_cube>
    )
    {
    }
  }
}

System Information (OS, Hardware)

Linux, centos6

Package Versions

USD 0.7.2

Build Flags

NA

@jtran56
Copy link

jtran56 commented Jan 25, 2017

Filed as internal issue #142302.

@blevin
Copy link
Member

blevin commented Jan 27, 2017

Hi Aloys -- we have a fix in testing for this and it should make its way into the github dev branch soon.

@sunyab
Copy link
Contributor

sunyab commented Jan 28, 2017

This issue should be addressed by commit f7c6045 in the dev branch.

@aloysbaillet
Copy link
Contributor Author

That's great news! Thanks to everyone involved!
As this looks like a fairly big change to Pcp, how safe do you think it would be to cherry-pick this commit in our local build?

@blevin
Copy link
Member

blevin commented Jan 28, 2017

Aloys, I recommend grabbing commit f7c6045 as well as 11d796f. These changes have passed our internal unit, integration, performance, and memory correctness (valgrind) tests so they should be quite safe. Although it's not a tiny change, it is purely to the internals of the Pcp algorithm, and does not affect anything downstream (i.e. no API or ABI changes).

@aloysbaillet
Copy link
Contributor Author

Thanks a lot Brett, we'll pick these two commits early then!

@aloysbaillet
Copy link
Contributor Author

Just wanted to confirm that the dev branch is indeed fixing this bug, thanks a lot!
Luckily it also fixes another issue (which seemed to be a regression in 0.7.2) where a Prim defined in a VariantSet selected by a class would also not be resolved properly (very similar to this issue indeed, but no payload involved).
I was not able to cleanly apply the 2 commits to 0.7.2 and picked the whole dev branch up to last week, and things seem to behave OK so far.

@sunyab
Copy link
Contributor

sunyab commented Feb 9, 2017

This has been merged into release 0.7.3.

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

5 participants