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

Make target prim a kwarg for Reference/Payload code samples #9

Open
mati-nvidia opened this issue Aug 17, 2023 · 1 comment
Open

Make target prim a kwarg for Reference/Payload code samples #9

mati-nvidia opened this issue Aug 17, 2023 · 1 comment
Labels
enhancement Improvements or additions to an existing code sample

Comments

@mati-nvidia
Copy link
Contributor

It'd be easier to use these code samples if ref_target_path was optional. This is what it looks like now:

def add_ext_reference(prim: Usd.Prim, ref_asset_path: str, ref_target_path: Sdf.Path) -> None:
    references: Usd.References = prim.GetReferences()
    references.AddReference(
        assetPath=ref_asset_path,
        primPath=ref_target_path # OPTIONAL: Reference a specific target prim. Otherwise, uses the referenced layer's defaultPrim.
    )

A better interface might be add_ext_reference(prim: Usd.Prim, ref_asset_path: str, ref_target_path: Sdf.Path=None). This way if ref_target_path is None, you can use the alternate AddReference signature that doesn't use a target.

FYI @felixmey

@mati-nvidia mati-nvidia added the enhancement Improvements or additions to an existing code sample label Aug 17, 2023
@felixmey
Copy link
Contributor

felixmey commented Aug 18, 2023

Yes agreed, also splitting of internal and external references in separate samples might help to get the references and payload samples streamlined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements or additions to an existing code sample
Projects
None yet
Development

No branches or pull requests

2 participants