Skip to content

Latest commit

 

History

History
 
 

userProperties

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Quick Explanation

Create a userProperty

C++

auto attribute = sphere.GetPrim().CreateAttribute(
    pxr::TfToken {"userProperties:some_attribute"},
    pxr::SdfValueTypeNames->Bool,
    true
);
attribute.Set(false);

Python

attribute = sphere.GetPrim().CreateAttribute(
    "userProperties:some_attribute", Sdf.ValueTypeNames.Bool, True
)
attribute.Set(False)

Find all userProperties

C++

auto is_user_property = [&](std::string const &path) {
    static std::string const properties = "userProperties";

    // If `path` starts with "userProperties" then it's a user property
    return strncmp(path.c_str(), properties.c_str(), strlen(properties.c_str())) == 0;
};

for (auto const &property : sphere.GetPrim().GetAuthoredProperties(is_user_property)) {
    std::cout << property.GetName() << " ";
}
std::cout << '\n';

Python

def is_user_property(node):
    return node.startswith("userProperties:")

print('user properties', sphere.GetPrim().GetAuthoredProperties(is_user_property))

See Also

https://graphics.pixar.com/usd/docs/Maya-USD-Plugins.html