file_path
stringlengths
5
148
content
stringlengths
150
498k
size
int64
150
498k
tutorial3.md
# Tutorial 3 - ABI Override Node Although the .ogn format creates an easy-to-use interface to the ABI of the OmniGraph node and the associated data model, there may be cases where you want to override the ABI to perform special processing. ## OgnTutorialABI.ogn The `ogn` file shows the implementation of a node named “omni.graph.tutorials.Abi”, in its first version, with a simple description. The single attribute serves mostly to provide a framework for the ABI discussion. ```json { "Abi": { "$comment": [ "Any key of a key/value pair that starts with a dollar sign, will be ignored by the parser.", "Its values can be anything; a number, string, list, or object. Since JSON does not have a", "mechanism for adding comments you can use this method instead." ], "version": 1, "categories": ["tutorials", { "internal:abi": "Internal nodes that override the ABI functions" }], "exclude": ["python"], "description": ["This tutorial node shows how to override ABI methods on your node."], "metadata": { "$comment": "Metadata is key/value pairs associated with the node type.", "$specialNames": "Kit may recognize specific keys. 'uiName' is a human readable version of the node name", "uiName": "Tutorial Node: ABI Overrides" }, "inputs": { "$comment": "Namespaces inside inputs or outputs are possible, similar to USD namespacing", "namespace:a_bool": { "type": "bool", "description": ["The input is any boolean value"], "default": true } } } } ``` ```json { "inputs": { "namespace:a_bool": { "type": "bool", "description": [ "The input is a boolean value" ], "default": false } }, "outputs": { "namespace:a_bool": { "type": "bool", "description": [ "The output is computed as the negation of the input" ], "default": true } }, "tests": [ { "inputs:namespace:a_bool": true, "outputs:namespace:a_bool": false } ] } ``` # OgnTutorialABI.cpp The cpp file contains the implementation of the node class with every possible ABI method replaced with customized processing. The node still functions the same as any other node, although it is forced to write a lot of extra boilerplate code to do so. ```c++ // Copyright (c) 2020-2024, NVIDIA CORPORATION. All rights reserved. // // NVIDIA CORPORATION and its licensors retain all intellectual property // and proprietary rights in and to this software, related documentation // and any modifications thereto. Any use, reproduction, disclosure or // distribution of this software and related documentation without an express // license agreement from NVIDIA CORPORATION is strictly prohibited. // #include <OgnTutorialABIDatabase.h> using omni::graph::core::Token; #include <string> #include <unordered_map> // Set this value true to enable messages when the ABI overrides are called const bool debug_abi{ true }; #define DEBUG_ABI \ if (debug_abi) \ CARB_LOG_INFO // In most cases the generated compute method is all that a node will need to implement. If for // some reason the node wants to access the omni::graph::core::INodeType ABI directly and override // any of its behavior it can. This set of functions shows how every method in the ABI might be // overridden. // // Note that certain ABI functions, though listed, are not implemented as a proper implementation would be more // complicated than warranted for this simple example. All are rarely overridden; in fact no known cases exist. class OgnTutorialABI { static std::unordered_map<std::string, std::string> s_metadata; // Alternative metadata implementation public: // ---------------------------------------------------------------------- // Almost always overridden indirectly // // ABI compute method takes the interface definitions of both the evaluation context and the node. // When using a .ogn generated class this function will be overridden by the generated code and the // node will implement the generated version of this method "bool compute(OgnTutorialABIDatabase&amp;)". // Overriding this method directly, while possible, does not add any extra capabilities as the two // parameters are also available through the database (contextObj = db.abi_context(), nodeObj = db.abi_node()) static bool compute(const GraphContextObj& contextObj, const NodeObj& nodeObj) { DEBUG_ABI("Computing the ABI node"); // The computation still runs the same as for the standard compute method by using the more ```c++ // complex ABI-based access patterns. First get the ABI-compliant structures needed. NodeContextHandle nodeHandle = nodeObj.nodeContextHandle; // Use the multiple-input template to access a pointer to the input boolean value auto inputValueAttr = getAttributesR<ConstAttributeDataHandle>( contextObj, nodeHandle, std::make_tuple(Token("inputs:namespace:a_bool")), kAccordingToContextIndex); const bool* inputValue{ nullptr }; std::tie(inputValue) = getDataR<bool*>(contextObj, inputValueAttr); // Use the single-output template to access a pointer to the output boolean value auto outputValueAttr = getAttributeW( contextObj, nodeHandle, Token("outputs:namespace:a_bool"), kAccordingToContextIndex); bool* outputValue = getDataW<bool>(contextObj, outputValueAttr); // Since the generated code isn't in control you are responsible for your own error checking if (!inputValue) { // LCOV_EXCL_START : This tags a section of code for removal from the code coverage runs because // the condition it checks cannot be easily reproduced in normal operation. // Not having access to the generated database class with its error interface we have to resort // to using the ABI for error logging. nodeObj.iNode->logComputeMessageOnInstance(nodeObj, kAccordingToContextIndex, omni::graph::core::ogn::Severity::eError, "Failed compute: No input attribute"); return false; // LCOV_EXCL_STOP } if (!outputValue) { // LCOV_EXCL_START nodeObj.iNode->logComputeMessageOnInstance(nodeObj, kAccordingToContextIndex, omni::graph::core::ogn::Severity::eError, "Failed compute: No output attribute"); return false; // LCOV_EXCL_STOP } // The actual computation of the node *outputValue = !*inputValue; return true; ``` ```c // These will almost never be overridden, specifically because the low level implementation lives in // the omni.graph.core extension and is not exposed through the ABI so it would be very difficult // for a node to be able to do the right thing when this function is called. // static void addInput // static void addOutput // static void addState // ---------------------------------------------------------------------- // Rarely overridden // // This should almost never be overridden as the auto-generated code will handle the name. // This particular override is used to bypass the unique naming feature of the .ogn name, where only names // with a namespace separator (".") do not have the extension name added as a prefix to the unique name. // This should only done for backward compatibility, and only until the node type name versioning is available. // Note that when you do this you will still be able to create a node using the generated node type name, as // that is required in order for the automated testing to work. The name returned here can be thought of as an // alias for the underlying name. static const char* getNodeType() { DEBUG_ABI("ABI override of getNodeType"); static const char* _nodeType{ "OmniGraphABI" }; return _nodeType; } // ---------------------------------------------------------------------- // Occasionally overridden // // When a node is created this will be called static void initialize(const GraphContextObj&, const NodeObj&) { DEBUG_ABI("ABI override of initialize"); // There is no default behavior on initialize so nothing else is needed for this tutorial to function } // ---------------------------------------------------------------------- // Rarely overridden // // This method might be overridden to set up initial conditions when a node type is registered, or // to replace initialization if the auto-generated version has some problem. static void initializeType(const NodeTypeObj&) { DEBUG_ABI("ABI override of initializeType"); // The generated initializeType will always be called so nothing needs to happen here } // ---------------------------------------------------------------------- // Occasionally overridden // // This is called while registering a node type. It is used to initialize tasks that can be used for // making compute more efficient by using Realm events. static void registerTasks() { DEBUG_ABI("ABI override of registerTasks"); } // ---------------------------------------------------------------------- // Occasionally overridden // // After a node is removed it will get a release call where anything set up in initialize() can be torn down static void release(const NodeObj&) { DEBUG_ABI("ABI override of release"); } ``` ```cpp // There is no default behavior on release so nothing else is needed for this tutorial to function } // ---------------------------------------------------------------------- // Occasionally overridden // // This is something you do want to override when you have more than version of your node. // In it you would translate attribute information from older versions into the current one. static bool updateNodeVersion(const GraphContextObj&amp;, const NodeObj&amp;, int oldVersion, int newVersion) { DEBUG_ABI("ABI override of updateNodeVersion from %d to %d", oldVersion, newVersion); // There is no default behavior on updateNodeVersion so nothing else is needed for this tutorial to function return oldVersion < newVersion; } // ---------------------------------------------------------------------- // Occasionally overridden // // When there is a connection change to this node which results in an extended type attribute being automatically // resolved, this callback gives the node a change to resolve other extended type attributes. For example a generic // 'Increment' node can resolve its output to an int only after its input has been resolved to an int. Attribute // types are resolved using IAttribute::setResolvedType() or the utility functions such as // INode::resolvePartiallyCoupledAttributes() static void onConnectionTypeResolve(const NodeObj&amp; nodeObj) { DEBUG_ABI("ABI override of onConnectionTypeResolve()"); // There is no default behavior on onConnectionTypeResolve so nothing else is needed for this tutorial to // function } // ---------------------------------------------------------------------- // Rarely overridden // // You may want to provide an alternative method of metadata storage. // This method can be used to intercept requests for metadata to provide those alternatives. static size_t getAllMetadata(const NodeTypeObj&amp; nodeType, const char** keyBuf, const char** valueBuf, size_t bufSize) { DEBUG_ABI("ABI override of getAllMetadata(%zu)", bufSize); if (s_metadata.size() > bufSize) { CARB_LOG_ERROR("Not enough space for metadata - needed %zu, got %zu", s_metadata.size(), bufSize); return 0; } size_t index = 0; for (auto&amp; metadata : s_metadata) { keyBuf[index] = metadata.first.c_str(); ``` ```cpp valueBuf[index] = metadata.second.c_str(); ++index; } return s_metadata.size(); } // ---------------------------------------------------------------------- // Rarely overridden // // You may want to provide an alternative method of metadata storage. // This method can be used to intercept requests for metadata to provide those alternatives. static const char* getMetadata(const NodeTypeObj& nodeType, const char* key) { DEBUG_ABI("ABI override of getMetadata('%s')", key); auto found = s_metadata.find(std::string(key)); if (found != s_metadata.end()) { return (*found).second.c_str(); } return nullptr; } // ---------------------------------------------------------------------- // Rarely overridden // // You may want to provide an alternative method of metadata storage. // This method can be used to intercept requests for the number of metadata elements to provide those alternatives. static size_t getMetadataCount(const NodeTypeObj& nodeType) { DEBUG_ABI("ABI override of getMetadataCount()"); return s_metadata.size(); } // ---------------------------------------------------------------------- // Rarely overridden // // You may want to provide an alternative method of metadata storage. // This method can be used to intercept requests to set metadata and use those alternatives. static void setMetadata(const NodeTypeObj& nodeType, const char* key, const char* value) { DEBUG_ABI("ABI override of setMetadata('%s' = '%s')", key, value); s_metadata[std::string(key)] = std::string(value); } // ---------------------------------------------------------------------- // Rarely overridden // // Subnode types are used when a single node type is shared among a set of other nodes, e.g. the way that // PythonNode is the node type for all nodes implemented in Python, while the subNodeType is the actual node type. // Overriding these functions let you implement different methods of managing those relationships. ``` ```cpp // static void addSubNodeType(const NodeTypeObj& nodeType, const char* subNodeTypeName, const NodeTypeObj& subNodeType) { DEBUG_ABI("ABI override of addSubNodeType('%s')", subNodeTypeName); } // ---------------------------------------------------------------------- // Rarely overridden // // Subnode types are used when a single node type is shared among a set of other nodes, e.g. the way that // PythonNode is the node type for all nodes implemented in Python, while the subNodeType is the actual node type. // Overriding these functions let you implement different methods of managing those relationships. // static NodeTypeObj getSubNodeType(const NodeTypeObj& nodeType, const char* subNodeTypeName) { DEBUG_ABI("ABI override of getSubNodeType('%s')", subNodeTypeName); return NodeTypeObj{ nullptr, kInvalidNodeTypeHandle }; } // ---------------------------------------------------------------------- // Rarely overridden // // Subnode types are used when a single node type is shared among a set of other nodes, e.g. the way that // PythonNode is the node type for all nodes implemented in Python, while the subNodeType is the actual node type. // Overriding these functions let you implement different methods of managing those relationships. // static NodeTypeObj createNodeType(const char* nodeTypeName, int version) { DEBUG_ABI("ABI override of createNodeType('%s')", nodeTypeName); return NodeTypeObj{ nullptr, kInvalidNodeTypeHandle }; } }; std::unordered_map<std::string, std::string> OgnTutorialABI::s_metadata; // ============================================================ // The magic for recognizing and using the overridden ABI code is in here. The generated interface // is still available, as seen in the initializeType implementation, although it's not required. REGISTER_OGN_NODE() ``` ## Node Type Metadata This file introduces the *metadata* keyword, whose value is a dictionary of key/value pairs associated with the node type that may be extracted using the ABI metadata functions. These are not persisted in any files and so must be set either in the .ogn file or in an override of the **initializeType()** method in the node definition. ## Exclusions Note the use of the **exclude** keyword in the .ogn file. This allows you to prevent generation of any of the default files. In this case, since the ABI is handling everything the Python database will not be able to access the node’s information so it is excluded.
16,574
tutorial30.md
# Tutorial 30 - Node with more advanced computeVectorized This tutorial demonstrates how to compose nodes that implements a computeVectorized function. It shows how to access the raw vectorized data, and how it can be used to write a performant tight loop using SIMD instructions. ## OgnTutorialSIMDAdd.ogn The `ogn` file shows the implementation of a node named “omni.graph.tutorials.TutorialSIMDFloatAdd”, which takes inputs of 2 floating point values, and performs a sum. ```json { "TutorialSIMDFloatAdd": { "version": 1, "description": "Add 2 floats together using SIMD instruction set", "categories": "tutorials", "uiName": "Tutorial Node: SIMD Add", "inputs": { "a": { "type": "float", "description": "first input operand" }, "b": { "type": "float", "description": "second input operand" } }, "outputs": { "result": { "type": "float", "description": "the sum of a and b" } } } } ``` ## OgnTutorialSIMDAdd.cpp The `cpp` file contains the implementation of the node. It takes two floating point inputs and performs a sum, demonstrating how to handle a vectorized compute. It shows how to retrieve the vectorized array of inputs and output. how to reason about the number of instances provided, and how to optimize the compute taking advantage of those vectorized inputs. Since a SIMD instruction requires a given alignment for its arguments, the compute is divided in 3 sections: - a first section that does a regular sum input on the few first instances that don’t have a proper alignment - a second, the heart of the function, that does as much SIMD adds as it can, performing them 4 elements by 4 elements - a last section that perform regular sum on the few remaining items that did not fit in the SIMD register ```cpp // Copyright (c) 2023-2024, NVIDIA CORPORATION. All rights reserved. // // NVIDIA CORPORATION and its licensors retain all intellectual property // and proprietary rights in and to this software, related documentation // and any modifications thereto. Any use, reproduction, disclosure or // distribution of this software and related documentation without an express // license agreement from NVIDIA CORPORATION is strictly prohibited. // #if !defined(__arm__) && !defined(__aarch64__) # define SIMD_AVAILABLE #endif #include <OgnTutorialSIMDAddDatabase.h> #ifdef SIMD_AVAILABLE # include <immintrin.h> #endif // This node perform a sum using SIMD instruction set class OgnTutorialSIMDAdd { public: static size_t computeVectorized(OgnTutorialSIMDAddDatabase& db, size_t count) { // Retrieve data auto opA = db.inputs.a.vectorized(count); auto opB = db.inputs.b.vectorized(count); auto res = db.outputs.result.vectorized(count); // Regular loop definition auto regularLoop = [&](size_t const begin, size_t const end) -> size_t const { for (size_t idx = begin; idx < end; ++idx) res[idx] = opA[idx] + opB[idx]; return end; }; #ifdef SIMD_AVAILABLE // Constants static constexpr size_t kSIMDSize = sizeof(__m128); static constexpr size_t kMask = kSIMDSize - 1; static constexpr size_t kSIMDFloatCount = kSIMDSize / sizeof(float); // Alignment must be identical bool const correctlyAligned = ((size_t(opA.data()) & kMask) == (size_t(opB.data()) & kMask)); #endif } }; ```cpp // 48 ((size_t(opA.data()) & kMask) == (size_t(res.data()) & kMask)); // 49 // 50 if (!correctlyAligned) { // 51 regularLoop(0, count); // 52 } else { // 53 // Unaligned elements const size_t maskedAddress = (size_t(res.data()) & kMask); // 56 const size_t unalignedCount = maskedAddress ? regularLoop(0, (kSIMDSize - maskedAddress) / sizeof(float)) : 0; // 57 // Vectorized elements const size_t vectorizedCount = (count - unalignedCount) & (~kMask); // 59 const size_t vectorizedLoop = vectorizedCount / kSIMDFloatCount; // 60 __m128* aSIMD = (__m128*)(opA.data() + unalignedCount); // 63 __m128* bSIMD = (__m128*)(opB.data() + unalignedCount); // 64 __m128* resSIMD = (__m128*)(res.data() + unalignedCount); // 65 for (size_t idx = 0; idx < vectorizedLoop; ++idx) resSIMD[idx] = _mm_add_ps(aSIMD[idx], bSIMD[idx]); // 66 // Remaining elements regularLoop(unalignedCount + vectorizedCount, count); // 69 } // 70 #else regularLoop(0, count); // 75 #endif // 76 return count; // 79 } // 80 }; // 81 REGISTER_OGN_NODE() // 82 ``` ```
4,728
tutorial4.md
# Tutorial 4 - Tuple Data Node Tuple data, also referred to as fixed array data, consists of multiple elements of a simple type. For example `float[3]` or `double[4]`. This node creates one input attribute and one output attribute of each of the simple data types with an element count greater than 1. ## OgnTutorialTupleData.ogn The `ogn` file shows the implementation of a node named “omni.tutorials.TupleData”, which has one input and one matching output attribute of each simple type with element counts greater than one. ```json { "omni.tutorials.TupleData": { "version": 1, "categories": "tutorials", "scheduling": ["threadsafe"], "description": [ "This is a tutorial node. It creates both an input and output attribute of some of the supported ", "tuple types. The values are modified in a simple way so that the compute can be tested." ], "metadata": { "uiName": "Tutorial Node: Tuple Attributes" }, "tags": ["tuple", "tutorial", "internal"], "inputs": { "a_double2": { "type": "double[2]", "description": "This is an attribute with two double values", "default": [1.1, 2.2] }, "a_float2": { "type": "float[2]", "description": "This is an attribute with two float values", "default": [1.1, 2.2] } } } } ``` 24. "default": [4.4, 5.5] 25. } 26. "a_half2": { 27. "type": "half[2]", 28. "description": "This is an attribute with two 16-bit float values", 29. "default": [7.0, 8.0] 30. } 31. "a_int2": { 32. "type": "int[2]", 33. "description": "This is an attribute with two 32-bit integer values", 34. "default": [10, 11] 35. } 36. "a_float3": { 37. "type": "float[3]", 38. "description": "This is an attribute with three float values", 39. "default": [6.6, 7.7, 8.8] 40. } 41. "a_double3": { 42. "type": "double[3]", 43. "description": "This is an attribute with three double values", 44. "default": [1.1, 2.2, 3.3] 45. } 46. } 47. "outputs": { 48. "a_double2": { 49. "type": "double[2]", 50. "description": "This is a computed attribute with two double values" 51. }, 52. "a_float2": { 53. "type": "float[2]", 54. "description": "This is a computed attribute with two float values" 55. }, 56. "a_half2": { 57. "type": "half[2]", 58. "description": "This is a computed attribute with two 16-bit float values" 59. }, 60. "a_int2": { 61. "type": "int[2]", 62. "description": "This is a computed attribute with two 32-bit integer values" 63. }, 64. "a_float3": { 65. "type": "float[3]", 66. "description": "This is a computed attribute with three float values" 67. }, 68. "a_double3": { 69. "type": "double[3]", 70. "description": "This is a computed attribute with three double values" ```json { "tests": [ { "description": "Verification that proper outputs are computed when inputs are all defaults.", "outputs:a_double2": [2.1, 3.2], "outputs:a_float2": [5.4, 6.5], "outputs:a_half2": [8.0, 9.0], "outputs:a_int2": [11, 12], "outputs:a_float3": [7.6, 8.7, 9.8], "outputs:a_double3": [2.1, 3.2, 4.3] }, { "description": "Check computation of all outputs using non-default input values", "inputs:a_double2": [2.1, 3.2], "outputs:a_double2": [3.1, 4.2], "inputs:a_float2": [5.1, 6.2], "outputs:a_float2": [6.1, 7.2], "inputs:a_half2": [8.0, 9.0], "outputs:a_half2": [9.0, 10.0], "inputs:a_int2": [11, 12], "outputs:a_int2": [12, 13], "inputs:a_float3": [7.1, 8.2, 9.3], "outputs:a_float3": [8.1, 9.2, 10.3], "inputs:a_double3": [10.1, 11.2, 12.3], "outputs:a_double3": [11.1, 12.2, 13.3] } ] } ``` ## New Concept - Tags Often it is helpful to group nodes with common functionality together in some way in the UI. To help with this you can specify values for the **tags** keyword. The values can either be a comma-separated string, or a list, that will be rendered into a comma-separated string when added to the metadata. ## New Concept - Namespaced Node Type Name The standard naming convention uses a simple `CamelCase` name, with the extension of origin prepended onto the name to ensure uniqueness. Sometimes you may wish to manage your own namespace, e.g. when you anticipate moving nodes between extensions so the extension name will not be consistent. All you have to do to override the default behavior is to specify a namespace for the node type name (i.e. include a `.` separator in it). ::: warning # Warning Once you have overridden the node type name with such an absolute value you are now responsible for ensuring uniqueness so be sure you have some scheme that will help you with that. The prefix **omni.** is reserved for NVIDIA nodes. Everything else is legal, so long as the entire name itself is legal. ## OgnTutorialTupleData.cpp The **cpp** file contains the implementation of the compute method, which modifies each of the inputs in a simple way to create outputs that have different values. ```c++ // Copyright (c) 2020-2024, NVIDIA CORPORATION. All rights reserved. // // NVIDIA CORPORATION and its licensors retain all intellectual property // and proprietary rights in and to this software, related documentation // and any modifications thereto. Any use, reproduction, disclosure or // distribution of this software and related documentation without an express // license agreement from NVIDIA CORPORATION is strictly prohibited. // #include <OgnTutorialTupleDataDatabase.h> #include <algorithm> #include <iostream> // This class exercises access to the DataModel through the generated database class for supported data types // with element counts greater than 1. class OgnTutorialTupleData { public: static bool compute(OgnTutorialTupleDataDatabase& db) { // For each piece of data apply a transforming operation so that compute does something testable. // The transformation adds 1 to the input to compute the matching output. Notice how the recognized // USD types can make use of the built-in manipulation functions while the generic types have to // manually apply the algorithm. db.outputs.a_double2() = db.inputs.a_double2() + GfVec2d(1.0, 1.0); db.outputs.a_double3() = db.inputs.a_double3() + GfVec3d(1.0, 1.0, 1.0); db.outputs.a_float2() = db.inputs.a_float2() + GfVec2f(1.0f, 1.0f); db.outputs.a_half2() = db.inputs.a_half2() + GfVec2h(1.0, 1.0); db.outputs.a_int2() = db.inputs.a_int2() + GfVec2i(1, 1); // If you have your own data types which are memory-layout-compatible with the defaults provided // you can use a simple cast operation to force a specific data type. Be careful not to cast away // the "const" on inputs or your data could get out of sync. const carb::Float3& inFloat3 = reinterpret_cast<const carb::Float3&>(db.inputs.a_float3()); carb::Float3& outFloat3 = reinterpret_cast<carb::Float3&>(db.outputs.a_float3()); } }; ``` ```{literalinclude} ../examples/ogn_nodes/tuple_data_node.cpp :start-line: 36 :end-line: 42 :lineno-start: 1 :language: cpp ``` Note how by default some of the attribute value types are USD types and some are generic `ogn::tuple` types. See omni.graph.docs.ogn_attribute_types for the full set of type definitions. ## Tuple Attribute Access  The attribute access is as described in [Tutorial 2 - Simple Data Node](tutorial2.html#ogn-tutorial-simpledata) except that the exact return types of the attributes are different in order to support tuple member access. In practice you would use an `auto` declaration. The types are shown only for illustrative purposes. The data types for tuples that correspond to existing USD types use the `pxr::gf` versions of those types, so the database accessors in this node will return these types: | Database Function | Returned Type | |-------------------|---------------| | inputs.a_double2() | const GfVec2d&amp; | | inputs.a_float2() | const GfVec2f&amp; | | inputs.a_half2() | const GfVec2h&amp; | | inputs.a_int2() | const GfVec2i&amp; | | inputs.a_float3() | const GfVec3f&amp; | | outputs.a_double2() | GfVec2d&amp; | | outputs.a_float2() | GfVec2f&amp; | | outputs.a_half2() | GfVec2h&amp; | | outputs.a_int2() | GfVec2i&amp; | | outputs.a_float3() | GfVec3f&amp; | ## Tuple Data Compute Validation  As with simple data types the existence of the mandatory inputs is confirmed before proceeding to the compute method. ## Tuple Data Node Computation Tests  In the “tests” section of the .ogn file there are some simple tests exercising the basic functionality of the compute method. In practice it is a good idea to include more thorough tests which exercise different data values, especially potential edge cases.
9,230
tutorial5.md
# Tutorial 5 - Array Data Node Array data consists of multiple elements of a simple type whose count is only known at runtime. For example `float[]` or `double[]`. This node takes an array of floats and a multiplier and generates an output array consisting of the product of the two. ## OgnTutorialArrayData.ogn The `ogn` file shows the implementation of a node named “omni.graph.tutorials.ArrayData”, which has a float value and float array input with one float array output. ```json { "ArrayData": { "version": 1, "categories": "tutorials", "scheduling": ["threadsafe"], "description": [ "This is a tutorial node. It will compute the array 'result' as the input array 'original' ", "with every element multiplied by the constant 'multiplier'." ], "$todo": "Enable the string attributes when fabric fully supports them", "metadata": { "uiName": "Tutorial Node: Array Attributes" }, "inputs": { "original": { "description": "Array to be multiplied", "type": "float[]", "default": [] }, "gates": { "description": "Boolean mask telling which elements of the array should be multiplied", "type": "bool[]", "default": [] }, "multiplier": { "description": "Multiplier for the array elements", "type": "float", "default": 1.0 } } } } ``` { "description": "Multiplier of the array elements", "type": "float", "default": 1.0 }, { "description": "List of strings providing commentary", "type": "token[]", "default": ["There", "is", "no", "data"] }, { "description": "Multiplied array", "type": "float[]" }, { "description": "Array of booleans set to true if the corresponding 'result' is negative", "type": "bool[]" }, { "description": "Number of letters in all strings in the info input", "type": "int" }, [ { "inputs:original": [1.0, 2.0, 3.0], "inputs:gates": [true, false, true], "inputs:multiplier": 2.0, "outputs:result": [2.0, 2.0, 6.0], "outputs:negativeValues": [false, false, false], "outputs:infoSize": 13 }, { "inputs:original": [10.0, -20.0, 30.0], "inputs:gates": [true, false, true], "outputs:result": [10.0, -20.0, 30.0], "outputs:negativeValues": [false, true, false] }, { "inputs:info": ["Hello", "lamp\"post", "what'cha", "knowing"], "outputs:infoSize": 29 } ] ```cpp // Copyright (c) 2020-2024, NVIDIA CORPORATION. All rights reserved. // // NVIDIA CORPORATION and its licensors retain all intellectual property // and proprietary rights in and to this software, related documentation // and any modifications thereto. Any use, reproduction, disclosure or // distribution of this software and related documentation without an express // license agreement from NVIDIA CORPORATION is strictly prohibited. // #include &lt;OgnTutorialArrayDataDatabase.h&gt; #include &lt;algorithm&gt; class OgnTutorialArrayData { public: static bool compute(OgnTutorialArrayDataDatabase& db) { // For clarity get the attribute values into separate variables. The type definitions are included to // show exactly what data types are returned, though you should know that from your .ogn declaration. // It's sufficient to use "const auto" for inputs or "auto" for outputs. const float multiplier = db.inputs.multiplier(); const ::ogn::const_array&lt;float&gt;&amp; inputArray = db.inputs.original(); const ::ogn::const_array&lt;bool&gt;&amp; gateArray = db.inputs.gates(); ::ogn::array&lt;float&gt;&amp; outputArray = db.outputs.result(); ::ogn::array&lt;bool&gt;&amp; negativeValues = db.outputs.negativeValues(); if (gateArray.size() != inputArray.size()) { db.logWarning("Gate array size %zu should equal input array size %zu", gateArray.size(), inputArray.size()); return false; } // Output array data has to be properly sized before filling as it will contain the same number // of elements as the input the size is already known. You could also do an assignment and modify the // output in place if that makes your algorithm more efficient: // outputArray = inputArray; outputArray.resize(inputArray.size()); negativeValues.resize(inputArray.size()); // The attribute array data wrapper is compatible with the STL algorithms so computations can be // performed in a single std::algorithm call. std::transform(inputArray.begin(), inputArray.end(), gateArray.begin(), outputArray.begin(), [=](float x, bool y) { return x * multiplier; }); } } ``` # OgnTutorialArrayData.cpp The `cpp` file contains the implementation of the compute method, which multiplies the float value by each member of the float array. Note how the attribute Array values can be accessed as though they were a simple `std::vector` type. ```cpp bool compute(OgnTutorialArrayDataDatabase& db) { const float multiplier = db.inputs.multiplier(); ogn::array<float>& outputArray = db.outputs.result(); const ogn::const_array<float>& negativeValues = db.inputs.original(); std::transform(outputArray.begin(), outputArray.end(), negativeValues.begin(), [multiplier](const float& value, const bool& gate) -> float { return gate ? value * multiplier : value; }); std::transform(outputArray.begin(), outputArray.end(), negativeValues.begin(), [](const float& value) -> bool { return value < 0.0f; }); // Regular iterators can also be applied size_t totalCharacters{0}; for (const auto& stringInput : db.inputs.info()) { totalCharacters += std::strlen(db.tokenToString(stringInput)); } db.outputs.infoSize() = int(totalCharacters); return true; } ``` ## Array Attribute Access The attribute access is as described in [Tutorial 2 - Simple Data Node](tutorial2.html#ogn-tutorial-simpledata) except that the exact return types of the attributes are different in order to support array member access. Full definition of the array wrapper classes can be found in the interface file `omni/graph/core/ogn/array.h`, though they do behave in a manner consistent with `std::array`, supporting iterators, standard algorithms, random access through either `operator[]` or the `at(index)` function, the `empty()` and `size()` functions, and access to the raw underlying data using the function `data()`. The non-const version also supports assignment and the `resize()` function for modifying its contents. | Database Function | Returned Type | |-------------------|---------------| | inputs.original() | const ogn::const_array&lt;float&gt;&amp; | | inputs.multiplier() | const float&amp; | | outputs.result() | ogn::array&lt;float&gt;&amp; | These wrapper classes are similar in concept to `std::span`, which handles unmanaged pointer+size data. In this case the data is being managed by the Fabric. Modifications to the wrapper class data will directly modify the underlying data in the Fabric. You can still use the `auto` declarations on these types, and the array attributes have an additional `size()` method added for convenience. ```cpp const auto& multiplier = db.inputs.multiplier(); const auto& original = db.inputs.original(); size_t originalSize = db.inputs.original.size(); auto& result = db.outputs.result(); ```
7,662
tutorial6.md
# Tutorial 6 - Array of Tuples Arrays and tuples can be combined to create common attribute types such as **float[3][]**, and array of 3 floats. This node takes two arrays of float[3]s and generates an output array consisting of the element-wise dot products. The *ogn* file shows the implementation of a node named “omni.graph.tutorials.TupleArrays”, which has two tuple-array inputs and a simple array output. ## OgnTutorialTupleArrays.ogn ```json { "TupleArrays": { "version": 1, "categories": "tutorials", "scheduling": ["threadsafe"], "description": [ "This is a tutorial node. It will compute the float array 'result' as the elementwise dot product of the input arrays 'a' and 'b'." ], "metadata": { "uiName": "Tutorial Node: Attributes With Arrays of Tuples" }, "inputs": { "a": { "description": "First array", "type": "float[3][]", "default": [] }, "b": { "description": "Second array", "type": "float[3][]", "default": [] } }, "outputs": { "result": { "description": "Dot-product array", "type": "float[]" } } } } ``` ```json { "parameters": { "inputs": { "a": { "type": "float[]", "default": [] }, "b": { "type": "float[]", "default": [] } } }, "tests": [ { "inputs:a": [[1.0, 2.0, 3.0],[2.0, 3.0, 4.0]], "inputs:b": [[10.0, 5.0, 1.0],[1.0, 5.0, 10.0]], "outputs:result": [23.0, 57.0] } ] } ``` # OgnTutorialTupleArrays.cpp The cpp file contains the implementation of the compute method, which computes the dot products. ```c++ // Copyright (c) 2020-2024, NVIDIA CORPORATION. All rights reserved. // // NVIDIA CORPORATION and its licensors retain all intellectual property // and proprietary rights in and to this software, related documentation // and any modifications thereto. Any use, reproduction, disclosure or // distribution of this software and related documentation without an express // license agreement from NVIDIA CORPORATION is strictly prohibited. // #include <OgnTutorialTupleArraysDatabase.h> #include <algorithm> class OgnTutorialTupleArrays { public: static bool compute(OgnTutorialTupleArraysDatabase& db) { // Use the "auto&" declarations to avoid long type names, prone to error const auto& a = db.inputs.a(); const auto& b = db.inputs.b(); auto& result = db.outputs.result(); // Some simple error checking never hurts if (a.size() != b.size()) { db.logWarning("Input sizes did not match (%zu versus %zu)", a.size(), b.size()); return false; } // The output contents are unrelated to the input contents so resize rather than copying result.resize(a.size()); // Illustrating how simple these operations are thanks to iterators and the built-in operator* std::transform(a.begin(), a.end(), b.begin(), result.begin(), [](float x, float y) { return x * y; }); return true; } }; ``` ```cpp const GfVec3f& valueA, const GfVec3f& valueB) -> float { return valueA * valueB; }); ``` ```cpp return true; ``` ```cpp }; ``` ```cpp REGISTER_OGN_NODE() ``` There are typedefs set up for USD-compatible types, e.g. for `float[3]` you get `GfVec3f`. Other types, for whom there is no USD equivalent, are implemented as `ogn::tuple<TYPE, N>`. See the complete table of data types in omni.graph.docs.ogn_attribute_types. | Database Function | Returned Type | |-------------------|---------------| | inputs.a() | const ogn::const_array<GfVec3f>& | | inputs.b() | const ogn::const_array<GfVec3f>& | | outputs.result() | ogn::array<GfVec3f>& | Note that the tuple array access is identical to the simple data array access, except that the types are now the compound tuple types.
4,200
tutorial7.md
# Tutorial 7 - Role-Based Data Node The role-based data node creates one input attribute and one output attribute of each of the role-based type. A role-based type is defined as data with an underlying simple data type, with an interpretation of that simple data, called a “role”. Examples of roles are **color**, **quat**, and **timecode**. For consistency the tuple counts for each of the roles are included in the declaration so that the “shape” of the underlying data is more obvious. ## OgnTutorialRoleData.ogn The `ogn` file shows the implementation of a node named “omni.graph.tutorials.RoleData”, which has one input and one output attribute of each Role type. ```json { "RoleData": { "version": 1, "categories": "tutorials", "scheduling": ["threadsafe"], "description": [ "This is a tutorial node. It creates both an input and output attribute of every supported ", "role-based data type. The values are modified in a simple way so that the compute modifies values. " ], "metadata": { "uiName": "Tutorial Node: Role-Based Attributes" }, "inputs": { "a_color3d": { "type": "colord[3]", "description": ["This is an attribute interpreted as a double-precision 3d color"], "default": [0.0, 0.0, 0.0] }, "a_color3f": { "type": "colorf[3]", "description": ["This is an attribute interpreted as a single-precision 3d color"], "default": [0.0, 0.0, 0.0] } } } } ``` }, "a_color3h": { "type": "colorh[3]", "description": ["This is an attribute interpreted as a half-precision 3d color"], "default": [0.0, 0.0, 0.0] }, "a_color4d": { "type": "colord[4]", "description": ["This is an attribute interpreted as a double-precision 4d color"], "default": [0.0, 0.0, 0.0, 0.0] }, "a_color4f": { "type": "colorf[4]", "description": ["This is an attribute interpreted as a single-precision 4d color"], "default": [0.0, 0.0, 0.0, 0.0] }, "a_color4h": { "type": "colorh[4]", "description": ["This is an attribute interpreted as a half-precision 4d color"], "default": [0.0, 0.0, 0.0, 0.0] }, "a_frame": { "type": "frame[4]", "description": ["This is an attribute interpreted as a coordinate frame"], "default": [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]] }, "a_matrix2d": { "type": "matrixd[2]", "description": ["This is an attribute interpreted as a double-precision 2d matrix"], "default": [[1.0, 0.0], [0.0, 1.0]] }, "a_matrix3d": { "type": "matrixd[3]", "description": ["This is an attribute interpreted as a double-precision 3d matrix"], "default": [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]] } 59, 60 "a_matrix4d": { 61 "type": "matrixd[4]", 62 "description": ["This is an attribute interpreted as a double-precision 4d matrix"], 63 "default": [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]] 64 }, 65 "a_normal3d": { 66 "type": "normald[3]", 67 "description": ["This is an attribute interpreted as a double-precision 3d normal"], 68 "default": [0.0, 0.0, 0.0] 69 }, 70 "a_normal3f": { 71 "type": "normalf[3]", 72 "description": ["This is an attribute interpreted as a single-precision 3d normal"], 73 "default": [0.0, 0.0, 0.0] 74 }, 75 "a_normal3h": { 76 "type": "normalh[3]", 77 "description": ["This is an attribute interpreted as a half-precision 3d normal"], 78 "default": [0.0, 0.0, 0.0] 79 }, 80 "a_point3d": { 81 "type": "pointd[3]", 82 "description": ["This is an attribute interpreted as a double-precision 3d point"], 83 "default": [0.0, 0.0, 0.0] 84 }, 85 "a_point3f": { 86 "type": "pointf[3]", 87 "description": ["This is an attribute interpreted as a single-precision 3d point"], 88 "default": [0.0, 0.0, 0.0] 89 }, 90 "a_point3h": { 91 "type": "pointh[3]", 92 "description": ["This is an attribute interpreted as a half-precision 3d point"], 93 "default": [0.0, 0.0, 0.0] 94 }, 95 "a_quatd": { 96 "type": "quatd[4]", "description": ["This is an attribute interpreted as a double-precision 4d quaternion"], "default": [0.0, 0.0, 0.0, 0.0] "description": ["This is an attribute interpreted as a single-precision 4d quaternion"], "default": [0.0, 0.0, 0.0, 0.0] "description": ["This is an attribute interpreted as a half-precision 4d quaternion"], "default": [0.0, 0.0, 0.0, 0.0] "description": ["This is an attribute interpreted as a double-precision 2d texcoord"], "default": [0.0, 0.0] "description": ["This is an attribute interpreted as a single-precision 2d texcoord"], "default": [0.0, 0.0] "description": ["This is an attribute interpreted as a half-precision 2d texcoord"], "default": [0.0, 0.0] "description": ["This is an attribute interpreted as a double-precision 3d texcoord"], "default": [0.0, 0.0, 0.0] "description": ["This is an attribute interpreted as a single-precision 3d texcoord"], "default": [0.0, 0.0, 0.0] "description": ["This is an attribute interpreted as a half-precision 3d texcoord"], "default": [0.0, 0.0, 0.0] 137. "description": ["This is an attribute interpreted as a half-precision 3d texcoord"], 138. "default": [0.0, 0.0, 0.0] 139. }, 140. "a_timecode": { 141. "type": "timecode", 142. "description": ["This is a computed attribute interpreted as a timecode"], 143. "default": 1.0 144. }, 145. "a_vector3d": { 146. "type": "vectord[3]", 147. "description": ["This is an attribute interpreted as a double-precision 3d vector"], 148. "default": [0.0, 0.0, 0.0] 149. }, 150. "a_vector3f": { 151. "type": "vectorf[3]", 152. "description": ["This is an attribute interpreted as a single-precision 3d vector"], 153. "default": [0.0, 0.0, 0.0] 154. }, 155. "a_vector3h": { 156. "type": "vectorh[3]", 157. "description": ["This is an attribute interpreted as a half-precision 3d vector"], 158. "default": [0.0, 0.0, 0.0] 159. } 160. }, 161. "outputs": { 162. "a_color3d": { 163. "type": "colord[3]", 164. "description": ["This is a computed attribute interpreted as a double-precision 3d color"] 165. }, 166. "a_color3f": { 167. "type": "colorf[3]", 168. "description": ["This is a computed attribute interpreted as a single-precision 3d color"] 169. }, 170. "a_color3h": { 171. "type": "colorh[3]", 172. "description": ["This is a computed attribute interpreted as a half-precision 3d color"] 173. }, 174. "a_color4d": { 175. "type": "colord[4]", 176. "description": ["This is a computed attribute interpreted as a double-precision 4d color"] 177. }, 178. "a_color4f": { 179. "type": "colorf[4]", 180. "description": ["This is a computed attribute interpreted as a single-precision 4d color"] 181 }, 182 "a_color4h": { 183 "type": "colorh[4]", 184 "description": ["This is a computed attribute interpreted as a half-precision 4d color"] 185 }, 186 "a_frame": { 187 "type": "frame[4]", 188 "description": ["This is a computed attribute interpreted as a coordinate frame"] 189 }, 190 "a_matrix2d": { 191 "type": "matrixd[2]", 192 "description": ["This is a computed attribute interpreted as a double-precision 2d matrix"] 193 }, 194 "a_matrix3d": { 195 "type": "matrixd[3]", 196 "description": ["This is a computed attribute interpreted as a double-precision 3d matrix"] 197 }, 198 "a_matrix4d": { 199 "type": "matrixd[4]", 200 "description": ["This is a computed attribute interpreted as a double-precision 4d matrix"] 201 }, 202 "a_normal3d": { 203 "type": "normald[3]", 204 "description": ["This is a computed attribute interpreted as a double-precision 3d normal"] 205 }, 206 "a_normal3f": { 207 "type": "normalf[3]", 208 "description": ["This is a computed attribute interpreted as a single-precision 3d normal"] 209 }, 210 "a_normal3h": { 211 "type": "normalh[3]", 212 "description": ["This is a computed attribute interpreted as a half-precision 3d normal"] 213 }, 214 "a_point3d": { 215 "type": "pointd[3]", 216 "description": ["This is a computed attribute interpreted as a double-precision 3d point"] 217 }, 218 "a_point3f": { 219 "type": "pointf[3]", 220 "description": ["This is a computed attribute interpreted as a single-precision 3d point"] 221 }, 222 "a_point3h": { 223 "type": "pointh[3]", 224 "description": ["This is a computed attribute interpreted as a half-precision 3d point"] 225 }, 226 "a_quatd": { 227 "type": "quatd[4]", "description": ["This is a computed attribute interpreted as a double-precision 4d quaternion"] }, "a_quatf": { "type": "quatf[4]", "description": ["This is a computed attribute interpreted as a single-precision 4d quaternion"] }, "a_quath": { "type": "quath[4]", "description": ["This is a computed attribute interpreted as a half-precision 4d quaternion"] }, "a_texcoord2d": { "type": "texcoordd[2]", "description": ["This is a computed attribute interpreted as a double-precision 2d texcoord"] }, "a_texcoord2f": { "type": "texcoordf[2]", "description": ["This is a computed attribute interpreted as a single-precision 2d texcoord"] }, "a_texcoord2h": { "type": "texcoordh[2]", "description": ["This is a computed attribute interpreted as a half-precision 2d texcoord"] }, "a_texcoord3d": { "type": "texcoordd[3]", "description": ["This is a computed attribute interpreted as a double-precision 3d texcoord"] }, "a_texcoord3f": { "type": "texcoordf[3]", "description": ["This is a computed attribute interpreted as a single-precision 3d texcoord"] }, "a_texcoord3h": { "type": "texcoordh[3]", "description": ["This is a computed attribute interpreted as a half-precision 3d texcoord"] }, "a_timecode": { "type": "timecode", "description": ["This is a computed attribute interpreted as a timecode"] }, "a_vector3d": { "type": "vectord[3]", "description": ["This is a computed attribute interpreted as a double-precision 3d vector"] }, "a_vector3f": { "type": "vectorf[3]", "description": ["This is a computed attribute interpreted as a single-precision 3d vector"] }, 274 "a_vector3h": { 275 "type": "vectorh[3]", 276 "description": ["This is a computed attribute interpreted as a half-precision 3d vector"] 277 } 278 }, 279 "tests": [ 280 { 281 "description": "Compute method just increments the component values", 282 "inputs:a_color3d": [1.0, 2.0, 3.0], "outputs:a_color3d": [2.0, 3.0, 4.0], 283 "inputs:a_color3f": [11.0, 12.0, 13.0], "outputs:a_color3f": [12.0, 13.0, 14.0], 284 "inputs:a_color3h": [21.0, 22.0, 23.0], "outputs:a_color3h": [22.0, 23.0, 24.0], 285 "inputs:a_color4d": [1.0, 2.0, 3.0, 4.0], "outputs:a_color4d": [2.0, 3.0, 4.0, 5.0], 286 "inputs:a_color4f": [11.0, 12.0, 13.0, 14.0], "outputs:a_color4f": [12.0, 13.0, 14.0, 15.0], 287 "inputs:a_color4h": [21.0, 22.0, 23.0, 24.0], "outputs:a_color4h": [22.0, 23.0, 24.0, 25.0], 288 "inputs:a_frame": [[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0], [13.0, 14.0, 15.0, 16.0]], 289 "outputs:a_frame": [[2.0, 3.0, 4.0, 5.0], [6.0, 7.0, 8.0, 9.0], [10.0, 11.0, 12.0, 13.0], [14.0, 15.0, 16.0, 17.0]], 290 "inputs:a_matrix2d": [[1.0, 2.0], [3.0, 4.0]], "outputs:a_matrix2d": [[2.0, 3.0], [4.0, 5.0]], "inputs:a_matrix3d": [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], "outputs:a_matrix3d": [[2.0, 3.0, 4.0], [5.0, 6.0, 7.0], [8.0, 9.0, 10.0]], "inputs:a_matrix4d": [[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0], [9.0, 10.0, 11.0, 12.0], [13.0, 14.0, 15.0, 16.0]], "outputs:a_matrix4d": [[2.0, 3.0, 4.0, 5.0], [6.0, 7.0, 8.0, 9.0], [10.0, 11.0, 12.0, 13.0], [14.0, 15.0, 16.0, 17.0]], "inputs:a_normal3d": [1.0, 2.0, 3.0], "outputs:a_normal3d": [2.0, 3.0, 4.0], "inputs:a_normal3f": [11.0, 12.0, 13.0], "outputs:a_normal3f": [12.0, 13.0, 14.0], "inputs:a_normal3h": [21.0, 22.0, 23.0], "outputs:a_normal3h": [22.0, 23.0, 24.0], "inputs:a_point3d": [1.0, 2.0, 3.0], "outputs:a_point3d": [2.0, 3.0, 4.0], "inputs:a_point3f": [11.0, 12.0, 13.0], "outputs:a_point3f": [12.0, 13.0, 14.0], "inputs:a_point3h": [21.0, 22.0, 23.0], "outputs:a_point3h": [22.0, 23.0, 24.0], "inputs:a_quatd": [1.0, 2.0, 3.0, 4.0], "outputs:a_quatd": [2.0, 3.0, 4.0, 5.0] ```c // and proprietary rights in and to this software, related documentation // and any modifications thereto. Any use, reproduction, disclosure or // distribution of this software and related documentation without an express // license agreement from NVIDIA CORPORATION is strictly prohibited. #include <OgnTutorialRoleDataDatabase.h> // This class exercises access to the DataModel through the generated database class for all role-based data types namespace { // Helper values to make it easy to add 1 to values of different lengths GfHalf h1{ 1.0f }; GfVec2d increment2d{ 1.0, 1.0 }; GfVec2f increment2f{ 1.0f, 1.0f }; GfVec2h increment2h{ h1, h1 }; GfVec3d increment3d{ 1.0, 1.0, 1.0 }; GfVec3f increment3f{ 1.0f, 1.0f, 1.0f }; GfVec3h increment3h{ h1, h1, h1 }; GfVec4d increment4d{ 1.0, 1.0, 1.0, 1.0 }; GfVec4f increment4f{ 1.0f, 1.0f, 1.0f, 1.0f }; GfVec4h increment4h{ h1, h1, h1, h1 }; GfQuatd incrementQd{ 1.0, 1.0, 1.0, 1.0 }; GfQuatf incrementQf{ 1.0f, 1.0f, 1.0f, 1.0f }; GfQuath incrementQh{ h1, h1, h1, h1 }; GfMatrix4d incrementM4d{ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; GfMatrix3d incrementM3d{ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; GfMatrix2d incrementM2d{ 1.0, 1.0, 1.0, 1.0 }; } // Helper macro to simplify the code but include all of the error checking #define ComputeOne(ATTRIBUTE_NAME, INCREMENT_VARIABLE, ROLE_EXPECTED) \ foundError = false; \ ``` 37 if (db.inputs.ATTRIBUTE_NAME.role() != ROLE_EXPECTED) \ 38 { \ 39 db.logWarning("Input role type %d != %d", (int)db.inputs.ATTRIBUTE_NAME.role(), (int)ROLE_EXPECTED); \ 40 foundError = true; \ 41 foundAnyErrors = true; \ 42 } \ 43 if (db.outputs.ATTRIBUTE_NAME.role() != ROLE_EXPECTED) \ 44 { \ 45 db.logWarning("output role type %d != %d", (int)db.outputs.ATTRIBUTE_NAME.role(), (int)ROLE_EXPECTED); \ 46 foundError = true; \ 47 foundAnyErrors = true; \ 48 } \ 49 if (!foundError) \ 50 { \ 51 db.outputs.ATTRIBUTE_NAME() = db.inputs.ATTRIBUTE_NAME() + INCREMENT_VARIABLE; \ 52 } 53 54 class OgnTutorialRoleData 55 { 56 public: 57 static bool compute(OgnTutorialRoleDataDatabase& db) 58 { 59 // The roles for the attributes only serve to guide how to interpret them. When accessed from the 60 // database they take the form of their raw underlying type. For example a point3d will have the 61 // same GfVec3d type as a double[3], as will a vector3d and a normal3d. 62 63 // Keep track if any role errors were found with this, continuing to the end of evaluation after errors 64 bool foundAnyErrors{ false }; // Toggled on as soon as any error is found 65 bool foundError{ false }; // Toggled off and on for each attribute 66 67 // Walk through all of the data types, using the macro to perform error checking 68 ComputeOne(a_color3d, increment3d, AttributeRole::eColor); 69 ComputeOne(a_color3f, increment3f, AttributeRole::eColor); 70 ComputeOne(a_color3h, increment3h, AttributeRole::eColor); 71 // 72 ComputeOne(a_color4d, increment4d, AttributeRole::eColor); 73 ComputeOne(a_color4f, increment4f, AttributeRole::eColor); 74 ComputeOne(a_color4h, increment4h, AttributeRole::eColor); 75 // 76 ComputeOne(a_frame, incrementM4d, AttributeRole::eFrame); 77 // 78 ComputeOne(a_matrix2d, incrementM2d, AttributeRole::eMatrix); 79 ComputeOne(a_matrix3d, incrementM3d, AttributeRole::eMatrix); 80 ComputeOne(a_matrix4d, incrementM4d, AttributeRole::eMatrix); 81 // 82 ComputeOne(a_normal3d, increment3d, AttributeRole::eNormal); ```cpp ComputeOne(a_normal3f, increment3f, AttributeRole::eNormal); ComputeOne(a_normal3h, increment3h, AttributeRole::eNormal); // ComputeOne(a_point3d, increment3d, AttributeRole::ePosition); ComputeOne(a_point3f, increment3f, AttributeRole::ePosition); ComputeOne(a_point3h, increment3h, AttributeRole::ePosition); // ComputeOne(a_quatd, incrementQd, AttributeRole::eQuaternion); ComputeOne(a_quatf, incrementQf, AttributeRole::eQuaternion); ComputeOne(a_quath, incrementQh, AttributeRole::eQuaternion); // ComputeOne(a_texcoord2d, increment2d, AttributeRole::eTexCoord); ComputeOne(a_texcoord2f, increment2f, AttributeRole::eTexCoord); ComputeOne(a_texcoord2h, increment2h, AttributeRole::eTexCoord); // ComputeOne(a_texcoord3d, increment3d, AttributeRole::eTexCoord); ComputeOne(a_texcoord3f, increment3f, AttributeRole::eTexCoord); ComputeOne(a_texcoord3h, increment3h, AttributeRole::eTexCoord); // ComputeOne(a_timecode, 1.0, AttributeRole::eTimeCode); // ComputeOne(a_vector3d, increment3d, AttributeRole::eVector); ComputeOne(a_vector3f, increment3f, AttributeRole::eVector); ComputeOne(a_vector3h, increment3h, AttributeRole::eVector); return foundAnyErrors; } }; REGISTER_OGN_NODE() ``` ## Role-Based Attribute Access Here is a subset of the generated role-based attributes from the database. It contains color attributes, a matrix attribute, and a timecode attribute. Notice how the underlying data types of the attributes are provided, again with the ability to cast to different interface classes with the same memory layout. | Database Function | Returned Type | |-------------------|---------------| | | | | inputs.a_color3d() | const GfVec3d& | |---------------------|----------------| | inputs.a_color4f() | const GfVec4f& | | inputs.a_frame() | const GfMatrix4d& | | inputs.a_timecode()| const double& | | outputs.a_color3d()| GfVec3d& | | outputs.a_color4f()| GfVec4f& | | outputs.a_frame() | GfMatrix4d& | | outputs.a_timecode()| double& | The full set of corresponding data types can be found in omni.graph.docs.ogn_attribute_roles. This role information is available on all attribute interfaces through the `role()` method. For example you can find that the first attribute is a color by making this check: ```c++ static bool compute(OgnTutorialRoleDataDatabase& db) { if (db.inputs.a_color3d.role == eColor) { processValueAsAColor( db.inputs.a_color3d() ); } } ```
21,588
tutorial8.md
# Tutorial 8 - GPU Data Node The GPU data node creates various attributes for use in a CUDA-based GPU compute. Several representative types are used, though the list of potential attribute types is not exhaustive. See omni.graph.docs.ogn_attribute_types for the full list. This node also introduces the notion of attribute typedefs; a useful concept when passing data around in functions. ## OgnTutorialCudaData.ogn The ogn file shows the implementation of a node named “omni.graph.tutorials.CudaData”, which has inputs and outputs of various types to use in various computations. Three different CUDA methods are created to show how each of the types is passed through to the GPU and used by CUDA. ```json { "CudaData": { "version": 1, "categories": "tutorials", "scheduling": ["threadsafe"], "memoryType": "cuda", "description": [ "This is a tutorial node. It performs different functions on the GPU to illustrate different types of", "data access. The first adds inputs 'a' and 'b' to yield output 'sum', all of which are on the GPU.", "The second is a sample expansion deformation that multiplies every point on a set of input points,", "stored on the GPU, by a constant value, stored on the CPU, to yield a set of output points, also on the GPU.", "The third is an assortment of different data types illustrating how different data is passed to the GPU.", "This particular node uses CUDA for its GPU computations, as indicated in the memory type value.", "Normal use case for GPU compute is large amounts of data. For testing purposes this node only handles", "a very small amount but the principle is the same." ], "metadata": { "uiName": "Tutorial Node: Attributes With CUDA Data" }, "inputs": { "a": { "type": "float" } } } } ``` 24. "description": ["First value to be added in algorithm 1"], 25. "default": 0.0 26. }, 27. "b": { 28. "type": "float", 29. "description": ["Second value to be added in algorithm 1"], 30. "default": 0.0 31. }, 32. "points": { 33. "type": "float[3][]", 34. "description": ["Points to be moved by algorithm 2"], 35. "default": [] 36. }, 37. "multiplier": { 38. "type": "float[3]", 39. "memoryType": "cpu", 40. "description": ["Amplitude of the expansion for the input points in algorithm 2"], 41. "default": [1.0, 1.0, 1.0] 42. }, 43. "half": { 44. "type": "half", 45. "description": ["Input of type half for algorithm 3"], 46. "default": 1.0 47. }, 48. "color": { 49. "type": "colord[3]", 50. "description": ["Input with three doubles as a color for algorithm 3"], 51. "default": [1.0, 0.5, 1.0] 52. }, 53. "matrix": { 54. "type": "matrixd[4]", 55. "description": ["Input with 16 doubles interpreted as a double-precision 4d matrix"], 56. "default": [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]] 57. } 58. }, 59. "outputs": { 60. "sum": { 61. "type": "float", 62. "description": ["Sum of the two inputs from algorithm 1"] 63. }, 64. "points": { 65. "type": "float[3][]", "description": ["Final positions of points from algorithm 2"] "half": { "type": "half", "description": ["Output of type half for algorithm 3"] }, "color": { "type": "colord[3]", "description": ["Output with three doubles as a color for algorithm 3"] }, "matrix": { "type": "matrixd[4]", "description": ["Output with 16 doubles interpreted as a double-precision 4d matrix"] } "$why": "By putting inputs but no outputs in tests I can run the compute without failing on extraction" "tests": [ { "inputs:a": 1.0, "inputs:b": 2.0, "inputs:half": 1.0, "inputs:color": [0.5, 0.6, 0.7], "inputs:matrix": [ [1.0, 2.0, 3.0, 4.0], [2.0, 3.0, 4.0, 5.0], [3.0, 4.0, 5.0, 6.0], [4.0, 5.0, 6.0, 7.0] ], "inputs:points": [ [1.0, 2.0, 3.0], [2.0, 3.0, 4.0] ], "inputs:multiplier": [2.0, 3.0, 4.0] } ], "$tests_disabled_until_gpu_data_extraction_works": [ { "inputs:a": 1.0, "inputs:b": 2.0, "outputs:sum": 3.0 }, { "inputs:a": 5.0, "inputs:b": 3.0, "outputs:sum": 8.0 }, { "inputs:half": 1.0, "outputs:half": 2.0, "inputs:color": [0.5, 0.6, 0.7], "outputs:color": [0.5, 0.4, 0.3], "inputs:matrix": [ [1.0, 2.0, 3.0, 4.0], [2.0, 3.0, 4.0, 5.0], [3.0, 4.0, 5.0, 6.0], [4.0, 5.0, 6.0, 7.0] ] } ] ```json { "outputs:matrix": [ [30.0, 40.0, 50.0, 60.0], [40.0, 54.0, 68.0, 82.0], [50.0, 68.0, 86.0, 104.0], [60.0, 82.0, 104.0, 126.0] ], "inputs:points": [ [1.0, 2.0, 3.0], [2.0, 3.0, 4.0] ], "inputs:multiplier": [ 2.0, 3.0, 4.0 ], "outputs:points": [ [2.0, 6.0, 12.0], [4.0, 9.0, 16.0] ] } ``` # OgnTutorialCudaData.cpp The cpp file contains the implementation of the compute method, which in turn calls the three CUDA algorithms. ```c++ // Copyright (c) 2020-2024, NVIDIA CORPORATION. All rights reserved. // // NVIDIA CORPORATION and its licensors retain all intellectual property // and proprietary rights in and to this software, related documentation // and any modifications thereto. Any use, reproduction, disclosure or // distribution of this software and related documentation without an express // license agreement from NVIDIA CORPORATION is strictly prohibited. // #include <omni/graph/core/GpuArray.h> #include <OgnTutorialCudaDataDatabase.h> // This function exercises referencing simple data types on the GPU, something you normally wouldn't do as // there is no efficiency gain in doing that versus just passing in the CPU value. extern "C" void applyAddGPU(outputs::sum_t sum, inputs::a_t a, inputs::b_t b); // This function exercises referencing of array data on the GPU. // The CUDA code takes its own "float3" data types, which are castable equivalents to the generated GfVec3f. // The GpuArray/ConstGpuArray wrappers isolate the GPU pointers from the CPU code. extern "C" void applyDeformationGPU(outputs::points_t outputPoints, inputs::points_t inputPoints, inputs::multiplier_t multiplier, size_t numberOfPoints); // This function exercises referencing non-standard data types on the GPU to illustrate how data of different // types are passed to the GPU. extern "C" void applyDataTypes(outputs::half_t halfOutput, outputs::color_t colorOutput, outputs::matrix_t matrixOutput, inputs::half_t halfInput, inputs::color_t colorInput, inputs::matrix_t matrixInput); ``` ```c++ // This node runs a couple of algorithms on the GPU, while accessing parameters from the CPU class OgnTutorialCudaData { public: static bool compute(OgnTutorialCudaDataDatabase& db) { // ================ algorithm 1 ========================================================= // It's an important distinction here that GPU data is always returned as raw pointers since the CPU code // in the node cannot directly access it. The raw pointers are passed into the GPU code for dereferencing. applyAddGPU(db.outputs.sum(), db.inputs.a(), db.inputs.b()); // ================ algorithm 2 ========================================================= size_t numberOfPoints = db.inputs.points.size(); db.outputs.points.resize(numberOfPoints); const auto& multiplier = db.inputs.multiplier(); if (numberOfPoints > 0) { applyDeformationGPU(db.outputs.points(), db.inputs.points(), multiplier, numberOfPoints); } // ================ algorithm 3 ========================================================= applyDataTypes(db.outputs.half(), db.outputs.color(), db.outputs.matrix(), db.inputs.half(), db.inputs.color(), db.inputs.matrix()); return true; } }; REGISTER_OGN_NODE() ``` ## OgnTutorialCudaData_CUDA.cu The `cu` file contains the implementation of the algorithms on the GPU using CUDA. ```c++ // Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. // // NVIDIA CORPORATION and its licensors retain all intellectual property // and proprietary rights in and to this software, related documentation // and any modifications thereto. Any use, reproduction, disclosure or // distribution of this software and related documentation without an express // license agreement from NVIDIA CORPORATION is strictly prohibited. // #include <OgnTutorialCudaDataDatabase.h> // ====================================================================== // CUDA compute implementation code will usually have two methods; // xxxGPU() - Host function to act as an intermediary between CPU and GPU code // xxxCUDA() - CUDA implementation of the actual node algorithm. // ====================================================================== // Algorithm 1 support - add two values together. // Note how the generated typedefs are used to make declarations easier. // On the CUDA side the types are different than what you'd see on the CPU side. // e.g. a CPU type of GfVec3f appears in CUDA as float3. __global__ void applyAddCUDA(outputs::sum_t output, inputs::a_t a, inputs::b_t b) ``` ```c { *output = *a + *b; } extern "C" void applyAddGPU(outputs::sum_t output, inputs::a_t a, inputs::b_t b) { // Launch the GPU code - only a single thread and block is needed since this is a single set of data applyAddCUDA<<<1, 1>>>(output, a, b); } // ====================================================================== // Algorithm 2 support - apply the multiplier to "inputPoints" to yield "outputPoints" __global__ void applyDeformationCUDA( outputs::points_t outputPoints, inputs::points_t inputPoints, inputs::multiplier_t multiplier, size_t numberOfPoints ) { // Make sure the current evaluation block is in range of the available points int currentPointIndex = blockIdx.x * blockDim.x + threadIdx.x; if (numberOfPoints <= currentPointIndex) return; // Apply the multiplier to the current points (*outputPoints)[currentPointIndex].x = (*inputPoints)[currentPointIndex].x * multiplier.x; (*outputPoints)[currentPointIndex].y = (*inputPoints)[currentPointIndex].y * multiplier.y; (*outputPoints)[currentPointIndex].z = (*inputPoints)[currentPointIndex].z * multiplier.z; } // CPU interface called from OgnTutorialCudaData::compute, used to launch the GPU workers. // "numberOfPoints" is technically redundant since it's equal to inputPoints.size(), however that call // is only available on the __device__ (GPU) side and the value is needed in the calculation of the // number of blocks required here on the __host__ (CPU) side so it's better to pass it in. extern "C" void applyDeformationGPU( outputs::points_t outputPoints, inputs::points_t inputPoints, inputs::multiplier_t& multiplier, // Using a ref here gives a matching type for CPU-side data size_t numberOfPoints ) { // Split the work into 256 threads, an arbitrary number that could be more precisely tuned when necessary const int numberOfThreads = 256; ``` ```c++ // Block size is the number of points that fit into each of the threads const int numberOfBlocks = (numberOfPoints + numberOfThreads - 1) / numberOfThreads; // Launch the GPU deformation using the calculated number of threads and blocks applyDeformationCUDA<<<numberOfBlocks, numberOfThreads>>>(outputPoints, inputPoints, multiplier, numberOfPoints); } // ====================================================================== // Algorithm 3 support - simple manipulation of an input to yield the similarly named output. // Typedefs are used to make declaration simple - the actual CUDA types are in the comment beside the attribute name. __global__ void applyDataTypesCUDA( outputs::half_t halfOutput, // __half outputs::color_t colorOutput, // double3 outputs::matrix_t matrixOutput, // Matrix4d inputs::half_t halfInput, // const __half inputs::color_t colorInput, // const double3 inputs::matrix_t matrixInput // const Matrix4d ) { // half and color values are doubled *halfOutput = __hadd(*halfInput, *halfInput); *colorOutput = *colorInput + *colorInput; // matrix value is squared *matrixOutput = *matrixInput; *matrixOutput *= *matrixInput; } extern "C" void applyDataTypes( outputs::half_t halfOutput, outputs::color_t colorOutput, outputs::matrix_t matrixOutput, inputs::half_t halfInput, inputs::color_t colorInput, inputs::matrix_t matrixInput ) { // Launch the GPU code - only a single thread and block is needed since this is a single set of data applyDataTypesCUDA<<<1, 1>>>(halfOutput, colorOutput, matrixOutput, halfInput, colorInput, matrixInput); } ``` ## GPU Attribute Access Here is the set of generated attributes from the database. The attributes living on the GPU return pointers to memory as the CPU side cannot dereference it into its actual type (e.g. a `float` value, which would be returned as a `float&` on the CPU side is returned instead as a `float*` on the GPU side.) In addition, when calling into CUDA code the data changes type as it crosses the GPU boundary. On the CUDA side it uses the CUDA native data types when it can, which are bytewise compatible with their CPU counterparts. Note that in the case of the CPU attribute *multiplier* the data is passed to the CUDA code by value, since it has to be copied from CPU to GPU. | Database Function | Is GPU? | CPU Type | CUDA Type | |-------------------|---------|-------------------|--------------------| | inputs.a() | Yes | const float* | const float* | | inputs.b() | Yes | const float* | const float* | | outputs.sum() | Yes | float* | float* | | inputs.half() | Yes | const pxr::GfHalf* | __half* | | outputs.half() | Yes | pxr::GfHalf* | __half* | | inputs.color() | Yes | const GfVec3d* | const double3* | | outputs.color() | Yes | GfVec3d* | double3* | | inputs.matrix() | Yes | const GfMatrix4d* | const Matrix4d* | | outputs.matrix() | Yes | GfMatrix4d* | Matrix4d* | | inputs.multiplier() | No | const GfVec3f&amp; | const float3 | | inputs.points() | Yes | const GfVec3f* | const float3** | | outputs.points() | Yes | GfVec3f* | float3** | The array attribute *points* does not have an array-like wrapper as the CUDA code would rather deal with raw pointers. In order to provide the size information, when calling the CUDA code the value `inputs.points.size()` should also be passed in. Notice the subtle difference in types on the CPU side for GPU-based data. Instead of references to data there are pointers, necessary since the data lives in a different memory-space, and all pointers have an extra level of indirection for the same reason. There is also a section of this generated file dedicated to information relevant to the CUDA code. In this section the CUDA attribute data types are defined. It is protected with `#ifdef __CUDACC__` so that it is only processed when included through the CUDA compiler (and vice versa, so none of the other setup code will be processed on the CUDA side). ```cpp #include &lt;cuda_fp16.h&gt; #include &lt;omni/graph/core/cuda/CUDAUtils.h&gt; #include &lt;omni/graph/core/cuda/Matrix4d.h&gt; namespace OgnTutorialCudaDataCudaTypes { namespace inputs { using a_t = const float*; using b_t = const float*; using points_t = const float3**; using multiplier_t = const float3*; ```c++ using half_t = const __half*; using color_t = const double3*; using matrix_t = const Matrix4d*; } namespace outputs { using sum_t = float*; using points_t = float3**; using half_t = __half*; using color_t = double3*; using matrix_t = Matrix4d*; } } using namespace OgnTutorialCudaDataCudaTypes; ``` Notice the inclusion of the file `cuda_fp16.h`, needed due to the use of the CUDA type `__half`, and the files `omni/graph/core/cuda/CUDAUtils.h` and `omni/graph/core/cuda/Matrix4d.h`, which provide support functions for CUDA math. The data types used by CUDA are compatible with their equivalents on the C++ side, so you can specify passing arguments into CUDA from C++ by using a declaration such as this on the C++ side: ```c++ // In this code "inputs::points_t" is the type "GfVec3f*". // The size of that array must be passed in as well since it is not implicit in the data type. extern "C" void cudaCompute( inputs::points_t*, size_t pointSize, inputs::multiplier_t*, outputs::points_t* ); ``` which corresponds to this function defined in the .cu file: ```c++ // In this code "inputs::points_t" is the type "float3*" extern "C" void cudaCompute( inputs::points_t* inPoints, size_t pointSize, inputs::multiplier_t* multiplier, outputs::points_t* outPoints ) {...} ``` Pointers are used in the calls rather than being part of the type definitions in order to emphasize the fact that the values passed through are pointers to the real data in the fabric, which in this case is data in GPU memory.
17,492
tutorial9.md
# Tutorial 9 - Runtime CPU/GPU Decision The CPU/GPU data node creates various attributes for use in a CUDA-based GPU compute or a CPU-based compute, where the decision of which to use is made at runtime rather than compile time. A few representative types are used, though the list of potential attribute types is not exhaustive. See [omni.graph.docs.ogn_attribute_types](Redirects.html#zzogn-attribute-types) for the full list. ## OgnTutorialCpuGpuData.ogn The `ogn` file shows the implementation of a node named “omni.graph.tutorials.CpuGpuData”, which has attributes whose memory type is determined at runtime by the input named `isGPU`. The algorithm of the node is implemented in CUDA, but in such a way that it can run on either the CPU or the GPU, depending on where the attribute data lives. ```json { "CpuGpuData": { "version": 1, "categories": "tutorials", "memoryType": "any", "description": [ "This is a tutorial node. It illustrates how to access data whose memory location, CPU or GPU, is determined at runtime in the compute method. The data types are the same as for the purely CPU and purely GPU tutorials, it is only the access method that changes. The input 'is_gpu' determines where the data of the other attributes can be accessed." ], "metadata": { "uiName": "Tutorial Node: Attributes With CPU/GPU Data" }, "inputs": { "is_gpu": { "type": "bool", "memoryType": "cpu", "description": ["Runtime switch determining where the data for the other attributes lives."], "default": false }, "a": { ... } } } } ```json { "a": { "type": "float", "description": ["First value to be added in algorithm 1"], "default": 0.0 }, "b": { "type": "float", "description": ["Second value to be added in algorithm 1"], "default": 0.0 }, "points": { "type": "float[3][]", "description": ["Points to be moved by algorithm 2"], "default": [] }, "multiplier": { "type": "float[3]", "description": ["Amplitude of the expansion for the input points in algorithm 2"], "default": [1.0, 1.0, 1.0] }, "outputs": { "sum": { "type": "float", "description": ["Sum of the two inputs from algorithm 1"] }, "points": { "type": "float[3][]", "description": ["Final positions of points from algorithm 2"] } }, "tests": [ { "inputs:is_gpu": false, "inputs:a": 1.0, "inputs:b": 2.0, "outputs:sum": 3.0 }, { "inputs:is_gpu": false, "inputs:a": 5.0, "inputs:b": 3.0, "outputs:sum": 8.0 }, { "inputs:is_gpu": false, "inputs:points": [[1.0, 2.0, 3.0], [2.0, 3.0, 4.0]], "inputs:multiplier": [2.0, 3.0, 4.0], "outputs:points": [[2.0, 6.0, 12.0], [4.0, 9.0, 16.0]] } ] } ``` ```json { "tests": [ { "inputs:is_gpu": true, "inputs:a": 1.0, "inputs:b": 2.0, "inputs:points": [ [1.0, 2.0, 3.0], [2.0, 3.0, 4.0] ], "inputs:multiplier": [2.0, 3.0, 4.0] } ], "$why_disabled": "GPU extraction is not yet implemented so for those tests only inputs are provided", "$tests_disabled_until_gpu_data_extraction_works": [ { "inputs:is_gpu": true, "inputs:a": 1.0, "inputs:b": 2.0, "outputs:sum": 3.0, "gpu": ["outputs:sum"] }, { "inputs:is_gpu": true, "inputs:a": 5.0, "inputs:b": 3.0, "outputs:sum": 8.0, "gpu": ["outputs:sum"] }, { "inputs:is_gpu": true, "inputs:points": [ [1.0, 2.0, 3.0], [2.0, 3.0, 4.0] ], "inputs:multiplier": [2.0, 3.0, 4.0], "outputs:points": [ [2.0, 6.0, 12.0], [4.0, 9.0, 16.0] ], "gpu": ["outputs:points"] } ] } ``` # OgnTutorialCpuGpuData.cpp The **cpp** file contains the implementation of the compute method, which checks the value of the **isGPU** attribute and then extracts the data of the specified type to pass to the algorithm in the .cu file. ```c++ // Copyright (c) 2020-2024, NVIDIA CORPORATION. All rights reserved. // // NVIDIA CORPORATION and its licensors retain all intellectual property // and proprietary rights in and to this software, related documentation // and any modifications thereto. Any use, reproduction, disclosure or // distribution of this software and related documentation without an express // license agreement from NVIDIA CORPORATION is strictly prohibited. // #include <OgnTutorialCpuGpuDataDatabase.h> // This helper file keeps the GPU and CPU functions organized for easy access. // It's only for illustration purposes; you can choose to organize your functions any way you wish. // The first algorithm is a simple add, to illustrate passing non-array types. extern "C" void cpuGpuAddCPU(outputs::sum_t_cpu, inputs::a_t_cpu, inputs::b_t_cpu, size_t); ``` 16. extern "C" void cpuGpuAddGPU(outputs::sum_t_gpu, inputs::a_t_gpu, inputs::b_t_gpu); 17. 18. // The second algorithm shows the more common case of accessing array data. 19. extern "C" void cpuGpuMultiplierCPU(outputs::points_t_gpu, inputs::multiplier_t_gpu, inputs::points_t_gpu, size_t); 20. extern "C" void cpuGpuMultiplierGPU(outputs::points_t_gpu, inputs::multiplier_t_gpu, inputs::points_t_gpu, size_t); 21. 22. class OgnTutorialCpuGpuData 23. { 24. public: 25. static bool compute(OgnTutorialCpuGpuDataDatabase& db) 26. { 27. // Computing the size of the output is independent of CPU/GPU as the size update is lazy and will happen 28. // when the data is requested from the fabric. 29. size_t numberOfPoints = db.inputs.points.size(); 30. db.outputs.points.resize(numberOfPoints); 31. 32. // Use the runtime input to determine where the calculation should take place. 33. // 34. // Another helpful use of this technique is to first measure the size of data being evaluated and 35. // if it meets a certain minimum threshold move the calculation to the GPU. 36. if (db.inputs.is_gpu()) 37. { 38. cpuGpuAddGPU(db.outputs.sum.gpu(), db.inputs.a.gpu(), db.inputs.b.gpu()); 39. 40. // GPU data is just raw pointers so the size must be passed down to the algorithm 41. cpuGpuMultiplierGPU( 42. db.outputs.points.gpu(), db.inputs.multiplier.gpu(), db.inputs.points.gpu(), numberOfPoints); 43. } 44. else 45. { 46. // CPU version calls the shared CPU/GPU algorithm directly. This could also be implemented in the 47. // CUDA file as an extern "C" function but it is so simple that this is easier. 48. cpuGpuAddCPU(db.outputs.sum.cpu(), db.inputs.a.cpu(), db.inputs.b.cpu(), 0); 49. 50. // Extract the CPU data and iterate over all of the points, calling the shared deformation algorithm. 51. // The data is passed through as raw CUDA-compatible bytes so that the deformation algorithm can live 52. // all in one file. If the code were all on the CPU side then the data types could be used as regular 53. // arrays, as showing in the tutorial on array data types. 54. auto rawOutputPoints = db.outputs.points.cpu().data(); ```cpp // Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. // // NVIDIA CORPORATION and its licensors retain all intellectual property // and proprietary rights in and to this software, related documentation // and any modifications thereto. Any use, reproduction, disclosure or // distribution of this software and related documentation without an express // license agreement from NVIDIA CORPORATION is strictly prohibited. // #include <OgnTutorialCpuGpuDataDatabase.h> // ====================================================================== // This set of methods is one way of efficiently implementing an algorithm to run on either CPU or GPU: // xxxCPU() - Looping over all inputs to call the node algorithm // xxxGPU() - Host function to launch the kernel to run the node algorithm // xxxCUDA() - Run the algorithm on the block of data in the kernel // xxx() - Implementation of the actual node algorithm // // This minimizes the code duplication by keeping the node algorithm in a shared location. The tradeoff is that // it is restricted to data types that CUDA understands, though for practical purposes since the algorithm must // run on the GPU this isn't restrictive at all. // // One thing to be careful of is when you are passing arrays of CPU data to a GPU function. Data can only be passed // from the CPU to the GPU by value, which for simple types is the default since the data type will be something // like "float", not "float&amp;" or "float*". However when the CPU data is an array it has to first be copied to the // GPU using something like cudaMalloc/cudaMemcpy/cudaFree. While possible, this is very inefficient. It is better // to specify that the attribute be always on the gpu, or that the decision is made at runtime, so that the // GPU conversion can be handled automatically. // // ====================================================================== // Algorithm 1 support - add two values together (something so trivial you would never use the GPU for it; here for // illustrative purposes only) // namespace { __device__ __host__ void cpuGpuAdd(float* sum, float const* a, float const* b, size_t i) { sum[i] = a[i] + b[i]; } // CUDA kernel that runs the addition algorithm on the block value __global__ void cpuGpuAddCUDA(outputs::sum_t sum, inputs::a_t a, inputs::b_t b) { // Make sure the current evaluation block is in range of the available points size_t i = blockIdx.x * blockDim.x + threadIdx.x; } ``` ```c if (1 < i) return; cpuGpuAdd(sum, a, b, i); } } // GPU kernel launcher extern "C" void cpuGpuAddGPU(outputs::sum_t sum, inputs::a_t a, inputs::b_t b) { // Launch the GPU deformation using the minimum number of threads and blocks cpuGpuAddCUDA<<<1, 1>>>(sum, a, b); } // CPU version of the algorithm extern "C" void cpuGpuAddCPU(float& sum, float const& a, float const& b, size_t i) { cpuGpuAdd(&sum, &a, &b, i); } // ====================================================================== // Algorithm 2 support - multiply every point in an array by a constant vector // namespace { // The shared algorithm applies the multiplier to the current point extern "C" __device__ __host__ void cpuGpuMultiplier( outputs::points_t outputPoints, inputs::multiplier_t multiplier, inputs::points_t inputPoints, size_t currentPointIndex) { (*outputPoints)[currentPointIndex].x = (*inputPoints)[currentPointIndex].x * multiplier->x; (*outputPoints)[currentPointIndex].y = (*inputPoints)[currentPointIndex].y * multiplier->y; (*outputPoints)[currentPointIndex].z = (*inputPoints)[currentPointIndex].z * multiplier->z; } // The CUDA kernel applies the deformation algorithm to the point under its control __global__ void cpuGpuMultiplierCUDA( outputs::points_t outputPoints, inputs::multiplier_t multiplier, inputs::points_t inputPoints, size_t currentPointIndex) { // Implementation of the CUDA kernel } } ``` ```cpp void cpuGpuMultiplier(outputs::points_t outputPoints, inputs::multiplier_t multiplier, inputs::points_t inputPoints, size_t i) { // Apply the deformation to the point outputPoints[i] = multiplier * inputPoints[i]; } void cpuGpuMultiplierCPU(outputs::points_t outputPoints, inputs::multiplier_t multiplier, inputs::points_t inputPoints, size_t numberOfPoints) { for (size_t i = 0; i < numberOfPoints; i++) { cpuGpuMultiplier(outputPoints, multiplier, inputPoints, i); } } void cpuGpuMultiplierGPU(outputs::points_t outputPoints, inputs::multiplier_t multiplier, inputs::points_t inputPoints, size_t numberOfPoints) { const int numberOfThreads = 256; const int numberOfBlocks = (numberOfPoints + numberOfThreads - 1) / numberOfThreads; // Launch the GPU deformation using the calculated number of threads and blocks cpuGpuMultiplierCUDA<<<numberOfBlocks, numberOfThreads>>>(outputPoints, multiplier, inputPoints, numberOfPoints); } ``` ## CPU/GPU Attribute Access Here is how the attribute values are returned from the database. Up until now the attribute name has sufficed as the database member that accesses the value through its `operator()`. The addition of the runtime switch of memory locations is facilitated by the addition of the `gpu()` and `cpu()` members. ``` | CPU Function | CPU Type | GPU Function | GPU Type | CUDA Type | |--------------|----------|-------------|----------|-----------| | inputs.a.cpu() | const float& | inputs.a_t_gpu | const float* | const float* | | inputs.b.cpu() | const float& | inputs.b.gpu() | const float* | const float* | | outputs.sum.cpu() | float& | outputs.sum.gpu() | float* | float* | | inputs.multiplier.cpu() | const GfVec3f& | inputs.multiplier.gpu() | const GfVec3f* | const float3 | | inputs.points.cpu() | const GfVec3f* | inputs.points.gpu() | const GfVec3f** | const float3** | | outputs.points.cpu() | GfVec3f* | outputs.points.gpu() | const GfVec3f** | float3** | ## Type Information As there are three different potential types for each attribute when it varies location at runtime (CPU, CPU being passed to GPU, and GPU) there are extra types introduced in order to handle each of them. The CUDA types are handled as before, but on the CPU side there are extra types for the data being passed from the CPU to the GPU. | CPU Type Method | CPU Data Type | GPU Type Method | GPU Data Type | |-----------------|---------------|----------------|---------------| | inputs::a_t | const float& | inputs::a_t_gpu | const float* | | inputs::b_t | const float& | inputs::b_t_gpu | const float* | | outputs::sum_t | float& | outputs::sum_t_gpu | float* | | inputs::multiplier_t | const GfVec3f& | inputs::multiplier_t_gpu | const GfVec3f* | | inputs::points_t | const GfVec3f* | inputs::points_t_gpu | const GfVec3f** | | outputs::points_t | GfVec3f* | outputs::points_t_gpu | const GfVec3f** | On the C++ side the functions defined in the CUDA file are declared as: ```cpp extern "C" void cpuGpuMultiplierCPU(outputs::points_t, inputs::multiplier_t, inputs::points_t, size_t); extern "C" void cpuGpuMultiplierGPU(outputs::points_t_gpu, inputs::multiplier_t_gpu, inputs::points_t_gpu, size_t); ``` The addition of the **_gpu** suffix mostly adds an extra layer of indirection to the values, since they exist in the GPU memory namespace. Care must be taken to call the correct version with the correctly extracted data: ```c++ if (db.inputs.is_gpu()) { cpuGpuMultiplierGPU( db.outputs.points.gpu(), db.inputs.multiplier.gpu(), db.inputs.points.gpu(), numberOfPoints ); } else { // Note how array data is extracted in its raw form for passing to the function on the CUDA side. // This would be unnecessary if the implementation were entirely on the CPU side. cpuGpuMultiplierCPU( db.outputs.points.cpu().data(), db.inputs.multiplier.cpu(), db.inputs.points.cpu().data(), numberOfPoints ); } ``` On the CUDA side the function definitions use the existing CUDA types, so their signatures are: ```c++ extern "C" void cpuGpuMultiplierCPU(outputs::points_t, inputs::multiplier_t, inputs::points_t, size_t); extern "C" void cpuGpuMultiplierGPU(outputs::points_t, inputs::multiplier_t, inputs::points_t, size_t); ```
16,141
tutorials_index.md
# Omni Asset Validator (Tutorial) ## Introduction `Omniverse Asset Validator` is an extensible framework to validate [USD](https://graphics.pixar.com/usd/release/index.html). Initially inspired from [Pixar Compliance Checker](https://graphics.pixar.com/usd/release/toolset.html#usdchecker), extends upon these ideas and adds more validation rules applicable throughout Omniverse, as well as adding the ability to automatically fix issues. Currently, there are two main components: - **Omni Asset Validator (Core)**: Core components for Validation engine. Feel free to use this component to implement programmatic functionality or extend Core functionality through its framework. - **Omni Asset Validator (UI)**: Convenient UI for Omniverse. Used for daily tasks with Omniverse tools as Create. The following tutorial will help you to: - Run basic operations for Asset Validator, `ValidationEngine` and `IssueFixer`. - Get familiar with existing Rules to diagnose and fix problems. - Create your custom Rules. ## Tutorials ### Testing assets In order to run Asset Validator, we need to enable the extension `Omni asset validator (Core)`. Optionally we can also enable `Omni asset validator (UI)` to perform similar operations using the user interface. Through this tutorial we will use `Script Editor`, enable it under the `Window` menu. The following tutorial uses the file `BASIC_TUTORIAL_PATH` which is bundled together with `omni.asset_validator.core`. We can see its contents with the following snippet: ```python import omni.asset_validator.core from pxr import Usd stage = Usd.Stage.Open(omni.asset_validator.core.BASIC_TUTORIAL_PATH) ``` we invoked all rules available. ``` ```html <code class="docutils literal notranslate"> <span class="pre"> ValidationRulesRegistry has a registry of all rules to be used by ``` ```html <code class="docutils literal notranslate"> <span class="pre"> ValidationEngine . ``` ```python import omni.asset_validator.core for category in omni.asset_validator.core.ValidationRulesRegistry.categories(): for rule in omni.asset_validator.core.ValidationRulesRegistry.rules(category=category): print(rule.__name__) ``` ```markdown If we want to have finer control of what we can execute, we can also specify which rules to run, for example: ``` ```python import omni.asset_validator.core engine = omni.asset_validator.core.ValidationEngine(initRules=False) engine.enableRule(omni.asset_validator.core.OmniDefaultPrimChecker) print(engine.validate(omni.asset_validator.core.BASIC_TUTORIAL_PATH)) ``` ```markdown There are two new elements present here: ``` ```markdown - `initRules`: By default set to `true`. if set to `false`, no rules will be automatically loaded. - `enableRule`: A method of `ValidationEngine` to add rules. ``` ```markdown The above would produce the following result: ``` ```python Results( asset="C:\some\location\exts\omni.asset_validator.core\omni\asset_validator\core\resources\tutorial.usda", issues=[ Issue( message="Stage has missing or invalid defaultPrim.", severity=IssueSeverity.FAILURE, rule=OmniDefaultPrimChecker, at=StageId( identifier="C:\some\location\exts\omni.asset_validator.core\omni\asset_validator\core\resources\tutorial.usda" ), suggestion=Suggestion( callable=UpdateDefaultPrim, message="Updates the default prim" ) ) ] ) ``` ```markdown In this particular case, `OmniDefaultPrimChecker` has implemented a suggestion for this specific issue. The second important class in `Core` we want to cover is `IssueFixer`, the way to invoke it is quite straightforward. ``` ```python import omni.asset_validator.core fixer = omni.asset_validator.core.IssueFixer(asset=omni.asset_validator.core.BASIC_TUTORIAL_PATH) fixer.fix([]) ``` ```markdown `fixer.fix` will receive the list of issues that should be addressed. The list of issues to address can be accessed through `issues` method in `Results` class. ``` ```markdown Note For more information about IssueFixer see IssueFixer API. ``` ```markdown By combining the previous two examples we can now, detect and fix issues for a specific rule. ``` ```python import omni.asset_validator.core # Detect issues engine = omni.asset_validator.core.ValidationEngine(initRules=False) engine.enableRule(omni.asset_validator.core.OmniDefaultPrimChecker) result = engine.validate(omni.asset_validator.core.BASIC_TUTORIAL_PATH) # Fix issues fixer = omni.asset_validator.core.IssueFixer(asset=omni.asset_validator.core.BASIC_TUTORIAL_PATH) ``` ```markdown ```python fixer.fix(result.issues()) ``` !!! warning In this tutorial we do temporary changes. To persist your changes uses `fixer.save()`. If we inspect the file `BASIC_TUTORIAL_PATH`: ```python import omni.asset_validator.core from pxr import Usd stage = Usd.Stage.Open(omni.asset_validator.core.BASIC_TUTORIAL_PATH) print(stage.ExportToString()) ``` We can find the issue reported by `OmniDefaultPrimChecker` is fixed: ```usda #usda 1.0 ( defaultPrim="Hello" doc="""Generated from Composed Stage of root layer C:\\some\\location\exts\\omni.asset_validator.core\\omni\\asset_validator\\core\\resources\\tutorial.usda""" ) def Xform "Hello" { def Sphere "World" { } } ``` !!! note Try to repeat the same steps using the UI. ## Custom Rule: Detection If the shipped rules are not enough for your needs you can also implement your own rule. `ValidationEngine` allows to be extensible, by levering users to add its own rules. To add a new rule extend from `BaseRuleChecker`. The most simple code to achieve this is as follows: ```python import omni.asset_validator.core from pxr import Usd class MyRule(omni.asset_validator.core.BaseRuleChecker): def CheckPrim(self, prim: Usd.Prim) -> None: pass engine = omni.asset_validator.core.ValidationEngine(initRules=False) engine.enableRule(MyRule) print(engine.validate(omni.asset_validator.core.BASIC_TUTORIAL_PATH)) ``` We can see our method `CheckPrim` being invoked for every Prim. However, our output is empty because `CheckPrim` has not notified of any issues. ```text Results( asset="C:\some\location\exts\omni.asset_validator.core\omni\asset_validator\core\resources\tutorial.usda", issues=[ ] ) ``` !!! note `CheckPrim` is not the only method available, see more at [BaseRuleChecker API](#omni.asset_validator.core.BaseRuleChecker). To add a bit of logic we can change our class to report a single failure when we encounter the prim whose path is `/Hello/World`: ```python import omni.asset_validator.core from pxr import Usd class MyRule(omni.asset_validator.core.BaseRuleChecker): def CheckPrim(self, prim: Usd.Prim) -> None: if prim.GetPath() == "/Hello/World": self._AddFailedCheck( message="Goodbye!", at=prim, ) engine = omni.asset_validator.core.ValidationEngine(initRules=False) ``` ```python from pxr import Usd class MyRule(omni.asset_validator.core.BaseRuleChecker): def Callable(self, stage: Usd.Stage, location: Usd.Prim) -> None: raise NotImplementedError() def CheckPrim(self, prim: Usd.Prim) -> None: if prim.GetPath() == "/Hello/World": self._AddFailedCheck( message="Goodbye!", at=prim, suggestion=omni.asset_validator.core.Suggestion( message="Avoids saying goodbye!", callable=self.Callable, ) ) engine = omni.asset_validator.core.ValidationEngine(initRules=False) engine.enableRule(MyRule) result = engine.validate(omni.asset_validator.core.BASIC_TUTORIAL_PATH) fixer = omni.asset_validator.core.IssueFixer(asset=omni.asset_validator.core.BASIC_TUTORIAL_PATH) result = fixer.fix(result.issues()) print(result) ``` Notice how the `NotImplementedError` error was not thrown during `fixer.fix`. However, we can access the result of execution by inspecting `result`: ``` [ FixResult( issue=Issue( message='Goodbye!', severity=FAILURE, rule=<class '__main__.MyRule'>, at=PrimId( stage_ref=StageId(identifier='C:\\sources\\asset-validator\\_build\\windows-x86_64\\release\\exts\\omni.asset_validator.core\\omni\\asset_validator\\core\\resources\\tutorial.usda'), path='/Hello/World' ), suggestion=Suggestion(callable=Callable, message='Avoids saying goodbye!') ), status=FAILURE, exception=NotImplementedError() ) ] ``` Finally, if you decide to run your custom `Rule` with the rest of the rules, it may be useful to register it in `ValidationRulesRegistry`, this can be done using `registerRule`. ```python import omni.asset_validator.core from pxr import Usd @omni.asset_validator.core.registerRule("MyCategory") class MyRule(omni.asset_validator.core.BaseRuleChecker): def CheckPrim(self, prim: Usd.Prim) -> None: pass for rule in omni.asset_validator.core.ValidationRulesRegistry.rules(category="MyCategory"): print(rule.__name__) ``` ## Custom Rule: Locations For this section, let us use LAYERS_TUTORIAL_PATH. We proceed like in the previous section: ```python import omni.asset_validator.core from pxr import Usd stage = Usd.Stage.Open(omni.asset_validator.core.LAYERS_TUTORIAL_PATH) print(stage.ExportToString()) ``` The contents should be equivalent to: ```usda #usda 1.0 ( doc="Generated from Composed Stage of root layer C:\\some\\location\\exts\\omni.asset_validator.core\\omni\\asset_validator\\core\\resources\\tutorial2.usda" ) def Xform "Hello" { def Sphere "World" { double3 xformOp:translate = (-250, 0, 0) uniform token[] xformOpOrder = ["xformOp:translate"] } } ``` What we are doing is adding an opinion to the prim “/Hello/World”. In the previous section we learned how to create a ``` Rule ``` and issue a ``` Failure ``` . The data model is similar to the following code snippet: ```python from pxr import Usd import omni.asset_validator.core # We open the stage stage = Usd.Stage.Open(omni.asset_validator.core.LAYERS_TUTORIAL_PATH) # We inspect a specific prim prim = stage.GetPrimAtPath("/Hello/World") # We create the data model for the issue def Callable(stage: Usd.Stage, location: Usd.Prim) -> None: raise NotImplementedError() issue = omni.asset_validator.core.Issue( message="Goodbye!", at=prim, severity=omni.asset_validator.core.IssueSeverity.FAILURE, suggestion=omni.asset_validator.core.Suggestion( message="Avoids saying goodbye!", callable=Callable ), ) # Inspect the fixing points for the suggestion for fix_at in issue.all_fix_sites: layer_id = fix_at.layer_id path = fix_at.path print(layer_id, path) ``` The output of the above snippet should show first the path of layers tutorial (i.e. `LAYERS_TUTORIAL_PATH`) and second the basic tutorial (i.e. `BASIC_TUTORIAL_PATH`). While this may be correct for above issue, different issues may need to override this information. Every issue, has associated fixing sites (i.e. property `all_fix_sites`). The fixing sites are all places that contribute opinions to the prim from `strongest` to `weakest` order. When no layer is provided to fix, by default will be the `strongest`. If no indicated (as above) the preferred site will be the `Root` layer. To change the preferred site to fix, we can add the `at` attribute to `Suggestion`. ```python from pxr import Usd, Sdf import omni.asset_validator.core # We open the stage stage = Usd.Stage.Open(omni.asset_validator.core.LAYERS_TUTORIAL_PATH) # We inspect a specific prim prim = stage.GetPrimAtPath("/Hello/World") # We create the data model for the issue def Callable(stage: Usd.Stage, location: Usd.Prim) -> None: raise NotImplementedError() ``` ```python raise NotImplementedError() issue = omni.asset_validator.core.Issue( message="Goodbye!", at=prim, severity=omni.asset_validator.core.IssueSeverity.FAILURE, suggestion=omni.asset_validator.core.Suggestion( message="Avoids saying goodbye!", callable=Callable, at=[Sdf.Layer.FindOrOpen(omni.asset_validator.core.BASIC_TUTORIAL_PATH)] ), ) # Inspect the fixing points for the suggestion for fix_at in issue.all_fix_sites: layer_id = fix_at.layer_id path = fix_at.path print(layer_id, path) ``` The output will change the order now, and you should see basic tutorial path **first** (i.e. `BASIC_TUTORIAL_PATH`). The previous tutorial should have helped you to: - Create a custom Rule, generating an error and a suggestion to fix it. - Run ValidationEngine with a specific rule. - Run IssueFixer to fix specific issues and review the response. ### Frequently Asked Questions **Are there any guards to make sure fixes are still relevant / don’t collide?** In our general practice we have noticed: - *Fixing an issue may solve another issue*. If a consecutive suggestion may fail to be applied, we just keep the exception in `FixResult` and continue execution. You will then decide the steps to take with `FixResult`. - *Fixing an issue may generate another issue*. For the second case it is recommended to run `ValidationEngine` again, to discover those cases. Think of it as an iterative process with help of an automated tool. **Are fixes addressed in the root layer? strongest layer?** Currently, some Issues would perform the suggestion on the strongest layer, while many on the root layer. We are working into offer flexibility to decide in which layer aim the changes, while also offering a default layer for automated workflows.
13,854
typedefs.md
# Typedefs - **NvBlastGraphShaderFunction**: Damage shader for actors with more then one node in support graph. - **NvBlastLog**: Function pointer type for logging. - **NvBlastSubgraphShaderFunction**: Damage shader for actors with single chunk. - **Nv::Blast::RNG_CALLBACK**
276
types.md
# Slang Node Data Types ## Table of Slang Node Data Types | OGN Attribute Type | USD Type | Slang Type | |--------------------|----------|------------| | bool | bool | bool | | colord[3] | color3d | double3 | | colorf[3] | color3f | float3 | | colord[4] | color4d | double4 | | colorf[4] | color4f | float4 | | double | double | double | | double[2] | double2 | double2 | | double[3] | double3 | double3 | | double[4] | double4 | double4 | | float | float | float | | float[2] | float2 | float2 | | float[3] | float3 | float3 | | float[4] | float4 | float4 | - float3 - float[4] - float4 - float4 - frame[4] - frame4d - double4x4 - int - int - int - int64 - int64 - int64_t - int[2] - int2 - int2 - int[3] - int3 - int3 - int[4] - int4 - int4 - matrixd[2] - matrix2d - double2x2 - matrixd[3] - matrix3d - double3x3 - matrixd[4] - matrix4d - double4x4 - normald[3] - normal3d - double3 - normalf[3] - normal3f - float3 - pointd[3] - point3d - double3 - pointf[3] - point3f - float3 - quatd[4] - quatd - double4 - quatf[4] - quatf - float4 - texcoordd[2] - texCoord2d - double2 - texcoordf[2] - texCoord2f - float2 - texcoordd[3] - texCoord3d - double3 - texcoordf[3] - texCoord3f - float3 - timecode - timecode - double - token - token | Column 1 | Column 2 | Column 3 | |-------------------|-------------------|-------------------| | Token | Token | Token | | uint | uint | uint | | uint64 | uint64 | uint64_t | | vectord[3] | vector3d | double3 | | vectorf[3] | vector3f | float3 |
1,874
Unicode.md
# Unicode Always use the unicode conversion functions offered in `carb/extras/Unicode.h` when you must convert between representations. Fortunately this is a rare occurrence because we follow the “Unicode sandwich” methodology in this code base. For more details continue reading. Unicode was unfortunately late to the character encoding party. When it finally arrived there were already in existence all kinds of half-baked solutions, including code pages and wide character encodings. This is legacy that we must still deal with. There are many pitfalls. Even in newer code, like the STL, it’s rather trivial to generate an exception when converting between unicode representations. Hopefully this introduction gets your attention. We’ve developed some simple rules for this project that should keep you out of harm’s way and make programming simple when dealing with text. ## Unicode sandwich There are multiple types of Unicode representations, like UTF8, UTF16LE, and UTF32. For this project we have chosen to use the same representation everywhere. That is, all text is stored and therefore interpreted the same way. This approach is called “the Unicode sandwich” because when we need to interact with external APIs (OS or 3rd party libraries) that don’t offer the internal encoding flavor we will convert on the boundary from whatever encoding is being used to our internal encoding. This will happen on input and output boundaries which act as the two slices of bread in our analogy with the sandwich. Inside the sandwich everything is in the same encoding. This uniformity makes things simpler for all of us. ## UTF8 is our encoding We use UTF8 encoding for all of our text in Carbonite, both in interfaces and inside plugins. This means that all the text is stored in char arrays. The reasons for choosing UTF8 over other encodings are the following: 1. Existing tools support; browsers, editors, etc support it directly and it is most often the default. 2. Existing format support; json, xml, etc are all by default UTF8 encoded. 3. Many string operations performed on 8-bit ASCII characters work equally well on UTF8 characters. 4. The English alphabet and many other special characters are directly represented in the first 7-bits (7-bit ASCII) making debugging easier when viewing raw memory. 5. All codepoints are supported by UTF8 because it’s inherently extendable ## Entering UTF8 characters in source files We use .editorconfig to set the encoding of all text files to UTF8. This means that the source files are already UTF8 and you can therefore enter text/paste directly into them and it just works! ```cpp const char* volcano = "Eyjafjallajökull"; const char* mountain = "Everest"; ``` Notice how we didn’t have to add `u8` qualifier in front of the string literal that had characters beyond 7-bit ASCII. You can put `u8` in front of these strings but it’s redundant, it will result in a NO-OP because our source files are already in UTF8 format. NOTE: If you choose to use an editor or merge tool that either: - doesn’t support character encoding coming from .editorconfig or, - doesn’t use UTF8 by default then you ## Viewing UTF8 characters in Windows console You need to enable the right code page in your Windows console to get the UTF8 encoded characters output by Carbonite FrameworkLogger to render correctly. You can do this temporarily by executing: ```shell chcp 65001 ``` You can also do it permanently by following these steps: 1. Start -> Run -> regedit 2. Go to ``` [HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor ``` 3. Create string ``` Autorun ``` (if it doesn’t already exist) 4. Change the value to ``` @chcp 65001>nul ``` 5. Launch a new Windows console Some Unicode characters - like Chinese characters for example - will still be displayed as boxes, question marks, or other placeholder symbols denoting that the font doesn’t have proper representation of the requested character. To fix this, you can select a different font for the console: right click on the console title bar -> Properties -> Font, and select ``` NSimSun ``` . Other fonts that have greater Unicode coverage are ``` MS Gothic MS Mincho ``` , but they are known to cause artifacts when displaying certain ASCII symbols. ## Converting to and from those tricky wchar_t types Yes, we used plural for wchar_t on purpose. There isn’t a single wchar_t type. On Windows it is actually a UTF16LE encoding while on Linux it’s a UTF32 encoding. Let that sink in. They don’t have the same capabilities and are not even the same size. This has some serious implications. - Don’t write code that converts between UTF16 and UTF8 when the input is wchar_t. That code will (probably) work on Windows but it will mysteriously fail on Linux. Instead you must be careful to convert from the actual type, not what you think it contains. The STL contains support for converting UTF16 and wchar_t. Avoid UTF16 unless you positively know the input is in UTF16. The fact that the type is wchar_t does not guarantee this - unless you are writing Windows specific code. Even so, it is safer to convert from wchar_t, since this will work correctly on all operating systems, regardless of what the wchar_t type is on that particular OS. - The default settings for the STL provided conversion objects (codecvt) will throw range exceptions when code points are encountered that are outside the range for the source or target encoding. Few are aware of this and even fewer know how to work around it, so please use the utility functions provided in Unicode.h and never roll your own. - Don’t use the std::experimental_filesystem::path facilities because they are not supported on all of Carbonite’s target platforms (Tegra) and secondly are error prone to use because by default these facilities will use wide strings with backslashes on Windows but UTF8 on Linux with forward slashes. You need to be careful to call the right u8string accessor and u8path constructors in order to not bungle it up. Just avoid this mess altogether and use Path.h. Fortunately, we only need to deal with the wide characters on Windows so the conversion functions to/from those are only available on the Windows platform. In general just write: ```cpp #include &lt;carb/extras/Unicode.h&gt; ``` and use the functions provided for your platform, knowing that you are doing it right.
6,415
uninstall_apps.md
# Uninstalling Apps (Win & Linux) ## Uninstalling Applications Guide for Windows & Linux There are two methods to uninstall Omniverse applications within the IT Managed Launcher. 1. Users can directly uninstall Omniverse applications from within the Launcher (no IT Manager required) 2. IT Managers can uninstall Omniverse applications using a command line argument. Uninstalling from within the IT Managed Launcher is very quick and straightforward. ### 1) Select the small **Hamburger Menu** icon next to the installed Omniverse Application and choose **Settings**. ![Uninstall Settings](../_images/uninstall_settings.png) ### 2) From the resulting floating dialog, choose the version of the application you want to remove and click **Uninstall**. ![Uninstall Button](../_images/uninstall_button.png) > If you have multiple versions of the same Omniverse application installed, you can remove any of them without disturbing the other versions. To uninstall applications using the Custom Protocol URL is designed for IT Managers and Systems Administrators to use. In this case, you’ll need to identify the application by name as well as its version number since a user can have multiple versions of the same application installed on their workstation. Like the install command, uninstalling adheres to the following base structure: ``` omniverse-launcher://uninstall?slug=<slug>&version=<version> ``` To find the **slug** and **version** information needed to run this command, do the following: ### 1) Go to the [Omniverse Enterprise Web Portal](https://enterprise.launcher.omniverse.nvidia.com/exchange). ### 2) Within the Apps section, find the Omniverse foundation application that is installed on a local workstation and select its tile. ![Uninstall Web Portal Apps](../_images/uninstall_web_portal_apps.png) ### 3) Look at the URL in the browser bar of that tile and at the end, you’ll see the application name. ![App Slug Close](../_images/app_slug_close.png) This application name represents the slug for the uninstall process. > Pay attention to any underscores or other characters in the application name as those will be required for the slug name. In the example above, the name usd_explorer is the correct name for the slug parameter. ### 4) Next, within the IT Managed Launcher, go to the Library tab and look at the version number listed beneath the Launch button. This indicates the version you should refer to in the uninstall command. ![App Version Close](../_images/app_version_close.png) Once you have both pieces of information, you can invoke the command as follows. **WINDOWS**: - DOS Command: `start omniverse-launcher://uninstall?slug=usd_explorer&version=2023.2.0` > Note > > Notice the ‘^’ character before the ‘&amp;’ character. This is needed for DOS, otherwise it will be interpreted as new window popup - PowerShell: ``` "start ominverse-launcher://uninstall?slug=usd_explorer&amp;version=2023.2.0" ``` **LINUX** : ``` xdg-open "omniverse-launcher://uninstall?slug=usd_explorer&amp;version=2023.2.0" ``` Once the command is triggered, the selected Omniverse application will be uninstalled from the IT Managed Launcher.
3,187
units.md
# Length Units ## Pixel Pixel is the size in pixels and scaled with the HiDPI scale factor. Pixel is the default unit. If a number is not specified to be a certain unit, it is Pixel. e.g. ``` ```python width=100 ``` meaning ```python width=ui.Pixel(100) ``` ```python with ui.HStack(): ui.Button("40px", width=ui.Pixel(40)) ui.Button("60px", width=ui.Pixel(60)) ui.Button("100px", width=100) ui.Button("120px", width=120) ui.Button("150px", width=150) ``` ## Percent Percent and Fraction units make it possible to specify sizes relative to the parent size. 1 Percent is 1/100 of the parent size. ```python with ui.HStack(): ui.Button("5%", width=ui.Percent(5)) ui.Button("10%", width=ui.Percent(10)) ui.Button("15%", width=ui.Percent(15)) ui.Button("20%", width=ui.Percent(20)) ui.Button("25%", width=ui.Percent(25)) ``` ## Fraction Fraction length is made to take the available space of the parent widget and then divide it among all the child widgets with Fraction length in proportion to their Fraction factor. ```python with ui.HStack(): ``` "One" "Two" "Three" "Four" "Five"
1,125
UnityBuilds.md
# Unity Builds The Carbonite build system includes support for opting projects in to using unity builds. This support is provided through a `premake` extension that adds a few APIs that can be used to enable unity builds for the project and control how it is used. The `premake` extension is intended to be installed as a host dependency package in the repo and then enabled through a single `require()` call in the repo’s main `premake` script. ## What is a Unity Build? Unity builds provide a way to speed up the compilation of some projects, especially larger ones. This is done by grouping multiple source files (ie: .cpp or .c) in the project into a single or a small number of compilation units instead of building each source file separately. The idea behind this is that it can save the compiler a huge amount of time not needing to reprocess large header files that are commonly included in multiple source files. The benefits of unity builds can obviously differ greatly from one project to the next however - for example, if a project’s source files don’t include a large number of common headers, it could actually slow down compilation when using unity builds. However, with some slight changes in how development is done, many projects can be easily made to be more unity build friendly and still benefit from these types of builds. The difference in build times between a unity build and a parallel build can vary quite drastically from one project to another and even between different machines. There are many variables involved including the total number and size of multiple-included headers in the project, the total number of source files in the project, and the number of CPU cores available on the building machine. When opting into unity builds, some care should be taken to profile builds to ensure it will be a net win in build times for the project. In general, there is a tradeoff between the amount of time saved in reprocessing the same large header files multiple times in the unity build versus the potential gains of building multiple files in parallel with the headers being reprocessed. Note however that there are some potential drawbacks to using unity builds: - Projects that have a small number of source files often don’t benefit. There are definitely exceptions to this rule, but in general projects that have fewer than five source files will typically build faster as individual parallel built source than with a unity build. - Projects with source files that do not include a set of common headers can increase build times. Since each included header is only included once or a few times in the project, the benefits of a unity build are outweighed by any gains that a parallel build would see. This can be avoided by having larger common header files or even with including several system header files to get the necessary functionality (where available). - Iterative builds no longer work as expected. While a project is configured as a unity build, a change to any source code file will effectively trigger a full rebuild of the project. This can increase the overall build times when iterating on changes locally. By default a unity build will not be used even for projects that have opted into unity builds. Unity builds will only be enabled for opted-in projects when the `--unity-build` command line option is also used during the build. This works best when there’s only a need to do a clean build (ie: in CI). - The project’s code must be clean enough to be able to effectively have all source files be part of the same translation unit. This may require either some code cleanup, or in very rare cases conditional compilation of some code based on whether `OMNI_USING_UNITY_BUILD` is defined. This symbol is defined any time a piece of code is being built as part of a unity build. Some common issues that are encountered when trying to enable a unity build are: - Local or static helper functions could have been copy/pasted between source files in the project. Since all source files in the project are effectively built as a single translation unit, these common local helper functions will conflict with each other giving a “this function already has a body” error. This can be fixed by removing duplicate helper functions and moving them to a common shared location. - Shared global symbols. If multiple source files define the same global variables or macros, they can conflict with each other in a unity build. All common symbols, even global ones, should be declared in a common location and defined only in a single location in the project. ### Headers missing include guards. If a commonly included header is missing an include guard, this can lead to multiple definition or conflicting declaration errors during a unity build. As per the Omniverse coding standard, all headers that are only intended to be included once must have an include guard in the form of a ```cpp #pragma once ``` line at the top of the file. ### Repeated definitions of classes. Some projects can end up with multiple internal implementations of a given common class (with the same name). This can lead to multiple definition errors in a unity build. This is technically undefined behavior in C++ (ie: the linker could choose which of the class’ methods are linked) and should not occur. ### Some additional unity build pitfalls: - Code can get sloppy at including the correct headers or defining common symbols in shared locations if unity builds are always used. Unity builds should not be used during development for this reason so that it can be verified that the non-unity build path will not be broken. ### This Implementation This implementation is provided through an extension to the `premake` tool. This extension provides a handful of new APIs that can be used at the project or configuration scope in a premake script. The following new APIs are available: - `unitybuildenabled(true)`: Enables unity builds for a project. By default a project will not use unity builds. Once enabled for a project, a unity build will only be configured if the `--unity-build` command line option is also used. - `unitybuildcount(<count>)`: Controls the number of unity build files to use for the project. If this is not specified, this aims to have at least 5 .cpp/.c files included in each unity build file. This will be capped to a maximum of 8 unity build files for large projects and clamped to a minimum of 1 unity build file for small projects. In testing, 5 source files seems to be the average tipping point between the savings of processing header files multiple times in a single unity build file versus reprocessing all of them in a parallel build. If a count is specified with this API, the minimum between that given number and the total number of eligible source files in the project will be used. This setting can be used to tune how the unity build for the project is configured. The `<count>` value may be any positive number. Though note that if it is too large, the benefits of a unity build may disappear. - `unitybuilddir(<path>)`: Allows the storage directory for the unity build files to be specified explicitly. By default, this will be the project’s intermediates directory. The `<path>` value may be any relative or absolute path. Tokens will be evaluated for this path. - `unitybuilddefines{<table>}`: Provides a set of custom macros to define at the top of each unity build file for the project. This can be used to add macros to help get a unity build working properly without needing to make source code changes. One example could be to add the `NOMINMAX` macro (set to `1`) to work around issues with Windows’ broken `min()` and `max()` macros. Note that this can also be done at the project or config level with `defines{}`, but this allows it to be done only in the context of a unity build. The `<table>` value is expected to be a set of key/value pairs indicating each macro’s name and value. An empty string may be set for the value if no value is needed. It is the caller’s responsibility to ensure that any macros added will compile successfully. With these three new APIs, a project can simply opt into using unity builds with a small handful of new lines (one new line at a minimum). Only C/C++ files will be affected by this change to a project. By default, these files can only end in ‘.c’ or ‘.cpp’. ### How to Integrate Unity Builds in a Repo In order to add unity build support in a repo, a few steps are required. These involve adding the package as a host dependency, adding the command line options to `repo.toml`, and loading the `premake` extension. These changes are necessary: - Add an entry to your repo’s `deps/host-deps.packman.xml` file (or another deps file if that one does not exist). This package needs to be pulled down before the `premake` scripts can be processed for the repo. This can be done with a block such as this: ```xml <dependency name="premake-unitybuild" linkPath="../_build/host-deps/unitybuild"> <package name="premake-unitybuild" version="1.0.1-0"/> ``` - Add the command line options for the unity build extension to your repo’s `repo.toml` file. This is needed for the `repo` to recognize the new options. ``` - To use the `build` tool to pass arguments to `premake`, add this to the `repo` build tool section of the `repo.toml` file: ```toml [[repo_build.argument]] name = "--unity-build" help = """ When enabled, projects that have opted-in to unity builds will enable their unity build setup. When disabled, the normal behavior of building each .cpp file independently is used. Projects can opt-in to unity builds by using the `add_files()` when adding files to the project and setting the fourth argument to `true`. Only .cpp/.cc files will be included in the unity build listing.""" kwargs.required = false kwargs.nargs = 0 extra_premake_args = ["--unity-build"] platforms = ["*"] # All platforms. [[repo_build.argument]] name = "--unity-log" help = """ When enabled, extra logging information will be output for all projects that have opted into unity builds. These will be silenced if this option is not used. This logging will greatly increase the amount of output and should only be used for debugging purposes when trying to enable a unity build for a new project.""" kwargs.required = false kwargs.nargs = 0 extra_premake_args = ["--unity-log"] platforms = ["*"] # All platforms. [[repo_build.argument]] name = "--unity-log-filter" help = """ When enabled, extra logging information will be output for all projects that have opted into unity builds. These will be silenced if this option is not used. This logging will greatly increase the amount of output and should only be used for debugging purposes when trying to enable a unity build for a new project.""" kwargs.required = false kwargs.nargs = 1 extra_premake_args = ["--unity-log-filter={}"] platforms = ["*"] # All platforms. ``` - Load the unity build extension in the repo’s main `premake` script with the line: ```lua require("_build/host-deps/unitybuild") ``` ## How to Opt in to Unity Builds for a Project Once the unity build extension has been integrated into a repo’s build toolchain, projects can start opting into unity builds. The simplest way to do this for a project is to add the following line to the project’s definition: ```lua unitybuildenabled(true) ``` The unity build behavior for the project can be further tweaked using APIs such as `unitybuildcount` or `unitybuilddefines`. - The `unitybuildcount` API allows the number of unity build files used for the project to be explicitly specified. - The `unitybuilddefines` API allows additional macros to be defined before the source files are included in each unity build file. The unity build extension adds a few new command line options that are valid in the `premake` invocation. These allow the unity builds to be enabled and enable some extra debug logging as needed. The following new command line options are available: - `--unity-build`: This enables unity builds for all projects that have opted into it. Since a unity build can negatively affect development workflows, this feature defaults to being disabled. When this option is not used, the project will be configured and built as if no projects had opted into unity builds. When this option is used, the projects that have opted into unity builds will be configured so that only the unity build files are included in the build. All other projects that have not opted into unity builds will still be configured and build as normal. - `--unity-log`: This enables extra debug logging output from `premake` when it runs during the build. This will outline which projects have opted into unity builds and how the files in each of those projects are being included in their unity build files. When enabled, this log can be very verbose and will result in log messages being generated even for projects that have not opted into unity builds. This can be filtered using the `--unity-log-filter` option below. - `--unity-log-filter=<filter>`: This allows the extra debugging messages from the `--unity-log` option to be filtered down to only a subset of projects as needed. This option has no effect if `--unity-log` was not also specified. The `<filter>` value can either be set to `enabled` to only output log messages for projects that have opted into unity builds, or it can be the name of one or more projects to display the unity build log messages for. If multiple project names are given, they should be separated by commas. This can be used to focus on the messages for just a single (or a few) project of interest when debugging unity build issues.
13,758
Update.md
# Update menus ## Rebuild - `omni.kit.menu.utils.rebuild_menus()` - This completely rebuilds all the menus ## Refresh - `omni.kit.menu.utils.refresh_menu_items("File")` - This refreshes the "File" menu group. - `omni.kit.menu.utils.refresh_menu_items("File/New")` - Is now supported to only refresh a single item in the group. - Refreshing only sets a flag, which is used when the menu is opening. Then it will update enabled/tick status updated etc. ## Updating menu items Menus added to "File" group ```python self._file_menu_list = [ MenuItemDescription(name="Menu Example 1", onclick_action=("omni.kit.menuext.extension", "menu_example_1")), MenuItemDescription(name="Menu Example 2", onclick_action=("omni.kit.menuext.extension", "menu_example_2")), ] omni.kit.menu.utils.add_menu_items(self._file_menu_list, "File") ``` To add an additional menu item to the previously created menus. ### New method Requires version 1.5.6 or above ```python file_menu_list = self._file_menu_list.copy() file_menu_list.append( MenuItemDescription(name="Menu Example 3", onclick_action=("omni.kit.menuext.extension", "menu_example_3")) ) omni.kit.menu.utils.replace_menu_items(file_menu_list, self._file_menu_list, "File") self._file_menu_list = file_menu_list ``` ### Old method ```python omni.kit.menu.utils.remove_menu_items(self._file_menu_list, "File") ``` ```python self._file_menu_list.append( MenuItemDescription(name="Menu Example 3", onclick_action=("omni.kit.menuext.extension", "menu_example_3")) ) omni.kit.menu.utils.add_menu_items(file_menu_list, self._file_menu_list, "File") ``` ```
1,635
Usage.md
# Usage There are two different entry points to import CAD files using the CAD Converter. ## File -> Import To import a CAD file into Omniverse, choose “Import” in the “File” menu. Use this method to import CAD Data into your scene - either by reference or directly into your stage. ## Content Browser -> Convert To USD To convert a CAD file to USD, select the file in the Content Browser and choose ‘Convert to USD’. ## Converter Options The available options for CAD Converter vary per file format and the underlying converter. All CAD Converters support `Generate Projection UVS` and `Enable Instancing`. ### Generate Projection UVs This option will enable automatic generation of UVs on your assets. Use this if you intend to use materials that require texture mapping. ### Enable Instancing This option will determine whether or not instancing will be used in the USD. ### Tesselation Level Tesselation level may be set when converting BREPs to geometry. The available presets are: - `ExtraLow`: ChordHeightRatio=50, AngleToleranceDeg=40, - `Low`: ChordHeightRatio=600, AngleToleranceDeg=40, - `Medium`: ChordHeightRatio=2000, AngleToleranceDeg=40, - `High`: ChordHeightRatio=5000, AngleToleranceDeg=30, - `ExtraHigh`: ChordHeightRatio=10000, AngleToleranceDeg=20. `ChordHeightRatio`: Specifies the ratio of the diagonal length of the bounding box (defined by `D` x `d`) to the chord height. A value of `50` means that the diagonal of the bounding box is `50` times greater than the chord height. Values can range from ```code 50 ``` to ```code 10,000 ``` . Higher values will generate more accurate tessellation. ```code AngleToleranceDeg ``` : Specifies the maximum angle between two contiguous tessellation segments describing the curve of a topological edge for every face. During tessellation, the curve describing the edge of a topological face will be approximated using straight line segments. ```code AngleToleranceDeg ``` is the maximum angle between two consecutive segments. Allowable values range from ```code 10 ``` to ```code 40 ``` . Lower values will result in greater accuracy. ## Destination Options The entry points for conversion expose different destination options. ### File -> Import ```code File -> Import ``` is recommended for importing data into your stage. You may ```code Import to Stage ``` , or ```code Import as Reference ``` in this context. #### Import to Stage Use this option to import directly into your stage. > **Note** > Not all converters support > ```code > Import > To > Stage > ``` > . In this case, only the > ```code > Path > ``` > field will be visible and > ```code > Import > as > Reference > ``` > behavior will be used. > **Warning** > ```code > Import > to > Stage > ``` > is not recommended while in a Live session is active. #### Import as Reference Using ```code Import as Reference ``` , the output USD file will be written to the chosen Destination Path. Set the Destintation Path to determine where the coverted files will be written. If left blank, files will be written in the same folder as the source files. ### Convert to USD Destination Options ```code Convert To USD ``` is recommended to convert files to external USD files only. You may choose to ```code Reference in Current Stage ``` or not. Set the Destintation Path to determine where the coverted files will be written. If left blank, files will be written in the same folder as the source files. Enable ```code Reference in Current Stage ``` to automatically add references after conversion.
3,557
USAGE_CPP.md
# C++ Usage Examples ## Example C++ Command ```c++ class TestCppCommand : public Command { public: static carb::ObjectPtr<ICommand> create(const char* extensionId, const char* commandName, const carb::dictionary::Item* kwargs) { return carb::stealObject<ICommand>(new TestCppCommand(extensionId, commandName, kwargs)); } TestCppCommand(const char* extensionId, const char* commandName, const carb::dictionary::Item* kwargs) : Command(extensionId, commandName) { if (carb::dictionary::IDictionary* iDictionary = carb::dictionary::getDictionary()) { m_x = iDictionary->getAsInt(iDictionary->getItem(kwargs, "x")); m_y = iDictionary->getAsInt(iDictionary->getItem(kwargs, "y")); } } void doCommand() override { // Implementation here } }; ``` ```cpp s_resultList.append(m_x); s_resultList.append(m_y); } void undoCommand() override { s_resultList.attr("pop")(); s_resultList.attr("pop")(); } private: int32_t m_x = 0; int32_t m_y = 0; }; ``` ## Registering C++ Commands ```cpp auto commandBridge = carb::getCachedInterface<omni::kit::commands::ICommandBridge>()); commandBridge->registerCommand("omni.kit.command_tests", "RegisteredFromCppCommand", TestCppCommand::create); // Note the command name (in this case "RegisteredFromCppCommand") is arbitrary and does not need to match the C++ class ``` ## Executing Commands From C++ ```cpp auto commandBridge = carb::getCachedInterface<omni::kit::commands::ICommandBridge>()); // Create the kwargs dictionary. auto iDictionary = carb::getCachedInterface<carb::dictionary::IDictionary>(); carb::dictionary::Item* kwargs = iDictionary->createItem(nullptr, "", carb::dictionary::ItemType::eDictionary); iDictionary->makeIntAtPath(kwargs, "x", 7); iDictionary->makeIntAtPath(kwargs, "y", 9); // Execute the command using its name... commandBridge->executeCommand("RegisteredFromCppCommand", kwargs); // or without the 'Command' postfix just like Python commands... commandBridge->executeCommand("RegisteredFromCpp", kwargs); // or fully qualified if needed to disambiguate (works with or without the 'Command)' postfix. commandBridge->executeCommand("omni.kit.command_tests", "RegisteredFromCppCommand", kwargs); // The C++ command can be executed from Python exactly like any Python command, // and we can also execute Python commands from C++ in the same ways as above: commandBridge->executeCommand("RegisteredFromPythonCommand", kwargs); // etc. // Destroy the kwargs dictionary. iDictionary->destroyItem(kwargs); ``` ## Undo/Redo Commands From C++ ```cpp auto commandBridge = carb::getCachedInterface<omni::kit::commands::ICommandBridge>()); // It doesn't matter whether the command stack contains Python commands, C++ commands, // or a mix of both, and the same stands for when undoing/redoing commands from Python. commandBridge->undoCommand(); commandBridge->redoCommand(); ``` ## Deregistering C++ Commands ```cpp auto commandBridge = carb::getCachedInterface<omni::kit::commands::ICommandBridge>()); commandBridge->deregisterCommand("omni.kit.command_tests", "RegisteredFromCppCommand"); ``` ```
3,187
USAGE_PYTHON.md
# Usage Examples ## Create a Fabric Primitive ```python import omni.kit.commands # Create a Fabric primitive of type 'Sphere' omni.kit.commands.execute("CreateFabricPrim", prim_type="Sphere") ``` ## Copy a Fabric Primitive ```python import omni.kit.commands # Copy a Fabric primitive from one path to another omni.kit.commands.execute("CopyFabricPrim", path_from="/World/Sphere", path_to="/World/Sphere_Copy") ``` ## Delete Fabric Primitives ```python import omni.kit.commands # Delete a list of Fabric primitives by their paths omni.kit.commands.execute("DeleteFabricPrims", paths=["/World/Sphere", "/World/Cube"]) ``` ## Move a Fabric Primitive ```python import omni.kit.commands # Move a Fabric primitive from one path to another omni.kit.commands.execute("MoveFabricPrim", path_from="/World/Sphere", path_to="/World/NewLocation/Sphere") ``` ## Toggle Visibility of Selected Fabric Primitives ```python import omni.kit.commands import omni.usd # Assuming '/World/Sphere' is selected, toggle its visibility selected_paths = ["/World/Sphere"] omni.kit.commands.execute("ToggleVisibilitySelectedFabricPrims", selected_paths=selected_paths) ``` # Group Fabric Primitives ```python import omni.kit.commands # Group multiple Fabric primitives under a new Xform primitive prim_paths = ["/World/Sphere", "/World/Cube"] omni.kit.commands.execute("GroupFabricPrims", prim_paths=prim_paths) ``` # Ungroup Fabric Primitives ```python import omni.kit.commands # Ungroup Fabric primitives from their common parent group prim_paths = ["/World/Group"] omni.kit.commands.execute("UngroupFabricPrims", prim_paths=prim_paths) ``` # Transform a Fabric Primitive ```python import omni.kit.commands import usdrt.Gf # Apply a transformation matrix to a Fabric primitive new_transform_matrix = usdrt.Gf.Matrix4d().SetTranslate(usdrt.Gf.Vec3d(1, 2, 3)) omni.kit.commands.execute( "TransformFabricPrim", path="/World/Sphere", new_transform_matrix=new_transform_matrix ) ``` # Change a Fabric Property ```python import omni.kit.commands # Change the 'radius' property of a Fabric Sphere primitive prop_path = "/World/Sphere.radius" omni.kit.commands.execute( "ChangeFabricProperty", prop_path=prop_path, value=2.0, prev=1.0 ) ``` # Create Default Transform on a Fabric Primitive ```python import omni.kit.commands # Create and apply a default transform to a Fabric primitive at a specified path omni.kit.commands.execute( "CreateDefaultXformOnFabricPrim", prim_path="/World/Sphere" ) ```
2,499
USAGE_TOOLBAR.md
# Toolbar Usage Examples To register widgets on a Toolbar, first you need a WidgetGroup to host your omni.ui widgets. For how to create a custom WidgetGroup, check out WidgetGroup Usage Example. Here we will be using a SimpleToolButton to create the WidgetGroup with one omni.ui.ToolButton and register it with the Toolbar. ```python from carb.input import KeyboardInput as Key from omni.kit.widget.toolbar import SimpleToolButton, get_instance # Create a WidgetGroup using SimpleToolButton simple_button = SimpleToolButton( name="test_simple", tooltip="Test Simple ToolButton", icon_path='${glyphs}/lock_open.svg', icon_checked_path='${glyphs}/lock.svg', hotkey=Key.L, toggled_fn=lambda c: print(f"Toggled {c}") ) # Get the global instance of Toolbar widget toolbar = get_instance() # Add the WidgetGroup to the Toolbar toolbar.add_widget(widget_group=simple_button, priority=100) ``` You should see a new button added to the toolbar. When you click on it, the icon shape will change from “unlocked” to “locked” and print `Toggled True` in the console, and the button shows a pressed background. To remove the button from toolbar, simply do ```python # Remove button from toolbar toolbar.remove_widget(simple_button) # Cleanup the button object simple_button.clean() del simple_button ```
1,324
USAGE_WIDGET_GROUP.md
# WidgetGroup Usage Example WidgetGroup is the base class you can override and put custom omni.ui widgets on the toolbar. SimpleToolButton included in this extension is an example of how you can inherit and extent WidgetGroup. Here we provide another example showing how to create a custom by inheriting and overriding WidgetGroup class and its methods. ```python from omni.kit.widget.toolbar import Hotkey, WidgetGroup class DemoToolButtonGroup(WidgetGroup): """ Example of how to create two ToolButton in one WidgetGroup """ def __init__(self, icon_path): super().__init__() self._icon_path = icon_path def clean(self): self._sub1 = None self._sub2 = None self._hotkey.clean() self._hotkey = None super().clean() def get_style(self): style = { "Button.Image::test1": {"image_url": f"{self._icon_path}/plus.svg"}, "Button.Image::test1:checked": {"image_url": f"{self._icon_path}/minus.svg"}, "Button.Image::test2": {"image_url": f"{self._icon_path}/minus.svg"}, "Button.Image::test2:checked": {"image_url": f"{self._icon_path}/plus.svg"}, } return style def create(self, default_size): def on_value_changed(index, model): if model.get_value_as_bool(): self._acquire_toolbar_context() else: pass ``` ```python self._release_toolbar_context() test_message_queue.append(f"Group button {index} clicked") button1 = ui.ToolButton( name="test1", width=default_size, height=default_size, ) self._sub1 = button1.model.subscribe_value_changed_fn(lambda model, index=1: on_value_changed(index, model)) button2 = ui.ToolButton( name="test2", width=default_size, height=default_size, ) self._sub2 = button2.model.subscribe_value_changed_fn(lambda model, index=2: on_value_changed(index, model)) self._hotkey = Hotkey( "toolbar::test2", Key.K, lambda: button2.model.set_value(not button2.model.get_value_as_bool()), lambda: self._is_in_context(), ) # return a dictionary of name -> widget if you want to expose it to other widget_group return {"test1": button1, "test2": button2} ``` For examples of how to put this WidgetGroup onto a Toolbar, check out Toolbar Usage Examples.
2,337
USD.md
# OmniGraph and USD USD is used as a source of data for OmniGraph. Both can be described as a set of nodes, attributes, and connections, each with their own set of strengths and restrictions. USD is declarative - it has no system for procedurally generating attribute values (such as expression binding, keyframing, etc). Timesamples can give different values when requested at different times, however they too are declarative - they are fixed values at fixed times and are unaffected by any configuration of the USD stage outside of composition. OmniGraph adds a procedural engine to Omniverse on top of USD that does generate computed attribute values. OmniGraph is not constrained by the data values in its definition. It can create entirely new values at runtime based on the computation algorithms in its nodes. A USD stage can contain several layers forming “opinions” on what its declared values should be, which are composed together to form the final result. OmniGraph only operates on the composed USD stage in general, although it is possible for special purpose nodes to access the USD layer data through the USD APIs. ## Syncing With Fabric In order to store and manage data efficiently, OmniGraph uses a data storage component called Fabric, which is a part of Omniverse. After the USD stage is composed, USD prim data is read into Fabric, where it can be efficiently accessed by OmniGraph for its computations. When appropriate, OmniGraph directs Fabric to synchronize with USD and the computed data becomes available to the USD stage. The nature of the computation being performed by OmniGraph will determine the interval for syncing computed data back to USD. If, for example, the graph is deforming a mesh for passing on to some external stress analysis software then the resulting mesh must be synced to USD on each playback frame so that each version of the deformed mesh is available for analysis. On the other hand if the graph is performing a large set of Machine Learning calculations for the purposes of training a model then it only needs to send the results back to USD when the training is complete and the resulting model needs to be stored. ### Important While some nodes within OmniGraph access USD data, and most have a direct correspondence with a USD prim, neither of these is required for OmniGraph to work properly. If an OmniGraph node is only required temporarily to perform some intermediate calculation, for example, it might only be known to Fabric and never appear in the USD stage. ### Note To avoid awkward wording the generic term “graph” will be used herein when discussing the component of the OmniGraph subsystem that represents a graph to be evaluated. OmniGraph as a whole comprises the collection of components required to perform runtime evaluation (graphs, evaluators, schedulers) and their interaction. ## How The Graph Appears In USD We’ll start with a simple example of how a graph looks in the USD Ascii format and the progressively fill in the details of exactly what each part of it represents. The graph will contain two nodes connected together to perform the two-part computation of multiplying a value by four using two nodes whose computation multiplies a value by two. ```python def OmniGraph "Graph" { token evaluator:type = "push" token fabricCacheBacking = "Shared" int2 fileFormatVersion = (1, 4) token pipelineStage = "pipelineStageOnDemand" def OmniGraphNode "times_2_node_1" { token node:type = "omni.graph.nodes.Times2" int node:typeVersion = 1 custom double inputs:a = 2.5 custom double outputs:two_a = 5.0 } def OmniGraphNode "times_2_node_2" { token node:type = "omni.graph.nodes.Times2" int node:typeVersion = 1 custom double inputs:a = 0.0 custom double inputs:a.connect = custom double outputs:two_a = 10.0 } } ## The Graph The graph itself is the top level USD Prim of type **OmniGraph**. It serves to define the parameters of the graph definition in its attribute values, and as a scope for all of the nodes that are contained within the graph. ### Important Nodes must all be contained within the scope of an **OmniGraph** prim, and no prims that are not of type **OmniGraph** or **OmniGraphNode** are allowed within that scope. ```python def OmniGraph "Graph" { token evaluator:type = "push" token fabricCacheBacking = "Shared" int2 fileFormatVersion = (1, 4) token pipelineStage = "pipelineStageOnDemand" def OmniGraphNode "times_2_node_1" { token node:type = "omni.graph.nodes.Times2" int node:typeVersion = 1 custom double inputs:a = 2.5 custom double outputs:two_a = 5.0 } def OmniGraphNode "times_2_node_2" { token node:type = "omni.graph.nodes.Times2" int node:typeVersion = 1 custom double inputs:a = 0.0 custom double inputs:a.connect = custom double outputs:two_a = 10.0 } } custom double inputs:a = 0.0 custom double inputs:a.connect = custom double outputs:two_a = 10.0 { } { } ``` ```mermaid classDiagram class Graph Graph: token evaluator.type Graph: token fabricCacheBacking Graph: int2 fileFormatVersion Graph: token pipelineStage ``` The predefined attributes in the OmniGraph prim come from the OmniGraph prim schema, generated using the standard USD Schema Definition API. This is the generated schema definition. ```usd class OmniGraph "OmniGraph" ( doc = "Base class for OmniGraph primitives containing the graph settings." ) { token evaluationMode = "Automatic" ( allowedTokens = ["Automatic", "Standalone", "Instanced"] doc = """Token that describes under what circumstances the graph should be evaluated. \r Automatic mode will evaluate the graph in Standalone mode when \r no Prims having a relationship to it exist. Otherwise it will be \r evaluated in Instanced mode.\r Standalone mode evaluates the graph with itself as the graph\r target, and ignores any Prims having relationships to the graph Prim. \r Use this mode with graphs that are expected to run only once per frame\r and use explicit paths to Prims on the stage. \r Instanced graphs will only evaluate the graph when it is part of a \r relationship from an OmniGraphAPI interface. Each Prim with a \r relationship to the graph will cause a unique evaluation with the \r graph target set to the path of the Prim having the relationship. \r Use this mode when the graph represents an asset or template, and \r parameterizes Prim paths through the use of the GraphTarget node,\r variables, or similar mechanisms. """ ) token evaluator:type = "push" ( allowedTokens = ["dirty_push", "push", "execution"] doc = "Type name for the evaluator used by the graph." ) token fabricCacheBacking = "Shared" ( allowedTokens = ["Shared", "StageWithHistory", "StageWithoutHistory"] doc = "Token that identifies the type of FabricCache backing used by the graph." ) int2 fileFormatVersion ( doc = """A pair of integers consisting of the major and minor versions of the\r file format under which the graph was saved.""" ) token pipelineStage = "pipelineStageSimulation" ( allowedTokens = ["pipelineStageSimulation", "pipelineStagePreRender", "pipelineStagePostRender", "pipelineStageOnDemand"] doc = """Optional token which is used to indicate the role of a vector\r valued field. This can drive the data type in which fields\r are made available in a renderer or whether the vector values\r are to be transformed.""" ) } ``` ## The Nodes A graph is more than just a graph prim on its own. Within its scope are an interconnected set of nodes with attribute values that are a visual representation of the computation algorithm of the graph. Each of these nodes are represented in USD as prims with the schema type **OmniGraphNode**. ```usd def OmniGraph "Graph" { token evaluator:type = "push" } token fabricCacheBacking = "Shared" int2 fileFormatVersion = (1, 4) token pipelineStage = "pipelineStageOnDemand" def OmniGraphNode "times_2_node_1" { token node:type = "omni.graph.nodes.Times2" int node:typeVersion = 1 custom double inputs:a = 2.5 custom double outputs:two_a = 5.0 } def OmniGraphNode "times_2_node_2" { token node:type = "omni.graph.nodes.Times2" int node:typeVersion = 1 custom double inputs:a = 0.0 custom double inputs:a.connect = custom double outputs:two_a = 10.0 } The predefined attributes in the **OmniGraphNode** prim come from the **OmniGraphNode** prim schema, also defined through the USD Schema Definition API. This is the generated schema for the node’s prim type. class OmniGraphNode "OmniGraphNode" ( doc = "Base class for OmniGraph nodes." ) { token node:type ( doc = "Unique identifier for the name of the registered type for this node." ) int node:typeVersion ( doc = """Each node type is versioned for enabling backward compatibility. This value indicates which version of the node type definition was used to create this node. By convention the version numbers start at 1.""" ) } ## Connections Although OmniGraph connections between attributes are implemented and handled directly within OmniGraph they are published within USD as *UsdAttribute* connections. Imagine a “Times2” node with one input and one output whose value is computed as the input multiplied by two. Then you can connect two of these in a row to multiple the original input by four. In USD this would look like: def OmniGraph "Graph" { token evaluator:type = "push" token fabricCacheBacking = "Shared" int2 fileFormatVersion = (1, 4) token pipelineStage = "pipelineStageOnDemand" def OmniGraphNode "times_2_node_1" { token node:type = "omni.graph.nodes.Times2" int node:typeVersion = 1 } } custom double inputs:a = 2.5 custom double outputs:two_a = 5.0 } def OmniGraphNode "times_2_node_2" { token node:type = "omni.graph.nodes.Times2" int node:typeVersion = 1 custom double inputs:a = 0.0 custom double inputs:a.connect = custom double outputs:two_a = 10.0 } } One thing worth mentioning here - in the second node /Graph/times_2_node_2 the value at inputs:a defines a value of 0.0, which is used in the event that a connection is not authored, or the connection is not evaluated (for example: outside an OmniGraph context), or an invalid connection is authored for the attribute. Where a valid connection is authored, it will take precedence during OmniGraph evaluation. In this example this is seen by the computation using the connected value of 5.0 as the multiplicand, not the authored value of 0.0 . ## Graph Extras The graph evaluation type is a hint to OmniGraph on how a set of nodes should be evaluated. One of the more common variations is the type execution , which is usually referred to as an Action Graph . def OmniGraph "ActionGraph" { evaluator:type = "execution" fabricCacheBacking = "Shared" fileFormatVersion = (1, 4) pipelineStage = "pipelineStageOnDemand" def OmniGraphNode "DoNothingNode" ( prepend apiSchemas = ["NodeGraphNodeAPI"] ) { node:type = "omni.graph.nodes.Noop" node:typeVersion = 1 inputs:execIn = 0 ui:nodegraph:node:expansionState = "open" ui:nodegraph:node:pos = (-196.9863, 332.03223) } } The key differentiator of an Action Graph is its use of execution attributes to trigger evaluation, rather than some external event such as the update of a USD stage. The additional two ui:nodegraph attributes shown in this example illustrate how extra information can be added to the node and be stored with the prim definition. In this case the Action Graph editor has added the information indicating the node’s position and expansion state so that when the file is reloaded and the editor is opened the node will appear in the same location it was last edited. The node graph editor has added the API schema NodeGraphNodeAPI to help it in interpreting the extra data it has added. This is a standard Pixar USD schema that you can read more # Custom Attributes Every node type can define its own set of custom attributes, specified using the `.ogn format`. These custom attributes are what an OmniGraph node uses for its computation. Although the attributes are represented in USD, the actual values OmniGraph nodes use are stored in `Fabric`. These are the values that need to be synchronized by OmniGraph as mentioned above. For the most part, every USD attribute type has a corresponding .ogn attribute type, though some may have some different interpretations. The full type correspondence shows how the types relate. Here is how the definition of our “multiply by two” node might look in .ogn format: ``` ```json { "Times2": { "version": 1, "description": "Multiplies a double value by 2.0", "inputs": { "a": { "type": "double", "description": "The number to be doubled" } }, "outputs": { "two_a": { "type": "double", "description": "The input multiplied by 2.0" } } } } ``` ``` When the graph creates an instance of this node type then it will publish it in the equivalent USD format. The data that can be recreated from the node type definition (i.e. the descriptions in this case) do not get published into USD. ``` ```usd def OmniGraph "Graph" { token evaluator:type = "push" token fabricCacheBacking = "Shared" int2 fileFormatVersion = (1, 4) token pipelineStage = "pipelineStageOnDemand" def OmniGraphNode "times_2_node_1" { token node:type = "omni.graph.nodes.Times2" int node:typeVersion = 1 custom double inputs:a = 2.5 custom double outputs:two_a = 5.0 } def OmniGraphNode "times_2_node_2" { token node:type = "omni.graph.nodes.Times2" int node:typeVersion = 1 custom double inputs:a = 0.0 custom double inputs:a.connect = custom double outputs:two_a = 10.0 } } ``` ``` A few points of interest in this output: - OmniGraph attributes are published as `custom` ## Attribute Namespaces - **attributes** - The value of `node:typeVersion` must match the “version” value specified in the .ogn file - The value of `node:type` is an extended version of the name key specified in the .ogn file, with the extension prepended - Input attributes are put into the namespace `inputs:` and output attributes are put into the namespace `outputs:` ## Special Attribute Types There are some .ogn attribute types that do not have a direct equivalent in USD. They are implemented using existing USD concepts, relying on OmniGraph to interpret them properly. ### Execution Attributes Attributes of type `execution` are used by Action Graphs to trigger evaluation based on events. They are stored in USD as unsigned integer values, with some custom data to indicate to OmniGraph that they are an execution type, not a plain old value. Here is an example of the builtin **OnTick** node which has one such input. ```usd def OmniGraphNode "on_tick" { custom uint inputs:framePeriod = 0 custom bool inputs:onlyPlayback = 1 custom token node:type = "omni.graph.action.OnTick" custom int node:typeVersion = 1 custom double outputs:absoluteSimTime = 0 custom double outputs:deltaSeconds = 0 custom double outputs:frame = 0 custom bool outputs:isPlaying = 0 custom uint outputs:tick = 0 ( customData = { bool isExecution = 1 } ) custom double outputs:time = 0 custom double outputs:timeSinceStart = 0 } ``` **Note:** With execution attributes only the outputs require the **customData** values. ### Bundle Attributes A `bundle` attribute in OmniGraph is simply a collection of other attributes. Bundles cannot be specified directly; they take their attribute members from an input connection. For this reason an input, output and state bundle attribute is represented as a USD `rel` type. Here is an example of a graph with two nodes, with an import of a cube prim to use for the extraction. ```usd def Xform "World" { def Mesh "Cube" { double3 xformOp:rotateXYZ = (0, 0, 0) double3 xformOp:scale = (1, 1, 1) double3 xformOp:translate = (0, 0, 0) } } ``` 8 string comment = "The rest of the cube data omitted for brevity" 9 } 10 11 def OmniGraph "PushGraph" 12 { 13 token evaluator:type = "push" 14 token fabricCacheBacking = "Shared" 15 int2 fileFormatVersion = (1, 8) 16 token pipelineStage = "pipelineStageSimulation" 17 18 def OmniGraphNode "read_prim_into_bundle" 19 { 20 custom token inputs:attrNamesToImport = "*" 21 custom bool inputs:computeBoundingBox = 0 22 custom rel inputs:prim = 23 customData = { 24 dictionary omni = { 25 dictionary graph = { 26 string relType = "target" 27 } 28 } 29 } 30 ) 31 custom token inputs:primPath = "" 32 custom timecode inputs:usdTimecode = nan 33 custom bool inputs:usePath = 0 34 token node:type = "omni.graph.nodes.ReadPrimBundle" 35 int node:typeVersion = 7 36 custom rel outputs_primBundle ( 37 customData = { 38 dictionary omni = { 39 dictionary graph = { 40 string relType = "bundle" 41 } 42 } 43 } 44 ) 45 custom uint64 state:attrNamesToImport 46 custom bool state:computeBoundingBox 47 custom uint64 state:primPath 48 custom uint64 state:target = 0 49 custom timecode state:usdTimecode = -1 50 custom bool state:usePath 51 } 52 53 def OmniGraphNode "extract_bundle" 54 { 55 custom rel inputs:bundle = 56 customData = { 57 dictionary omni = { 58 dictionary graph = { 59 string relType = "bundle" 60 } 61 } 62 } 63 ) 64 token node:type = "omni.graph.nodes.ExtractBundle" 65 int node:typeVersion = 3 66 custom string outputs:comment 67 custom int[] outputs:faceVertexCounts 68 custom int[] outputs:faceVertexIndices 69 custom normal3f[] outputs:normals 70 custom rel outputs:passThrough ( 71 customData = { 72 dictionary omni = { 73 dictionary graph = { 74 string relType = "bundle" 75 } 76 } 77 } 78 ) 79 custom point3f[] outputs:points 80 custom float2[] outputs:primvars:st 81 custom token outputs:sourcePrimPath = "" 82 custom token outputs:sourcePrimType 83 custom token outputs:subdivisionScheme = "" 84 custom matrix4d outputs:worldMatrix = ((0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0), (0, 0, 0, 0)) 85 custom double3 outputs:xformOp:rotateXYZ = (0, 0, 0) 86 custom double3 outputs:xformOp:scale = (0, 0, 0) 87 custom double3 outputs:xformOp:translate = (0, 0, 0) 88 custom token[] outputs:xformOpOrder 89 } 90 } 91} The interpretation of the five highlighted sections is: 1. The import node is given a relationship to the prim it will be importing 2. The bundle it is creating is given a placeholder child prim of type “Output” 3. The generated bundle is passed along to the extract_bundle node via a connection 4. The worldMatrix value was extracted from the bundle containing the cube’s definition 5. The bundle being extracted is also presented as an output via the passThrough placeholder ## Extended Attributes An extended attribute is one that can take on any number of different types when it is part of an OmniGraph. For example it might be a double, float, or int value. The exact type will be determined by OmniGraph, either when a connection is made or a value is set. The actual attributes, however, are represented as token types in USD and it is only OmniGraph’s interpretation that provides them with their “real” type. Here is an example of a node having its inputs:floatOrToken attribute type resolve to a float value at runtime since it has an incoming connection from a float type attribute. ```usd def Xform "World" { def OmniGraph "ActionGraph" { token evaluator:type = "execution" token fabricCacheBacking = "Shared" int2 fileFormatVersion = (1, 4) token pipelineStage = "pipelineStageSimulation" def OmniGraphNode "tutorial_node_extended_attribute_types" { custom token inputs:flexible custom token inputs:floatOrToken custom token inputs:toNegate custom token inputs:tuple token node:type = "omni.graph.tutorials.ExtendedTypes" int node:typeVersion = 1 prepend token inputs:floatOrToken.connect = &lt;/World/ActionGraph/constant_float.inputs:value&gt; custom token outputs:doubledResult custom token outputs:flexible custom token outputs:negatedResult custom token outputs:tuple } def OmniGraphNode "constant_float" { custom float inputs:value = 0 token node:type = "omni.graph.nodes.ConstantFloat" int node:typeVersion = 1 } } } ``` # Mermaid Diagram ```mermaid flowchart LR subgraph /World/PushGraph constant_float --> tutorial_node_extended_attribute_types end ``` ## Path Attributes The special OmniGraph attribute type `path` is used to represent USD paths, represented as token-type attributes in USD. To OmniGraph they are equivalent to an `Sdf.Path` that points to a prim or attribute that may or may not exist on the USD stage. When paths are modified, OmniGraph listens to the USD notices and attempts to fix up any path attributes that may have changed locations. To USD though they are simply strings and no updates are attempted when OmniGraph is not enabled and listening to the changes. See the attribute `inputs:primPath` in the example above for the representation of a path attribute in USD. ## Accessing USD Prims From Nodes OmniGraph accesses USD scene data through special import and export nodes. Examples of each of these are the `ReadPrimBundle` node for importing a USD prim into an `OmniGraph bundle attribute` and a corresponding `WritePrim` node for exporting a computed bundle of attributes back onto a USD prim. Both of these node types use the `path attribute` type to specify the location of the prim on the USD stage that they will access. Once the nodes are connected to the prim they are importing or exporting, usually via specifying the `SdfPath` to that prim on the USD stage, they can be used the same as any other OmniGraph node, passing the extracted USD data through the graph for computation. See above for a detailed example. ## The USD API OmniGraph listens the USD change notices, so it is able to update values when the USD API is used to modify them, or by proxy when UI elements that use the USD API modify them. However this is not an efficient way to set values as the notification process can be slow so it is best to avoid this if possible. ```python import omni.usd import omni.graph.core as og from pxr import Usd # Slow Method prim_node = omni.usd.get_context().get_stage().GetPrimAtPath("/World/ActionGraph/constant_float") attribute = prim_node.GetAttribute("inputs:value") attribute.Set(5.0) # Fast Method og.Controller("/World/ActionGraph/constant_float.inputs:value").set(5.0) ```
24,592
UsdAppUtils.md
# UsdAppUtils module Summary: The UsdAppUtils module contains a number of utilities and common functionality for applications that view and/or record images of USD stages. ## Classes: | Class | Description | |-------|-------------| | [FrameRecorder](#pxr.UsdAppUtils.FrameRecorder) | A utility class for recording images of USD stages. | ### pxr.UsdAppUtils.FrameRecorder A utility class for recording images of USD stages. UsdAppUtilsFrameRecorder uses Hydra to produce recorded images of a USD stage looking through a particular UsdGeomCamera on that stage at a particular UsdTimeCode. The images generated will be effectively the same as what you would see in the viewer in usdview. Note that it is assumed that an OpenGL context has already been setup. **Methods:** | Method | Description | |--------|-------------| | [GetCurrentRendererId](#pxr.UsdAppUtils.FrameRecorder.GetCurrentRendererId)() | Gets the ID of the Hydra renderer plugin that will be used for recording. | | [Record](#pxr.UsdAppUtils.FrameRecorder.Record)(stage, usdCamera, timeCode, ...) | Records an image and writes the result to `outputImagePath`. | | [SetColorCorrectionMode](#pxr.UsdAppUtils.FrameRecorder.SetColorCorrectionMode)(colorCorrectionMode) | Sets the color correction mode to be used for recording. | | [SetComplexity](#pxr.UsdAppUtils.FrameRecorder.SetComplexity)(complexity) | Sets the level of refinement complexity. | | Method Name | Description | |-------------|-------------| | `SetImageWidth` (imageWidth) | Sets the width of the recorded image. | | `SetIncludedPurposes` (purposes) | Sets the UsdGeomImageable purposes to be used for rendering. | | `SetRendererPlugin` (id) | Sets the Hydra renderer plugin to be used for recording. | ### GetCurrentRendererId() - Returns: `str` - Description: Gets the ID of the Hydra renderer plugin that will be used for recording. ### Record(stage, usdCamera, timeCode, outputImagePath) - Returns: `bool` - Description: Records an image and writes the result to `outputImagePath`. The recorded image will represent the view from `usdCamera` looking at the imageable prims on USD stage `stage` at time `timeCode`. If `usdCamera` is not a valid camera, a camera will be computed to automatically frame the stage geometry. Returns true if the image was generated and written successfully, or false otherwise. - Parameters: - `stage` (Stage) - `usdCamera` (Camera) - `timeCode` (TimeCode) - `outputImagePath` (str) ### SetColorCorrectionMode(colorCorrectionMode) - Returns: `None` - Description: Sets the color correction mode to be used for recording. By default, color correction is disabled. - Parameters: - `colorCorrectionMode` (str) ## SetComplexity SetComplexity ( complexity ) → None Sets the level of refinement complexity. The default complexity is "low" (1.0). Parameters complexity (float) – ``` ## SetImageWidth ``` SetImageWidth ( imageWidth ) → None Sets the width of the recorded image. The height of the recorded image will be computed using this value and the aspect ratio of the camera used for recording. The default image width is 960 pixels. Parameters imageWidth (int) – ``` ## SetIncludedPurposes ``` SetIncludedPurposes ( purposes ) → None Sets the UsdGeomImageable purposes to be used for rendering. We will always include "default" purpose, and by default, we will also include UsdGeomTokens->proxy. Use this method to explicitly enumerate an alternate set of purposes to be included along with "default". Parameters purposes (list [TfToken]) – ``` ## SetRendererPlugin ``` SetRendererPlugin ( id ) → bool Sets the Hydra renderer plugin to be used for recording. Parameters id (str) – ``` ```
3,671
UsdGeom.md
# UsdGeom module Summary: The UsdGeom module defines 3D graphics-related prim and property schemas that form a basis for geometry interchange. ## Classes: - **BBoxCache** - Caches bounds by recursively computing and aggregating bounds of children in world space and aggregating the result back into local space. - **BasisCurves** - BasisCurves are a batched curve representation analogous to the classic RIB definition via Basis and Curves statements. - **Boundable** - Boundable introduces the ability for a prim to persistently cache a rectilinear, local-space, extent. - **Camera** - Transformable camera. - **Capsule** - Defines a primitive capsule, i.e. a cylinder capped by two half spheres, centered at the origin, whose spine is along the specified axis. - **Cone** - Defines a primitive cone, centered at the origin, whose spine is along the specified axis, with the apex of the cone pointing in the direction of the positive axis. - **ConstraintTarget** - Schema wrapper for UsdAttribute for authoring and introspecting attributes that are constraint targets. - **Cube** - Defines a primitive rectilinear cube centered at the origin. Curves ==== Base class for UsdGeomBasisCurves, UsdGeomNurbsCurves, and UsdGeomHermiteCurves. Cylinder ==== Defines a primitive cylinder with closed ends, centered at the origin, whose spine is along the specified axis. Gprim ==== Base class for all geometric primitives. HermiteCurves ==== This schema specifies a cubic hermite interpolated curve batch as sometimes used for defining guides for animation. Imageable ==== Base class for all prims that may require rendering or visualization of some sort. LinearUnits ==== Mesh ==== Encodes a mesh with optional subdivision properties and features. ModelAPI ==== UsdGeomModelAPI extends the generic UsdModelAPI schema with geometry specific concepts such as cached extents for the entire model, constraint targets, and geometry-inspired extensions to the payload lofting process. MotionAPI ==== UsdGeomMotionAPI encodes data that can live on any prim that may affect computations involving: NurbsCurves ==== This schema is analagous to NURBS Curves in packages like Maya and Houdini, often used for interchange of rigging and modeling curves. NurbsPatch ==== Encodes a rational or polynomial non-uniform B-spline surface, with optional trim curves. Plane ==== Defines a primitive plane, centered at the origin, and is defined by a cardinal axis, width, and length. PointBased ==== Base class for all UsdGeomGprims that possess points, providing common attributes such as normals and velocities. PointInstancer ==== Encodes vectorized instancing of multiple, potentially animated, prototypes (object/instance masters), which can be arbitrary prims/subtrees on a UsdStage. Points ==== Points are analogous to the RiPoints spec. Primvar ==== Schema wrapper for UsdAttribute for authoring and introspecting attributes that are primvars. PrimvarsAPI ==== UsdGeomPrimvarsAPI encodes geometric"primitive variables", as UsdGeomPrimvar, which interpolate across a primitive's topology, can override shader inputs, and inherit down namespace. | Scope | Scope is the simplest grouping primitive, and does not carry the baggage of transformability. | | --- | --- | | Sphere | Defines a primitive sphere centered at the origin. | | Subset | Encodes a subset of a piece of geometry (i.e. | | Tokens | | | VisibilityAPI | UsdGeomVisibilityAPI introduces properties that can be used to author visibility opinions. | | Xform | Concrete prim schema for a transform, which implements Xformable | | XformCache | A caching mechanism for transform matrices. | | XformCommonAPI | This class provides API for authoring and retrieving a standard set of component transformations which include a scale, a rotation, a scale- rotate pivot and a translation. | | XformOp | Schema wrapper for UsdAttribute for authoring and computing transformation operations, as consumed by UsdGeomXformable schema. | | XformOpTypes | | | Xformable | Base class for all transformable prims, which allows arbitrary sequences of component affine transformations to be encoded. | ### pxr.UsdGeom.BBoxCache class pxr.UsdGeom.BBoxCache Caches bounds by recursively computing and aggregating bounds of children in world space and aggregating the result back into local space. The cache is configured for a specific time and UsdGeomImageable::GetPurposeAttr() set of purposes. When querying a bound, transforms and extents are read either from the time specified or UsdTimeCode::Default() , following TimeSamples, Defaults, and Value Resolution standard time-sample value resolution. As noted in SetIncludedPurposes() , changing the included purposes does not invalidate the cache, because we cache purpose along with the geometric data. Child prims that are invisible at the requested time are excluded when computing a prim’s bounds. However, if a bound is requested directly for an excluded prim, it will be computed. Additionally, only prims deriving from UsdGeomImageable are included in child bounds computations. Unlike standard UsdStage traversals, the traversal performed by the UsdGeomBBoxCache includes prims that are unloaded (see UsdPrim::IsLoaded() ). This makes it possible to fetch bounds for a UsdStage that has been opened without forcePopulate, provided the unloaded model prims have authored extent hints (see UsdGeomModelAPI::GetExtentsHint() ). This class is optimized for computing tight "untransformed" object" space bounds for component-models. In the absence of component models, bounds are optimized for world-space, since there is no other easily identifiable space for which to optimize, and we cannot optimize for every prim’s local space without performing quadratic work. The TfDebug flag, USDGEOM_BBOX, is provided for debugging. #### Warning - This class should only be used with valid UsdPrim objects. - This cache does not listen for change notifications; the user is responsible for clearing the cache when changes occur. - Thread safety: instances of this class may not be used concurrently. - Plugins may be loaded in order to compute extents for prim types provided by that plugin. See ## UsdGeomBoundable::ComputeExtentFromPlugins ### Methods: | Method | Description | | ------ | ----------- | | `Clear()` | Clears all pre-cached values. | | `ClearBaseTime()` | Clear this cache's baseTime if one has been set. | | `ComputeLocalBound(prim)` | Computes the oriented bounding box of the given prim, leveraging any pre-existing, cached bounds. | | `ComputePointInstanceLocalBound(instancer, ...)` | Compute the oriented bounding boxes of the given point instances. | | `ComputePointInstanceLocalBounds(instancer, ...)` | Compute the oriented bounding boxes of the given point instances. | | `ComputePointInstanceRelativeBound(instancer, ...)` | Compute the bound of the given point instance in the space of an ancestor prim `relativeToAncestorPrim`. | | `ComputePointInstanceRelativeBounds(...)` | Compute the bounds of the given point instances in the space of an ancestor prim `relativeToAncestorPrim`. | | `ComputePointInstanceUntransformedBound(...)` | Computes the bound of the given point instances, but does not include the instancer's transform. | | `ComputePointInstanceUntransformedBounds(...)` | Computes the bound of the given point instances, but does not include the transform (if any) authored on the instancer itself. | | `ComputePointInstanceWorldBound(instancer, ...)` | Compute the bound of the given point instance in world space. | | `ComputePointInstanceWorldBounds(instancer, ...)` | Compute the bound of the given point instances in world space. | | `ComputeRelativeBound(prim, ...)` | Compute the bound of the given prim in the space of an ancestor prim, `relativeToAncestorPrim`, leveraging any pre-existing cached bounds. | | `ComputeUntransformedBound()` | [Description missing] | - **ComputeUntransformedBound (prim)** - Computes the bound of the prim's children leveraging any pre-existing, cached bounds, but does not include the transform (if any) authored on the prim itself. - **ComputeWorldBound (prim)** - Compute the bound of the given prim in world space, leveraging any pre-existing, cached bounds. - **ComputeWorldBoundWithOverrides (prim, ...)** - Computes the bound of the prim's descendents in world space while excluding the subtrees rooted at the paths in `pathsToSkip`. - **GetBaseTime ()** - Return the base time if set, otherwise GetTime(). - **GetIncludedPurposes ()** - Get the current set of included purposes. - **GetTime ()** - Get the current time from which this cache is reading values. - **GetUseExtentsHint ()** - Returns whether authored extent hints are used to compute bounding boxes. - **HasBaseTime ()** - Return true if this cache has a baseTime that's been explicitly set, false otherwise. - **SetBaseTime (baseTime)** - Set the base time value for this bbox cache. - **SetIncludedPurposes (includedPurposes)** - Indicate the set of `includedPurposes` to use when resolving child bounds. - **SetTime (time)** - Use the new `time` when computing values and may clear any existing values cached for the previous time. - **Clear ()** - Clears all pre-cached values. - **ClearBaseTime ()** - Clears the base time. ### Clear baseTime of cache - Clear this cache’s baseTime if one has been set. - After calling this, the cache will use its time as the baseTime value. ### ComputeLocalBound - Computes the oriented bounding box of the given prim, leveraging any pre-existing, cached bounds. - The computed bound includes the transform authored on the prim itself, but does not include any ancestor transforms (it does not include the local-to-world transform). - See ComputeWorldBound() for notes on performance and error handling. - Parameters: - prim (Prim) ### ComputePointInstanceLocalBound - Compute the oriented bounding boxes of the given point instances. - Parameters: - instancer (PointInstancer) - instanceId (int) ### ComputePointInstanceLocalBounds - Compute the oriented bounding boxes of the given point instances. - The computed bounds include the transform authored on the instancer itself, but does not include any ancestor transforms (it does not include the local-to-world transform). - The `result` pointer must point to `numIds` GfBBox3d instances to be filled. - Parameters: - instancer (PointInstancer) - instanceIdBegin (int) - numIds (int) - result (BBox3d) ### ComputePointInstanceRelativeBound - **Parameters** - **instancer** (PointInstancer) – - **instanceId** (int) – - **relativeToAncestorPrim** (Prim) – - **Description** Compute the bound of the given point instance in the space of an ancestor prim `relativeToAncestorPrim`. ### ComputePointInstanceRelativeBounds - **Parameters** - **instancer** (PointInstancer) – - **instanceIdBegin** (int) – - **numIds** (int) – - **relativeToAncestorPrim** (Prim) – - **result** (BBox3d) – - **Description** Compute the bounds of the given point instances in the space of an ancestor prim `relativeToAncestorPrim`. Write the results to `result`. The computed bound excludes the local transform at `relativeToAncestorPrim`. The computed bound may be incorrect if `relativeToAncestorPrim` is not an ancestor of `prim`. The `result` pointer must point to `numIds` GfBBox3d instances to be filled. ### ComputePointInstanceUntransformedBound - **Parameters** - **instancer** (PointInstancer) – - **instanceId** (int) – - **Description** Compute the untransformed bound of the given point instance. ## ComputePointInstanceUntransformedBound Computes the bound of the given point instances, but does not include the instancer’s transform. ### Parameters - **instancer** (PointInstancer) – - **instanceId** (int) – ## ComputePointInstanceUntransformedBounds Computes the bound of the given point instances, but does not include the transform (if any) authored on the instancer itself. **IMPORTANT:** while the BBox does not contain the local transformation, in general it may still contain a non-identity transformation matrix to put the bounds in the correct space. Therefore, to obtain the correct axis-aligned bounding box, the client must call ComputeAlignedRange(). The `result` pointer must point to `numIds` GfBBox3d instances to be filled. ### Parameters - **instancer** (PointInstancer) – - **instanceIdBegin** (int) – - **numIds** (int) – - **result** (BBox3d) – ## ComputePointInstanceWorldBound Compute the bound of the given point instance in world space. ### Parameters - **instancer** (PointInstancer) – - **instanceId** (int) – ## ComputePointInstanceWorldBounds Compute the bound of the given point instances in world space. ### Parameters - **instancer** (PointInstancer) – - **instanceIdBegin** (int) – - **numIds** (int) – - **result** (BBox3d) – ## ComputePointInstanceWorldBounds Compute the bound of the given point instances in world space. The bounds of each instance is computed and then transformed to world space. The `result` pointer must point to `numIds` GfBBox3d instances to be filled. ### Parameters - **instancer** (PointInstancer) – - **instanceIdBegin** (int) – - **numIds** (int) – - **result** (BBox3d) – ## ComputeRelativeBound Compute the bound of the given prim in the space of an ancestor prim, `relativeToAncestorPrim`, leveraging any pre-existing cached bounds. The computed bound excludes the local transform at `relativeToAncestorPrim`. The computed bound may be incorrect if `relativeToAncestorPrim` is not an ancestor of `prim`. ### Parameters - **prim** (Prim) – - **relativeToAncestorPrim** (Prim) – ## ComputeUntransformedBound Computes the bound of the prim’s children leveraging any pre-existing, cached bounds, but does not include the transform (if any) authored on the prim itself. **IMPORTANT:** while the BBox does not contain the local transformation, in general it may still contain a non-identity transformation matrix to put the bounds in the correct space. Therefore, to obtain the correct axis-aligned bounding box, the client must call ComputeAlignedRange(). See ComputeWorldBound() for notes on performance and error handling. ### Parameters - **prim** (Prim) – ### Overloaded Function ComputeUntransformedBound(prim, pathsToSkip, ctmOverrides) -> BBox3d This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the bound of the prim’s descendents while excluding the subtrees rooted at the paths in `pathsToSkip`. Additionally, the parameter `ctmOverrides` is used to specify overrides to the CTM values of certain paths underneath the prim. The CTM values in the `ctmOverrides` map are in the space of the given prim. This is the bounding box of the given prim, including all its descendants, in local space. This leverages any pre-existing, cached bounds, but does not include the transform (if any) authored on the prim itself. **IMPORTANT:** while the BBox does not contain the local transformation, in general it may still contain a non-identity transformation matrix to put the bounds in the correct space. Therefore, to obtain the correct axis-aligned bounding box, the client must call ComputeAlignedRange(). See ComputeWorldBound() for notes on performance and error handling. ### Parameters - **prim** (Prim) – - **pathsToSkip** (SdfPathSet) – - **ctmOverrides** (TfHashMap[Path, Matrix4d, Path.Hash]) – Compute the bound of the given prim in world space, leveraging any pre-existing, cached bounds. The bound of the prim is computed, including the transform (if any) authored on the node itself, and then transformed to world space. Error handling note: No checking of `prim` validity is performed. If `prim` is invalid, this method will abort the program; therefore it is the client’s responsibility to ensure `prim` is valid. ### Parameters - **prim** (Prim) – Computes the bound of the prim’s descendents in world space while excluding the subtrees rooted at the paths in `pathsToSkip`. Additionally, the parameter `primOverride` overrides the local-to-world transform of the prim and `ctmOverrides` is used to specify overrides the local-to-world transforms of certain paths underneath the prim. This leverages any pre-existing, cached bounds, but does not include the transform (if any) authored on the prim itself. See ComputeWorldBound() for notes on performance and error handling. ### Parameters - **prim** (Prim) – - **pathsToSkip** (SdfPathSet) – - **primOverride** (Matrix4d) – - **ctmOverrides** (TfHashMap[Path, Matrix4d, Path.Hash]) – - **ctmOverrides** (**TfHashMap** [**Path** , **Matrix4d** , **Path.Hash** ]) – ### GetBaseTime ```python GetBaseTime() -> TimeCode ``` Return the base time if set, otherwise GetTime(). Use HasBaseTime() to observe if a base time has been set. ### GetIncludedPurposes ```python GetIncludedPurposes() -> list[TfToken] ``` Get the current set of included purposes. ### GetTime ```python GetTime() -> TimeCode ``` Get the current time from which this cache is reading values. ### GetUseExtentsHint ```python GetUseExtentsHint() -> bool ``` Returns whether authored extent hints are used to compute bounding boxes. ### HasBaseTime ```python HasBaseTime() -> bool ``` Return true if this cache has a baseTime that’s been explicitly set, false otherwise. ### SetBaseTime ```python SetBaseTime(baseTime: TimeCode) -> None ``` Set the base time value for this bbox cache. This value is used only when computing bboxes for point instancer instances (see ComputePointInstanceWorldBounds() , for example). See UsdGeomPointInstancer::ComputeExtentAtTime() for more information. If unset, the bbox cache uses its time ( GetTime() / SetTime() ) for this value. Note that setting the base time does not invalidate any cache entries. Parameters: - **baseTime** (TimeCode) – ``` <span class="pre"> includedPurposes <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <dd> <p> Indicate the set of <code class="docutils literal notranslate"> <span class="pre"> includedPurposes to use when resolving child bounds. <p> Each child’s purpose must match one of the elements of this set to be included in the computation; if it does not, child is excluded. <p> Note the use of <em> child in the docs above, purpose is ignored for the prim for whose bounds are directly queried. <p> Changing this value <strong> does not invalidate existing caches . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> includedPurposes ( <em> list <em> [ <em> TfToken <em> ] ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.BBoxCache.SetTime"> <span class="sig-name descname"> <span class="pre"> SetTime <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> time <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <dd> <p> Use the new <code class="docutils literal notranslate"> <span class="pre"> time when computing values and may clear any existing values cached for the previous time. <p> Setting <code class="docutils literal notranslate"> <span class="pre"> time to the current time is a no-op. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> time ( <em> TimeCode ) – <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdGeom.BasisCurves"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.UsdGeom. <span class="sig-name descname"> <span class="pre"> BasisCurves <dd> <p> BasisCurves are a batched curve representation analogous to the classic RIB definition via Basis and Curves statements. BasisCurves are often used to render dense aggregate geometry like hair or grass. <p> A’matrix’and’vstep’associated with the <em> basis are used to interpolate the vertices of a cubic BasisCurves. (The basis attribute is unused for linear BasisCurves.) <p> A single prim may have many curves whose count is determined implicitly by the length of the <em> curveVertexCounts vector. Each individual curve is composed of one or more segments. Each segment is defined by four vertices for cubic curves and two vertices for linear curves. See the next section for more information on how to map curve vertex counts to segment counts. <section id="segment-indexing"> <h2> Segment Indexing <p> Interpolating a curve requires knowing how to decompose it into its individual segments. <p> The segments of a cubic curve are determined by the vertex count, the <em> wrap (periodicity), and the vstep of the basis. For linear curves, the basis token is ignored and only the vertex count and wrap are needed. <p> cubic basis <p> vstep <p> bezier <p> 3 <p> catmullRom <p> 1 <p> bspline <p> 1 <p> The first segment of a cubic (nonperiodic) curve is always defined by its first four points. The vstep is the increment used to determine what vertex indices define the next segment. For a two segment (nonperiodic) bspline basis curve (vstep = 1), the first segment will be defined by interpolating vertices [0, 1, 2, 3] and the second segment will be defined by [1, 2, 3, 4]. For a two segment bezier basis curve (vstep = 3), the first segment will be defined by interpolating vertices [0, 1, 2, 3] and the second segment will be defined by [3, 4, 5, 6]. If the vstep is not one, then you must take special care to make sure that the number of cvs properly divides by your vstep. (The indices described are relative to the initial vertex index for a batched curve.) <p> For periodic curves, at least one of the curve’s initial vertices are repeated to close the curve. For cubic curves, the number of vertices repeated is’4 - vstep’. For linear curves, only one vertex is repeated to close the loop. <p> Pinned curves are a special case of nonperiodic curves that only affects the behavior of cubic Bspline and Catmull-Rom curves. To evaluate or render pinned curves, a client must effectively add’phantom points’at the beginning and end of every curve in a batch. These phantom points are injected to ensure that the interpolated curve begins at P[0] and ends at P[n-1]. <p> For a curve with initial point P[0] and last point P[n-1], the phantom points are defined as. P[-1] = 2 * P[0] - P[1] P[n] = 2 * P[n-1] - P[n-2] <p> Pinned cubic curves will (usually) have to be unpacked into the standard nonperiodic representation before rendering. This unpacking can add some additional overhead. However, using pinned curves reduces the amount of data recorded in a scene and (more importantly) better records the authors’intent for interchange. <p> The additional phantom points mean that the minimum curve vertex count for cubic bspline and catmullRom curves is 2. Linear curve segments are defined by two vertices. A two segment linear curve’s first segment would be defined by interpolating vertices [0, 1]. The second segment would be defined by vertices [1, 2]. (Again, for a batched curve, indices are relative to the initial vertex index.) When validating curve topology, each renderable entry in the curveVertexCounts vector must pass this check. type wrap validitity linear nonperiodic curveVertexCounts[i]>2 linear periodic curveVertexCounts[i]>3 cubic nonperiodic (curveVertexCounts[i] - 4) % vstep == 0 cubic periodic (curveVertexCounts[i]) % vstep == 0 cubic pinned (catmullRom/bspline) (curveVertexCounts[i] - 2)>= 0 ## Cubic Vertex Interpolation ## Linear Vertex Interpolation Linear interpolation is always used on curves of type linear. 't' with domain [0, 1], the curve is defined by the equation P0 * (1-t) + P1 * t. t at 0 describes the first point and t at 1 describes the end point. ## Primvar Interpolation For cubic curves, primvar data can be either interpolated cubically between vertices or linearly across segments. The corresponding token for cubic interpolation is 'vertex' and for linear interpolation is 'varying'. Per vertex data should be the same size as the number of vertices in your curve. Segment varying data is dependent on the wrap (periodicity) and number of segments in your curve. For linear curves, varying and vertex data would be interpolated the same way. By convention varying is the preferred interpolation because of the association of varying with linear interpolation. To convert an entry in the curveVertexCounts vector into a segment count for an individual curve, apply these rules. Sum up all the results in order to compute how many total segments all curves have. The following tables describe the expected segment count for the 'i'th curve in a curve batch as well as the entire batch. Python syntax like '[:]' (to describe all members of an array) and 'len(...)' (to describe the length of an array) are used. type wrap curve segment count batch segment count linear nonperiodic curveVertexCounts[i] - 1 sum(curveVertexCounts[:]) - len(curveVertexCounts) linear periodic curveVertexCounts[i] sum(curveVertexCounts[:]) cubic nonperiodic (curveVertexCounts[i] - 4) / vstep + 1 sum(curveVertexCounts[:] - 4) / vstep + len(curveVertexCounts) cubic periodic curveVertexCounts[i] / vstep sum(curveVertexCounts[:]) / vstep cubic pinned (catmullRom/bspline) (curveVertexCounts[i] - 2) + 1 sum(curveVertexCounts[:] - 2) + len(curveVertexCounts) The following table describes the expected size of varying (linearly interpolated) data, derived from the segment counts computed above. wrap curve varying count batch varying count nonperiodic/pinned segmentCounts[i] + 1 sum(segmentCounts[:]) + len(curveVertexCounts) periodic segmentCounts[i] sum(segmentCounts[:]) Both curve types additionally define 'constant' interpolation for the entire prim and 'uniform' interpolation as per curve data. Take care when providing support for linearly interpolated data for cubic curves. Its shape doesn't provide a one to one mapping with either the number of curves (like 'uniform') or the number of vertices (like 'vertex') and so it is often overlooked. This is the only primitive in UsdGeom (as of this writing) where this is true. For meshes, while they use different interpolation methods, 'varying' and 'vertex' are both specified per point. It's common to assume that curves follow a similar pattern and build in structures and language for per primitive, per element, and per point data only to come upon these arrays that don't quite fit into either of those categories. It is also common to conflate 'varying' with being per segment data and use the segmentCount rules table instead of its neighboring varying data table rules. We suspect that this is because for the common case of nonperiodic cubic curves, both the provided segment count and varying data size formula end with '+ 1'. While debugging, users may look at the double '+ 1' as a mistake and try to remove it. We take this time to enumerate these issues because we've fallen into them before and hope that we save others time in their own implementations. As an example of deriving per curve segment and varying primvar data counts from the wrap, type, basis, and curveVertexCount, the following table is provided. wrap type basis curveVertexCount curveSegmentCount varyingDataCount nonperiodic linear N/A [2 3 2 5] [1 2 1 4] [2 3 2 5] nonperiodic cubic bezier [4 7 10 4 7] [1 2 3 1 2] [2 3 4 2 3] nonperiodic cubic bspline [5 4 6 7] [2 1 3 4] [3 2 4 5] periodic cubic bezier [6 9 6] [2 3 2] [2 3 2] periodic linear N/A [3 7] [3 7] [3 7] ## Tubes and Ribbons The strictest definition of a curve as an infinitely thin wire is not particularly useful for describing production scenes. The additional **Emphasized Text:** - widths - normals Attributes like widths and normals can be used to describe cylindrical tubes and or flat oriented ribbons. Curves with only widths defined are imaged as tubes with radius 'width / 2'. Curves with both widths and normals are imaged as ribbons oriented in the direction of the interpolated normal vectors. While not technically UsdGeomPrimvars, widths and normals also have interpolation metadata. It's common for authored widths to have constant, varying, or vertex interpolation (see UsdGeomCurves::GetWidthsInterpolation()). It's common for authored normals to have varying interpolation (see UsdGeomPointBased::GetNormalsInterpolation()). The file used to generate these curves can be found in pxr/extras/examples/usdGeomExamples/basisCurves.usda. It's provided as a reference on how to properly image both tubes and ribbons. The first row of curves are linear; the second are cubic bezier. (We aim in future releases of HdSt to fix the discontinuity seen with broken tangents to better match offline renderers like RenderMan.) The yellow and violet cubic curves represent cubic vertex width interpolation for which there is no equivalent for linear curves. How did this prim type get its name? This prim is a portmanteau of two different statements in the original RenderMan specification: 'Basis' and 'Curves'. For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded as the value. **Methods:** | Method Name | Description | |-------------|-------------| | ComputeInterpolationForSize(n, timeCode, info) | Computes interpolation token for n. | | ComputeUniformDataSize(timeCode) | Computes the expected size for data with "uniform" interpolation. | | ComputeVaryingDataSize(timeCode) | Computes the expected size for data with "varying" interpolation. | | ComputeVertexDataSize(timeCode) | Computes the expected size for data with "vertex" interpolation. | | CreateBasisAttr(defaultValue, writeSparsely) | See GetBasisAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateTypeAttr(defaultValue, writeSparsely) | See GetTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateWrapAttr(defaultValue, writeSparsely) | See GetWrapAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | Define(stage, path) -> BasisCurves | **classmethod** Define(stage, path) -> BasisCurves | | Get(stage, path) -> BasisCurves | **classmethod** Get(stage, path) -> BasisCurves | | GetBasisAttr() | The basis specifies the vstep and matrix used for cubic interpolation. | | Method Name | Description | |-------------|-------------| | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | A classmethod that returns a list of attribute names in the schema. | | `GetTypeAttr()` | Linear curves interpolate linearly between two vertices. | | `GetWrapAttr()` | If wrap is set to periodic, the curve when rendered will repeat the initial vertices (dependent on the vstep) to close the curve. | ### ComputeInterpolationForSize ```python ComputeInterpolationForSize(n, timeCode, info) -> str ``` Computes interpolation token for `n`. If this returns an empty token and `info` was non-None, it’ll contain the expected value for each token. The topology is determined using `timeCode`. **Parameters:** - `n` (int) – - `timeCode` (TimeCode) – - `info` (ComputeInterpolationInfo) – ### ComputeUniformDataSize ```python ComputeUniformDataSize(timeCode) -> int ``` Computes the expected size for data with "uniform" interpolation. If you’re trying to determine what interpolation to use, it is more efficient to use `ComputeInterpolationForSize`. **Parameters:** - `timeCode` (TimeCode) – ### ComputeVaryingDataSize ```python ComputeVaryingDataSize(timeCode) -> int ``` Computes the expected size for data with "varying" interpolation. If you’re trying to determine what interpolation to use, it is more efficient to use `ComputeInterpolationForSize`. **Parameters:** - `timeCode` (TimeCode) – ## ComputeVertexDataSize Computes the expected size for data with "vertex" interpolation. If you're trying to determine what interpolation to use, it is more efficient to use `ComputeInterpolationForSize`. ### Parameters - **timeCode** (TimeCode) – ## CreateBasisAttr See GetBasisAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateTypeAttr See GetTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateWrapAttr <em>defaultValue <em>writeSparsely ) → Attribute See GetWrapAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters: - **defaultValue** (VtValue) – - **writeSparsely** (bool) – static Define() classmethod Define(stage, path) -> BasisCurves Attempt to ensure a UsdPrim adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with specifier == SdfSpecifierDef and this schema’s prim type name for the prim at `path` at the current EditTarget. Author SdfPrimSpec s with `specifier` == SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid UsdPrim. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. Parameters: - **stage** (Stage) – - **path** (Path) – static Get() classmethod Get(stage, path) -> BasisCurves Return a UsdGeomBasisCurves holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. UsdGeomBasisCurves(stage->GetPrimAtPath(path)); ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetBasisAttr The basis specifies the vstep and matrix used for cubic interpolation. The 'hermite' and 'power' tokens have been removed. We've provided UsdGeomHermiteCurves as an alternative for the 'hermite' basis. #### Declaration ``` uniform token basis="bezier" ``` #### C++ Type TfToken #### Usd Type SdfValueTypeNames->Token #### Variability SdfVariabilityUniform #### Allowed Values bezier, bspline, catmullRom ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ### GetTypeAttr Linear curves interpolate linearly between two vertices. Cubic curves use a basis matrix with four vertices to interpolate a segment. #### Declaration ``` uniform token type="cubic" ``` #### C++ Type TfToken #### Usd Type SdfValueTypeNames->Token #### Variability SdfVariabilityUniform #### Allowed Values linear, cubic ### GetWrapAttr If wrap is set to periodic, the curve when rendered will repeat the initial vertices (dependent on the vstep) to close the curve. If wrap is set to 'pinned', phantom points may be created to ensure that the curve interpolation starts at P[0] and ends at P[n-1]. #### Declaration ``` uniform token wrap="nonperiodic" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Variability SdfVariabilityUniform Allowed Values nonperiodic, periodic, pinned class pxr.UsdGeom.Boundable Boundable introduces the ability for a prim to persistently cache a rectilinear, local-space, extent. ## Why Extent and not Bounds ? Boundable introduces the notion of "extent", which is a cached computation of a prim’s local-space 3D range for its resolved attributes at the layer and time in which extent is authored. We have found that with composed scene description, attempting to cache pre-computed bounds at interior prims in a scene graph is very fragile, given the ease with which one can author a single attribute in a stronger layer that can invalidate many authored caches - or with which a re-published, referenced asset can do the same. Therefore, we limit to precomputing (generally) leaf-prim extent, which avoids the need to read in large point arrays to compute bounds, and provides UsdGeomBBoxCache the means to efficiently compute and (session-only) cache intermediate bounds. You are free to compute and author intermediate bounds into your scenes, of course, which may work well if you have sufficient locks on your pipeline to guarantee that once authored, the geometry and transforms upon which they are based will remain unchanged, or if accuracy of the bounds is not an ironclad requisite. When intermediate bounds are authored on Boundable parents, the child prims will be pruned from BBox computation; the authored extent is expected to incorporate all child bounds. **Methods:** | Method | Description | |--------|-------------| | `ComputeExtent(radius, extent) -> bool` | Compute the extent for the sphere defined by the radius. | | `ComputeExtentFromPlugins(boundable, time, extent) -> bool` | Compute the extent from plugins. | | `CreateExtentAttr(defaultValue, writeSparsely)` | See GetExtentAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Get(stage, path) -> Boundable` | Get the Boundable instance. | | `GetExtentAttr()` | Extent is a three dimensional range measuring the geometric extent of the authored gprim in its own local space. | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | Get the attribute names of the schema. | ### ComputeExtent **classmethod** ComputeExtent(radius, extent) -> bool Compute the extent for the sphere defined by the radius. true upon success, false if unable to calculate extent. On success, extent will contain an approximate axis-aligned bounding box of the sphere defined by the radius. This function is to provide easy authoring of extent for usd authoring tools, hence it is static and acts outside a specific prim (as in attribute based methods). Parameters: - **radius** (float) – - **extent** **Vec3fArray** – ComputeExtent(radius, transform, extent) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the extent as if the matrix `transform` was first applied. **Parameters** - **radius** (float) – - **transform** (Matrix4d) – - **extent** (Vec3fArray) – **classmethod** ComputeExtentFromPlugins(boundable, time, extent) -> bool Compute the extent for the Boundable prim `boundable` at time `time`. If successful, populates `extent` with the result and returns `true`, otherwise returns `false`. The extent computation is based on the concrete type of the prim represented by `boundable`. Plugins that provide a Boundable prim type may implement and register an extent computation for that type using UsdGeomRegisterComputeExtentFunction. ComputeExtentFromPlugins will use this function to compute extents for all prims of that type. If no function has been registered for a prim type, but a function has been registered for one of its base types, that function will be used instead. This function may load plugins in order to access the extent computation for a prim type. **Parameters** - **boundable** (Boundable) – - **time** (TimeCode) – - **extent** (Vec3fArray) – ComputeExtentFromPlugins(boundable, time, transform, extent) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the extent as if the matrix `transform` was first applied. **Parameters** - **boundable** (Boundable) – - **time** (TimeCode) – - **transform** (Matrix4d) – - **extent** (Vec3fArray) – <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetExtentAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl> <dt> Parameters <dd> <ul> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Boundable.Get"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Get <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod Get(stage, path) -&gt; Boundable <p> Return a UsdGeomBoundable holding the prim adhering to this schema at <code> path on <code> stage . <p> If no prim exists at <code> path on <code> stage , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: <div class="highlight"> <pre>UsdGeomBoundable(stage-&gt;GetPrimAtPath(path)); <dl> <dt> Parameters <dd> <ul> <li> <p> <strong> stage ( <em> Stage ) – <li> <p> <strong> path ( <em> Path ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Boundable.GetExtentAttr"> <span class="sig-name descname"> <span class="pre"> GetExtentAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> → <span class="sig-return-typehint"> Attribute <dd> <p> Extent is a three dimensional range measuring the geometric extent of the authored gprim in its own local space (i.e. <p> its own transform not applied), <em> without accounting for any shader- induced displacement. If <strong> any extent value has been authored for a given Boundable, then it should be authored at every timeSample at which geometry-affecting properties are authored, to ensure correct evaluation via ComputeExtent() . If <strong> no extent value has been authored, then ComputeExtent() will call the Boundable’s registered ComputeExtentFunction(), which may be expensive, which is why we strongly encourage proper authoring of extent. <p> ComputeExtent() <p> Why Extent and not Bounds? . An authored extent on a prim which has children is expected to include the extent of all children, as they will be pruned from BBox computation during traversal. <p> Declaration <p> <code> float3[] extent <p> C++ Type <p> VtArray&lt;GfVec3f&gt; <p> Usd Type <p> SdfValueTypeNames-&gt;Float3Array ## GetSchemaAttributeNames ### classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ## pxr.UsdGeom.Camera ### class Camera Transformable camera. Describes optical properties of a camera via a common set of attributes that provide control over the camera’s frustum as well as its depth of field. For stereo, the left and right camera are individual prims tagged through the stereoRole attribute. There is a corresponding class GfCamera, which can hold the state of a camera (at a particular time). UsdGeomCamera::GetCamera() and UsdGeomCamera::SetFromCamera() convert between a USD camera prim and a GfCamera. To obtain the camera’s location in world space, call the following on a UsdGeomCamera ‘camera’: ```python GfMatrix4d camXform = camera.ComputeLocalToWorldTransform(time); ``` **Cameras in USD are always "Y up", regardless of the stage’s orientation (i.e. UsdGeomGetStageUpAxis() ).** This means that the inverse of 'camXform' (the VIEW half of the MODELVIEW transform in OpenGL parlance) will transform the world such that the camera is at the origin, looking down the -Z axis, with +Y as the up axis, and +X pointing to the right. This describes a **right handed coordinate system**. ### Units of Measure for Camera Properties Despite the familiarity of millimeters for specifying some physical camera properties, UsdGeomCamera opts for greater consistency with all other UsdGeom schemas, which measure geometric properties in scene units, as determined by UsdGeomGetStageMetersPerUnit(). We do make a concession, however, in that lens and filmback properties are measured in **tenths of a scene unit** rather than "raw" scene units. This means that with the fallback value of .01 for *metersPerUnit* - i.e. scene unit of centimeters - then these "tenth of scene unit" properties are effectively millimeters. If one adds a Camera prim to a UsdStage whose scene unit is not centimeters, the fallback values for filmback properties will be incorrect (or at the least, unexpected) in an absolute sense; however, proper imaging through a "default camera" with focusing disabled depends only on ratios of the other properties, so the camera is still usable. However, it follows that if even one property is authored in the correct scene units, then they all must be. Linear Algebra in UsdGeom For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded as the value. **Methods:** - **CreateClippingPlanesAttr** (defaultValue, ...) - See GetClippingPlanesAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateClippingRangeAttr** (defaultValue, ...) - See GetClippingRangeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateExposureAttr** (defaultValue, writeSparsely) - See GetExposureAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateFStopAttr** (defaultValue, writeSparsely) - See GetFStopAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateFocalLengthAttr** (defaultValue, ...) - See GetFocalLengthAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - `CreateFocusDistanceAttr` (defaultValue, ...) - See GetFocusDistanceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateHorizontalApertureAttr` (defaultValue, ...) - See GetHorizontalApertureAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateHorizontalApertureOffsetAttr` (...) - See GetHorizontalApertureOffsetAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateProjectionAttr` (defaultValue, writeSparsely) - See GetProjectionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateShutterCloseAttr` (defaultValue, ...) - See GetShutterCloseAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateShutterOpenAttr` (defaultValue, ...) - See GetShutterOpenAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateStereoRoleAttr` (defaultValue, writeSparsely) - See GetStereoRoleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateVerticalApertureAttr` (defaultValue, ...) - See GetVerticalApertureAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateVerticalApertureOffsetAttr` (...) - See GetVerticalApertureOffsetAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `Define` - `classmethod` Define(stage, path) -> Camera - `Get` - `classmethod` Get(stage, path) -> Camera - `GetCamera` (time) - Creates a GfCamera object from the attribute values at `time`. - `GetClippingPlanesAttr` () - Additional, arbitrarily oriented clipping planes. - `GetClippingRangeAttr` () - (Note: The description for `GetClippingRangeAttr` is missing in the provided HTML) - **GetClippingRangeAttr** - Near and far clipping distances in scene units; see Units of Measure for Camera Properties. - **GetExposureAttr** - Exposure adjustment, as a log base-2 value. - **GetFStopAttr** - Lens aperture. - **GetFocalLengthAttr** - Perspective focal length in tenths of a scene unit; see Units of Measure for Camera Properties. - **GetFocusDistanceAttr** - Distance from the camera to the focus plane in scene units; see Units of Measure for Camera Properties. - **GetHorizontalApertureAttr** - Horizontal aperture in tenths of a scene unit; see Units of Measure for Camera Properties. - **GetHorizontalApertureOffsetAttr** - Horizontal aperture offset in the same units as horizontalAperture. - **GetProjectionAttr** - Declaration - **GetSchemaAttributeNames** - **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] - **GetShutterCloseAttr** - Frame relative shutter close time, analogous comments from shutter:open apply. - **GetShutterOpenAttr** - Frame relative shutter open time in UsdTimeCode units (negative value indicates that the shutter opens before the current frame time). - **GetStereoRoleAttr** - If different from mono, the camera is intended to be the left or right camera of a stereo setup. - **GetVerticalApertureAttr** - Vertical aperture in tenths of a scene unit; see Units of Measure for Camera Properties. - **GetVerticalApertureOffsetAttr** - Vertical aperture offset in the same units as verticalAperture. - **SetFromCamera** - (No description provided) | (camera, time) | | --- | | Write attribute values from `camera` for `time`. | ### CreateClippingPlanesAttr ```python CreateClippingPlanesAttr(defaultValue, writeSparsely) → Attribute ``` See GetClippingPlanesAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateClippingRangeAttr ```python CreateClippingRangeAttr(defaultValue, writeSparsely) → Attribute ``` See GetClippingRangeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateExposureAttr ```python CreateExposureAttr(defaultValue, writeSparsely) → Attribute ``` See GetExposureAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ```code``` is ```code``` - the default for ```code``` is ```code```. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateFStopAttr ```code```(```code```, ```code```) → ```code``` See GetFStopAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```code``` as the attribute’s default, sparsely (when it makes sense to do so) if ```code``` is ```code``` - the default for ```code``` is ```code```. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateFocalLengthAttr ```code```(```code```, ```code```) → ```code``` See GetFocalLengthAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```code``` as the attribute’s default, sparsely (when it makes sense to do so) if ```code``` is ```code``` - the default for ```code``` is ```code```. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateFocusDistanceAttr ```code```(```code```, ```code```) → ```code``` See GetFocusDistanceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```code``` as the attribute’s default, sparsely (when it makes sense to do so) if ```code``` is ```code``` - the default for ```code``` is ```code```. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateFocusDistanceAttr See GetFocusDistanceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateHorizontalApertureAttr See GetHorizontalApertureAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateHorizontalApertureOffsetAttr See GetHorizontalApertureOffsetAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateProjectionAttr ```CreateProjectionAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See GetProjectionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateShutterCloseAttr ```CreateShutterCloseAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See GetShutterCloseAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateShutterOpenAttr ```CreateShutterOpenAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See GetShutterOpenAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – - **defaultValue** (**VtValue**) – - **writeSparsely** (**bool**) – ## CreateStereoRoleAttr - **defaultValue** - **writeSparsely** - Returns: **Attribute** See GetStereoRoleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (**VtValue**) – - **writeSparsely** (**bool**) – ## CreateVerticalApertureAttr - **defaultValue** - **writeSparsely** - Returns: **Attribute** See GetVerticalApertureAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (**VtValue**) – - **writeSparsely** (**bool**) – ## CreateVerticalApertureOffsetAttr - **defaultValue** - **writeSparsely** - Returns: **Attribute** See GetVerticalApertureOffsetAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue (<em> VtValue <li> <p> <strong> writeSparsely (<em> bool <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Camera.Define"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Define <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdGeom.Camera.Define" title="Permalink to this definition">  <dd> <p> <strong> classmethod Define(stage, path) -&gt; Camera <p> Attempt to ensure a <em> UsdPrim adhering to this schema at <code class="docutils literal notranslate"> <span class="pre"> path is defined (according to UsdPrim::IsDefined() ) on this stage. <p> If a prim adhering to this schema at <code class="docutils literal notranslate"> <span class="pre"> path is already defined on this stage, return that prim. Otherwise author an <em> SdfPrimSpec with <em> specifier == <em> SdfSpecifierDef and this schema’s prim type name for the prim at <code class="docutils literal notranslate"> <span class="pre"> path at the current EditTarget. Author <em> SdfPrimSpec s with <code class="docutils literal notranslate"> <span class="pre"> specifier == <em> SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not <em> Defined ancestors. <p> The given <em> path must be an absolute prim path that does not contain any variant selections. <p> If it is impossible to author any of the necessary PrimSpecs, (for example, in case <em> path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid <em> UsdPrim . <p> Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> stage (<em> Stage <li> <p> <strong> path (<em> Path <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Camera.Get"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Get <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdGeom.Camera.Get" title="Permalink to this definition">  <dd> <p> <strong> classmethod Get(stage, path) -&gt; Camera <p> Return a UsdGeomCamera holding the prim adhering to this schema at <code class="docutils literal notranslate"> <span class="pre"> path on <code class="docutils literal notranslate"> <span class="pre"> stage . <p> If no prim exists at <code class="docutils literal notranslate"> <span class="pre"> path on <code class="docutils literal notranslate"> <span class="pre"> stage , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: <div class="highlight-text notranslate"> <div class="highlight"> <pre><span> <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> stage (<em> Stage <li> <p> <strong> path (<em> Path <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Camera.GetCamera"> <span class="sig-name descname"> ### GetCamera (time) → Camera Creates a GfCamera object from the attribute values at time. #### Parameters - **time** (TimeCode) – ### GetClippingPlanesAttr () → Attribute Additional, arbitrarily oriented clipping planes. A vector (a,b,c,d) encodes a clipping plane that cuts off (x,y,z) with a * x + b * y + c * z + d * 1&lt;0 where (x,y,z) are the coordinates in the camera’s space. #### Declaration ``` float4[] clippingPlanes = [] ``` #### C++ Type VtArray&lt;GfVec4f&gt; #### Usd Type SdfValueTypeNames-&gt;Float4Array ### GetClippingRangeAttr () → Attribute Near and far clipping distances in scene units; see Units of Measure for Camera Properties. #### Declaration ``` float2 clippingRange = (1, 1000000) ``` #### C++ Type GfVec2f #### Usd Type SdfValueTypeNames-&gt;Float2 ### GetExposureAttr () → Attribute Exposure adjustment, as a log base-2 value. The default of 0.0 has no effect. A value of 1.0 will double the image-plane intensities in a rendered image; a value of -1.0 will halve them. #### Declaration ``` float exposure = 0 ``` #### C++ Type float #### Usd Type SdfValueTypeNames-&gt;Float ### GetFStopAttr () → Attribute Lens aperture. Defaults to 0.0, which turns off focusing. #### Declaration ``` float fStop = 0 ``` ### GetFocalLengthAttr - **Return Type**: Attribute - **Description**: Perspective focal length in tenths of a scene unit; see Units of Measure for Camera Properties. - **Declaration**: ``` float focalLength = 50 ``` - **C++ Type**: float - **Usd Type**: SdfValueTypeNames->Float ### GetFocusDistanceAttr - **Return Type**: Attribute - **Description**: Distance from the camera to the focus plane in scene units; see Units of Measure for Camera Properties. - **Declaration**: ``` float focusDistance = 0 ``` - **C++ Type**: float - **Usd Type**: SdfValueTypeNames->Float ### GetHorizontalApertureAttr - **Return Type**: Attribute - **Description**: Horizontal aperture in tenths of a scene unit; see Units of Measure for Camera Properties. Default is the equivalent of the standard 35mm spherical projector aperture. - **Declaration**: ``` float horizontalAperture = 20.955 ``` - **C++ Type**: float - **Usd Type**: SdfValueTypeNames->Float ### GetHorizontalApertureOffsetAttr - **Return Type**: Attribute - **Description**: Horizontal aperture offset in the same units as horizontalAperture. Defaults to 0. - **Declaration**: ``` float horizontalApertureOffset = 0 ``` - **C++ Type**: float - **Usd Type**: SdfValueTypeNames->Float ### GetProjectionAttr - **Return Type**: Attribute - **Description**: (No specific description provided) - **Declaration**: ``` (Code block not fully provided) ``` ```pre token ``` ```pre projection ``` ```pre ="perspective" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Allowed Values perspective, orthographic ```pre static ``` ```pre GetSchemaAttributeNames ``` ```pre GetSchemaAttributeNames ``` ( ) ```pre classmethod ``` GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters ```pre includeInherited ``` (bool) – ```pre GetShutterCloseAttr ``` ( ) ```pre → ``` ```pre Attribute ``` Frame relative shutter close time, analogous comments from shutter:open apply. A value greater or equal to shutter:open should be authored, otherwise there is no exposure and a renderer should produce a black image. Declaration ```pre double ``` ```pre shutter:close ``` ```pre = ``` ```pre 0 ``` C++ Type double Usd Type SdfValueTypeNames->Double ```pre GetShutterOpenAttr ``` ( ) ```pre → ``` ```pre Attribute ``` Frame relative shutter open time in UsdTimeCode units (negative value indicates that the shutter opens before the current frame time). Used for motion blur. Declaration ```pre double ``` ```pre shutter:open ``` ```pre = ``` ```pre 0 ``` C++ Type double Usd Type SdfValueTypeNames->Double ```pre GetStereoRoleAttr ``` ( ) ```pre → ``` ```pre Attribute ``` If different from mono, the camera is intended to be the left or right camera of a stereo setup. Declaration ```pre uniform ``` ```pre token ``` ```pre stereoRole ``` ```pre ="mono" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Variability SdfVariabilityUniform Allowed Values mono, left, right ```pre GetVerticalApertureAttr ``` ( ) ```pre → ``` ```pre Attribute ``` <dl> <dt> <p> Vertical aperture in tenths of a scene unit; see Units of Measure for Camera Properties. <p> Default is the equivalent of the standard 35mm spherical projector aperture. <p> Declaration <p> <code> float verticalAperture = 15.2908 <p> C++ Type <p> float <p> Usd Type <p> SdfValueTypeNames->Float <dd> <p> Vertical aperture offset in the same units as verticalAperture. <p> Defaults to 0. <p> Declaration <p> <code> float verticalApertureOffset = 0 <p> C++ Type <p> float <p> Usd Type <p> SdfValueTypeNames->Float <dd> <p> Write attribute values from camera for time. <p> These attributes will be updated: <blockquote> <ul> <li> projection <li> horizontalAperture <li> horizontalApertureOffset <li> verticalAperture <li> verticalApertureOffset <li> focalLength <li> clippingRange <li> clippingPlanes <li> fStop <li> focalDistance <li> xformOpOrder and xformOp:transform <p> This will clear any existing xformOpOrder and replace it with a single xformOp:transform entry. The xformOp:transform property is created or updated here to match the transform on camera. This operation will fail if there are stronger xform op opinions in the composed layer stack that are stronger than that of the current edit target. <dl> <dt> Parameters <dd> <ul> <li> <strong> camera (Camera) – <li> <strong> time (TimeCode) – # Values below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded as the value. ## Methods: | Method Name | Description | |-------------|-------------| | `CreateAxisAttr(defaultValue, writeSparsely)` | See GetAxisAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateExtentAttr(defaultValue, writeSparsely)` | See GetExtentAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateHeightAttr(defaultValue, writeSparsely)` | See GetHeightAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateRadiusAttr(defaultValue, writeSparsely)` | See GetRadiusAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Define(stage, path)` | `classmethod Define(stage, path) -> Capsule` | | `Get(stage, path)` | `classmethod Get(stage, path) -> Capsule` | | `GetAxisAttr()` | The axis along which the spine of the capsule is aligned. | | `GetExtentAttr()` | Extent is re-defined on Capsule only to provide a fallback value. | | `GetHeightAttr()` | The size of the capsule's spine along the specified axis excluding the size of the two half spheres, i.e. | | `GetRadiusAttr()` | The radius of the capsule. | | `GetSchemaAttributeNames(includeInherited)` | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | ## CreateAxisAttr ```python CreateAxisAttr(defaultValue, writeSparsely) → Attribute ``` See GetAxisAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue. ``` See GetExtentAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – See GetHeightAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – See GetRadiusAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## pxr.UsdGeom.Capsule.CreateRadiusAttr See GetRadiusAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## pxr.UsdGeom.Capsule.Define **classmethod** Define(stage, path) -> Capsule Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ## pxr.UsdGeom.Capsule.Get **classmethod** Get(stage, path) -> Capsule Return a UsdGeomCapsule holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdGeomCapsule(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### GetAxisAttr - **Description**: The axis along which the spine of the capsule is aligned. - **Declaration**: ``` uniform token axis = "Z" ``` - **C++ Type**: TfToken - **Usd Type**: SdfValueTypeNames->Token - **Variability**: SdfVariabilityUniform - **Allowed Values**: X, Y, Z ### GetExtentAttr - **Description**: Extent is re-defined on Capsule only to provide a fallback value. - **Declaration**: ``` float3[] extent = [(-0.5, -0.5, -1), (0.5, 0.5, 1)] ``` - **C++ Type**: VtArray<GfVec3f> - **Usd Type**: SdfValueTypeNames->Float3Array ### GetHeightAttr - **Description**: The size of the capsule’s spine along the specified axis excluding the size of the two half spheres, i.e. the size of the cylinder portion of the capsule. If you author height you must also author extent. - **Declaration**: ``` double height = 1 ``` - **C++ Type**: double - **Usd Type**: SdfValueTypeNames->Double ### GetRadiusAttr - **Description**: The radius of the capsule. If you author radius you must also author extent. - **Declaration**: ``` double radius = 0.5 ``` - **C++ Type**: double - **Usd Type**: SdfValueTypeNames->Double ### GetSchemaAttributeNames - **Description**: (static) <strong>classmethod Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <strong>includeInherited <em class="property"><span class="pre">class Defines a primitive cone, centered at the origin, whose spine is along the specified <em>axis The fallback values for Cube, Sphere, Cone, and Cylinder are set so that they all pack into the same volume/bounds. For any described attribute <em>Fallback <strong>Methods: | Method | Description | | --- | --- | | CreateAxisAttr(defaultValue, writeSparsely) | See GetAxisAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateExtentAttr(defaultValue, writeSparsely) | See GetExtentAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateHeightAttr(defaultValue, writeSparsely) | See GetHeightAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateRadiusAttr(defaultValue, writeSparsely) | See GetRadiusAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | <strong>classmethod | <strong>classmethod | GetAxisAttr() | The axis along which the spine of the cone is aligned. | | GetExtentAttr() | Extent is re-defined on Cone only to provide a fallback value. | | GetHeightAttr() | The size of the cone's spine along the specified <em>axis | GetRadiusAttr() | The radius of the cone. | | GetSchemaAttributeNames | | --- | | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | ### CreateAxisAttr ```python CreateAxisAttr(defaultValue, writeSparsely) -> Attribute ``` See GetAxisAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateExtentAttr ```python CreateExtentAttr(defaultValue, writeSparsely) -> Attribute ``` See GetExtentAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateHeightAttr ```python CreateHeightAttr(defaultValue, writeSparsely) -> Attribute ``` See GetHeightAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ```python false ``` ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ```python CreateRadiusAttr(defaultValue, writeSparsely) → Attribute ``` See GetRadiusAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ```python static classmethod Define(stage, path) -> Cone ``` Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ```python static classmethod Get(stage, path) -> Cone ``` <p> Return a UsdGeomCone holding the prim adhering to this schema at <code>path <p> If no prim exists at <code>path <div> <pre>UsdGeomCone(stage-&gt;GetPrimAtPath(path)); <dl> <dt>Parameters <dd> <ul> <li> <p><strong>stage <li> <p><strong>path <dl> <dt><span class="pre">GetAxisAttr <dd> <p>The axis along which the spine of the cone is aligned. <p>Declaration <p><code>uniform token axis ="Z" <p>C++ Type <p>TfToken <p>Usd Type <p>SdfValueTypeNames-&gt;Token <p>Variability <p>SdfVariabilityUniform <p>Allowed Values <p>X, Y, Z <dl> <dt><span class="pre">GetExtentAttr <dd> <p>Extent is re-defined on Cone only to provide a fallback value. <p>UsdGeomGprim::GetExtentAttr(). <p>Declaration <p><code>float3[] extent = [(-1, -1, -1), (1, 1, 1)] <p>C++ Type <p>VtArray&lt;GfVec3f&gt; <p>Usd Type <p>SdfValueTypeNames-&gt;Float3Array <dl> <dt><span class="pre">GetHeightAttr <dd> <p>The size of the cone’s spine along the specified <em>axis <p>If you author <em>height <p>GetExtentAttr() <p>Declaration <p><code>double height = 2 <p>C++ Type <p>double <p>Usd Type <p>SdfValueTypeNames-&gt;Double <dl> <dt><span class="pre">GetRadiusAttr <dd> <p>The size of the cone’s spine along the specified <em>axis <p>If you author <em>height <p>GetExtentAttr() <p>Declaration <p><code>double height = 2 <p>C++ Type <p>double <p>Usd Type <p>SdfValueTypeNames-&gt;Double <dl> <dt> <p> The radius of the cone. <p> If you author <em> radius you must also author <em> extent . <p> GetExtentAttr() <p> Declaration <p> <code> double radius = 1 <p> C++ Type <p> double <p> Usd Type <p> SdfValueTypeNames->Double <dt> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <p> Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. <p> Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl> <dt> Parameters <dd> <p> <strong> includeInherited ( <em> bool ) – <dt> <p> Schema wrapper for UsdAttribute for authoring and introspecting attributes that are constraint targets. <p> Constraint targets correspond roughly to what some DCC’s call locators. They are coordinate frames, represented as (animated or static) GfMatrix4d values. We represent them as attributes in USD rather than transformable prims because generally we require no other coordinated information about a constraint target other than its name and its matrix value, and because attributes are more concise than prims. <p> Because consumer clients often care only about the identity and value of constraint targets and may be able to usefully consume them without caring about the actual geometry with which they may logically correspond, UsdGeom aggregates all constraint targets onto a model’s root prim, assuming that an exporter will use property namespacing within the constraint target attribute’s name to indicate a path to a prim within the model with which the constraint target may correspond. <p> To facilitate instancing, and also position-tweaking of baked assets, we stipulate that constraint target values always be recorded in <strong>model-relative transformation space <p> <strong> Methods: <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr> <td> <p> <code> ComputeInWorldSpace (time, xfCache) <td> <p> Computes the value of the constraint target in world space. <tr> <td> <p> <code> Get (value, time) <td> <p> Get the attribute value of the ConstraintTarget at time. <tr> <td> <p> <code> GetAttr () <td> <p> Explicit UsdAttribute extractor. <tr> <td> <p> <code> GetConstraintAttrName () <td> <p> <strong> classmethod GetConstraintAttrName(constraintName) -> str <tr> <td> <p> <code> GetIdentifier () <td> <p> Get the stored identifier unique to the enclosing model's namespace for this constraint target. <tr> <td> <p> <code> IsDefined () <td> <p> Return true if the wrapped UsdAttribute::IsDefined() , and in addition the attribute is identified as a ConstraintTarget. <p> IsValid <p> classmethod IsValid(attr) -> bool <p> Set (value, time) <p> Set the attribute value of the ConstraintTarget at time. <p> SetIdentifier (identifier) <p> Explicitly sets the stored identifier to the given string. <dl> <dt> ComputeInWorldSpace (time, xfCache) → Matrix4d <dd> <p> Computes the value of the constraint target in world space. <p> If a valid UsdGeomXformCache is provided in the argument xfCache, it is used to evaluate the CTM of the model to which the constraint target belongs. <p> To get the constraint value in model-space (or local space), simply use UsdGeomConstraintTarget::Get() , since the authored values must already be in model-space. <dl> <dt> Parameters <dd> <ul> <li> <p> time (TimeCode) – <li> <p> xfCache (XformCache) – <dt> Get (value, time) → bool <dd> <p> Get the attribute value of the ConstraintTarget at time. <dl> <dt> Parameters <dd> <ul> <li> <p> value (Matrix4d) – <li> <p> time (TimeCode) – <dt> GetAttr () → Attribute <dd> <p> Explicit UsdAttribute extractor. <dt> static GetConstraintAttrName () ## classmethod GetConstraintAttrName(constraintName) -> str Returns the fully namespaced constraint attribute name, given the constraint name. ### Parameters - **constraintName** (str) – ## GetIdentifier() -> str Get the stored identifier unique to the enclosing model’s namespace for this constraint target. SetIdentifier() ## IsDefined() -> bool Return true if the wrapped UsdAttribute::IsDefined() , and in addition the attribute is identified as a ConstraintTarget. ## classmethod IsValid(attr) -> bool Test whether a given UsdAttribute represents valid ConstraintTarget, which implies that creating a UsdGeomConstraintTarget from the attribute will succeed. Success implies that `attr.IsDefined()` is true. ### Parameters - **attr** (Attribute) – ## Set(value, time) -> bool Set the attribute value of the ConstraintTarget at `time`. ### Parameters - **value** (Matrix4d) – - **time** (TimeCode) – ## SetIdentifier(identifier) -> None Explicitly sets the stored identifier to the given string. Clients are responsible for ensuring the uniqueness of this identifier within the enclosing model’s namespace. ### Parameters - **identifier** (str) – ### Cube Defines a primitive rectilinear cube centered at the origin. The fallback values for Cube, Sphere, Cone, and Cylinder are set so that they all pack into the same volume/bounds. **Methods:** | Method | Description | |--------|-------------| | `CreateExtentAttr(defaultValue, writeSparsely)` | See GetExtentAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateSizeAttr(defaultValue, writeSparsely)` | See GetSizeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Define(stage, path)` | **classmethod** Define(stage, path) -> Cube | | `Get(stage, path)` | **classmethod** Get(stage, path) -> Cube | | `GetExtentAttr()` | Extent is re-defined on Cube only to provide a fallback value. | | `GetSchemaAttributeNames(includeInherited)` | **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | `GetSizeAttr()` | Indicates the length of each edge of the cube. | #### CreateExtentAttr(defaultValue, writeSparsely) See GetExtentAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – #### CreateSizeAttr(defaultValue, writeSparsely) See GetSizeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateSizeAttr See GetSizeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### Define **classmethod** Define(stage, path) -> Cube Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. #### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### Get **classmethod** Get(stage, path) -> Cube Return a UsdGeomCube holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```cpp UsdGeomCube(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (`Stage`) – **path** (**Path**) – ## GetExtentAttr ### Declaration ``` float3[] extent = [(-1, -1, -1), (1, 1, 1)] ``` ### C++ Type VtArray&lt;GfVec3f&gt; ### Usd Type SdfValueTypeNames-&gt;Float3Array Extent is re-defined on Cube only to provide a fallback value. UsdGeomGprim::GetExtentAttr(). ## GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – ## GetSizeAttr Indicates the length of each edge of the cube. If you author **size** you must also author **extent**. GetExtentAttr() ### Declaration ``` double size = 2 ``` ### C++ Type double ### Usd Type SdfValueTypeNames-&gt;Double ## Curves Base class for UsdGeomBasisCurves, UsdGeomNurbsCurves, and UsdGeomHermiteCurves. The BasisCurves schema is designed to be analagous to offline renderers’ notion of batched curves (such as the classical RIB definition via Basis and Curves statements), while the NurbsCurve schema is designed to be analgous to the NURBS curves found in packages like Maya and Houdini while retaining their consistency with the RenderMan specification for NURBS Patches. HermiteCurves are useful for the interchange of animation guides and paths. It is safe to use the length of the curve vertex count to derive the number of curves and the number and layout of curve vertices, but this schema should NOT be used to derive the number of curve points. While vertex indices are implicit in all shipped descendent types of this schema, one should not assume that all internal or future shipped schemas will follow this pattern. Be sure to key any indexing behavior off the concrete type, not this abstract type. **Methods:** - **classmethod** ComputeExtent(points, widths, extent) -> bool ``` | CreateCurveVertexCountsAttr (defaultValue, ...) | See GetCurveVertexCountsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | |------------------------------------------------|----------------------------------------------------------------------------------------------------------| | CreateWidthsAttr (defaultValue, writeSparsely) | See GetWidthsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | Get (classmethod Get(stage, path) -> Curves) | | | GetCurveCount (timeCode) | Returns the number of curves as defined by the size of the curveVertexCounts array at timeCode. | | GetCurveVertexCountsAttr () | Curves-derived primitives can represent multiple distinct, potentially disconnected curves. | | GetSchemaAttributeNames (includeInherited) -> list[TfToken] | | | GetWidthsAttr () | Provides width specification for the curves, whose application will depend on whether the curve is oriented (normals are defined for it), in which case widths are"ribbon width", or unoriented, in which case widths are cylinder width. | | GetWidthsInterpolation () | Get the interpolation for the widths attribute. | | SetWidthsInterpolation (interpolation) | Set the interpolation for the widths attribute. | ### ComputeExtent **classmethod** ComputeExtent(points, widths, extent) -> bool Compute the extent for the curves defined by points and widths. true upon success, false if unable to calculate extent. On success, extent will contain an approximate axis-aligned bounding box of the curve defined by points with the given widths. This function is to provide easy authoring of extent for usd authoring tools, hence it is static and acts outside a specific prim (as in attribute based methods). **Parameters** - **points** (Vec3fArray) - **widths** (FloatArray) - **extent** (Vec3fArray) ComputeExtent(points, widths, transform, extent) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the extent as if the matrix transform was first applied. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong>points <li> <p> <strong>widths <li> <p> <strong>transform <li> <p> <strong>extent <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Curves.CreateCurveVertexCountsAttr"> <span class="sig-name descname"> <span class="pre"> CreateCurveVertexCountsAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdGeom.Curves.CreateCurveVertexCountsAttr" title="Permalink to this definition">  <dd> <p> See GetCurveVertexCountsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong>defaultValue <li> <p> <strong>writeSparsely <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Curves.CreateWidthsAttr"> <span class="sig-name descname"> <span class="pre"> CreateWidthsAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdGeom.Curves.CreateWidthsAttr" title="Permalink to this definition">  <dd> <p> See GetWidthsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong>defaultValue <li> <p> <strong>writeSparsely <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Curves.Get"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Get <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdGeom.Curves.Get" title="Permalink to this definition">  <dd> <p> <strong>classmethod <p> Return a UsdGeomCurves holding the prim adhering to this schema at ```code path ``` on ```code stage ``` . If no prim exists at ```code path ``` on ```code stage ``` , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```text UsdGeomCurves(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetCurveCount ```text GetCurveCount(timeCode) ``` → int Returns the number of curves as defined by the size of the `curveVertexCounts` array at `timeCode`. For most code, this check will be performant. When using file formats where the cost of attribute reading is high and the time sampled array will be read into memory later, it may be better to explicitly read the value once and check the size of the array directly. ### GetCurveVertexCountsAttr ```text GetCurveVertexCountsAttr() ``` → Attribute Curves-derived primitives can represent multiple distinct, potentially disconnected curves. The length of 'curveVertexCounts' gives the number of such curves, and each element describes the number of vertices in the corresponding curve. Declaration ```text int[] curveVertexCounts ``` C++ Type ```text VtArray<int> ``` Usd Type ```text SdfValueTypeNames->IntArray ``` ### GetSchemaAttributeNames ```text static GetSchemaAttributeNames(includeInherited) ``` → list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - **includeInherited** (bool) – ### GetWidthsAttr ```text GetWidthsAttr() ``` → Attribute Provides width specification for the curves, whose application will depend on whether the curve is oriented (normals are defined for it), in which case widths are "ribbon width", or unoriented, in which case widths are cylinder width. 'widths' is not a generic Primvar, but the number of elements in this attribute will be determined by its 'interpolation'. See SetWidthsInterpolation(). If 'widths' and 'primvars:widths' are both specified, the latter has precedence. Declaration C++ Type ``` ```c++ float[] widths ``` ```cpp VtArray<float> ``` Usd Type ``` SdfValueTypeNames->FloatArray ``` GetWidthsInterpolation ```python def GetWidthsInterpolation(): return str ``` Get the interpolation for the *widths* attribute. Although 'widths' is not classified as a generic UsdGeomPrimvar (and will not be included in the results of UsdGeomPrimvarsAPI::GetPrimvars()) it does require an interpolation specification. The fallback interpolation, if left unspecified, is UsdGeomTokens->vertex, which means a width value is specified at the end of each curve segment. SetWidthsInterpolation ```python def SetWidthsInterpolation(interpolation): return bool ``` Set the interpolation for the *widths* attribute. true upon success, false if `interpolation` is not a legal value as defined by UsdPrimvar::IsValidInterpolation(), or if there was a problem setting the value. No attempt is made to validate that the widths attr's value contains the right number of elements to match its interpolation to its prim's topology. Parameters ``` interpolation (str) – ``` class pxr.UsdGeom.Cylinder ``` class pxr.UsdGeom.Cylinder ``` Defines a primitive cylinder with closed ends, centered at the origin, whose spine is along the specified *axis*. The fallback values for Cube, Sphere, Cone, and Cylinder are set so that they all pack into the same volume/bounds. For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded as the value. Methods: ``` CreateAxisAttr(defaultValue, writeSparsely) CreateExtentAttr(defaultValue, writeSparsely) CreateHeightAttr(defaultValue, writeSparsely) CreateRadiusAttr(defaultValue, writeSparsely) Define(stage, path) -> Cylinder ``` | Get | classmethod Get(stage, path) -> Cylinder | | --- | --- | | GetAxisAttr() | The axis along which the spine of the cylinder is aligned. | | GetExtentAttr() | Extent is re-defined on Cylinder only to provide a fallback value. | | GetHeightAttr() | The size of the cylinder's spine along the specified axis. | | GetRadiusAttr() | The radius of the cylinder. | | GetSchemaAttributeNames | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | ### CreateAxisAttr ```python CreateAxisAttr(defaultValue, writeSparsely) -> Attribute ``` See GetAxisAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateExtentAttr ```python CreateExtentAttr(defaultValue, writeSparsely) -> Attribute ``` See GetExtentAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. . ``` ```markdown false ``` ```markdown . ``` ```markdown Parameters ``` ```markdown - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ``` ```markdown CreateHeightAttr ``` ```markdown ( ``` ```markdown defaultValue ``` ```markdown , ``` ```markdown writeSparsely ``` ```markdown ) ``` ```markdown → Attribute ``` ```markdown See GetHeightAttr() , and also Create vs Get Property Methods for when to use Get vs Create. ``` ```markdown If specified, author ``` ```markdown defaultValue ``` ```markdown as the attribute’s default, sparsely (when it makes sense to do so) if ``` ```markdown writeSparsely ``` ```markdown is ``` ```markdown true ``` ```markdown - the default for ``` ```markdown writeSparsely ``` ```markdown is ``` ```markdown false ``` ```markdown . ``` ```markdown Parameters ``` ```markdown - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ``` ```markdown CreateRadiusAttr ``` ```markdown ( ``` ```markdown defaultValue ``` ```markdown , ``` ```markdown writeSparsely ``` ```markdown ) ``` ```markdown → Attribute ``` ```markdown See GetRadiusAttr() , and also Create vs Get Property Methods for when to use Get vs Create. ``` ```markdown If specified, author ``` ```markdown defaultValue ``` ```markdown as the attribute’s default, sparsely (when it makes sense to do so) if ``` ```markdown writeSparsely ``` ```markdown is ``` ```markdown true ``` ```markdown - the default for ``` ```markdown writeSparsely ``` ```markdown is ``` ```markdown false ``` ```markdown . ``` ```markdown Parameters ``` ```markdown - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ``` ```markdown static Define() ``` ```markdown classmethod Define(stage, path) -> Cylinder ``` ```markdown Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. ``` ```markdown If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at path ``` at the current EditTarget. Author **SdfPrimSpec** s with ``` specifier ``` == **SdfSpecifierDef** and empty typeName at the current EditTarget for any nonexistent, or existing but not **Defined** ancestors. The given **path** must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case **path** cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. Parameters - **stage** (Stage) – - **path** (Path) – ``` static Get () classmethod ``` Get(stage, path) -> Cylinder Return a UsdGeomCylinder holding the prim adhering to this schema at ``` path ``` on ``` stage ``` . If no prim exists at ``` path ``` on ``` stage ``` , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdGeomCylinder(stage->GetPrimAtPath(path)); ``` Parameters - **stage** (Stage) – - **path** (Path) – ``` GetAxisAttr () ``` → ``` Attribute ``` The axis along which the spine of the cylinder is aligned. Declaration ``` uniform token axis ="Z" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Variability SdfVariabilityUniform Allowed Values X, Y, Z ``` GetExtentAttr () ``` → ``` Attribute ``` Extent is re-defined on Cylinder only to provide a fallback value. UsdGeomGprim::GetExtentAttr() . Declaration ``` float3[] extent = [(-1, -1, -1), ```html <span class="pre"> (1, <span class="pre"> 1, <span class="pre"> 1)] <p> C++ Type <p> VtArray&lt;GfVec3f&gt; <p> Usd Type <p> SdfValueTypeNames-&gt;Float3Array <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Cylinder.GetHeightAttr"> <span class="sig-name descname"> <span class="pre"> GetHeightAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdGeom.Cylinder.GetHeightAttr" title="Permalink to this definition">  <dd> <p> The size of the cylinder’s spine along the specified <em> axis . <p> If you author <em> height you must also author <em> extent . <p> GetExtentAttr() <p> Declaration <p> <code class="docutils literal notranslate"> <span class="pre"> double <span class="pre"> height <span class="pre"> = <span class="pre"> 2 <p> C++ Type <p> double <p> Usd Type <p> SdfValueTypeNames-&gt;Double <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Cylinder.GetRadiusAttr"> <span class="sig-name descname"> <span class="pre"> GetRadiusAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdGeom.Cylinder.GetRadiusAttr" title="Permalink to this definition">  <dd> <p> The radius of the cylinder. <p> If you author <em> radius you must also author <em> extent . <p> GetExtentAttr() <p> Declaration <p> <code class="docutils literal notranslate"> <span class="pre"> double <span class="pre"> radius <span class="pre"> = <span class="pre"> 1 <p> C++ Type <p> double <p> Usd Type <p> SdfValueTypeNames-&gt;Double <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Cylinder.GetSchemaAttributeNames"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> GetSchemaAttributeNames <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdGeom.Cylinder.GetSchemaAttributeNames" title="Permalink to this definition">  <dd> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <p> Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. <p> Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> includeInherited ( <em> bool ) – <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdGeom.Gprim"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.UsdGeom. <span class="sig-name descname"> <span class="pre"> Gprim <a class="headerlink" href="#pxr.UsdGeom.Gprim" title="Permalink to this definition">  <dd> <p> Base class for all geometric primitives. <p> Gprim encodes basic graphical properties such as <em> doubleSided and <em> orientation , and provides primvars for”display color”and”displayopacity”that travel with geometry to be used as shader overrides. <p> For any described attribute <em> Fallback <em> Value or <em> Allowed <em> Values below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value”rightHanded”, use UsdGeomTokens-&gt;rightHanded as the value. <p> <strong> Methods: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.Gprim.CreateDisplayColorAttr" title="pxr.UsdGeom.Gprim.CreateDisplayColorAttr"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateDisplayColorAttr (defaultValue, ...) <td> <p> See GetDisplayColorAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.Gprim.CreateDisplayColorPrimvar" title="pxr.UsdGeom.Gprim.CreateDisplayColorPrimvar"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateDisplayColorPrimvar (interpolation, ...) | td | p | | --- | --- | | | Convenience function to create the displayColor primvar, optionally specifying interpolation and elementSize. | | | See GetDisplayOpacityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | | Convenience function to create the displayOpacity primvar, optionally specifying interpolation and elementSize. | | | See GetDoubleSidedAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | | See GetOrientationAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | | **classmethod** Get(stage, path) -> Gprim | | | It is useful to have an "official" colorSet that can be used as a display or modeling color, even in the absence of any specified shader for a gprim. | | | Convenience function to get the displayColor Attribute as a Primvar. | | | Companion to *displayColor* that specifies opacity, broken out as an independent attribute rather than an rgba color, both so that each can be independently overridden, and because shaders rarely consume rgba parameters. | | | Convenience function to get the displayOpacity Attribute as a Primvar. | | | Although some renderers treat all parametric or polygonal surfaces as if they were effectively laminae with outward-facing normals on both sides, some renderers derive significant optimizations by considering these surfaces to have only a single outward side, typically determined by control-point winding order and/or *orientation*. | | | Orientation specifies whether the gprim's surface normal should be computed using the right hand rule, or the left hand rule. | | | **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] | <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetDisplayColorAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Gprim.CreateDisplayColorPrimvar"> <span class="sig-name descname"> <span class="pre"> CreateDisplayColorPrimvar <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> interpolation , <em class="sig-param"> <span class="n"> <span class="pre"> elementSize <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Primvar <dd> <p> Convenience function to create the displayColor primvar, optionally specifying interpolation and elementSize. <p> CreateDisplayColorAttr() , GetDisplayColorPrimvar() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> interpolation ( <em> str ) – <li> <p> <strong> elementSize ( <em> int ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Gprim.CreateDisplayOpacityAttr"> <span class="sig-name descname"> <span class="pre"> CreateDisplayOpacityAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetDisplayOpacityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Gprim.CreateDisplayOpacityPrimvar"> <span class="sig-name descname"> <span class="pre"> CreateDisplayOpacityPrimvar <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> interpolation , <em class="sig-param"> <span class="n"> <span class="pre"> elementSize <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Primvar <dd> <p> Convenience function to create the displayOpacity primvar, optionally specifying interpolation and elementSize. <p> CreateDisplayOpacityAttr() , GetDisplayOpacityPrimvar() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> interpolation ( <em> str ) – <li> <p> <strong> elementSize ( <em> int ) – ### pxr.UsdGeom.Gprim.CreateDisplayOpacityPrimvar Convenience function to create the displayOpacity primvar, optionally specifying interpolation and elementSize. CreateDisplayOpacityAttr() , GetDisplayOpacityPrimvar() #### Parameters - **interpolation** (`str`) – - **elementSize** (`int`) – ### pxr.UsdGeom.Gprim.CreateDoubleSidedAttr CreateDoubleSidedAttr(defaultValue, writeSparsely) See GetDoubleSidedAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### pxr.UsdGeom.Gprim.CreateOrientationAttr CreateOrientationAttr(defaultValue, writeSparsely) See GetOrientationAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### pxr.UsdGeom.Gprim.Get **classmethod** Get(stage, path) -> Gprim Return a UsdGeomGprim holding the prim adhering to this schema at `path` on `stage`. If no prim exists at ```cpp path ``` on ```cpp stage ``` , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```cpp UsdGeomGprim(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetDisplayColorAttr ``` GetDisplayColorAttr() ``` It is useful to have an “official” colorSet that can be used as a display or modeling color, even in the absence of any specified shader for a gprim. DisplayColor serves this role; because it is a UsdGeomPrimvar, it can also be used as a gprim override for any shader that consumes a displayColor parameter. Declaration ``` color3f[] primvars:displayColor ``` C++ Type ``` VtArray<GfVec3f> ``` Usd Type ``` SdfValueTypeNames->Color3fArray ``` ### GetDisplayColorPrimvar ``` GetDisplayColorPrimvar() ``` Convenience function to get the displayColor Attribute as a Primvar. GetDisplayColorAttr(), CreateDisplayColorPrimvar() ### GetDisplayOpacityAttr ``` GetDisplayOpacityAttr() ``` Companion to displayColor that specifies opacity, broken out as an independent attribute rather than an rgba color, both so that each can be independently overridden, and because shaders rarely consume rgba parameters. Declaration ``` float[] primvars:displayOpacity ``` C++ Type ``` VtArray<float> ``` Usd Type ``` SdfValueTypeNames->FloatArray ``` ### GetDisplayOpacityPrimvar ``` GetDisplayOpacityPrimvar() ``` Convenience function to get the displayOpacity Attribute as a Primvar. GetDisplayOpacityAttr(), CreateDisplayOpacityPrimvar() ### GetDoubleSidedAttr ``` GetDoubleSidedAttr() ``` Although some renderers treat all parametric or polygonal surfaces as if they were effectively laminae with outward-facing normals on both sides, some renderers derive significant optimizations by considering these surfaces to have only a single outward side, typically determined by control-point winding order and/or **orientation**. By doing so they can perform “backface culling” to avoid drawing the many polygons of most closed surfaces that face away from the viewer. However, it is often advantageous to model thin objects such as paper and cloth as single, open surfaces that must be viewable from both sides, always. Setting a gprim’s **doubleSided** attribute to ``` true ``` instructs all renderers to disable optimizations such as backface culling for the gprim, and attempt (not all renderers are able to do so, but the USD reference GL renderer always will) to provide forward- facing normals on each side of the surface for lighting calculations. Declaration ``` uniform bool doubleSided = 0 ``` C++ Type bool Usd Type SdfValueTypeNames->Bool Variability SdfVariabilityUniform Orientation specifies whether the gprim’s surface normal should be computed using the right hand rule, or the left hand rule. Please see Coordinate System, Winding Order, Orientation, and Surface Normals for a deeper explanation and generalization of orientation to composed scenes with transformation hierarchies. Declaration ``` uniform token orientation ="rightHanded" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Variability SdfVariabilityUniform Allowed Values rightHanded, leftHanded **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters **includeInherited** (bool) – This schema specifies a cubic hermite interpolated curve batch as sometimes used for defining guides for animation. While hermite curves can be useful because they interpolate through their control points, they are not well supported by high-end renderers for imaging. Therefore, while we include this schema for interchange, we strongly recommend the use of UsdGeomBasisCurves as the representation of curves intended to be rendered (ie. hair or grass). Hermite curves can be converted to a Bezier representation (though not from Bezier back to Hermite in general). ### Point Interpolation The initial cubic curve segment is defined by the first two points and first two tangents. Additional segments are defined by additional point / tangent pairs. The number of segments for each non-batched hermite curve would be len(curve.points) - 1. The total number of segments for the batched UsdGeomHermiteCurves representation is len(points) - len(curveVertexCounts). ### Primvar, Width, and Normal Interpolation Primvar interpolation is not well specified for this type as it is not intended as a rendering representation. We suggest that per point primvars would be linearly interpolated across each segment and should be tagged as’varying’. It is not immediately clear how to specify cubic or’vertex’interpolation for this type, as we lack a specification for primvar tangents. This also means that width and normal interpolation should be restricted to varying (linear), uniform (per curve element), or constant (per prim). **Classes:** ## Methods: ### CreateTangentsAttr(defaultValue, writeSparsely) See GetTangentsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. ### Define(stage, path) -> HermiteCurves classmethod ### Get(stage, path) -> HermiteCurves classmethod ### GetSchemaAttributeNames(includeInherited) -> list[TfToken] classmethod ### GetTangentsAttr() Defines the outgoing trajectory tangent for each point. ## PointAndTangentArrays ### Methods: #### GetPoints #### GetTangents #### Interleave #### IsEmpty #### Separate #### GetPoints #### GetTangents ### Interleave ``` ### IsEmpty ``` ### Separate ``` ### CreateTangentsAttr ``` See GetTangentsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ``` ### Define ``` **classmethod** Define(stage, path) -> HermiteCurves Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - ``` - **stage** (Stage) – - **path** (Path) – ### Get **classmethod** Get(stage, path) -> HermiteCurves Return a UsdGeomHermiteCurves holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```text UsdGeomHermiteCurves(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – ### GetTangentsAttr Defines the outgoing trajectory tangent for each point. Tangents should be the same size as the points attribute. **Declaration** ```text vector3f[] tangents = [] ``` **C++ Type** VtArray<GfVec3f> **Usd Type** SdfValueTypeNames->Vector3fArray ### Imageable Base class for all prims that may require rendering or visualization of some sort. The primary attributes of Imageable are `visibility` and `purpose`, which each provide instructions for what geometry should be included for processing by rendering and other computations. **Deprecated** Imageable also provides API for accessing primvars, which has been moved to the UsdGeomPrimvarsAPI schema, because primvars can now be applied on non-Imageable prim types. This API is planned to be removed, UsdGeomPrimvarsAPI should be used directly instead. ``` **Fallback** **Value** or **Allowed** **Values** below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded as the value. **Classes:** **Methods:** | Method Name | Description | |---------------------------------------|--------------------------------------------------------------------------------------------------| | ComputeEffectiveVisibility(purpose, time) | Calculate the effective purpose visibility of this prim for the given purpose, taking into account opinions for the corresponding purpose attribute, along with overall visibility opinions. | | ComputeLocalBound(time, purpose1, purpose2, ...) | Compute the bound of this prim in local space, at the specified time, and for the specified purposes. | | ComputeLocalToWorldTransform(time) | Compute the transformation matrix for this prim at the given time, including the transform authored on the Prim itself, if present. | | ComputeParentToWorldTransform(time) | Compute the transformation matrix for this prim at the given time, NOT including the transform authored on the prim itself. | | ComputeProxyPrim() | Returns None if neither this prim nor any of its ancestors has a valid renderProxy prim. | | ComputePurpose() | Calculate the effective purpose information about this prim. | | ComputePurposeInfo() | Calculate the effective purpose information about this prim which includes final computed purpose value of the prim as well as whether the purpose value should be inherited by namespace children without their own purpose opinions. | | ComputeUntransformedBound(time, purpose1, ...) | Compute the untransformed bound of this prim, at the specified time, and for the specified purposes. | | ComputeVisibility(time) | Calculate the effective visibility of this prim, as defined by its most ancestral authored "invisible" opinion, if any. | | ComputeWorldBound(time, purpose1, purpose2, ...) | Compute the bound of this prim in world space, at the specified time, and for the specified purposes. | | | | |----|-------------------------------------------------------------------------------------| | 奇 | `CreateProxyPrimRel()` | | | See GetProxyPrimRel() , and also Create vs Get Property Methods for when to use Get vs Create. | | 偶 | `CreatePurposeAttr(defaultValue, writeSparsely)` | | | See GetPurposeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | 奇 | `CreateVisibilityAttr(defaultValue, writeSparsely)` | | | See GetVisibilityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | 偶 | `Get` | | | **classmethod** Get(stage, path) -> Imageable | | 奇 | `GetOrderedPurposeTokens()` | | | **classmethod** GetOrderedPurposeTokens() -> list[TfToken] | | 偶 | `GetProxyPrimRel()` | | | The *proxyPrim* relationship allows us to link a prim whose *purpose* is "render" to its (single target) purpose="proxy" prim. | | 奇 | `GetPurposeAttr()` | | | Purpose is a classification of geometry into categories that can each be independently included or excluded from traversals of prims on a stage, such as rendering or bounding-box computation traversals. | | 偶 | `GetPurposeVisibilityAttr(purpose)` | | | Return the attribute that is used for expressing visibility opinions for the given *purpose*. | | 奇 | `GetSchemaAttributeNames(includeInherited)` | | | **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | 偶 | `GetVisibilityAttr()` | | | Visibility is meant to be the simplest form of "pruning" visibility that is supported by most DCC apps. | | 奇 | `MakeInvisible(time)` | | | Makes the imageable invisible if it is visible at the given time. | | 偶 | `MakeVisible(time)` | | | Make the imageable visible if it is invisible at the given time. | | 奇 | `SetProxyPrim(proxy)` | | | Convenience function for authoring the *renderProxy* rel on this prim to target the given *proxy* prim. | <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-name descname"> <span class="pre"> PurposeInfo <dd> <p> <strong> Methods: <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code> <span class="pre"> GetInheritablePurpose <td> <p> <p> <strong> Attributes: <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code> <span class="pre"> isInheritable <td> <p> <tr class="row-even"> <td> <p> <code> <span class="pre"> purpose <td> <p> <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Imageable.PurposeInfo.GetInheritablePurpose"> <span class="sig-name descname"> <span class="pre"> GetInheritablePurpose <span class="sig-paren"> () <dd> <dl class="py property"> <dt class="sig sig-object py" id="pxr.UsdGeom.Imageable.PurposeInfo.isInheritable"> <em class="property"> <span class="pre"> property <span class="w"> <span class="sig-name descname"> <span class="pre"> isInheritable <dd> <dl class="py property"> <dt class="sig sig-object py" id="pxr.UsdGeom.Imageable.PurposeInfo.purpose"> <em class="property"> <span class="pre"> property <span class="w"> <span class="sig-name descname"> <span class="pre"> purpose <dd> <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Imageable.ComputeEffectiveVisibility"> <span class="sig-name descname"> <span class="pre"> ComputeEffectiveVisibility <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> purpose , <em class="sig-param"> <span class="n"> <span class="pre"> time <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> str <dd> <p> Calculate the effective purpose visibility of this prim for the given <code> <span class="pre"> purpose , taking into account opinions for the corresponding purpose attribute, along with overall visibility opinions. <p> If ComputeVisibility() returns”invisible”, then ComputeEffectiveVisibility() is”invisible”for all purpose values. Otherwise, ComputeEffectiveVisibility() returns the value of the nearest ancestral authored opinion for the corresponding purpose visibility attribute, as retured by GetPurposeVisibilityAttr(purpose). <p> Note that the value returned here can be”invisible”(indicating the prim is invisible for the given purpose),”visible”(indicating that it’s visible), or”inherited”(indicating that the purpose visibility is context-dependent and the fallback behavior must be determined by the caller. <p> This function should be considered a reference implementation for correctness. <strong> If called on each prim in the context of a traversal we will perform massive overcomputation, because sibling prims share sub- problems in the query that can be efficiently cached, but are not (cannot be) by this simple implementation. If you have control of your traversal, it will be far more efficient to manage visibility on a stack as you traverse. <p> UsdGeomVisibilityAPI <p> GetPurposeVisibilityAttr() <p> ComputeVisibility() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> purpose (<em> str <li> <p> <strong> time (<a href="Sdf.html#pxr.Sdf.TimeCode" title="pxr.Sdf.TimeCode"> <em> TimeCode ### ComputeLocalBound **Parameters** - **time** (TimeCode) – - **purpose1** (str) – - **purpose2** (str) – - **purpose3** (str) – - **purpose4** (str) – Compute the bound of this prim in local space, at the specified time, and for the specified purposes. The bound of the prim is computed, including the transform (if any) authored on the node itself. It is an error to not specify any purposes, which will result in the return of an empty box. **If you need to compute bounds for multiple prims on a stage, it will be much, much more efficient to instantiate a UsdGeomBBoxCache and query it directly; doing so will reuse sub-computations shared by the prims.** ### ComputeLocalToWorldTransform **Parameters** - **time** (TimeCode) – Compute the transformation matrix for this prim at the given time, including the transform authored on the Prim itself, if present. **If you need to compute the transform for multiple prims on a stage, it will be much, much more efficient to instantiate a UsdGeomXformCache and query it directly; doing so will reuse sub-computations shared by the prims.** ### ComputeParentToWorldTransform **Parameters** - **time** (TimeCode) – Compute the transformation matrix for this prim at the given time, NOT including the transform authored on the prim itself. **If you need to compute the transform for multiple prims on a stage, it will be much, much more efficient to instantiate a UsdGeomXformCache and query it directly; doing so will reuse sub-computations shared by the prims.** ### ComputeProxyPrim Returns None if neither this prim nor any of its ancestors has a valid renderProxy prim. Otherwise, returns a tuple of (proxyPrim, renderPrimWithAuthoredProxyPrimRel) ## ComputePurpose ``` Calculate the effective purpose information about this prim. This is equivalent to extracting the purpose from the value returned by ComputePurposeInfo(). This function should be considered a reference implementation for correctness. **If called on each prim in the context of a traversal we will perform massive overcomputation, because sibling prims share sub-problems in the query that can be efficiently cached, but are not (cannot be) by this simple implementation.** If you have control of your traversal, it will be far more efficient to manage purpose, along with visibility, on a stack as you traverse. GetPurposeAttr(), Imageable Purpose ## ComputePurposeInfo ``` Calculate the effective purpose information about this prim which includes final computed purpose value of the prim as well as whether the purpose value should be inherited by namespace children without their own purpose opinions. This function should be considered a reference implementation for correctness. **If called on each prim in the context of a traversal we will perform massive overcomputation, because sibling prims share sub-problems in the query that can be efficiently cached, but are not (cannot be) by this simple implementation.** If you have control of your traversal, it will be far more efficient to manage purpose, along with visibility, on a stack as you traverse. GetPurposeAttr(), Imageable Purpose ComputePurposeInfo(parentPurposeInfo) -> PurposeInfo This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Calculates the effective purpose information about this prim, given the computed purpose information of its parent prim. This can be much more efficient than using CommputePurposeInfo() when PurposeInfo values are properly computed and cached for a hierarchy of prims using this function. GetPurposeAttr(), Imageable Purpose ### Parameters - **parentPurposeInfo** (PurposeInfo) – ## ComputeUntransformedBound ``` Compute the untransformed bound of this prim, at the specified time, and for the specified purposes. The bound of the prim is computed in its object space, ignoring any transforms authored on or above the prim. It is an error to not specify any purposes, which will result in the return of an empty box. **If you need to compute bounds for multiple prims on a stage, it will be much, much more efficient to instantiate a UsdGeomBBoxCache and query it directly; doing so will reuse sub-computations shared by the prims.** ### Parameters - **time** (TimeCode) – - **purpose1** (str) – - **purpose2** (str) – - **purpose3** (str) – - **purpose4** (str) – ### ComputeVisibility Calculate the effective visibility of this prim, as defined by its most ancestral authored "invisible" opinion, if any. A prim is considered visible at the current `time` if none of its Imageable ancestors express an authored "invisible" opinion, which is what leads to the "simple pruning" behavior described in GetVisibilityAttr(). This function should be considered a reference implementation for correctness. **If called on each prim in the context of a traversal we will perform massive overcomputation, because sibling prims share sub-problems in the query that can be efficiently cached, but are not (cannot be) by this simple implementation.** If you have control of your traversal, it will be far more efficient to manage visibility on a stack as you traverse. GetVisibilityAttr() #### Parameters - **time** (TimeCode) – ### ComputeWorldBound Compute the bound of this prim in world space, at the specified `time`, and for the specified purposes. The bound of the prim is computed, including the transform (if any) authored on the node itself, and then transformed to world space. It is an error to not specify any purposes, which will result in the return of an empty box. **If you need to compute bounds for multiple prims on a stage, it will be much, much more efficient to instantiate a UsdGeomBBoxCache and query it directly; doing so will reuse sub-computations shared by the prims.** #### Parameters - **time** (TimeCode) – - **purpose1** (str) – - **purpose2** (str) – - **purpose3** (str) – - **purpose4** (str) – ### CreateProxyPrimRel See GetProxyPrimRel(), and also Create vs Get Property Methods for when to use Get vs Create. ### CreatePurposeAttr Create a purpose attribute with the specified default value and sparse write flag. #### Parameters - **defaultValue** - **writeSparsely** ## pxr.UsdGeom.Imageable.CreatePurposeAttr See GetPurposeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## pxr.UsdGeom.Imageable.CreateVisibilityAttr See GetVisibilityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## pxr.UsdGeom.Imageable.Get **classmethod** Get(stage, path) -> Imageable Return a UsdGeomImageable holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdGeomImageable(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ## pxr.UsdGeom.Imageable.GetOrderedPurposeTokens ``` **classmethod** GetOrderedPurposeTokens() -> list[TfToken] Returns an ordered list of allowed values of the purpose attribute. The ordering is important because it defines the protocol between UsdGeomModelAPI and UsdGeomBBoxCache for caching and retrieving extents hints by purpose. The order is: [default, render, proxy, guide] See UsdGeomModelAPI::GetExtentsHint() . GetOrderedPurposeTokens() --- **GetProxyPrimRel**() -> Relationship The *proxyPrim* relationship allows us to link a prim whose *purpose* is "render" to its (single target) purpose="proxy" prim. This is entirely optional, but can be useful in several scenarios: - In a pipeline that does pruning (for complexity management) by deactivating prims composed from asset references, when we deactivate a purpose="render" prim, we will be able to discover and additionally deactivate its associated purpose="proxy" prim, so that preview renders reflect the pruning accurately. - DCC importers may be able to make more aggressive optimizations for interactive processing and display if they can discover the proxy for a given render prim. - With a little more work, a Hydra-based application will be able to map a picked proxy prim back to its render geometry for selection. It is only valid to author the proxyPrim relationship on prims whose purpose is "render". --- **GetPurposeAttr**() -> Attribute Purpose is a classification of geometry into categories that can each be independently included or excluded from traversals of prims on a stage, such as rendering or bounding-box computation traversals. See Imageable Purpose for more detail about how *purpose* is computed and used. Declaration ``` uniform token purpose="default" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Variability SdfVariabilityUniform Allowed Values default, render, proxy, guide --- **GetPurposeVisibilityAttr**(purpose) -> Attribute Return the attribute that is used for expressing visibility opinions for the given *purpose*. For "default" purpose, return the overall *visibility* attribute. For "guide", "proxy", or "render" purpose, return *guideVisibility*, *proxyVisibility*, or *renderVisibility* if UsdGeomVisibilityAPI is applied to the prim. If UsdGeomvVisibiltyAPI is not applied, an empty attribute is returned for purposes other than default. UsdGeomVisibilityAPI::Apply UsdGeomVisibilityAPI::GetPurposeVisibilityAttr Parameters - **purpose** (*str*) – --- **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters ========== includeInherited (bool) – GetVisibilityAttr ================= Visibility is meant to be the simplest form of “pruning” visibility that is supported by most DCC apps. Visibility is animatable, allowing a sub-tree of geometry to be present for some segment of a shot, and absent from others; unlike the action of deactivating geometry prims, invisible geometry is still available for inspection, for positioning, for defining volumes, etc. Declaration ----------- ``` token visibility ="inherited" ``` C++ Type -------- TfToken Usd Type -------- SdfValueTypeNames->Token Allowed Values --------------- inherited, invisible MakeInvisible ============= Makes the imageable invisible if it is visible at the given time. When visibility is animated, this only works when it is invoked sequentially at increasing time samples. If visibility is already authored and animated in the scene, calling MakeVisible() at an arbitrary (in-between) frame isn’t guaranteed to work. Be sure to set the edit target to the layer containing the strongest visibility opinion or to a stronger layer. MakeVisible() ComputeVisibility() Parameters ---------- time (TimeCode) – MakeVisible =========== Make the imageable visible if it is invisible at the given time. Since visibility is pruning, this may need to override some ancestor’s visibility and all-but-one of the ancestor’s children’s visibility, for all the ancestors of this prim up to the highest ancestor that is explicitly invisible, to preserve the visibility state. If MakeVisible() (or MakeInvisible() ) is going to be applied to all the prims on a stage, ancestors must be processed prior to descendants to get the correct behavior. When visibility is animated, this only works when it is invoked sequentially at increasing time samples. If visibility is already authored and animated in the scene, calling MakeVisible() at an arbitrary (in-between) frame isn’t guaranteed to work. This will only work properly if all ancestor prims of the imageable are defined, as the imageable schema is only valid on defined prims. Be sure to set the edit target to the layer containing the strongest visibility opinion or to a stronger layer. MakeInvisible() ComputeVisibility() Parameters ---------- time (TimeCode) – SetProxyPrim ============ Convenience function for authoring the renderProxy rel on this prim to target the given ```code proxy ``` prim. To facilitate authoring on sparse or unloaded stages, we do not perform any validation of this prim’s purpose or the type or purpose of the specified prim. ComputeProxyPrim() , GetProxyPrimRel() Parameters ---------- - **proxy** (Prim) – SetProxyPrim(proxy) -> bool Parameters ---------- - **proxy** (SchemaBase) – class pxr.UsdGeom.LinearUnits ---------------------------- Attributes: ------------ - **centimeters** - **feet** - **inches** - **kilometers** - **lightYears** - **meters** - **micrometers** - **miles** - **millimeters** - **nanometers** - **yards** - **centimeters** = 0.01 feet = 0.3048 inches = 0.0254 kilometers = 1000.0 lightYears = 9460730472580800.0 meters = 1.0 micrometers = 1e-06 miles = 1609.344 millimeters = 0.001 nanometers = 1e-09 yards = 0.9144 class pxr.UsdGeom.Mesh - Encodes a mesh with optional subdivision properties and features. - As a point-based primitive, meshes are defined in terms of points that are connected into edges and faces. Many references to meshes use the term ‘vertex’ in place of or interchangeably with ‘points’, while some use ‘vertex’ to refer to the ‘face-vertices’ that define a face. To avoid confusion, the term ‘vertex’ is intentionally avoided in favor of ‘points’ or ‘face-vertices’. - The connectivity between points, edges and faces is encoded using a common minimal topological description of the faces of the mesh. Each face is defined by a set of face-vertices using indices into the Mesh’s points array (inherited from UsdGeomPointBased) and laid out in a single linear faceVertexIndices. A compact representation of a mesh is provided by an array of face-vertex indices, `faceVertexIndices`, which is an array of unsigned integers. This array is organized into a flat array for efficiency. A companion `faceVertexCounts` array provides, for each face, the number of consecutive face-vertices in `faceVertexIndices` that define the face. No additional connectivity information is required or constructed, so no adjacency or neighborhood queries are available. A key property of this mesh schema is that it encodes both subdivision surfaces and simpler polygonal meshes. This is achieved by varying the `subdivisionScheme` attribute, which is set to specify Catmull-Clark subdivision by default, so polygonal meshes must always be explicitly declared. The available subdivision schemes and additional subdivision features encoded in optional attributes conform to the feature set of OpenSubdiv. **A Note About Primvars** The following list clarifies the number of elements for and the interpolation behavior of the different primvar interpolation types for meshes: - **constant**: One element for the entire mesh; no interpolation. - **uniform**: One element for each face of the mesh; elements are typically not interpolated but are inherited by other faces derived from a given face (via subdivision, tessellation, etc.). - **varying**: One element for each point of the mesh; interpolation of point data is always linear. - **vertex**: One element for each point of the mesh; interpolation of point data is applied according to the `subdivisionScheme` attribute. - **faceVarying**: One element for each of the face-vertices that define the mesh topology; interpolation of face-vertex data may be smooth or linear, according to the `subdivisionScheme` and `faceVaryingLinearInterpolation` attributes. Primvar interpolation types and related utilities are described more generally in Interpolation of Geometric Primitive Variables. **A Note About Normals** Normals should not be authored on a subdivision mesh, since subdivision algorithms define their own normals. They should only be authored for polygonal meshes (`subdivisionScheme` =”none”). The `normals` attribute inherited from UsdGeomPointBased is not a generic primvar, but the number of elements in this attribute will be determined by its `interpolation`. See UsdGeomPointBased::GetNormalsInterpolation() . If `normals` and `primvars:normals` are both specified, the latter has precedence. If a polygonal mesh specifies **neither** `normals` nor `primvars:normals`, then it should be treated and rendered as faceted, with no attempt to compute smooth normals. The normals generated for smooth subdivision schemes, e.g. Catmull- Clark and Loop, will likewise be smooth, but others, e.g. Bilinear, may be discontinuous between faces and/or within non-planar irregular faces. For any described attribute `Fallback Value` or `Allowed Values` below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value”rightHanded”, use UsdGeomTokens->rightHanded as the value. **Methods:** | Method | Description | |--------|-------------| | `CreateCornerIndicesAttr(defaultValue, ...)` | See GetCornerIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateCornerSharpnessesAttr(defaultValue, ...)` | See GetCornerSharpnessesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateCreaseIndicesAttr(defaultValue, ...)` | See GetCreaseIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateCreaseLengthsAttr(defaultValue, ...)` | See GetCreaseLengthsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateCreaseSharpnessesAttr(defaultValue, ...)` | See GetCreaseSharpnessesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateFaceVaryingLinearInterpolationAttr(defaultValue, ...)` | See GetFaceVaryingLinearInterpolationAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | CreateFaceVaryingLinearInterpolationAttr ``` See GetFaceVaryingLinearInterpolationAttr(), and also Create vs Get Property Methods for when to use Get vs Create. ```markdown CreateFaceVertexCountsAttr ``` See GetFaceVertexCountsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. ```markdown CreateFaceVertexIndicesAttr ``` See GetFaceVertexIndicesAttr(), and also Create vs Get Property Methods for when to use Get vs Create. ```markdown CreateHoleIndicesAttr ``` See GetHoleIndicesAttr(), and also Create vs Get Property Methods for when to use Get vs Create. ```markdown CreateInterpolateBoundaryAttr ``` See GetInterpolateBoundaryAttr(), and also Create vs Get Property Methods for when to use Get vs Create. ```markdown CreateSubdivisionSchemeAttr ``` See GetSubdivisionSchemeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. ```markdown CreateTriangleSubdivisionRuleAttr ``` See GetTriangleSubdivisionRuleAttr(), and also Create vs Get Property Methods for when to use Get vs Create. ```markdown Define ``` **classmethod** Define(stage, path) -> Mesh ```markdown Get ``` **classmethod** Get(stage, path) -> Mesh ```markdown GetCornerIndicesAttr ``` The indices of points for which a corresponding sharpness value is specified in *cornerSharpnesses* (so the size of this array must match that of *cornerSharpnesses*). ```markdown GetCornerSharpnessesAttr ``` The sharpness values associated with a corresponding set of points specified in *cornerIndices* (so the size of this array must match that of *cornerIndices*). ```markdown GetCreaseIndicesAttr ``` The indices of points grouped into sets of successive pairs that identify edges to be creased. ```markdown GetCreaseLengthsAttr ``` The length of this array specifies the number of creases (sets of adjacent sharpened edges) on the mesh. ```markdown GetCreaseSharpnessesAttr ``` The sharpness values associated with a corresponding set of points specified in *cornerIndices* (so the size of this array must match that of *cornerIndices*). The per-crease or per-edge sharpness values for all creases. GetFaceCount (timeCode) Returns the number of faces as defined by the size of the `faceVertexCounts` array at `timeCode`. GetFaceVaryingLinearInterpolationAttr () Specifies how elements of a primvar of interpolation type "faceVarying" are interpolated for subdivision surfaces. GetFaceVertexCountsAttr () Provides the number of vertices in each face of the mesh, which is also the number of consecutive indices in `faceVertexIndices` that define the face. GetFaceVertexIndicesAttr () Flat list of the index (into the `points` attribute) of each vertex of each face in the mesh. GetHoleIndicesAttr () The indices of all faces that should be treated as holes, i.e. GetInterpolateBoundaryAttr () Specifies how subdivision is applied for faces adjacent to boundary edges and boundary points. GetSchemaAttributeNames classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] GetSubdivisionSchemeAttr () The subdivision scheme to be applied to the surface. GetTriangleSubdivisionRuleAttr () Specifies an option to the subdivision rules for the Catmull-Clark scheme to try and improve undesirable artifacts when subdividing triangles. ValidateTopology classmethod ValidateTopology(faceVertexIndices, faceVertexCounts, numPoints, reason) -> bool Attributes: SHARPNESS_INFINITE CreateCornerIndicesAttr(defaultValue, writeSparsely) -> Attribute <p>See GetCornerIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <p>See GetCornerSharpnessesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <p>See GetCreaseIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <p>See GetCreaseLengthsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely ## CreateCreaseLengthsAttr See GetCreaseLengthsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateCreaseSharpnessesAttr See GetCreaseSharpnessesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateFaceVaryingLinearInterpolationAttr See GetFaceVaryingLinearInterpolationAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateFaceVertexCountsAttr ```CreateFaceVertexCountsAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See GetFaceVertexCountsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateFaceVertexIndicesAttr ```CreateFaceVertexIndicesAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See GetFaceVertexIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateHoleIndicesAttr ```CreateHoleIndicesAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See GetHoleIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateInterpolateBoundaryAttr See GetInterpolateBoundaryAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateSubdivisionSchemeAttr See GetSubdivisionSchemeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateTriangleSubdivisionRuleAttr See GetTriangleSubdivisionRuleAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – is ``` ```markdown false ``` ```markdown . ``` ```markdown Parameters ``` ```markdown - defaultValue (VtValue) – - writeSparsely (bool) – ``` ```markdown classmethod Define(stage, path) -> Mesh ``` ```markdown Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at path is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with specifier == SdfSpecifierDef and this schema’s prim type name for the prim at path at the current EditTarget. Author SdfPrimSpec s with specifier == SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors. The given path must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid UsdPrim. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. ``` ```markdown Parameters ``` ```markdown - stage (Stage) – - path (Path) – ``` ```markdown classmethod Get(stage, path) -> Mesh ``` ```markdown Return a UsdGeomMesh holding the prim adhering to this schema at path on stage. If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` ```markdown UsdGeomMesh(stage->GetPrimAtPath(path)); ``` ```markdown Parameters ``` ```markdown - stage (Stage) – - path (Path) – ``` ```markdown GetCornerIndicesAttr() → Attribute ``` <dl> <dt> <dd> <p> The indices of points for which a corresponding sharpness value is specified in <em>cornerSharpnesses <p> Declaration <p> <code>int[] cornerIndices = [] <p> C++ Type <p> VtArray&lt;int&gt; <p> Usd Type <p> SdfValueTypeNames-&gt;IntArray <dt class="sig sig-object py" id="pxr.UsdGeom.Mesh.GetCornerSharpnessesAttr"> <span class="sig-name descname"> <span class="pre">GetCornerSharpnessesAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon">→ <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdGeom.Mesh.GetCornerSharpnessesAttr" title="Permalink to this definition"> <dd> <p> The sharpness values associated with a corresponding set of points specified in <em>cornerIndices <p> Use the constant <code>SHARPNESS_INFINITE <p> Declaration <p> <code>float[] cornerSharpnesses = [] <p> C++ Type <p> VtArray&lt;float&gt; <p> Usd Type <p> SdfValueTypeNames-&gt;FloatArray <dt class="sig sig-object py" id="pxr.UsdGeom.Mesh.GetCreaseIndicesAttr"> <span class="sig-name descname"> <span class="pre">GetCreaseIndicesAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon">→ <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdGeom.Mesh.GetCreaseIndicesAttr" title="Permalink to this definition"> <dd> <p> The indices of points grouped into sets of successive pairs that identify edges to be creased. <p> The size of this array must be equal to the sum of all elements of the <em>creaseLengths <p> Declaration <p> <code>int[] creaseIndices = [] <p> C++ Type <p> VtArray&lt;int&gt; <p> Usd Type <p> SdfValueTypeNames-&gt;IntArray <dt class="sig sig-object py" id="pxr.UsdGeom.Mesh.GetCreaseLengthsAttr"> <span class="sig-name descname"> <span class="pre">GetCreaseLengthsAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon">→ <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdGeom.Mesh.GetCreaseLengthsAttr" title="Permalink to this definition"> <dd> <p> The length of this array specifies the number of creases (sets of adjacent sharpened edges) on the mesh. <p> Each element gives the number of points of each crease, whose indices are successively laid out in the <em>creaseIndices <p> Declaration <p> <code>int[] creaseLengths = [] <p> C++ Type <p> VtArray&lt;int&gt; <p> Usd Type <p> SdfValueTypeNames-&gt;IntArray <dt class="sig sig-object py" id="pxr.UsdGeom.Mesh.GetCreaseSharpnessesAttr"> <span class="sig-name descname"> <span class="pre">GetCreaseSharpnessesAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon">→ <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdGeom.Mesh.GetCreaseSharpnessesAttr" title="Permalink to this definition"> <dd> <p> The per-crease or per-edge sharpness values for all creases. <p> Since <em>creaseLengths <p> To create a perfectly sharp crease, use the following code: <p> Declaration <p> <code> float[] creaseSharpnesses = [] <p> C++ Type <p> VtArray&lt;float&gt; <p> Usd Type <p> SdfValueTypeNames-&gt;FloatArray <dl> <dt> <span> <span> GetFaceCount <span> ( <em> <span> timeCode <span> ) <span> <span> → <span> int <a>  <dd> <p> Returns the number of faces as defined by the size of the <em> faceVertexCounts array at <em> timeCode . <p> For most code, this check will be performant. When using file formats where the cost of attribute reading is high and the time sampled array will be read into memory later, it may be better to explicitly read the value once and check the size of the array directly. <p> GetFaceVertexCountsAttr() <dl> <dt> Parameters <dd> <p> <strong> timeCode ( <em> TimeCode ) – <dl> <dt> <span> <span> GetFaceVaryingLinearInterpolationAttr <span> ( <span> ) <span> <span> → <span> Attribute <a>  <dd> <p> Specifies how elements of a primvar of interpolation type”faceVarying”are interpolated for subdivision surfaces. <p> Interpolation can be as smooth as a”vertex”primvar or constrained to be linear at features specified by several options. Valid values correspond to choices available in OpenSubdiv: <blockquote> <div> <ul> <li> <p> <strong> none : No linear constraints or sharpening, smooth everywhere <li> <p> <strong> cornersOnly : Sharpen corners of discontinuous boundaries only, smooth everywhere else <li> <p> <strong> cornersPlus1 : The default, same as”cornersOnly”plus additional sharpening at points where three or more distinct face- varying values occur <li> <p> <strong> cornersPlus2 : Same as”cornersPlus1”plus additional sharpening at points with at least one discontinuous boundary corner or only one discontinuous boundary edge (a dart) <li> <p> <strong> boundaries : Piecewise linear along discontinuous boundaries, smooth interior <li> <p> <strong> all : Piecewise linear everywhere <p> These are illustrated and described in more detail in the OpenSubdiv documentation: - varying-interpolation-rules <p> Declaration <p> <code> token faceVaryingLinearInterpolation ="cornersPlus1" <p> C++ Type <p> TfToken <p> Usd Type <p> SdfValueTypeNames-&gt;Token <p> Allowed Values <p> none, cornersOnly, cornersPlus1, cornersPlus2, boundaries, all <dl> <dt> <span> <span> GetFaceVertexCountsAttr <span> ( <span> ) <span> <span> → <span> Attribute <a>  <dd> <p> Provides the number of vertices in each face of the mesh, which is also the number of consecutive indices in <em> faceVertexIndices that define the face. <p> The length of this attribute is the number of faces in the mesh. If this attribute has more than one timeSample, the mesh is considered to be topologically varying. <p> Declaration <p> <code> int[] faceVertexCounts <p> C++ Type <p> VtArray&lt;int&gt; <p> Usd Type <p> SdfValueTypeNames-&gt;IntArray ### GetFaceVertexIndicesAttr ```python GetFaceVertexIndicesAttr() -> Attribute ``` Flat list of the index (into the `points` attribute) of each vertex of each face in the mesh. If this attribute has more than one timeSample, the mesh is considered to be topologically varying. Declaration ```python int[] faceVertexIndices ``` C++ Type ```cpp VtArray<int> ``` Usd Type ``` SdfValueTypeNames->IntArray ``` ### GetHoleIndicesAttr ```python GetHoleIndicesAttr() -> Attribute ``` The indices of all faces that should be treated as holes, i.e., made invisible. This is traditionally a feature of subdivision surfaces and not generally applied to polygonal meshes. Declaration ```python int[] holeIndices = [] ``` C++ Type ```cpp VtArray<int> ``` Usd Type ``` SdfValueTypeNames->IntArray ``` ### GetInterpolateBoundaryAttr ```python GetInterpolateBoundaryAttr() -> Attribute ``` Specifies how subdivision is applied for faces adjacent to boundary edges and boundary points. Valid values correspond to choices available in OpenSubdiv: - **none**: No boundary interpolation is applied and boundary faces are effectively treated as holes - **edgeOnly**: A sequence of boundary edges defines a smooth curve to which the edges of subdivided boundary faces converge - **edgeAndCorner**: The default, similar to "edgeOnly" but the smooth boundary curve is made sharp at corner points These are illustrated and described in more detail in the OpenSubdiv documentation: - interpolation-rules Declaration ```python token interpolateBoundary = "edgeAndCorner" ``` C++ Type ```cpp TfToken ``` Usd Type ``` SdfValueTypeNames->Token ``` Allowed Values ``` none, edgeOnly, edgeAndCorner ``` ### GetSchemaAttributeNames ```python static GetSchemaAttributeNames() ``` **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters - **includeInherited** (bool) – ``` → Attribute ### pxr.UsdGeom.Mesh.GetSubdivisionSchemeAttr The subdivision scheme to be applied to the surface. Valid values are: > - **catmullClark** : The default, Catmull-Clark subdivision; preferred for quad-dominant meshes (generalizes B-splines); interpolation of point data is smooth (non-linear) > - **loop** : Loop subdivision; preferred for purely triangular meshes; interpolation of point data is smooth (non-linear) > - **bilinear** : Subdivision reduces all faces to quads (topologically similar to "catmullClark"); interpolation of point data is bilinear > - **none** : No subdivision, i.e. a simple polygonal mesh; interpolation of point data is linear Polygonal meshes are typically lighter weight and faster to render, depending on renderer and render mode. Use of "bilinear" will produce a similar shape to a polygonal mesh and may offer additional guarantees of watertightness and additional subdivision features (e.g. holes) but may also not respect authored normals. Declaration ```markdown uniform token subdivisionScheme="catmullClark" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Variability SdfVariabilityUniform Allowed Values catmullClark, loop, bilinear, none ### pxr.UsdGeom.Mesh.GetTriangleSubdivisionRuleAttr Specifies an option to the subdivision rules for the Catmull-Clark scheme to try and improve undesirable artifacts when subdividing triangles. Valid values are "catmullClark" for the standard rules (the default) and "smooth" for the improvement. See [https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#triangle](https://graphics.pixar.com/opensubdiv/docs/subdivision_surfaces.html#triangle) - subdivision-rule Declaration ```markdown token triangleSubdivisionRule="catmullClark" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Allowed Values catmullClark, smooth ### pxr.UsdGeom.Mesh.ValidateTopology **classmethod** ValidateTopology(faceVertexIndices, faceVertexCounts, numPoints, reason) -> bool Validate the topology of a mesh. This validates that the sum of `faceVertexCounts` is equal to the size of the `faceVertexIndices` array, and that all face vertex indices in the `faceVertexIndices` array are in the range [0, numPoints). Returns true if the topology is valid, or false otherwise. If the topology is invalid and `reason` is non-null, an error message describing the validation error will be set. Parameters - **faceVertexIndices** (IntArray) – - **faceVertexCounts** (IntArray) – - **numPoints** (int) – - **reason** (str) – ``` <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Mesh.SHARPNESS_INFINITE"> <span class="sig-name descname"> <span class="pre"> SHARPNESS_INFINITE <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 10.0 <a class="headerlink" href="#pxr.UsdGeom.Mesh.SHARPNESS_INFINITE" title="Permalink to this definition">  <dd> <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdGeom.ModelAPI"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.UsdGeom. <span class="sig-name descname"> <span class="pre"> ModelAPI <a class="headerlink" href="#pxr.UsdGeom.ModelAPI" title="Permalink to this definition">  <dd> <p> UsdGeomModelAPI extends the generic UsdModelAPI schema with geometry specific concepts such as cached extents for the entire model, constraint targets, and geometry-inspired extensions to the payload lofting process. <p> As described in GetExtentsHint() below, it is useful to cache extents at the model level. UsdGeomModelAPI provides schema for computing and storing these cached extents, which can be consumed by UsdGeomBBoxCache to provide fast access to precomputed extents that will be used as the model’s bounds ( see UsdGeomBBoxCache::UsdGeomBBoxCache() ). <section id="draw-modes"> <h2> Draw Modes  <p> Draw modes provide optional alternate imaging behavior for USD subtrees with kind model. <em> model:drawMode (which is inheritable) and <em> model:applyDrawMode (which is not) are resolved into a decision to stop traversing the scene graph at a certain point, and replace a USD subtree with proxy geometry. <p> The value of <em> model:drawMode determines the type of proxy geometry: <blockquote> <div> <ul> <li> <p> <em> origin - Draw the model-space basis vectors of the replaced prim. <li> <p> <em> bounds - Draw the model-space bounding box of the replaced prim. <li> <p> <em> cards - Draw textured quads as a placeholder for the replaced prim. <li> <p> <em> default - An explicit opinion to draw the USD subtree as normal. <li> <p> <em> inherited - Defer to the parent opinion. <p> <em> model:drawMode falls back to <em> inherited so that a whole scene, a large group, or all prototypes of a model hierarchy PointInstancer can be assigned a draw mode with a single attribute edit. If no draw mode is explicitly set in a hierarchy, the resolved value is <em> default . <p> <em> model:applyDrawMode is meant to be written when an asset is authored, and provides flexibility for different asset types. For example, a character assembly (composed of character, clothes, etc) might have <em> model:applyDrawMode set at the top of the subtree so the whole group can be drawn as a single card object. An effects subtree might have <em> model:applyDrawMode set at a lower level so each particle group draws individually. <p> Models of kind component are treated as if <em> model:applyDrawMode were true. This means a prim is drawn with proxy geometry when: the prim has kind component, and/or <em> model:applyDrawMode is set; and the prim’s resolved value for <em> model:drawMode is not <em> default . <section id="cards-geometry"> <h2> Cards Geometry  <p> The specific geometry used in cards mode is controlled by the <em> model:cardGeometry attribute: <blockquote> <div> <ul> <li> <p> <em> cross - Generate a quad normal to each basis direction and negative. Locate each quad so that it bisects the model extents. <li> <p> <em> box - Generate a quad normal to each basis direction and negative. Locate each quad on a face of the model extents, facing out. <li> <p> <em> fromTexture - Generate a quad for each supplied texture from attributes stored in that texture’s metadata. <p> For <em> cross and <em> box mode, the extents are calculated for purposes <em> default , <em> proxy , and <em> render , at their earliest authored time. If the model has no textures, all six card faces are rendered using <em> model:drawModeColor . If one or more textures are present, only axes with one or more textures assigned are drawn. For each axis, if both textures (positive and negative) are specified, they’ll be used on the corresponding card faces; if only one texture is specified, it will be mapped to the opposite card face after being flipped on the texture’s s-axis. Any card faces with invalid asset paths will be drawn with <em> model:drawModeColor . <p> Both <em> model:cardGeometry and <em> model:drawModeColor should be authored on the prim where the draw mode takes effect, since these attributes are not inherited. <p> For <em> fromTexture mode, only card faces with valid textures assigned are drawn. The geometry is generated by pulling the <em> worldtoscreen attribute out of texture metadata. This is expected to be a 4x4 matrix mapping the model-space position of the card quad to the clip-space quad with corners (-1,-1,0) and (1,1,0). The card vertices are generated by transforming the clip-space corners by the inverse of <em> worldtoscreen . Textures are mapped so that (s) and (t) map to (+x) and (+y) in clip space. If the metadata cannot be read in the right format, or the matrix can’t be inverted, the card face is not drawn. <p> All card faces are drawn and textured as single-sided. <p> For any described attribute **Fallback** **Value** or **Allowed** **Values** below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded as the value. **Methods:** | Method Name | Description | |-------------|-------------| | Apply | classmethod Apply(prim) -> ModelAPI | | CanApply | classmethod CanApply(prim, whyNot) -> bool | | ComputeExtentsHint | For the given model, compute the value for the extents hint with the given `bboxCache`. | | ComputeModelDrawMode | Calculate the effective model:drawMode of this prim. | | CreateConstraintTarget | Creates a new constraint target with the given name, `constraintName`. | | CreateModelApplyDrawModeAttr | See GetModelApplyDrawModeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateModelCardGeometryAttr | See GetModelCardGeometryAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateModelCardTextureXNegAttr | See GetModelCardTextureXNegAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateModelCardTextureXPosAttr | See GetModelCardTextureXPosAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateModelCardTextureYNegAttr | See GetModelCardTextureYNegAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateModelCardTextureYPosAttr | See GetModelCardTextureYPosAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateModelCardTextureZNegAttr | See GetModelCardTextureZNegAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | See GetModelCardTextureZNegAttr() , and also Create vs Get Property Methods for when to use Get vs Create. CreateModelCardTextureZPosAttr(defaultValue, ...) See GetModelCardTextureZPosAttr() , and also Create vs Get Property Methods for when to use Get vs Create. CreateModelDrawModeAttr(defaultValue, ...) See GetModelDrawModeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. CreateModelDrawModeColorAttr(defaultValue, ...) See GetModelDrawModeColorAttr() , and also Create vs Get Property Methods for when to use Get vs Create. Get **classmethod** Get(stage, path) -> ModelAPI GetConstraintTarget(constraintName) Get the constraint target with the given name, `constraintName`. GetConstraintTargets() Returns all the constraint targets belonging to the model. GetExtentsHint(extents, time) Retrieve the authored value (if any) of this model's "extentsHint". GetExtentsHintAttr() Returns the custom 'extentsHint' attribute if it exists. GetModelApplyDrawModeAttr() If true, and the resolved value of *model:drawMode* is non-default, apply an alternate imaging mode to this prim. GetModelCardGeometryAttr() The geometry to generate for imaging prims inserted for *cards* imaging mode. GetModelCardTextureXNegAttr() In *cards* imaging mode, the texture applied to the X- quad. GetModelCardTextureXPosAttr() In *cards* imaging mode, the texture applied to the X+ quad. GetModelCardTextureYNegAttr() In *cards* imaging mode, the texture applied to the Y- quad. **cards** imaging mode, the texture applied to the Y- quad. In **cards** imaging mode, the texture applied to the Y+ quad. In **cards** imaging mode, the texture applied to the Z- quad. In **cards** imaging mode, the texture applied to the Z+ quad. Alternate imaging mode; applied to this prim or child prims where **model:applyDrawMode** is true, or where the prim has kind **component**. The base color of imaging prims inserted for alternate imaging modes. **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] SetExtentsHint(extents, time) Authors the extentsHint array for this model at the given time. **classmethod** Apply(prim) -> ModelAPI Applies this **single-apply** API schema to the given prim. This information is stored by adding "GeomModelAPI" to the token-valued, listOp metadata **apiSchemas** on the prim. A valid UsdGeomModelAPI object is returned upon success. An invalid (or empty) UsdGeomModelAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters: **prim** (Prim) – **classmethod** CanApply(prim, whyNot) -> bool Returns true if this **single-apply** API schema can be applied to the given prim. If this schema can not be applied to the prim, this returns false and, if provided, populates <span class="pre"> whyNot with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> prim ( <em> Prim ) – <li> <p> <strong> whyNot ( <em> str ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.ModelAPI.ComputeExtentsHint"> <span class="sig-name descname"> <span class="pre"> ComputeExtentsHint <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> bboxCache <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Vec3fArray <a class="headerlink" href="#pxr.UsdGeom.ModelAPI.ComputeExtentsHint" title="Permalink to this definition">  <dd> <p> For the given model, compute the value for the extents hint with the given <code class="docutils literal notranslate"> <span class="pre"> bboxCache . <p> <code class="docutils literal notranslate"> <span class="pre"> bboxCache should be setup with the appropriate time. After calling this function, the <code class="docutils literal notranslate"> <span class="pre"> bboxCache may have it’s included purposes changed. <p> <code class="docutils literal notranslate"> <span class="pre"> bboxCache should not be in use by any other thread while this method is using it in a thread. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> bboxCache ( <em> BBoxCache ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.ModelAPI.ComputeModelDrawMode"> <span class="sig-name descname"> <span class="pre"> ComputeModelDrawMode <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> parentDrawMode <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> str <a class="headerlink" href="#pxr.UsdGeom.ModelAPI.ComputeModelDrawMode" title="Permalink to this definition">  <dd> <p> Calculate the effective model:drawMode of this prim. <p> If the draw mode is authored on this prim, it’s used. Otherwise, the fallback value is”inherited”, which defers to the parent opinion. The first non-inherited opinion found walking from this prim towards the root is used. If the attribute isn’t set on any ancestors, we return”default”(meaning, disable”drawMode”geometry). <p> If this function is being called in a traversal context to compute the draw mode of an entire hierarchy of prims, it would be beneficial to cache and pass in the computed parent draw-mode via the <code class="docutils literal notranslate"> <span class="pre"> parentDrawMode parameter. This avoids repeated upward traversal to look for ancestor opinions. <p> When <code class="docutils literal notranslate"> <span class="pre"> parentDrawMode is empty (or unspecified), this function does an upward traversal to find the closest ancestor with an authored model:drawMode. <p> GetModelDrawModeAttr() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> parentDrawMode ( <em> str ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.ModelAPI.CreateConstraintTarget"> <span class="sig-name descname"> <span class="pre"> CreateConstraintTarget <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> constraintName <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> ConstraintTarget <a class="headerlink" href="#pxr.UsdGeom.ModelAPI.CreateConstraintTarget" title="Permalink to this definition">  <dd> <p> Creates a new constraint target with the given name, <code class="docutils literal notranslate"> <span class="pre"> constraintName . <p> If the constraint target already exists, then the existing target is returned. If it does not exist, a new one is created and returned. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> constraintName ( <em> str ) – CreateModelApplyDrawModeAttr( defaultValue, writeSparsely ) → Attribute See GetModelApplyDrawModeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters: - **defaultValue** (VtValue) – - **writeSparsely** (bool) – CreateModelCardGeometryAttr( defaultValue, writeSparsely ) → Attribute See GetModelCardGeometryAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters: - **defaultValue** (VtValue) – - **writeSparsely** (bool) – CreateModelCardTextureXNegAttr( defaultValue, writeSparsely ) → Attribute See GetModelCardTextureXNegAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters: - **defaultValue** (VtValue) – - **writeSparsely** (bool) – <p> The attribute <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl> <dt>Parameters <dd> <ul> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <dl> <dt>CreateModelCardTextureXPosAttr <dd> <p>See GetModelCardTextureXPosAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <dl> <dt>CreateModelCardTextureYNegAttr <dd> <p>See GetModelCardTextureYNegAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <dl> <dt>CreateModelCardTextureYPosAttr <dd> <p>See GetModelCardTextureYPosAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <p> See GetModelCardTextureYPosAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl> <dt> Parameters <dd> <ul> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <p> See GetModelCardTextureZNegAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl> <dt> Parameters <dd> <ul> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <p> See GetModelCardTextureZPosAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl> <dt> Parameters <dd> <ul> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – ### CreateModelDrawModeAttr ```python CreateModelDrawModeAttr(defaultValue, writeSparsely) → Attribute ``` See GetModelDrawModeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateModelDrawModeColorAttr ```python CreateModelDrawModeColorAttr(defaultValue, writeSparsely) → Attribute ``` See GetModelDrawModeColorAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### Get ```python classmethod Get(stage, path) -> ModelAPI ``` Return a UsdGeomModelAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdGeomModelAPI(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (Stage) – - **path** (Path) – ``` **Path** - **GetConstraintTarget** - Parameters: - **constraintName** (str) - Returns: - **ConstraintTarget** - Description: - Get the constraint target with the given name, `constraintName`. - If the requested constraint target does not exist, then an invalid UsdConstraintTarget object is returned. - **GetConstraintTargets** - Returns: - **list[ConstraintTarget]** - Description: - Returns all the constraint targets belonging to the model. - Only valid constraint targets in the "constraintTargets" namespace are returned by this method. - **GetExtentsHint** - Parameters: - **extents** (Vec3fArray) - **time** (TimeCode) - Returns: - **bool** - Description: - Retrieve the authored value (if any) of this model’s "extentsHint". - Persistent caching of bounds in USD is a potentially perilous endeavor, given that: - It is very easy to add overrides in new super-layers that invalidate the cached bounds, and no practical way to automatically detect when this happens. - It is possible for references to be allowed to "float", so that asset updates can flow directly into cached scenes. Such changes in referenced scene description can also invalidate cached bounds in referencing layers. - For these reasons, as a general rule, we only persistently cache leaf gprim extents in object space. However, even with cached gprim extents, computing bounds can be expensive. Since model-level bounds are so useful to many graphics applications, we make an exception, with some caveats. The "extentsHint" should be considered entirely optional (whereas gprim extent is not); if authored, it should contain the extents for various values of gprim purposes. The extents for different values of purpose are stored in a linear Vec3f array as pairs of GfVec3f values in the order specified by UsdGeomImageable::GetOrderedPurposeTokens(). This list is trimmed to only include non-empty extents. i.e., if a model has only default and render geoms, then it will only have 4 GfVec3f values in its extentsHint array. We do not skip over zero extents, so if a model has only default and proxy geom, we will author six GfVec3f 's, the middle two representing an zero extent for render geometry. - A UsdGeomBBoxCache can be configured to first consult the cached extents when evaluating model roots, rather than descending into the models for the full computation. This is not the default behavior, and gives us a convenient way to validate that the cached extentsHint is still valid. - `true` if a value was fetched; `false` if no value was authored, or on error. It is an error to make this query of a prim that is not a model root. - UsdGeomImageable::GetPurposeAttr(), UsdGeomImageable::GetOrderedPurposeTokens() ### GetExtentsHintAttr Returns the custom’extentsHint’attribute if it exits. ### GetModelApplyDrawModeAttr If true, and the resolved value of `model:drawMode` is non-default, apply an alternate imaging mode to this prim. See Draw Modes. Declaration uniform bool model:applyDrawMode = 0 ``` C++ Type ``` bool ``` Usd Type ``` SdfValueTypeNames->Bool ``` Variability ``` SdfVariabilityUniform ``` ### GetModelCardGeometryAttr The geometry to generate for imaging prims inserted for `cards` imaging mode. See Cards Geometry for geometry descriptions. Declaration ``` uniform token model:cardGeometry ="cross" ``` C++ Type ``` TfToken ``` Usd Type ``` SdfValueTypeNames->Token ``` Variability ``` SdfVariabilityUniform ``` Allowed Values ``` cross, box, fromTexture ``` ### GetModelCardTextureXNegAttr In `cards` imaging mode, the texture applied to the X- quad. The texture axes (s,t) are mapped to model-space axes (y, -z). Declaration ``` asset model:cardTextureXNeg ``` C++ Type ``` SdfAssetPath ``` Usd Type ``` SdfValueTypeNames->Asset ``` ### GetModelCardTextureXPosAttr In `cards` imaging mode, the texture applied to the X+ quad. The texture axes (s,t) are mapped to model-space axes (-y, -z). Declaration ``` asset model:cardTextureXPos ``` C++ Type ``` SdfAssetPath ``` Usd Type ``` SdfValueTypeNames->Asset ``` ### GetModelCardTextureYNegAttr - **Description**: In *cards* imaging mode, the texture applied to the Y- quad. The texture axes (s,t) are mapped to model-space axes (-x, -z). - **Declaration**: `asset model:cardTextureYNeg` - **C++ Type**: SdfAssetPath - **Usd Type**: SdfValueTypeNames->Asset ### GetModelCardTextureYPosAttr - **Description**: In *cards* imaging mode, the texture applied to the Y+ quad. The texture axes (s,t) are mapped to model-space axes (x, -z). - **Declaration**: `asset model:cardTextureYPos` - **C++ Type**: SdfAssetPath - **Usd Type**: SdfValueTypeNames->Asset ### GetModelCardTextureZNegAttr - **Description**: In *cards* imaging mode, the texture applied to the Z- quad. The texture axes (s,t) are mapped to model-space axes (-x, -y). - **Declaration**: `asset model:cardTextureZNeg` - **C++ Type**: SdfAssetPath - **Usd Type**: SdfValueTypeNames->Asset ### GetModelCardTextureZPosAttr - **Description**: In *cards* imaging mode, the texture applied to the Z+ quad. The texture axes (s,t) are mapped to model-space axes (x, -y). - **Declaration**: `asset model:cardTextureZPos` - **C++ Type**: SdfAssetPath - **Usd Type**: SdfValueTypeNames->Asset ### GetModelDrawModeAttr - **Description**: Alternate imaging mode; applied to this prim or child prims where *model:applyDrawMode* is true, or where the prim has kind *component*. See Draw Modes for mode descriptions. - **Declaration**: `uniform model:drawMode` - **C++ Type**: SdfAssetPath - **Usd Type**: SdfValueTypeNames->Asset ## Attributes - **Token** - **model:drawMode** - **="inherited"** ### C++ Type - TfToken ### Usd Type - SdfValueTypeNames->Token ### Variability - SdfVariabilityUniform ### Allowed Values - origin, bounds, cards, default, inherited ## Methods ### GetModelDrawModeColorAttr - The base color of imaging prims inserted for alternate imaging modes. - For `origin` and `bounds` modes, this controls line color; for `cards` mode, this controls the fallback quad color. - Declaration: ``` uniform float3 model:drawModeColor = (0.18, 0.18, 0.18) ``` - C++ Type - GfVec3f - Usd Type - SdfValueTypeNames->Float3 - Variability - SdfVariabilityUniform ### GetSchemaAttributeNames - `classmethod` GetSchemaAttributeNames(includeInherited) -> list[TfToken] - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. - Parameters: - includeInherited (bool) ### SetExtentsHint - Authors the extentsHint array for this model at the given time. - GetExtentsHint() - Parameters: - extents (Vec3fArray) - time (TimeCode) ## Class ### MotionAPI - UsdGeomMotionAPI encodes data that can live on any prim that may affect computations involving: - computed motion for motion blur - sampling for motion blur - The motion:blurScale attribute allows artists to scale the amount of motion blur to be rendered for parts of the scene without changing the recorded animation. | Apply | classmethod Apply(prim) -> MotionAPI | | --- | --- | | CanApply | classmethod CanApply(prim, whyNot) -> bool | | ComputeMotionBlurScale | Compute the inherited value of `motion:blurScale` at `time`, i.e. | | ComputeNonlinearSampleCount | Compute the inherited value of `nonlinearSampleCount` at `time`, i.e. | | ComputeVelocityScale | Deprecated | | CreateMotionBlurScaleAttr | See GetMotionBlurScaleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateNonlinearSampleCountAttr | See GetNonlinearSampleCountAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateVelocityScaleAttr | See GetVelocityScaleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | Get | classmethod Get(stage, path) -> MotionAPI | | GetMotionBlurScaleAttr | BlurScale is an **inherited** float attribute that stipulates the rendered motion blur (as typically specified via UsdGeomCamera 's `shutter:open` and `shutter:close` properties) should be scaled for **all objects** at and beneath the prim in namespace on which the `motion:blurScale` value is specified. | | GetNonlinearSampleCountAttr | Determines the number of position or transformation samples created when motion is described by attributes contributing non-linear terms. | | GetSchemaAttributeNames | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | <span class="pre"> GetVelocityScaleAttr () <td> <p> Deprecated <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.MotionAPI.Apply"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Apply <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdGeom.MotionAPI.Apply" title="Permalink to this definition">  <dd> <p> <strong> classmethod Apply(prim) -&gt; MotionAPI <p> Applies this <strong> single-apply API schema to the given <code class="docutils literal notranslate"> <span class="pre"> prim . <p> This information is stored by adding”MotionAPI”to the token-valued, listOp metadata <em> apiSchemas on the prim. <p> A valid UsdGeomMotionAPI object is returned upon success. An invalid (or empty) UsdGeomMotionAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> prim ( <a class="reference internal" href="Usd.html#pxr.Usd.Prim" title="pxr.Usd.Prim"> <em> Prim ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.MotionAPI.CanApply"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> CanApply <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdGeom.MotionAPI.CanApply" title="Permalink to this definition">  <dd> <p> <strong> classmethod CanApply(prim, whyNot) -&gt; bool <p> Returns true if this <strong> single-apply API schema can be applied to the given <code class="docutils literal notranslate"> <span class="pre"> prim . <p> If this schema can not be a applied to the prim, this returns false and, if provided, populates <code class="docutils literal notranslate"> <span class="pre"> whyNot with the reason it can not be applied. <p> Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> prim ( <a class="reference internal" href="Usd.html#pxr.Usd.Prim" title="pxr.Usd.Prim"> <em> Prim ) – <li> <p> <strong> whyNot ( <em> str ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.MotionAPI.ComputeMotionBlurScale"> <span class="sig-name descname"> <span class="pre"> ComputeMotionBlurScale <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> time <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> float <a class="headerlink" href="#pxr.UsdGeom.MotionAPI.ComputeMotionBlurScale" title="Permalink to this definition">  <dd> <p> Compute the inherited value of <em> motion:blurScale at <code class="docutils literal notranslate"> <span class="pre"> time , i.e. <p> the authored value on the prim closest to this prim in namespace, resolved upwards through its ancestors in namespace. <p> the inherited value, or 1.0 if neither the prim nor any of its ancestors possesses an authored value. <p> this is a reference implementation that is not particularly efficient if evaluating over many prims, because it does not share inherited results. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> time ( <a class="reference internal" href="Sdf.html#pxr.Sdf.TimeCode" title="pxr.Sdf.TimeCode"> <em> TimeCode ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.MotionAPI.ComputeNonlinearSampleCount"> <span class="sig-name descname"> <span class="pre"> ComputeNonlinearSampleCount <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> time <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> int <a class="headerlink" href="#pxr.UsdGeom.MotionAPI.ComputeNonlinearSampleCount" title="Permalink to this definition">  <dd> <p> Compute the inherited value of **nonlinearSampleCount** at **time**, i.e. the authored value on the prim closest to this prim in namespace, resolved upwards through its ancestors in namespace. the inherited value, or 3 if neither the prim nor any of its ancestors possesses an authored value. this is a reference implementation that is not particularly efficient if evaluating over many prims, because it does not share inherited results. **Parameters** - **time** (TimeCode) – **ComputeVelocityScale** (**time**) → float - Deprecated - Compute the inherited value of **velocityScale** at **time**, i.e. the authored value on the prim closest to this prim in namespace, resolved upwards through its ancestors in namespace. - the inherited value, or 1.0 if neither the prim nor any of its ancestors possesses an authored value. - this is a reference implementation that is not particularly efficient if evaluating over many prims, because it does not share inherited results. - **Parameters** - **time** (TimeCode) – **CreateMotionBlurScaleAttr** (**defaultValue**, **writeSparsely**) → Attribute - See GetMotionBlurScaleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - If specified, author **defaultValue** as the attribute’s default, sparsely (when it makes sense to do so) if **writeSparsely** is **true** - the default for **writeSparsely** is **false**. - **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – **CreateNonlinearSampleCountAttr** (**defaultValue**, **writeSparsely**) → Attribute - See GetNonlinearSampleCountAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - If specified, author **defaultValue** as the attribute’s default, sparsely (when it makes sense to do so) if **writeSparsely** is **true** - the default for **writeSparsely** is **false**. ```pre false ``` ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ```pre CreateVelocityScaleAttr ``` ( ```pre defaultValue ``` , ```pre writeSparsely ``` ) → ```pre Attribute ``` See GetVelocityScaleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ```pre static ``` ```pre Get ``` ( ) **classmethod** Get(stage, path) -> MotionAPI Return a UsdGeomMotionAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdGeomMotionAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ```pre GetMotionBlurScaleAttr ``` ( ) → ```pre Attribute ``` BlurScale is an **inherited** float attribute that stipulates the rendered motion blur (as typically specified via UsdGeomCamera ‘s `shutter:open` and `shutter:close` properties) should be scaled for **all objects** at and beneath the prim in namespace on which the `motion:blurScale` value is specified. Without changing any other data in the scene, `blurScale` allows artists to”dial in”the amount of blur on a per-object basis. A `blurScale` value of zero removes all blur, a value of 0.5 reduces blur by half, and a value of 2.0 doubles the blur. The legal range for **blurScale** is [0, inf), although very high values may result in extremely expensive renders, and may exceed the capabilities of some renderers. Although renderers are free to implement this feature however they see fit, see Effectively Applying motion:blurScale for our guidance on implementing the feature universally and efficiently. ComputeMotionBlurScale() Declaration ``` float motion:blurScale = 1 ``` C++ Type float Usd Type SdfValueTypeNames->Float --- **GetNonlinearSampleCountAttr**() → Attribute Determines the number of position or transformation samples created when motion is described by attributes contributing non-linear terms. To give an example, imagine an application (such as a renderer) consuming 'points' and the USD document also contains 'accelerations' for the same prim. Unless the application can consume these 'accelerations' itself, an intermediate layer has to compute samples within the sampling interval for the point positions based on the value of 'points', 'velocities', and 'accelerations'. The number of these samples is given by 'nonlinearSampleCount'. The samples are equally spaced within the sampling interval. Another example involves the PointInstancer where 'nonlinearSampleCount' is relevant when 'angularVelocities' or 'accelerations' are authored. 'nonlinearSampleCount' is an **inherited** attribute, also see ComputeNonlinearSampleCount() Declaration ``` int motion:nonlinearSampleCount = 3 ``` C++ Type int Usd Type SdfValueTypeNames->Int --- **classmethod** GetSchemaAttributeNames(includeInherited) → list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters includeInherited (bool) – --- **GetVelocityScaleAttr**() → Attribute Deprecated VelocityScale is an **inherited** float attribute that velocity-based schemas (e.g. PointBased, PointInstancer) can consume to compute interpolated positions and orientations by applying velocity and angularVelocity, which is required for interpolating between samples when topology is varying over time. Although these quantities are generally physically computed by a simulator, sometimes we require more or less motion-blur to achieve the desired look. VelocityScale allows artists to dial-in, as a post-sim correction, a scale factor to be applied to the velocity prior to computing interpolated positions from it. Declaration ``` float motion:velocityScale = 1 ``` C++ Type float Usd Type SdfValueTypeNames->Float --- **class** pxr.UsdGeom.NurbsCurves This schema is analogous to NURBS Curves in packages like Maya and Houdini, often used for interchange of rigging and modeling curves. Unlike Maya, this curve spec supports batching of multiple curves into a single prim, widths, and normals in the schema. Additionally, we require 'numSegments + 2 * degree + 1' knots (2 more than Maya does). This is to be more consistent with RenderMan's NURBS patch specification. To express a periodic curve: > 1. > - knot[0] = knot[1] - (knots[-2] - knots[-3]; > 2. > - knot[-1] = knot[-2] + (knot[2] - knots[1]); To express a nonperiodic curve: > 1. > - knot[0] = knot[1]; > 2. > - knot[-1] = knot[-2]; In spite of these slight differences in the spec, curves generated in Maya should be preserved when roundtripping. * order * range , when representing a batched NurbsCurve should be authored one value per curve. * knots should be the concatenation of all batched curves. **NurbsCurve Form** **Form** is provided as an aid to interchange between modeling and animation applications so that they can robustly identify the intent with which the surface was modelled, and take measures (if they are able) to preserve the continuity/concidence constraints as the surface may be rigged or deformed. > 1. > - An *open-form* NurbsCurve has no continuity constraints. > 2. > - A *closed-form* NurbsCurve expects the first and last control points to overlap > 3. > - A *periodic-form* NurbsCurve expects the first and last *order* - 1 control points to overlap. For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value”rightHanded”, use UsdGeomTokens->rightHanded as the value. **Methods:** | Method | Description | | --- | --- | | `CreateFormAttr(defaultValue, writeSparsely)` | See GetFormAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateKnotsAttr(defaultValue, writeSparsely)` | See GetKnotsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateOrderAttr(defaultValue, writeSparsely)` | See GetOrderAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreatePointWeightsAttr(defaultValue, ...)` | See GetPointWeightsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateRangesAttr(defaultValue, writeSparsely)` | See GetRangesAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `Define(stage, path) -> NurbsCurves` | **classmethod** | | `Get(stage, path) -> NurbsCurves` | **classmethod** | | `GetFormAttr()` | Interpret the control grid and knot vectors as representing an open, geometrically closed, or geometrically closed and C2 continuous curve. | | `GetKnotsAttr()` | Knot vector providing curve parameterization. | | GetOrderAttr() | Order of the curve. | | --- | --- | | GetPointWeightsAttr() | Optionally provides "w" components for each control point, thus must be the same length as the points attribute. | | GetRangesAttr() | Provides the minimum and maximum parametric values (as defined by knots) over which the curve is actually defined. | | GetSchemaAttributeNames(includeInherited) -> list[TfToken] | classmethod | ### CreateFormAttr ```python CreateFormAttr(defaultValue, writeSparsely) -> Attribute ``` See GetFormAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateKnotsAttr ```python CreateKnotsAttr(defaultValue, writeSparsely) -> Attribute ``` See GetKnotsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateOrderAttr ```CreateOrderAttr``` ( ```defaultValue``` , ```writeSparsely``` ) → ```Attribute``` See GetOrderAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreatePointWeightsAttr ```CreatePointWeightsAttr``` ( ```defaultValue``` , ```writeSparsely``` ) → ```Attribute``` See GetPointWeightsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateRangesAttr ```CreateRangesAttr``` ( ```defaultValue``` , ```writeSparsely``` ) → ```Attribute``` See GetRangesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – - **writeSparsely** (`bool`) – ## Define ```python static Define() ``` - **classmethod** Define(stage, path) -> NurbsCurves Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ## Get ```python static Get() ``` - **classmethod** Get(stage, path) -> NurbsCurves Return a UsdGeomNurbsCurves holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdGeomNurbsCurves(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ## GetFormAttr ```python GetFormAttr() -> Attribute ``` Interpret the control grid and knot vectors as representing an open, geometrically closed, or geometrically closed and C2 continuous curve. NurbsCurve Form Declaration ``` uniform token ``` <form> ```cpp "open" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Variability SdfVariabilityUniform Allowed Values open, closed, periodic ```python GetKnotsAttr() ``` Knot vector providing curve parameterization. The length of the slice of the array for the ith curve must be (curveVertexCount[i] + order[i] ), and its entries must take on monotonically increasing values. Declaration ```cpp double[] knots ``` C++ Type VtArray<double> Usd Type SdfValueTypeNames->DoubleArray ```python GetOrderAttr() ``` Order of the curve. Order must be positive and is equal to the degree of the polynomial basis to be evaluated, plus 1. Its value for the’i’th curve must be less than or equal to curveVertexCount[i] Declaration ```cpp int[] order = [] ``` C++ Type VtArray<int> Usd Type SdfValueTypeNames->IntArray ```python GetPointWeightsAttr() ``` Optionally provides”w”components for each control point, thus must be the same length as the points attribute. If authored, the patch will be rational. If unauthored, the patch will be polynomial, i.e. weight for all points is 1.0. Some DCC’s pre-weight the points, but in this schema, points are not pre-weighted. Declaration ```cpp double[] pointWeights ``` C++ Type VtArray<double> Usd Type SdfValueTypeNames->DoubleArray ```python GetRangesAttr() ``` Provides the minimum and maximum parametric values (as defined by knots) over which the curve is actually defined. The minimum must be less than the maximum, and greater than or equal to the value of the knots[‘i’th curve slice][order[i]-1]. The maxium must be less than or equal to the last element’s value in knots[‘i’th curve slice]. Range maps to (vmin, vmax) in the RenderMan spec. Declaration ```cpp double2[] ranges ``` C++ Type VtArray<GfVec2d> Usd Type SdfValueTypeNames->Double2Array ```python GetSchemaAttributeNames() ``` ## classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - **includeInherited** (`bool`) – ## pxr.UsdGeom.NurbsPatch Encodes a rational or polynomial non-uniform B-spline surface, with optional trim curves. The encoding mostly follows that of RiNuPatch and RiTrimCurve, with some minor renaming and coalescing for clarity. The layout of control vertices in the `points` attribute inherited from UsdGeomPointBased is row-major with U considered rows, and V columns. ### NurbsPatch Form The authored points, orders, knots, weights, and ranges are all that is required to render the nurbs patch. However, the only way to model closed surfaces with nurbs is to ensure that the first and last control points along the given axis are coincident. Similarly, to ensure the surface is not only closed but also C2 continuous, the last `order` - 1 control points must be (correspondingly) coincident with the first `order` - 1 control points, and also the spacing of the last corresponding knots must be the same as the first corresponding knots. **Form** is provided as an aid to interchange between modeling and animation applications so that they can robustly identify the intent with which the surface was modelled, and take measures (if they are able) to preserve the continuity/concidence constraints as the surface may be rigged or deformed. > - An **open-form** NurbsPatch has no continuity constraints. > - A **closed-form** NurbsPatch expects the first and last control points to overlap > - A **periodic-form** NurbsPatch expects the first and last `order` - 1 control points to overlap. > **Nurbs vs Subdivision Surfaces** Nurbs are an important modeling primitive in CAD/CAM tools and early computer graphics DCC’s. Because they have a natural UV parameterization they easily support “trim curves”, which allow smooth shapes to be carved out of the surface. However, the topology of the patch is always rectangular, and joining two nurbs patches together (especially when they have differing numbers of spans) is difficult to do smoothly. Also, nurbs are not supported by the Ptex texturing technology. Neither of these limitations are shared by subdivision surfaces; therefore, although they do not subscribe to trim-curve-based shaping, subdivs are often considered a more flexible modeling primitive. For any described attribute **Fallback Value** or **Allowed Values** below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value “rightHanded”, use UsdGeomTokens->rightHanded as the value. ### Methods: - **CreatePointWeightsAttr** (defaultValue, ...) - See GetPointWeightsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateTrimCurveCountsAttr** (defaultValue, ...) - See GetTrimCurveCountsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateTrimCurveKnotsAttr** (defaultValue, ...) - See GetTrimCurveKnotsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateTrimCurveOrdersAttr** (defaultValue, ...) - See GetTrimCurveOrdersAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateTrimCurvePointsAttr** (defaultValue, ...) - See GetTrimCurvePointsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, ...) See GetTrimCurvePointsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, ...) See GetTrimCurveRangesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (...) See GetTrimCurveVertexCountsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, writeSparsely) See GetUFormAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, writeSparsely) See GetUKnotsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, writeSparsely) See GetUOrderAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, writeSparsely) See GetURangeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, ...) See GetUVertexCountAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, writeSparsely) See GetVFormAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, writeSparsely) See GetVKnotsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, writeSparsely) See GetVOrderAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, writeSparsely) See GetVRangeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. (defaultValue, ...) See GetVVertexCountAttr() , and also Create vs Get Property Methods for when to use Get vs Create. Define classmethod Define(stage, path) -> NurbsPatch - **classmethod Get(stage, path) -> NurbsPatch** - **GetPointWeightsAttr()** - Optionally provides "w" components for each control point, thus must be the same length as the points attribute. - **classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]** - **GetTrimCurveCountsAttr()** - Each element specifies how many curves are present in each "loop" of the trimCurve, and the length of the array determines how many loops the trimCurve contains. - **GetTrimCurveKnotsAttr()** - Flat list of parametric values for each of the *nCurves* curves. - **GetTrimCurveOrdersAttr()** - Flat list of orders for each of the *nCurves* curves. - **GetTrimCurvePointsAttr()** - Flat list of homogeneous 2D points (u, v, w) that comprise the *nCurves* curves. - **GetTrimCurveRangesAttr()** - Flat list of minimum and maximum parametric values (as defined by *knots*) for each of the *nCurves* curves. - **GetTrimCurveVertexCountsAttr()** - Flat list of number of vertices for each of the *nCurves* curves. - **GetUFormAttr()** - Interpret the control grid and knot vectors as representing an open, geometrically closed, or geometrically closed and C2 continuous surface along the U dimension. - **GetUKnotsAttr()** - Knot vector for U direction providing U parameterization. - **GetUOrderAttr()** - Order in the U direction. - **GetURangeAttr()** - Provides the minimum and maximum parametric values (as defined by uKnots) over which the surface is actually defined. - **GetUVertexCountAttr()** - Provides the number of vertices in the U direction. <table> <tbody> <tr class="row-odd"> <td> <p>Number of vertices in the U direction. <tr class="row-even"> <td> <p><code>GetVFormAttr <td> <p>Interpret the control grid and knot vectors as representing an open, geometrically closed, or geometrically closed and C2 continuous surface along the V dimension. <tr class="row-odd"> <td> <p><code>GetVKnotsAttr <td> <p>Knot vector for V direction providing U parameterization. <tr class="row-even"> <td> <p><code>GetVOrderAttr <td> <p>Order in the V direction. <tr class="row-odd"> <td> <p><code>GetVRangeAttr <td> <p>Provides the minimum and maximum parametric values (as defined by vKnots) over which the surface is actually defined. <tr class="row-even"> <td> <p><code>GetVVertexCountAttr <td> <p>Number of vertices in the V direction. <dl> <dt> <code>CreatePointWeightsAttr(defaultValue, writeSparsely) <span>→ Attribute <dd> <p>See GetPointWeightsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li><strong>defaultValue <li><strong>writeSparsely <dt> <code>CreateTrimCurveCountsAttr(defaultValue, writeSparsely) <span>→ Attribute <dd> <p>See GetTrimCurveCountsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li><strong>defaultValue <li><strong>writeSparsely ## CreateTrimCurveKnotsAttr ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – See GetTrimCurveKnotsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ## CreateTrimCurveOrdersAttr ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – See GetTrimCurveOrdersAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ## CreateTrimCurvePointsAttr ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – See GetTrimCurvePointsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. - the default for ``` writeSparsely ``` is ``` false ``` . - Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – - ``` CreateTrimCurveRangesAttr ``` ( ``` defaultValue ``` , ``` writeSparsely ``` ) -> ``` Attribute ``` See GetTrimCurveRangesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ``` defaultValue ``` as the attribute’s default, sparsely (when it makes sense to do so) if ``` writeSparsely ``` is ``` true ``` - the default for ``` writeSparsely ``` is ``` false ``` . - Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – - ``` CreateTrimCurveVertexCountsAttr ``` ( ``` defaultValue ``` , ``` writeSparsely ``` ) -> ``` Attribute ``` See GetTrimCurveVertexCountsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ``` defaultValue ``` as the attribute’s default, sparsely (when it makes sense to do so) if ``` writeSparsely ``` is ``` true ``` - the default for ``` writeSparsely ``` is ``` false ``` . - Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – - ``` CreateUFormAttr ``` ( ``` defaultValue ``` , ``` writeSparsely ``` ) -> ``` Attribute ``` See GetUFormAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateUKnotsAttr ```python CreateUKnotsAttr(defaultValue, writeSparsely) → Attribute ``` See GetUKnotsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateUOrderAttr ```python CreateUOrderAttr(defaultValue, writeSparsely) → Attribute ``` See GetUOrderAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateURangeAttr ```python CreateURangeAttr(defaultValue, writeSparsely) → Attribute ``` See GetURangeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ``` ### CreateURangeAttr See GetURangeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateUVertexCountAttr See GetUVertexCountAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateVFormAttr See GetVFormAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateVKnotsAttr See GetVKnotsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetVKnotsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.NurbsPatch.CreateVOrderAttr"> <span class="sig-name descname"> <span class="pre"> CreateVOrderAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetVOrderAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.NurbsPatch.CreateVRangeAttr"> <span class="sig-name descname"> <span class="pre"> CreateVRangeAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetVRangeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – ### CreateVVertexCountAttr CreateVVertexCountAttr(defaultValue, writeSparsely) → Attribute See GetVVertexCountAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### Define static Define() **classmethod** Define(stage, path) -> NurbsPatch Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. #### Parameters - **stage** (Stage) – - **path** (Path) – ### Get static Get() **classmethod** Get(stage, path) -> NurbsPatch Return a UsdGeomNurbsPatch holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```cpp UsdGeomNurbsPatch(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – **GetPointWeightsAttr** Optionally provides "w" components for each control point, thus must be the same length as the points attribute. If authored, the patch will be rational. If unauthored, the patch will be polynomial, i.e. weight for all points is 1.0. Some DCC’s pre-weight the points, but in this schema, points are not pre-weighted. **Declaration** ``` double[] pointWeights ``` **C++ Type** ``` VtArray<double> ``` **Usd Type** ``` SdfValueTypeNames->DoubleArray ``` **GetSchemaAttributeNames** **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – **GetTrimCurveCountsAttr** Each element specifies how many curves are present in each "loop" of the trimCurve, and the length of the array determines how many loops the trimCurve contains. The sum of all elements is the total number of curves in the trim, to which we will refer as nCurves in describing the other trim attributes. **Declaration** ``` int[] trimCurve:counts ``` **C++ Type** ``` VtArray<int> ``` **Usd Type** ``` SdfValueTypeNames->IntArray ``` **GetTrimCurveKnotsAttr** Flat list of parametric values for each of the nCurves curves. There will be as many knots as the sum over all elements of vertexCounts plus the sum over all elements of orders. **Declaration** ``` double[] trimCurve:knots ``` **C++ Type** ``` VtArray<double> ``` **Usd Type** ``` SdfValueTypeNames->DoubleArray ``` **GetTrimCurveOrdersAttr** ``` ## GetTrimCurveOrdersAttr ``` ```markdown ( ) ``` ```markdown → Attribute ``` ```markdown ### Description Flat list of orders for each of the `nCurves` curves. ``` ```markdown ### Declaration ``` ```markdown int[] trimCurve:orders ``` ```markdown ### C++ Type VtArray&lt;int&gt; ``` ```markdown ### Usd Type SdfValueTypeNames-&gt;IntArray ``` ```markdown ## GetTrimCurvePointsAttr ``` ```markdown ( ) ``` ```markdown → Attribute ``` ```markdown ### Description Flat list of homogeneous 2D points (u, v, w) that comprise the `nCurves` curves. ``` ```markdown ### Declaration ``` ```markdown double3[] trimCurve:points ``` ```markdown ### C++ Type VtArray&lt;GfVec3d&gt; ``` ```markdown ### Usd Type SdfValueTypeNames-&gt;Double3Array ``` ```markdown ## GetTrimCurveRangesAttr ``` ```markdown ( ) ``` ```markdown → Attribute ``` ```markdown ### Description Flat list of minimum and maximum parametric values (as defined by `knots`) for each of the `nCurves` curves. ``` ```markdown ### Declaration ``` ```markdown double2[] trimCurve:ranges ``` ```markdown ### C++ Type VtArray&lt;GfVec2d&gt; ``` ```markdown ### Usd Type SdfValueTypeNames-&gt;Double2Array ``` ```markdown ## GetTrimCurveVertexCountsAttr ``` ```markdown ( ) ``` ```markdown → Attribute ``` ```markdown ### Description Flat list of number of vertices for each of the `nCurves` curves. ``` ```markdown ### Declaration ``` ```markdown int[] trimCurve:vertexCounts ``` ```markdown ### C++ Type VtArray&lt;int&gt; ``` ```markdown ### Usd Type SdfValueTypeNames-&gt;IntArray ``` ```markdown ## GetUFormAttr ``` ```markdown ( ) ``` ```markdown → Attribute ``` ```markdown ### Description Interpret the control grid and knot vectors as representing an open, geometrically closed, or geometrically closed and C2 continuous surface along the U dimension. ``` ```markdown ### NurbsPatch Form ``` ```markdown ### Declaration ``` ```markdown uniform token uForm ="open" ``` ```markdown ### C++ Type TfToken ``` ```markdown ### Usd Type SdfValueTypeNames-&gt;Token ``` ```markdown ### Variability SdfVariabilityUniform ``` ```markdown ### Allowed Values open, closed, periodic ``` ```markdown ## pxr.UsdGeom.NurbsPatch.GetUKnotsAttr ### Description Knot vector for U direction providing U parameterization. The length of this array must be ( uVertexCount + uOrder), and its entries must take on monotonically increasing values. #### Declaration ``` double[] uKnots ``` #### C++ Type VtArray&lt;double&gt; #### Usd Type SdfValueTypeNames-&gt;DoubleArray ``` ## pxr.UsdGeom.NurbsPatch.GetUOrderAttr ### Description Order in the U direction. Order must be positive and is equal to the degree of the polynomial basis to be evaluated, plus 1. #### Declaration ``` int uOrder ``` #### C++ Type int #### Usd Type SdfValueTypeNames-&gt;Int ``` ## pxr.UsdGeom.NurbsPatch.GetURangeAttr ### Description Provides the minimum and maximum parametric values (as defined by uKnots) over which the surface is actually defined. The minimum must be less than the maximum, and greater than or equal to the value of uKnots[uOrder-1]. The maxium must be less than or equal to the last element’s value in uKnots. #### Declaration ``` double2 uRange ``` #### C++ Type GfVec2d #### Usd Type SdfValueTypeNames-&gt;Double2 ``` ## pxr.UsdGeom.NurbsPatch.GetUVertexCountAttr ### Description Number of vertices in the U direction. Should be at least as large as uOrder. #### Declaration ``` int uVertexCount ``` #### C++ Type int #### Usd Type SdfValueTypeNames-&gt;Int ``` ## pxr.UsdGeom.NurbsPatch.GetVFormAttr ### Description Interpret the control grid and knot vectors as representing an open, geometrically closed, or geometrically closed and C2 continuous surface along the V dimension. #### NurbsPatch Form #### Declaration ``` uniform token vForm ="open" ``` #### C++ Type TfToken #### Usd Type SdfValueTypeNames-&gt;Token #### Variability SdfVariabilityUniform #### Allowed Values ``` ### GetVKnotsAttr - **Description**: Knot vector for V direction providing U parameterization. The length of this array must be (vVertexCount + vOrder), and its entries must take on monotonically increasing values. - **Declaration**: `double[] vKnots` - **C++ Type**: `VtArray<double>` - **Usd Type**: `SdfValueTypeNames->DoubleArray` ### GetVOrderAttr - **Description**: Order in the V direction. Order must be positive and is equal to the degree of the polynomial basis to be evaluated, plus 1. - **Declaration**: `int vOrder` - **C++ Type**: `int` - **Usd Type**: `SdfValueTypeNames->Int` ### GetVRangeAttr - **Description**: Provides the minimum and maximum parametric values (as defined by vKnots) over which the surface is actually defined. The minimum must be less than the maximum, and greater than or equal to the value of vKnots[vOrder-1]. The maximum must be less than or equal to the last element’s value in vKnots. - **Declaration**: `double2 vRange` - **C++ Type**: `GfVec2d` - **Usd Type**: `SdfValueTypeNames->Double2` ### GetVVertexCountAttr - **Description**: Number of vertices in the V direction. Should be at least as large as vOrder. - **Declaration**: `int vVertexCount` - **C++ Type**: `int` - **Usd Type**: `SdfValueTypeNames->Int` ### Plane - **Description**: Defines a primitive plane, centered at the origin, and is defined by a cardinal axis, width, and length. The plane is double-sided by default. The axis of width and length are perpendicular to the plane’s axis: - **axis**: width, length - **X**: z-axis, y-axis - **Y**: x-axis, z-axis - **Z**: x-axis, y-axis - **Note**: For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded as the value. ## Methods: | Method | Description | | --- | --- | | `CreateAxisAttr(defaultValue, writeSparsely)` | See GetAxisAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateDoubleSidedAttr(defaultValue, ...)` | See GetDoubleSidedAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateExtentAttr(defaultValue, writeSparsely)` | See GetExtentAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateLengthAttr(defaultValue, writeSparsely)` | See GetLengthAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateWidthAttr(defaultValue, writeSparsely)` | See GetWidthAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Define(stage, path) -> Plane` | classmethod | | `Get(stage, path) -> Plane` | classmethod | | `GetAxisAttr()` | The axis along which the surface of the plane is aligned. | | `GetDoubleSidedAttr()` | Planes are double-sided by default. | | `GetExtentAttr()` | Extent is re-defined on Plane only to provide a fallback value. | | `GetLengthAttr()` | The length of the plane, which aligns to the y-axis when axis is 'Z' or 'X', or to the z-axis when axis is 'Y'. | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | classmethod | | `GetWidthAttr()` | The width of the plane, which aligns to the x-axis when axis is 'Z' or 'Y', or to the z-axis when axis is 'X'. | <em>defaultValue <em>writeSparsely ) → Attribute <dd> <p>See GetAxisAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li><p><strong>defaultValue <li><p><strong>writeSparsely <dt> <span>CreateDoubleSidedAttr ( <em>defaultValue <em>writeSparsely ) → Attribute <dd> <p>See GetDoubleSidedAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li><p><strong>defaultValue <li><p><strong>writeSparsely <dt> <span>CreateExtentAttr ( <em>defaultValue <em>writeSparsely ) → Attribute <dd> <p>See GetExtentAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li><p><strong>defaultValue <li><p><strong>writeSparsely CreateLengthAttr(defaultValue, writeSparsely) → Attribute See GetLengthAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters: - **defaultValue** (VtValue) – - **writeSparsely** (bool) – CreateWidthAttr(defaultValue, writeSparsely) → Attribute See GetWidthAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters: - **defaultValue** (VtValue) – - **writeSparsely** (bool) – classmethod Define(stage, path) -> Plane Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid UsdPrim. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. Parameters ---------- - **stage** (Stage) – - **path** (Path) – classmethod Get(stage, path) -> Plane ------------------------------------- Return a UsdGeomPlane holding the prim adhering to this schema at path on stage. If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdGeomPlane(stage->GetPrimAtPath(path)); ``` Parameters ---------- - **stage** (Stage) – - **path** (Path) – GetAxisAttr() ------------- The axis along which the surface of the plane is aligned. When set to 'Z' the plane is in the xy-plane; when axis is 'X' the plane is in the yz-plane, and when axis is 'Y' the plane is in the xz-plane. Declaration ----------- ``` uniform token axis ="Z" ``` C++ Type -------- TfToken Usd Type -------- SdfValueTypeNames->Token Variability ----------- SdfVariabilityUniform Allowed Values --------------- X, Y, Z GetDoubleSidedAttr() -------------------- Planes are double-sided by default. Clients may also support single-sided planes. Declaration ----------- ``` uniform bool doubleSided = 1 ``` C++ Type -------- bool Usd Type -------- SdfValueTypeNames->Bool Variability ----------- SdfVariabilityUniform ### GetExtentAttr GetExtentAttr () → Attribute Extent is re-defined on Plane only to provide a fallback value. UsdGeomGprim::GetExtentAttr() . Declaration float3[] extent = [(-1, -1, 0), (1, 1, 0)] C++ Type VtArray<GfVec3f> Usd Type SdfValueTypeNames->Float3Array ``` ### GetLengthAttr ``` GetLengthAttr () → Attribute The length of the plane, which aligns to the y-axis when axis is 'Z' or 'X', or to the z-axis when axis is 'Y'. If you author length you must also author extent. UsdGeomGprim::GetExtentAttr() Declaration double length = 2 C++ Type double Usd Type SdfValueTypeNames->Double ``` ### GetSchemaAttributeNames ``` static GetSchemaAttributeNames() classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters includeInherited (bool) – ``` ### GetWidthAttr ``` GetWidthAttr () → Attribute The width of the plane, which aligns to the x-axis when axis is 'Z' or 'Y', or to the z-axis when axis is 'X'. If you author width you must also author extent. UsdGeomGprim::GetExtentAttr() Declaration double width = 2 C++ Type double Usd Type SdfValueTypeNames->Double ``` ### PointBased ``` class pxr.UsdGeom.PointBased Base class for all UsdGeomGprims that possess points, providing common attributes such as normals and velocities. Methods: | Method | Description | |------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------| | `ComputeExtent(points, extent) -> bool` | classmethod ComputeExtent(points, extent) -> bool | | `ComputePointsAtTime(points, time, baseTime) -> bool` | classmethod ComputePointsAtTime(points, time, baseTime) -> bool | | `ComputePointsAtTimes(pointsArray, times, ...)` | Compute points as in ComputePointsAtTime, but using multiple sample times. | | `CreateAccelerationsAttr(defaultValue, ...)` | See GetAccelerationsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateNormalsAttr(defaultValue, writeSparsely)` | See GetNormalsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreatePointsAttr(defaultValue, writeSparsely)` | See GetPointsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateVelocitiesAttr(defaultValue, writeSparsely)` | See GetVelocitiesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Get(stage, path) -> PointBased` | classmethod Get(stage, path) -> PointBased | | `GetAccelerationsAttr()` | If provided,'accelerations'should be used with velocities to compute positions between samples for the'points'attribute rather than interpolating between neighboring'points'samples. | | `GetNormalsAttr()` | Provide an object-space orientation for individual points, which, depending on subclass, may define a surface, curve, or free points. | | `GetNormalsInterpolation()` | Get the interpolation for the normals attribute. | | `GetPointsAttr()` | The primary geometry attribute for all PointBased primitives, describes points in (local) space. | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | `GetVelocitiesAttr()` | See GetVelocitiesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | If provided,'velocities'should be used by renderers to. | |------------------------------------------------------------| | SetNormalsInterpolation (interpolation) | | Set the interpolation for the *normals* attribute. | ## ComputeExtent **classmethod** ComputeExtent(points, extent) -> bool Compute the extent for the point cloud defined by points. true on success, false if extents was unable to be calculated. On success, extent will contain the axis-aligned bounding box of the point cloud defined by points. This function is to provide easy authoring of extent for usd authoring tools, hence it is static and acts outside a specific prim (as in attribute based methods). **Parameters** - **points** (Vec3fArray) – - **extent** (Vec3fArray) – ComputeExtent(points, transform, extent) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the extent as if the matrix `transform` was first applied. **Parameters** - **points** (Vec3fArray) – - **transform** (Matrix4d) – - **extent** (Vec3fArray) – ## ComputePointsAtTime **classmethod** ComputePointsAtTime(points, time, baseTime) -> bool Compute points given the positions, velocities and accelerations at `time`. This will return `false` and leave `points` untouched if: - `points` is None - one of `time` and `baseTime` is numeric and the other is UsdTimeCode::Default() (they must either both be numeric or both be default) - there is no authored points attribute If there is no error, we will return `true` and `points` will contain the computed points. points - the out parameter for the new points. Its size will depend on the authored data. time - UsdTimeCode at which we want to evaluate the transforms baseTime - required for correct interpolation between samples when *velocities* or *accelerations* are present. If there are samples for *positions* and *velocities* at t1 and t2, normal value resolution would attempt to interpolate between the two samples, and if they could not be interpolated because they differ in size (common in cases where velocity is authored), will choose the sample at t1. When sampling for the purposes of motion-blur, for example, it is common, when rendering the frame at t2, to sample at [ t2-shutter/2, t2+shutter/2 ] for a shutter interval of **shutter**. The first sample falls between t1 and t2, but we must sample at t2 and apply velocity-based interpolation based on those samples to get a correct result. In such scenarios, one should provide a `baseTime` of t2 when querying **both** samples. If your application does not care about off-sample interpolation, it can supply the same value for `baseTime` that it does for `time`. When `baseTime` is less than or equal to `time`, we will choose the lower bracketing timeSample. ### Parameters - **points** (`VtArray[Vec3f]`) – - **time** (`TimeCode`) – - **baseTime** (`TimeCode`) – --- ComputePointsAtTime(points, stage, time, positions, velocities, velocitiesSampleTime, accelerations, velocityScale) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Perform the point computation. This does the same computation as the non-static ComputePointsAtTime method, but takes all data as parameters rather than accessing authored data. - **points** - the out parameter for the computed points. Its size will depend on the given data. stage - **stage** - the UsdStage time - **time** - time at which we want to evaluate the transforms positions - **positions** - array containing all current points. velocities - **velocities** - array containing all velocities. This array must be either the same size as `positions` or empty. If it is empty, points are computed as if all velocities were zero in all dimensions. velocitiesSampleTime - **velocitiesSampleTime** - time at which the samples from `velocities` were taken. accelerations - **accelerations** - array containing all accelerations. This array must be either the same size as `positions` or empty. If it is empty, points are computed as if all accelerations were zero in all dimensions. - **velocityScale** - Deprecated ### Parameters - **points** (`VtArray[Vec3f]`) – - **stage** (`UsdStageWeak`) – - **time** (`TimeCode`) – - **positions** (`Vec3fArray`) – - **velocities** (`Vec3fArray`) – - **velocitiesSampleTime** (`TimeCode`) – - **accelerations** (`Vec3fArray`) – - **velocityScale** (`float`) – Compute points as in ComputePointsAtTime, but using multiple sample times. An array of vector arrays is returned where each vector array contains the points for the corresponding time in `times`. times - A vector containing the UsdTimeCodes at which we want to sample. Parameters - **pointsArray** (list [VtArray [Vec3f]]) – - **times** (list [TimeCode]) – - **baseTime** (TimeCode) – See GetAccelerationsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – See GetNormalsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreatePointsAttr **CreatePointsAttr**(defaultValue, writeSparsely) → Attribute See GetPointsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateVelocitiesAttr **CreateVelocitiesAttr**(defaultValue, writeSparsely) → Attribute See GetVelocitiesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## Get **classmethod** Get(stage, path) -> PointBased Return a UsdGeomPointBased holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdGeomPointBased(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Usd.Stage) – - **path** (str) – <em> Stage ) – <strong> path ( <em> Path ) – ### GetAccelerationsAttr ```python GetAccelerationsAttr() → Attribute ``` If provided, 'accelerations' should be used with velocities to compute positions between samples for the 'points' attribute rather than interpolating between neighboring 'points' samples. Acceleration is measured in position units per second-squared. To convert to position units per squared UsdTimeCode, divide by the square of UsdStage::GetTimeCodesPerSecond(). Declaration ``` vector3f[] accelerations ``` C++ Type ``` VtArray&lt;GfVec3f&gt; ``` Usd Type ``` SdfValueTypeNames->Vector3fArray ``` ### GetNormalsAttr ```python GetNormalsAttr() → Attribute ``` Provide an object-space orientation for individual points, which, depending on subclass, may define a surface, curve, or free points. Note that 'normals' should not be authored on any Mesh that is subdivided, since the subdivision algorithm will define its own normals. 'normals' is not a generic primvar, but the number of elements in this attribute will be determined by its 'interpolation'. See SetNormalsInterpolation(). If 'normals' and 'primvars:normals' are both specified, the latter has precedence. Declaration ``` normal3f[] normals ``` C++ Type ``` VtArray&lt;GfVec3f&gt; ``` Usd Type ``` SdfValueTypeNames->Normal3fArray ``` ### GetNormalsInterpolation ```python GetNormalsInterpolation() → str ``` Get the interpolation for the *normals* attribute. Although 'normals' is not classified as a generic UsdGeomPrimvar (and will not be included in the results of UsdGeomPrimvarsAPI::GetPrimvars()) it does require an interpolation specification. The fallback interpolation, if left unspecified, is UsdGeomTokens->vertex, which will generally produce smooth shading on a polygonal mesh. To achieve partial or fully faceted shading of a polygonal mesh with normals, one should use UsdGeomTokens->faceVarying or UsdGeomTokens->uniform interpolation. ### GetPointsAttr ```python GetPointsAttr() → Attribute ``` The primary geometry attribute for all PointBased primitives, describes points in (local) space. Declaration ``` point3f[] points ``` C++ Type ``` VtArray&lt;GfVec3f&gt; ``` Usd Type ``` SdfValueTypeNames->Point3fArray ``` ### GetSchemaAttributeNames ```python static GetSchemaAttributeNames() ``` **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. ## Parameters **includeInherited** (**bool**) – ## GetVelocitiesAttr ``` GetVelocitiesAttr ``` → Attribute If provided, 'velocities' should be used by renderers to compute positions between samples for the 'points' attribute, rather than interpolating between neighboring 'points' samples. This is the only reasonable means of computing motion blur for topologically varying PointBased primitives. It follows that the length of each 'velocities' sample must match the length of the corresponding 'points' sample. Velocity is measured in position units per second, as per most simulation software. To convert to position units per UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). See also Applying Timesampled Velocities to Geometry. Declaration ``` vector3f[] velocities ``` C++ Type ``` VtArray<GfVec3f> ``` Usd Type ``` SdfValueTypeNames->Vector3fArray ``` ## SetNormalsInterpolation ``` SetNormalsInterpolation(interpolation) ``` → bool Set the interpolation for the **normals** attribute. true upon success, false if 'interpolation' is not a legal value as defined by UsdGeomPrimvar::IsValidInterpolation(), or if there was a problem setting the value. No attempt is made to validate that the normals attr's value contains the right number of elements to match its interpolation to its prim's topology. GetNormalsInterpolation() ### Parameters **interpolation** (**str**) – ## PointInstancer class pxr.UsdGeom.PointInstancer Encodes vectorized instancing of multiple, potentially animated, prototypes (object/instance masters), which can be arbitrary prims/subtrees on a UsdStage. PointInstancer is a "multi instancer", as it allows multiple prototypes to be scattered among its "points". We use a UsdRelationship **prototypes** to identify and order all of the possible prototypes, by targeting the root prim of each prototype. The ordering imparted by relationships associates a zero-based integer with each prototype, and it is these integers we use to identify the prototype of each instance, compactly, and allowing prototypes to be swapped out without needing to reauthor all of the per-instance data. The PointInstancer schema is designed to scale to billions of instances, which motivates the choice to split the per-instance transformation into position, (quaternion) orientation, and scales, rather than a 4x4 matrix per-instance. In addition to requiring fewer bytes even if all elements are authored (32 bytes vs 64 for a single-precision 4x4 matrix), we can also be selective about which attributes need to animate over time, for substantial data reduction in many cases. Note that PointInstancer is **not** a Gprim, since it is not a graphical primitive by any stretch of the imagination. It **is**, however, Boundable, since we will sometimes want to treat the entire PointInstancer similarly to a procedural, from the perspective of inclusion or framing. ### Varying Instance Identity over Time PointInstancers originating from simulations often have the characteristic that points/instances are "born", move around for some time period, and then die (or leave the area of interest). In such cases, billions of instances may be birthed over time, while at any **specific** time, only a much smaller number are actually alive. To encode this situation efficiently, the simulator may re-use indices in the instance arrays, when a particle dies, its index will be taken over by a new particle that may be birthed in a much different location. This presents challenges both for identity-tracking, and for motion-blur. We facilitate identity tracking by providing an optional, animatable **ids** attribute, that specifies the 64 bit integer ID of the particle at each index, at each point in time. If the simulator keeps monotonically increasing a particle-count each time a new particle is birthed, it will serve perfectly as particle **ids**. We facilitate motion blur for varying-topology particle streams by optionally allowing per-instance **velocities** and **angularVelocities** to be authored. If instance transforms are requested at a time between samples and either of the velocity attributes is authored, then we will not attempt to interpolate samples of **positions** or **orientations**. If not authored, and the bracketing samples have the same length, then we will interpolate. ## Computing an Instance Transform Each instance’s transformation is a combination of the SRT affine transform described by its scale, orientation, and position, applied after (i.e. less locally) than the transformation computed at the root of the prototype it is instancing. In other words, to put an instance of a PointInstancer into the space of the PointInstancer’s parent prim: > 1. Apply (most locally) the authored transformation for prototypes[protoIndices[i]] > 2. If scales is authored, next apply the scaling matrix from scales[i] > 3. If orientations is authored: > - if angularVelocities is authored, first multiply orientations[i] by the unit quaternion derived by scaling angularVelocities[i] by the time differential from the left-bracketing timeSample for orientation to the requested evaluation time t, storing the result in R, else assign R directly from orientations[i]. Apply the rotation matrix derived from R. > 4. Apply the translation derived from positions[i]. If velocities is authored, apply the translation deriving from velocities[i] scaled by the time differential from the left-bracketing timeSample for positions to the requested evaluation time t. > 5. Least locally, apply the transformation authored on the PointInstancer prim itself (or the UsdGeomImageable::ComputeLocalToWorldTransform() of the PointInstancer to put the instance directly into world space) If neither velocities nor angularVelocities are authored, we fallback to standard position and orientation computation logic (using linear interpolation between timeSamples) as described by Applying Timesampled Velocities to Geometry. ### Scaling Velocities for Interpolation When computing time-differentials by which to apply velocity or angularVelocity to positions or orientations, we must scale by ( 1.0 / UsdStage::GetTimeCodesPerSecond() ), because velocities are recorded in units/second, while we are interpolating in UsdTimeCode ordinates. We provide both high and low-level API’s for dealing with the transformation as a matrix, both will compute the instance matrices using multiple threads; the low-level API allows the client to cache unvarying inputs so that they need not be read duplicately when computing over time. See also Applying Timesampled Velocities to Geometry. ## Primvars on PointInstancer Primvars authored on a PointInstancer prim should always be applied to each instance with constant interpolation at the root of the instance. When you are authoring primvars on a PointInstancer, think about it as if you were authoring them on a point-cloud (e.g. a UsdGeomPoints gprim). The same interpolation rules for points apply here, substituting”instance”for”point”. In other words, the (constant) value extracted for each instance from the authored primvar value depends on the authored interpolation and elementSize of the primvar, as follows: > - **constant** or **uniform**: the entire authored value of the primvar should be applied exactly to each instance. > - **varying**, **vertex**, or **faceVarying**: the first elementSize elements of the authored primvar array should be assigned to instance zero, the second elementSize elements should be assigned to instance one, and so forth. ## Masking Instances: "Deactivating" and Invising Often a PointInstancer is created "upstream" in a graphics pipeline, and the needs of "downstream" clients necessitate eliminating some of the instances from further consideration. Accomplishing this pruning by re-authoring all of the per-instance attributes is not very attractive, since it may mean destructively editing a large quantity of data. We therefore provide means of "masking" instances by ID, such that the instance data is unmolested, but per-instance transform and primvar data can be retrieved with the no-longer-desired instances eliminated from the (smaller) arrays. PointInstancer allows two independent means of masking instances by ID, each with different features that meet the needs of various clients in a pipeline. Both pruning features' lists of ID's are combined to produce the mask returned by ComputeMaskAtTime(). If a PointInstancer has no authored ids attribute, the masking features will still be available, with the integers specifying element position in the protoIndices array rather than ID. The first masking feature encodes a list of IDs in a list-editable metadatum called inactiveIds, which, although it does not have any similar impact to stage population as prim activation, it shares with that feature that its application is uniform over all time. Because it is list-editable, we can sparsely add and remove instances from it in many layers. This sparse application pattern makes inactiveIds a good choice when further downstream clients may need to reverse masking decisions made upstream, in a manner that is robust to many kinds of future changes to the upstream data. See ActivateId() , ActivateIds() , DeactivateId() , DeactivateIds() , ActivateAllIds() The second masking feature encodes a list of IDs in a time-varying Int64Array-valued UsdAttribute called *invisibleIds*, since it shares with Imageable visibility the ability to animate object visibility. Unlike *inactiveIds*, overriding a set of opinions for *invisibleIds* is not at all straightforward, because one will, in general need to reauthor (in the overriding layer) **all** timeSamples for the attribute just to change one Id’s visibility state, so it cannot be authored sparsely. But it can be a very useful tool for situations like encoding pre-computed camera-frustum culling of geometry when either or both of the instances or the camera is animated. See VisId() , VisIds() , InvisId() , InvisIds() , VisAllIds() ## Processing and Not Processing Prototypes Any prim in the scenegraph can be targeted as a prototype by the *prototypes* relationship. We do not, however, provide a specific mechanism for identifying prototypes as geometry that should not be drawn (or processed) in their own, local spaces in the scenegraph. We encourage organizing all prototypes as children of the PointInstancer prim that consumes them, and pruning”raw”processing and drawing traversals when they encounter a PointInstancer prim; this is what the UsdGeomBBoxCache and UsdImaging engines do. There *is* a pattern one can deploy for organizing the prototypes such that they will automatically be skipped by basic UsdPrim::GetChildren() or UsdPrimRange traversals. Usd prims each have a specifier of”def”,”over”, or”class”. The default traversals skip over prims that are”pure overs”or classes. So to protect prototypes from all generic traversals and processing, place them under a prim that is just an”over”. For example, ``` 01 def PointInstancer "Crowd_Mid" 02 { 03 rel prototypes = [ 04 05 over "Prototypes" 06 { 07 def "MaleThin_Business" ( 08 references = [@MaleGroupA/usd/MaleGroupA.usd@ 09 variants = { 10 string modelingVariant = "Thin" 11 string costumeVariant = "BusinessAttire" 12 } 13 ) 14 { ... } 15 16 def "MaleThin_Casual" 17 ... 18 } 19 } ``` **Classes:** | Class | Description | | --- | --- | | MaskApplication | Encodes whether to evaluate and apply the PointInstancer's mask to computed results. | | ProtoXformInclusion | Encodes whether to include each prototype's root prim's transformation as the most-local component of computed instance transforms. | **Methods:** | Method | Description | | --- | --- | | ActivateAllIds() | Ensure that all instances are active over all time. | | ActivateId(id) | Ensure that the instance identified by id is active over all time. | | ActivateIds(ids) | Ensure that the instances identified by ids are active over all time. | | ComputeExtentAtTime(extent, time, baseTime) | Compute the extent of the point instancer based on the per- instance,"PointInstancer relative"transforms at time, as described in Computing an Instance Transform. | | ComputeExtentAtTimes(extents, times, baseTime) | Compute the extent of the point instancer as in ComputeExtentAtTime, but across multiple times. | | HTML | Markdown | | --- | --- | | <p> | <p> | | <strong> | ** | | <em> | * | | <code> | ` | | <span class="pre"> | <span class="pre"> | | <a href="#..." title="..."> | [...](#...) | | <tr class="row-even"> | <tr class="row-even"> | | <tr class="row-odd"> | <tr class="row-odd"> | | <td> | <td> | | <p> | <p> | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.ComputeInstanceTransformsAtTime" title="pxr.UsdGeom.PointInstancer.ComputeInstanceTransformsAtTime"> | [ComputeInstanceTransformsAtTime](#pxr.UsdGeom.PointInstancer.ComputeInstanceTransformsAtTime) | | <code class="xref py py-obj docutils literal notranslate"> | `ComputeInstanceTransformsAtTime` | | <span class="pre"> | <span class="pre"> | | <strong> | ** | | <em> | * | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.ComputeMaskAtTime" title="pxr.UsdGeom.PointInstancer.ComputeMaskAtTime"> | [ComputeMaskAtTime](#pxr.UsdGeom.PointInstancer.ComputeMaskAtTime) | | <code class="xref py py-obj docutils literal notranslate"> | `ComputeMaskAtTime` | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.CreateAccelerationsAttr" title="pxr.UsdGeom.PointInstancer.CreateAccelerationsAttr"> | [CreateAccelerationsAttr](#pxr.UsdGeom.PointInstancer.CreateAccelerationsAttr) | | <code class="xref py py-obj docutils literal notranslate"> | `CreateAccelerationsAttr` | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.CreateAngularVelocitiesAttr" title="pxr.UsdGeom.PointInstancer.CreateAngularVelocitiesAttr"> | [CreateAngularVelocitiesAttr](#pxr.UsdGeom.PointInstancer.CreateAngularVelocitiesAttr) | | <code class="xref py py-obj docutils literal notranslate"> | `CreateAngularVelocitiesAttr` | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.CreateIdsAttr" title="pxr.UsdGeom.PointInstancer.CreateIdsAttr"> | [CreateIdsAttr](#pxr.UsdGeom.PointInstancer.CreateIdsAttr) | | <code class="xref py py-obj docutils literal notranslate"> | `CreateIdsAttr` | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.CreateInvisibleIdsAttr" title="pxr.UsdGeom.PointInstancer.CreateInvisibleIdsAttr"> | [CreateInvisibleIdsAttr](#pxr.UsdGeom.PointInstancer.CreateInvisibleIdsAttr) | | <code class="xref py py-obj docutils literal notranslate"> | `CreateInvisibleIdsAttr` | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.CreateOrientationsAttr" title="pxr.UsdGeom.PointInstancer.CreateOrientationsAttr"> | [CreateOrientationsAttr](#pxr.UsdGeom.PointInstancer.CreateOrientationsAttr) | | <code class="xref py py-obj docutils literal notranslate"> | `CreateOrientationsAttr` | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.CreatePositionsAttr" title="pxr.UsdGeom.PointInstancer.CreatePositionsAttr"> | [CreatePositionsAttr](#pxr.UsdGeom.PointInstancer.CreatePositionsAttr) | | <code class="xref py py-obj docutils literal notranslate"> | `CreatePositionsAttr` | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.CreateProtoIndicesAttr" title="pxr.UsdGeom.PointInstancer.CreateProtoIndicesAttr"> | [CreateProtoIndicesAttr](#pxr.UsdGeom.PointInstancer.CreateProtoIndicesAttr) | | <code class="xref py py-obj docutils literal notranslate"> | `CreateProtoIndicesAttr` | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.CreatePrototypesRel" title="pxr.UsdGeom.PointInstancer.CreatePrototypesRel"> | [CreatePrototypesRel](#pxr.UsdGeom.PointInstancer.CreatePrototypesRel) | | <code class="xref py py-obj docutils literal notranslate"> | `CreatePrototypesRel` | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.CreateScalesAttr" title="pxr.UsdGeom.PointInstancer.CreateScalesAttr"> | [CreateScalesAttr](#pxr.UsdGeom.PointInstancer.CreateScalesAttr) | | <code class="xref py py-obj docutils literal notranslate"> | `CreateScalesAttr` | | <a class="reference internal" href="#pxr.UsdGeom.PointInstancer.CreateVelocitiesAttr" title="pxr.UsdGeom.PointInstancer.CreateVelocitiesAttr"> | [CreateVelocitiesAttr](#pxr.UsdGeom.PointInstancer.CreateVelocitiesAttr) | | <code class="xref py py-obj docutils literal notranslate"> | `CreateVelocitiesAttr` | | 属性 | 描述 | | --- | --- | | DeactivateId (id) | Ensure that the instance identified by `id` is inactive over all time. | | DeactivateIds (ids) | Ensure that the instances identified by `ids` are inactive over all time. | | Define | `classmethod` Define(stage, path) -> PointInstancer | | Get | `classmethod` Get(stage, path) -> PointInstancer | | GetAccelerationsAttr () | If authored, per-instance'accelerations' will be used with velocities to compute positions between samples for the 'positions' attribute rather than interpolating between neighboring 'positions' samples. | | GetAngularVelocitiesAttr () | If authored, per-instance angular velocity vector to be used for interpolating orientations. | | GetIdsAttr () | Ids are optional; if authored, the ids array should be the same length as the `protoIndices` array, specifying (at each timeSample if instance identities are changing) the id of each instance. | | GetInstanceCount (timeCode) | Returns the number of instances as defined by the size of the `protoIndices` array at `timeCode`. | | GetInvisibleIdsAttr () | A list of id's to make invisible at the evaluation time. | | GetOrientationsAttr () | If authored, per-instance orientation of each instance about its prototype's origin, represented as a unit length quaternion, which allows us to encode it with sufficient precision in a compact GfQuath. | | GetPositionsAttr () | **Required property**. | | GetProtoIndicesAttr () | **Required property**. | | Method | Description | |--------|-------------| | `GetPrototypesRel()` | Required property. | | `GetScalesAttr()` | If authored, per-instance scale to be applied to each instance, before any rotation is applied. | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | classmethod | | `GetVelocitiesAttr()` | If provided, per-instance'velocities'will be used to compute positions between samples for the'positions'attribute, rather than interpolating between neighboring'positions'samples. | | `InvisId(id, time)` | Ensure that the instance identified by `id` is invisible at `time`. | | `InvisIds(ids, time)` | Ensure that the instances identified by `ids` are invisible at `time`. | | `VisAllIds(time)` | Ensure that all instances are visible at `time`. | | `VisId(id, time)` | Ensure that the instance identified by `id` is visible at `time`. | | `VisIds(ids, time)` | Ensure that the instances identified by `ids` are visible at `time`. | **Attributes:** | Attribute | Description | |-----------|-------------| | `ApplyMask` | | | `ExcludeProtoXform` | | | `IgnoreMask` | | <td> <p> <code> IncludeProtoXform <td> <p> <dl> <dt> <em> class <strong> MaskApplication <dd> <p> Encodes whether to evaluate and apply the PointInstancer’s mask to computed results. <p> ComputeMaskAtTime() <p> **Methods:** <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr> <td> <p> <code> GetValueFromName <td> <p> <p> **Attributes:** <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr> <td> <p> <code> allValues <td> <p> <dl> <dt> <em> class <strong> ProtoXformInclusion <dd> <p> Encodes whether to include each prototype’s root prim’s transformation as the most-local component of computed instance transforms. <p> **Methods:** <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr> <td> <p> <code> GetValueFromName <td> <p> <p> **Attributes:** <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr> <td> <p> <code> allValues <td> <p> <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.PointInstancer.ProtoXformInclusion.allValues"> <span class="sig-name descname"> <span class="pre"> allValues <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> tuple <em> <span class="p"> <span class="pre"> ( <span class="p"> <span class="pre"> = <span class="pre"> (UsdGeom.PointInstancer.IncludeProtoXform, <span class="pre"> UsdGeom.PointInstancer.ExcludeProtoXform) <dd> <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.PointInstancer.ActivateAllIds"> <span class="sig-name descname"> <span class="pre"> ActivateAllIds <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Ensure that all instances are active over all time. <p> This does not guarantee that the instances will be rendered, because each may still be”invisible”due to its presence in the <em> invisibleIds attribute (see VisId() , InvisId() ) <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.PointInstancer.ActivateId"> <span class="sig-name descname"> <span class="pre"> ActivateId <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> id <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Ensure that the instance identified by <code class="docutils literal notranslate"> <span class="pre"> id is active over all time. <p> This activation is encoded sparsely, affecting no other instances. <p> This does not guarantee that the instance will be rendered, because it may still be”invisible”due to <code class="docutils literal notranslate"> <span class="pre"> id being present in the <em> invisibleIds attribute (see VisId() , InvisId() ) <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> id ( <em> int ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.PointInstancer.ActivateIds"> <span class="sig-name descname"> <span class="pre"> ActivateIds <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> ids <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Ensure that the instances identified by <code class="docutils literal notranslate"> <span class="pre"> ids are active over all time. <p> This activation is encoded sparsely, affecting no other instances. <p> This does not guarantee that the instances will be rendered, because each may still be”invisible”due to its presence in the <em> invisibleIds attribute (see VisId() , InvisId() ) <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> ids ( <em> Int64Array ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.PointInstancer.ComputeExtentAtTime"> <span class="sig-name descname"> <span class="pre"> ComputeExtentAtTime <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> extent , <em class="sig-param"> <span class="n"> <span class="pre"> time , <em class="sig-param"> <span class="n"> <span class="pre"> baseTime <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Compute the extent of the point instancer based on the per- instance,”PointInstancer relative”transforms at <code class="docutils literal notranslate"> <span class="pre"> time , as described in Computing an Instance Transform. <p> If there is no error, we return <code class="docutils literal notranslate"> <span class="pre"> true and <code class="docutils literal notranslate"> <span class="pre"> extent will be the tightest bounds we can compute efficiently. If an error occurs, <code class="docutils literal notranslate"> <span class="pre"> false will be returned and <code class="docutils literal notranslate"> <span class="pre"> extent will be left untouched. <p> For now, this uses a UsdGeomBBoxCache with the”default”,”proxy”, and”render”purposes. extent - the out parameter for the extent. On success, it will contain two elements representing the min and max. time - UsdTimeCode at which we want to evaluate the extent baseTime - required for correct interpolation between samples when velocities or angularVelocities are present. If there are samples for positions and velocities at t1 and t2, normal value resolution would attempt to interpolate between the two samples, and if they could not be interpolated because they differ in size (common in cases where velocity is authored), will choose the sample at t1. When sampling for the purposes of motion-blur, for example, it is common, when rendering the frame at t2, to sample at [ t2-shutter/2, t2+shutter/2 ] for a shutter interval of shutter. The first sample falls between t1 and t2, but we must sample at t2 and apply velocity-based interpolation based on those samples to get a correct result. In such scenarios, one should provide a `baseTime` of t2 when querying both samples. If your application does not care about off-sample interpolation, it can supply the same value for `baseTime` that it does for `time`. When `baseTime` is less than or equal to `time`, we will choose the lower bracketing timeSample. Parameters ---------- - **extent** (Vec3fArray) – - **time** (TimeCode) – - **baseTime** (TimeCode) – ComputeExtentAtTime(extent, time, baseTime, transform) -> bool ----------------------------------------------------------- This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the extent as if the matrix `transform` was first applied. Parameters ---------- - **extent** (Vec3fArray) – - **time** (TimeCode) – - **baseTime** (TimeCode) – - **transform** (Matrix4d) – ComputeExtentAtTimes(extents, times, baseTime) -> bool ------------------------------------------------------ Compute the extent of the point instancer as in ComputeExtentAtTime, but across multiple `times`. This is equivalent to, but more efficient than, calling ComputeExtentAtTime several times. Each element in `extents` is the computed extent at the corresponding time in `times`. As in ComputeExtentAtTime, if there is no error, we return `true` and `extents` will be the tightest bounds we can compute efficiently. If an error occurs computing the extent at any time, `extents` will be the tightest bounds we can compute efficiently. ```html <span class="pre"> false will be returned and <code class="docutils literal notranslate"> <span class="pre"> extents will be left untouched. <p> times <p> - A vector containing the UsdTimeCodes at which we want to sample. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> extents ( <em> list <em> [ <em> Vec3fArray <em> ] ) – <li> <p> <strong> times ( <em> list <em> [ <em> TimeCode <em> ] ) – <li> <p> <strong> baseTime ( <em> TimeCode ) – <hr class="docutils"/> <p> ComputeExtentAtTimes(extents, times, baseTime, transform) -&gt; bool <p> This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the extent as if the matrix <code class="docutils literal notranslate"> <span class="pre"> transform was first applied at each time. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> extents ( <em> list <em> [ <em> Vec3fArray <em> ] ) – <li> <p> <strong> times ( <em> list <em> [ <em> TimeCode <em> ] ) – <li> <p> <strong> baseTime ( <em> TimeCode ) – <li> <p> <strong> transform ( <em> Matrix4d ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.PointInstancer.ComputeInstanceTransformsAtTime"> <span class="sig-name descname"> <span class="pre"> ComputeInstanceTransformsAtTime <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdGeom.PointInstancer.ComputeInstanceTransformsAtTime" title="Permalink to this definition">  <dd> <p> <strong> classmethod ComputeInstanceTransformsAtTime(xforms, time, baseTime, doProtoXforms, applyMask) -&gt; bool <p> Compute the per-instance,”PointInstancer relative”transforms given the positions, scales, orientations, velocities and angularVelocities at <code class="docutils literal notranslate"> <span class="pre"> time , as described in Computing an Instance Transform. <p> This will return <code class="docutils literal notranslate"> <span class="pre"> false and leave <code class="docutils literal notranslate"> <span class="pre"> xforms untouched if: <blockquote> <div> <ul class="simple"> <li> <p> <code class="docutils literal notranslate"> <span class="pre"> xforms is None <li> <p> one of <code class="docutils literal notranslate"> <span class="pre"> time and <code class="docutils literal notranslate"> <span class="pre"> baseTime is numeric and the other is UsdTimeCode::Default() (they must either both be numeric or both be default) <li> <p> there is no authored <em> protoIndices attribute or <em> positions attribute <li> <p> the size of any of the per-instance attributes does not match the size of <em> protoIndices <li> <p> <code class="docutils literal notranslate"> <span class="pre"> doProtoXforms is <code class="docutils literal notranslate"> <span class="pre"> IncludeProtoXform but an index value in <em> protoIndices is outside the range [0, prototypes.size()) <li> <p> <code class="docutils literal notranslate"> <span class="pre"> applyMask is <code class="docutils literal notranslate"> <span class="pre"> ApplyMask and a mask is set but the size of the mask does not match the size of <em> protoIndices . <p> If there is no error, we will return <code class="docutils literal notranslate"> <span class="pre"> true and <code class="docutils literal notranslate"> <span class="pre"> xforms will contain the computed transformations. <p> xforms <p> - the out parameter for the transformations. Its size will depend on the authored data and <code class="docutils literal notranslate"> <span class="pre"> applyMask time <p> - UsdTimeCode at which we want to evaluate the transforms baseTime <p> - required for correct interpolation between samples when <em> velocities or <em> angularVelocities are present. If there are samples for <em> positions and <em> velocities at t1 and t2, normal value resolution would attempt to interpolate between the two samples, and if they could not be interpolated because they differ in size (common in cases where velocity is authored), will choose the sample at t1. When sampling for the purposes of motion-blur, for example, it is common, when rendering the frame at t2, to sample at [ t2-shutter/2, t2+shutter/2 ] for a shutter interval of <em> shutter . The first sample falls between t1 and t2, but we must sample at t2 and apply velocity- based interpolation based on those samples to get a correct result. In such scenarios, one should provide a <code class="docutils literal notranslate"> <span class="pre"> baseTime of t2 when querying <em> both samples. If your application does not care about off-sample interpolation, it can supply the same value for <code class="docutils literal notranslate"> <span class="pre"> baseTime that it does for <code class="docutils literal notranslate"> <span class="pre"> time . When <code class="docutils literal notranslate"> <span class="pre"> baseTime is less than or equal to <code class="docutils literal notranslate"> <span class="pre"> time , we will choose the lower bracketing timeSample. Selecting sample times with respect to baseTime will be performed independently for positions and orientations. doProtoXforms <p> - specifies whether to include the root transformation of each instance’s prototype in the instance’s transform. Default is to include it, but some clients may want to apply the proto transform as part of the prototype itself, so they can specify <code class="docutils literal notranslate"> <span class="pre"> ExcludeProtoXform instead. applyMask <p> - specifies whether to apply ApplyMaskToArray() to the computed result. The default is <code class="docutils literal notranslate"> <span class="pre"> ApplyMask . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> xforms ( <em> VtArray <em> [ <em> Matrix4d <em> ] ) – <li> <p> <strong> time ( <em> TimeCode ) – <li> <p> <strong> baseTime ( <em> TimeCode ) – <li> <p> <strong> doProtoXforms ( <em> ProtoXformInclusion ) – <li> <p> <strong> applyMask ( <em> MaskApplication ) – <hr class="docutils"/> <p> ComputeInstanceTransformsAtTime(xforms, stage, time, protoIndices, positions, velocities, velocitiesSampleTime, accelerations, scales, orientations, angularVelocities, angularVelocitiesSampleTime, protoPaths, mask, velocityScale) -&gt; bool <p> This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Perform the per-instance transform computation as described in Computing an Instance Transform. <p> This does the same computation as the non-static ComputeInstanceTransformsAtTime method, but takes all data as parameters rather than accessing authored data. <p> xforms <p> - the out parameter for the transformations. Its size will depend on the given data and <code class="docutils literal notranslate"> <span class="pre"> applyMask stage <p> - the UsdStage time <p> - time at which we want to evaluate the transforms protoIndices <p> - array containing all instance prototype indices. positions <p> - array containing all instance positions. This array must be the same size as <code class="docutils literal notranslate"> <span class="pre"> protoIndices . velocities <p> - array containing all instance velocities. This array must be either the same size as <code class="docutils literal notranslate"> <span class="pre"> protoIndices or empty. If it is empty, transforms are computed as if all velocities were zero in all dimensions. velocitiesSampleTime <p> - time at which the samples from <code class="docutils literal notranslate"> <span class="pre"> velocities were taken. accelerations - array containing all instance accelerations. This array must be either the same size as `protoIndices` or empty. If it is empty, transforms are computed as if all accelerations were zero in all dimensions. scales - array containing all instance scales. This array must be either the same size as `protoIndices` or empty. If it is empty, transforms are computed with no change in scale. orientations - array containing all instance orientations. This array must be either the same size as `protoIndices` or empty. If it is empty, transforms are computed with no change in orientation angularVelocities - array containing all instance angular velocities. This array must be either the same size as `protoIndices` or empty. If it is empty, transforms are computed as if all angular velocities were zero in all dimensions. angularVelocitiesSampleTime - time at which the samples from `angularVelocities` were taken. protoPaths - array containing the paths for all instance prototypes. If this array is not empty, prototype transforms are applied to the instance transforms. mask - vector containing a mask to apply to the computed result. This vector must be either the same size as `protoIndices` or empty. If it is empty, no mask is applied. velocityScale - Deprecated Parameters - xforms (VtArray[Matrix4d]) – - stage (UsdStageWeak) – - time (TimeCode) – - protoIndices (IntArray) – - positions (Vec3fArray) – - velocities (Vec3fArray) – - velocitiesSampleTime (TimeCode) – - accelerations (Vec3fArray) – - scales (Vec3fArray) – - orientations (QuathArray) – - angularVelocities (Vec3fArray) – - angularVelocitiesSampleTime (TimeCode) – - protoPaths (list[SdfPath]) – - mask (list[bool]) – - velocityScale (float) – ## ComputeInstanceTransformsAtTimes Compute the per-instance transforms as in ComputeInstanceTransformsAtTime, but using multiple sample times. An array of matrix arrays is returned where each matrix array contains the instance transforms for the corresponding time in `times`. times - A vector containing the UsdTimeCodes at which we want to sample. ### Parameters - **xformsArray** (list [VtArray [Matrix4d]]) – - **times** (list [TimeCode]) – - **baseTime** (TimeCode) – - **doProtoXforms** (ProtoXformInclusion) – - **applyMask** (MaskApplication) – ## ComputeMaskAtTime Computes a presence mask to be applied to per-instance data arrays based on authored `inactiveIds`, `invisibleIds`, and `ids`. If no `ids` attribute has been authored, then the values in `inactiveIds` and `invisibleIds` will be interpreted directly as indices of `protoIndices`. If `ids` is non-None, it is assumed to be the id-mapping to apply, and must match the length of `protoIndices` at `time`. If None, we will call GetIdsAttr().Get(time) If all "live" instances at UsdTimeCode `time` pass the mask, we will return an **empty** mask so that clients can trivially recognize the common "no masking" case. The returned mask can be used with ApplyMaskToArray(), and will contain a `true` value for every element that should survive. ### Parameters - **time** (TimeCode) – - **ids** (list [bool]) – - **time** (TimeCode) – - **ids** (Int64Array) – ### CreateAccelerationsAttr ```python CreateAccelerationsAttr(defaultValue, writeSparsely) → Attribute ``` See GetAccelerationsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateAngularVelocitiesAttr ```python CreateAngularVelocitiesAttr(defaultValue, writeSparsely) → Attribute ``` See GetAngularVelocitiesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateIdsAttr ```python CreateIdsAttr(defaultValue, writeSparsely) → Attribute ``` See GetIdsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ``` <p> See GetInvisibleIdsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <p> See GetOrientationsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <p> See GetPositionsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code>defaultValue <dl> <dt>Parameters <dd> <ul> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely ## CreatePositionsAttr See GetPositionsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateProtoIndicesAttr See GetProtoIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreatePrototypesRel See GetPrototypesRel() , and also Create vs Get Property Methods for when to use Get vs Create. ## CreateScalesAttr See GetScalesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateVelocitiesAttr ( `defaultValue`, `writeSparsely` ) → `Attribute` See GetVelocitiesAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### DeactivateId ( `id` ) → `bool` Ensure that the instance identified by `id` is inactive over all time. This deactivation is encoded sparsely, affecting no other instances. A deactivated instance is guaranteed not to render if the renderer honors masking. ### Parameters - **id** (`int`) – ### DeactivateIds ( `ids` ) → `bool` Ensure that the instances identified by `ids` are inactive over all time. This deactivation is encoded sparsely, affecting no other instances. A deactivated instance is guaranteed not to render if the renderer honors masking. ### Parameters - **ids** (`Int64Array`) – ### Define(stage, path) -> PointInstancer Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ### Get(stage, path) -> PointInstancer Return a UsdGeomPointInstancer holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdGeomPointInstancer(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ### GetAccelerationsAttr() -> Attribute If authored, per-instance’accelerations’will be used with velocities to compute positions between samples for the’positions’attribute rather than interpolating between neighboring’positions’samples. Acceleration is measured in position units per second-squared. To convert to position units per squared UsdTimeCode, divide by the square of UsdStage::GetTimeCodesPerSecond(). **Declaration** ``` vector3f[] accelerations ``` **C++ Type** `VtArray<GfVec3f>` **Usd Type** `SdfValueTypeNames->Vector3fArray` ### GetAngularVelocitiesAttr() -> Attribute ``` ### GetAngularVelocitiesAttr If authored, per-instance angular velocity vector to be used for interpolating orientations. Angular velocities should be considered mandatory if both `protoIndices` and `orientations` are animated. Angular velocity is measured in **degrees** per second. To convert to degrees per UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond(). See also Computing an Instance Transform. Declaration ``` vector3f[] angularVelocities ``` C++ Type ``` VtArray<GfVec3f> ``` Usd Type ``` SdfValueTypeNames->Vector3fArray ``` ### GetIdsAttr Ids are optional; if authored, the ids array should be the same length as the `protoIndices` array, specifying (at each timeSample if instance identities are changing) the id of each instance. The type is signed intentionally, so that clients can encode some binary state on Id’d instances without adding a separate primvar. See also Varying Instance Identity over Time Declaration ``` int64[] ids ``` C++ Type ``` VtArray<int64_t> ``` Usd Type ``` SdfValueTypeNames->Int64Array ``` ### GetInstanceCount Returns the number of instances as defined by the size of the `protoIndices` array at `timeCode`. For most code, this check will be performant. When using file formats where the cost of attribute reading is high and the time sampled array will be read into memory later, it may be better to explicitly read the value once and check the size of the array directly. Parameters ``` timeCode (TimeCode) – ``` ### GetInvisibleIdsAttr A list of id’s to make invisible at the evaluation time. See invisibleIds: Animatable Masking. Declaration ``` int64[] invisibleIds = [] ``` C++ Type ``` VtArray<int64_t> ``` Usd Type ``` SdfValueTypeNames->Int64Array ``` ### GetOrientationsAttr ``` ## Attribute ### GetOrientationsAttr If authored, per-instance orientation of each instance about its prototype’s origin, represented as a unit length quaternion, which allows us to encode it with sufficient precision in a compact GfQuath. It is client’s responsibility to ensure that authored quaternions are unit length; the convenience API below for authoring orientations from rotation matrices will ensure that quaternions are unit length, though it will not make any attempt to select the "better (for interpolation with respect to neighboring samples)" of the two possible quaternions that encode the rotation. See also Computing an Instance Transform. Declaration ``` ```plaintext quath[] orientations ``` C++ Type ```plaintext VtArray<GfQuath> ``` Usd Type ```plaintext SdfValueTypeNames->QuathArray ``` ### GetPositionsAttr **Required property**. Per-instance position. See also Computing an Instance Transform. Declaration ``` point3f[] positions ``` C++ Type ``` VtArray<GfVec3f> ``` Usd Type ``` SdfValueTypeNames->Point3fArray ``` ### GetProtoIndicesAttr **Required property**. Per-instance index into *prototypes* relationship that identifies what geometry should be drawn for each instance. **Topology attribute** - can be animated, but at a potential performance impact for streaming. Declaration ``` int[] protoIndices ``` C++ Type ``` VtArray<int> ``` Usd Type ``` SdfValueTypeNames->IntArray ``` ### GetPrototypesRel **Required property**. Orders and targets the prototype root prims, which can be located anywhere in the scenegraph that is convenient, although we promote organizing prototypes as children of the PointInstancer. The position of a prototype in this relationship defines the value an instance would specify in the *protoIndices* attribute to instance that prototype. Since relationships are uniform, this property cannot be animated. ### GetScalesAttr If authored, per-instance scale to be applied to each instance, before any rotation is applied. See also Computing an Instance Transform. Declaration ``` float3[] scales ``` C++ Type ``` VtArray<GfVec3f> ``` Usd Type ``` SdfValueTypeNames->Float3Array ``` <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> GetSchemaAttributeNames <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdGeom.PointInstancer.GetSchemaAttributeNames" title="Permalink to this definition">  <dd> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <p> Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. <p> Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> includeInherited ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.PointInstancer.GetVelocitiesAttr"> <span class="sig-name descname"> <span class="pre"> GetVelocitiesAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <a class="reference internal" href="Usd.html#pxr.Usd.Attribute" title="pxr.Usd.Attribute"> <span class="pre"> Attribute <a class="headerlink" href="#pxr.UsdGeom.PointInstancer.GetVelocitiesAttr" title="Permalink to this definition">  <dd> <p> If provided, per-instance’velocities’will be used to compute positions between samples for the’positions’attribute, rather than interpolating between neighboring’positions’samples. <p> Velocities should be considered mandatory if both <em> protoIndices and <em> positions are animated. Velocity is measured in position units per second, as per most simulation software. To convert to position units per UsdTimeCode, divide by UsdStage::GetTimeCodesPerSecond() . <p> See also Computing an Instance Transform, Applying Timesampled Velocities to Geometry. <p> Declaration <p> <code class="docutils literal notranslate"> <span class="pre"> vector3f[] <span class="pre"> velocities <p> C++ Type <p> VtArray&lt;GfVec3f&gt; <p> Usd Type <p> SdfValueTypeNames-&gt;Vector3fArray <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.PointInstancer.InvisId"> <span class="sig-name descname"> <span class="pre"> InvisId <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> id , <em class="sig-param"> <span class="n"> <span class="pre"> time <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <a class="headerlink" href="#pxr.UsdGeom.PointInstancer.InvisId" title="Permalink to this definition">  <dd> <p> Ensure that the instance identified by <code class="docutils literal notranslate"> <span class="pre"> id is invisible at <code class="docutils literal notranslate"> <span class="pre"> time . <p> This will cause <em> invisibleIds to first be broken down (keyed) at <code class="docutils literal notranslate"> <span class="pre"> time , causing all animation in weaker layers that the current UsdEditTarget to be overridden. Has no effect on any timeSamples other than the one at <code class="docutils literal notranslate"> <span class="pre"> time . <p> An invised instance is guaranteed not to render if the renderer honors masking. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> id ( <em> int ) – <li> <p> <strong> time ( <a class="reference internal" href="Sdf.html#pxr.Sdf.TimeCode" title="pxr.Sdf.TimeCode"> <em> TimeCode ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.PointInstancer.InvisIds"> <span class="sig-name descname"> <span class="pre"> InvisIds <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> ids , <em class="sig-param"> <span class="n"> <span class="pre"> time <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <a class="headerlink" href="#pxr.UsdGeom.PointInstancer.InvisIds" title="Permalink to this definition">  <dd> <p> Ensure that the instances identified by <code class="docutils literal notranslate"> <span class="pre"> ids are invisible at <code class="docutils literal notranslate"> <span class="pre"> time . <p> This will cause <em> invisibleIds to first be broken down (keyed) at <code class="docutils literal notranslate"> <span class="pre"> time . An invised instance is guaranteed not to render if the renderer honors masking. ### Parameters - **ids** (Int64Array) – - **time** (TimeCode) – ### VisAllIds Ensure that all instances are visible at `time`. Operates by authoring an empty array at `time`. This does not guarantee that the instances will be rendered, because each may still be "inactive" due to its id being present in the `inactivevIds` metadata (see ActivateId(), DeactivateId()). #### Parameters - **time** (TimeCode) – ### VisId Ensure that the instance identified by `id` is visible at `time`. This will cause `invisibleIds` to first be broken down (keyed) at `time`, causing all animation in weaker layers that the current UsdEditTarget to be overridden. Has no effect on any timeSamples other than the one at `time`. If the `invisibleIds` attribute is not authored or is blocked, this operation is a no-op. This does not guarantee that the instance will be rendered, because it may still be "inactive" due to `id` being present in the `inactivevIds` metadata (see ActivateId(), DeactivateId()). #### Parameters - **id** (int) – - **time** (TimeCode) – ### VisIds Ensure that the instances identified by `ids` are visible at `time`. This will cause **invisibleIds** to first be broken down (keyed) at `time`, causing all animation in weaker layers that the current UsdEditTarget to be overridden. Has no effect on any timeSamples other than the one at `time`. If the **invisibleIds** attribute is not authored or is blocked, this operation is a no-op. This does not guarantee that the instances will be rendered, because each may still be "inactive" due to `id` being present in the **inactivevIds** metadata (see ActivateId() , DeactivateId() ) Parameters: - **ids** (Int64Array) – - **time** (TimeCode) – class pxr.UsdGeom.Points - Points are analogous to the RiPoints spec. - Points can be an efficient means of storing and rendering particle effects comprised of thousands or millions of small particles. Points generally receive a single shading sample each, which should take **normals** into account, if present. - While not technically UsdGeomPrimvars, the widths and normals also have interpolation metadata. It’s common for authored widths and normals to have constant or varying interpolation. Methods: - `ComputeExtent` classmethod ComputeExtent(points, widths, extent) -> bool - `CreateIdsAttr` (defaultValue, writeSparsely) - See GetIdsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateWidthsAttr` (defaultValue, writeSparsely) <p> See GetWidthsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> <code> Define <p> classmethod Define(stage, path) -> Points <p> <code> Get <p> classmethod Get(stage, path) -> Points <p> <code> GetIdsAttr () <p> Ids are optional; if authored, the ids array should be the same length as the points array, specifying (at each timesample if point identities are changing) the id of each point. <p> <code> GetPointCount (timeCode) <p> Returns the number of points as defined by the size of the points array at timeCode. <p> <code> GetSchemaAttributeNames <p> classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <p> <code> GetWidthsAttr () <p> Widths are defined as the diameter of the points, in object space. <p> <code> GetWidthsInterpolation () <p> Get the interpolation for the widths attribute. <p> <code> SetWidthsInterpolation (interpolation) <p> Set the interpolation for the widths attribute. <dt class="sig sig-object py" id="pxr.UsdGeom.Points.ComputeExtent"> <em class="property"> static <span class="sig-name descname"> ComputeExtent <span class="sig-paren"> () <a class="headerlink" href="#pxr.UsdGeom.Points.ComputeExtent" title="Permalink to this definition">  <dd> <p> classmethod ComputeExtent(points, widths, extent) -> bool <p> Compute the extent for the point cloud defined by points and widths. <p> true upon success, false if widths and points are different sized arrays. On success, extent will contain the axis-aligned bounding box of the point cloud defined by points with the given widths. <p> This function is to provide easy authoring of extent for usd authoring tools, hence it is static and acts outside a specific prim (as in attribute based methods). <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> points (Vec3fArray) – <li> <p> widths (FloatArray) – <li> <p> extent (Vec3fArray) – <hr class="docutils"/> <p> ComputeExtent(points, widths, transform, extent) -> bool <p> This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the extent as if the matrix transform was first applied. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> points (Vec3fArray) – <li> <p> widths (FloatArray) – <li> <p> transform (Matrix) – <li> <p> extent (Vec3fArray) – - **points** (Vec3fArray) – - **widths** (FloatArray) – - **transform** (Matrix4d) – - **extent** (Vec3fArray) – ### CreateIdsAttr ```python CreateIdsAttr(defaultValue, writeSparsely) → Attribute ``` See GetIdsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateWidthsAttr ```python CreateWidthsAttr(defaultValue, writeSparsely) → Attribute ``` See GetWidthsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### Define ```python classmethod Define() ``` **classmethod** Define(stage, path) -> Points Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined()) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an *SdfPrimSpec* with *specifier* == *SdfSpecifierDef* and this schema’s prim type name for the prim at `path` at the current EditTarget. Author *SdfPrimSpec*s with `specifier` == *SdfSpecifierDef* and empty typeName at the current EditTarget for any nonexistent, or existing but not *Defined* ancestors. The given *path* must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case *path* cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid *UsdPrim*. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. ### Parameters - **stage** (*Stage*) – - **path** (*Path*) – ### classmethod Get(stage, path) -> Points Return a UsdGeomPoints holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdGeomPoints(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (*Stage*) – - **path** (*Path*) – ### GetIdsAttr() -> Attribute Ids are optional; if authored, the ids array should be the same length as the points array, specifying (at each timesample if point identities are changing) the id of each point. The type is signed intentionally, so that clients can encode some binary state on Id’d points without adding a separate primvar. #### Declaration ``` int64[] ids ``` #### C++ Type VtArray<int64_t> #### Usd Type SdfValueTypeNames->Int64Array ### GetPointCount(timeCode) -> int Returns the number of points as defined by the size of the *points* array at *timeCode*. For most code, this check will be performant. When using file formats where the cost of attribute reading is high and the time sampled array will be read into memory later, it may be better to explicitly read the value once and check the size of the array directly. GetPointsAttr() ### Parameters - **timeCode** (TimeCode) – ### classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ### GetWidthsAttr() -> Attribute Widths are defined as the diameter of the points, in object space. ‘widths’ is not a generic Primvar, but the number of elements in this attribute will be determined by its ‘interpolation’. See SetWidthsInterpolation(). If ‘widths’ and ‘primvars:widths’ are both specified, the latter has precedence. #### Declaration ``` float[] widths ``` #### C++ Type VtArray<float> #### Usd Type SdfValueTypeNames->FloatArray ### GetWidthsInterpolation() -> str Get the interpolation for the widths attribute. Although ‘widths’ is not classified as a generic UsdGeomPrimvar (and will not be included in the results of UsdGeomPrimvarsAPI::GetPrimvars()) it does require an interpolation specification. The fallback interpolation, if left unspecified, is UsdGeomTokens->vertex, which means a width value is specified for each point. ### SetWidthsInterpolation(interpolation) -> bool Set the interpolation for the widths attribute. true upon success, false if interpolation is not a legal value as defined by UsdPrimvar::IsValidInterpolation(), or if there was a problem setting the value. No attempt is made to validate that the widths attr’s value contains the right number of elements to match its interpolation to its prim’s topology. #### Parameters - **interpolation** (str) – (which RenderMan refers to as its class specifier and Alembic as its "geometry scope" ); it also includes the attribute’s elementSize, which states how many values in the value array must be aggregated for each element on the primitive. An attribute’s TypeName also factors into the encoding of Primvar. ## What is the Purpose of a Primvar? There are three key aspects of Primvar identity: > 1. Primvars define a value that can vary across the primitive on which they are defined, via prescribed interpolation rules > 2. Taken collectively on a prim, its Primvars describe the"per-primitive overrides" to the material to which the prim is bound. Different renderers may communicate the variables to the shaders using different mechanisms over which Usd has no control; Primvars simply provide the classification that any renderer should use to locate potential overrides. Do please note that primvars override parameters on UsdShadeShader objects, not Interface Attributes on UsdShadeMaterial prims. > 3. Primvars inherit down scene namespace. Regular USD attributes only apply to the prim on which they are specified, but primvars implicitly also apply to any child prims, unless those child prims have their own opinions about those primvars. This capability necessarily entails added cost to check for inherited values, but the benefit is that it allows concise encoding of certain opinions that broadly affect large amounts of geometry. See UsdGeomImageable::FindInheritedPrimvars(). ## Creating and Accessing Primvars The UsdGeomPrimvarsAPI schema provides a complete interface for creating and querying prims for primvars. The only way to create a new Primvar in scene description is by calling UsdGeomPrimvarsAPI::CreatePrimvar(). One cannot "enhance" or "promote" an already existing attribute into a Primvar, because doing so may require a namespace edit to rename the attribute, which cannot, in general, be done within a single UsdEditContext. Instead, create a new UsdGeomPrimvar of the desired name using UsdGeomPrimvarsAPI::CreatePrimvar(), and then copy the existing attribute onto the new UsdGeomPrimvar. Primvar names can contain arbitrary sub-namespaces. The behavior of UsdGeomImageable::GetPrimvar(TfToken const & name) is to prepend "primvars:" onto 'name' if it is not already a prefix, and return the result, which means we do not have any ambiguity between the primvars "primvars:nsA:foo" and "primvars:nsB:foo". There are reserved keywords that may not be used as the base names of primvars, and attempting to create Primvars of these names will result in a coding error. The reserved keywords are tokens the Primvar uses internally to encode various features, such as the "indices" keyword used by Indexed Primvars. If a client wishes to access an already-extant attribute as a Primvar, (which may or may not actually be valid Primvar), they can use the speculative constructor; typically, a primvar is only "interesting" if it additionally provides a value. This might look like: ``` UsdGeomPrimvar primvar = UsdGeomPrimvar(usdAttr); if (primvar.HasValue()) { VtValue values; primvar.Get(&values, timeCode); TfToken interpolation = primvar.GetInterpolation(); int elementSize = primvar.GetElementSize(); ... } ``` or, because Get() returns `true` if and only if it found a value: ``` UsdGeomPrimvar primvar = UsdGeomPrimvar(usdAttr); VtValue values; if (primvar.Get(&values, timeCode)) { TfToken interpolation = primvar.GetInterpolation(); int elementSize = primvar.GetElementSize(); ... } ``` As discussed in greater detail in Indexed Primvars, primvars can optionally contain a (possibly time-varying) indexing attribute that establishes a sharing topology for elements of the primvar. Consumers can always chose to ignore the possibility of indexed data by exclusively using the ComputeFlattened() API. If a client wishes to preserve indexing in their processing of a primvar, we suggest a pattern like the following, which accounts for the fact that a stronger layer can block a primvar’s indexing from a weaker layer, via UsdGeomPrimvar::BlockIndices(): ``` VtValue values; VtIntArray indices; if (primvar.Get(&values, timeCode)){ if (primvar.GetIndices(&indices, timeCode)){ // primvar is indexed: validate/process values and indices together } else { // primvar is not indexed: validate/process values as flat array } } ``` UsdGeomPrimvar presents a small slice of the UsdAttribute API - enough to extract the data that comprises the "Declaration info", and get/set of the attribute value. A UsdGeomPrimvar also auto-converts to UsdAttribute, so you can pass a UsdGeomPrimvar to any function that accepts a UsdAttribute or const-ref thereto. ## Primvar Allowed Scene Description Types and Plurality There are no limitations imposed on the allowable scene description types for Primvars; it is the responsibility of each consuming client to perform renderer-specific conversions, if need be (the USD distribution will include reference RenderMan conversion utilities). A note about type plurality of Primvars: It is legitimate for a Primvar to be of scalar or array type, and again, consuming clients must be prepared to accommodate both. However, while it is not possible, in all cases, for USD to prevent one from changing the type of an attribute in different layers or variants of an asset, it is never a good idea to do so. This is relevant because, except in a few special cases, it is not possible to encode an interpolation of any value greater than constant without providing multiple (i.e. array) data values. Therefore, if there is any possibility that downstream clients might need to change a Primvar’s interpolation, the Primvar-creator should encode it as an array rather than a scalar. Why allow scalar values at all, then? First, sometimes it brings clarity to (use of) a shader’s API to acknowledge that some parameters are meant to be single-valued over a shaded primitive. Second, many DCC’s provide far richer affordances for editing scalars than they do array values, and we feel it is safer to let the content creator make the decision/tradeoff of which kind of flexibility is more relevant, rather than leaving it to an importer/exporter pair to interpret. Also, like all attributes, Primvars can be time-sampled, and values can be authored and consumed just as any other attribute. There is currently no validation that the length of value arrays matches to the size required by a gprim’s topology, interpolation, and elementSize. For consumer convenience, we provide GetDeclarationInfo(), which returns all the type information (other than topology) needed to compute the required array size, which is also all the information required to prepare the Primvar’s value for consumption by a renderer. ## Lifetime Management and Primvar Validity UsdGeomPrimvar has an explicit bool operator that validates that the attribute IsDefined() and thus valid for querying and authoring values and metadata. This is a fairly expensive query that we do **not** cache, so if client code retains UsdGeomPrimvar objects, it should manage its object validity closely, for performance. An ideal pattern is to listen for UsdNotice::StageContentsChanged notifications, and revalidate/refetch its retained UsdGeomPrimvar s only then, and otherwise use them without validity checking. ## Interpolation of Geometric Primitive Variables In the following explanation of the meaning of the various kinds/levels of Primvar interpolation, each bolded bullet gives the name of the token in UsdGeomTokens that provides the value. So to set a Primvar’s interpolation to"varying", one would: ```python primvar.SetInterpolation(UsdGeomTokens->varying); ``` Reprinted and adapted from the RPS documentation, which contains further details, *interpolation* describes how the Primvar will be interpolated over the uv parameter space of a surface primitive (or curve or pointcloud). The possible values are: - **constant** One value remains constant over the entire surface primitive. - **uniform** One value remains constant for each uv patch segment of the surface primitive (which is a *face* for meshes). - **varying** Four values are interpolated over each uv patch segment of the surface. Bilinear interpolation is used for interpolation between the four values. - **vertex** Values are interpolated between each vertex in the surface primitive. The basis function of the surface is used for interpolation between vertices. - **faceVarying** For polygons and subdivision surfaces, four values are interpolated over each face of the mesh. Bilinear interpolation is used for interpolation between the four values. ## UsdGeomPrimvar As Example of Attribute Schema Just as UsdSchemaBase and its subclasses provide the pattern for how to layer schema onto the generic UsdPrim object, UsdGeomPrimvar provides an example of how to layer schema onto a generic UsdAttribute object. In both cases, the schema object wraps and contains the UsdObject. ## Primvar Namespace Inheritance Constant interpolation primvar values can be inherited down namespace. That is, a primvar value set on a prim will also apply to any child prims, unless those children have their own opinions about those named primvars. For complete details on how primvars inherit, see usdGeom_PrimvarInheritance. UsdGeomImageable::FindInheritablePrimvars(). **Methods:** - BlockIndices() Block the indices that were previously set. - ComputeFlattened(value, time) -> bool - CreateIndicesAttr() Returns the existing indices attribute if the primvar is indexed or creates a new one. - Get(value, time) Get the attribute value of the Primvar at time. - GetAttr() Explicit UsdAttribute extractor. - GetBaseName() UsdAttribute::GetBaseName() - GetDeclarationInfo() - **GetDeclarationInfo** (name, typeName, ...) - Convenience function for fetching all information required to properly declare this Primvar. - **GetElementSize** () - Return the "element size" for this Primvar, which is 1 if unauthored. - **GetIndices** (indices, time) - Returns the value of the indices array associated with the indexed primvar at `time`. - **GetIndicesAttr** () - Returns a valid indices attribute if the primvar is indexed. - **GetInterpolation** () - Return the Primvar's interpolation, which is UsdGeomTokens->constant if unauthored. - **GetName** () - UsdAttribute::GetName() - **GetNamespace** () - UsdAttribute::GetNamespace() - **GetPrimvarName** () - Returns the primvar's name, devoid of the "primvars:" namespace. - **GetTimeSamples** (times) - Populates a vector with authored sample times for this primvar. - **GetTimeSamplesInInterval** (interval, times) - Populates a vector with authored sample times in `interval`. - **GetTypeName** () - UsdAttribute::GetTypeName() - **GetUnauthoredValuesIndex** () - Returns the index that represents unauthored values in the indices array. - **HasAuthoredElementSize** () - Has elementSize been explicitly authored on this Primvar? - **HasAuthoredInterpolation** () - Has interpolation been explicitly authored on this Primvar? - **HasAuthoredValue** () - (Note: The description for this function is missing in the provided HTML.) | Method | Description | | ------ | ----------- | | `HasAuthoredValue()` | Return true if the underlying attribute has an unblocked, authored value. | | `HasValue()` | Return true if the underlying attribute has a value, either from authored scene description or a fallback. | | `IsDefined()` | Return true if the underlying UsdAttribute::IsDefined() , and in addition the attribute is identified as a Primvar. | | `IsIdTarget()` | Returns true if the primvar is an Id primvar. | | `IsIndexed()` | Returns true if the primvar is indexed, i.e., if it has an associated "indices" attribute. | | `IsPrimvar(attr) -> bool` | classmethod | | `IsValidInterpolation(interpolation) -> bool` | classmethod | | `IsValidPrimvarName(name) -> bool` | classmethod | | `NameContainsNamespaces()` | Does this primvar contain any namespaces other than the "primvars:" namespace? | | `Set(value, time)` | Set the attribute value of the Primvar at time. | | `SetElementSize(eltSize)` | Set the elementSize for this Primvar. | | `SetIdTarget(path)` | This primvar must be of String or StringArray type for this method to succeed. | | `SetIndices(indices, time)` | Sets the indices value of the indexed primvar at time. | | `SetInterpolation(interpolation)` | Set the Primvar's interpolation. | | 方法 | 描述 | | --- | --- | | `SetUnauthoredValuesIndex` (unauthoredValuesIndex) | Set the index that represents unauthored values in the indices array. | | `SplitName` () | UsdAttribute::SplitName() | | `StripPrimvarsName` (name) -> str | classmethod StripPrimvarsName(name) -> str | | `ValueMightBeTimeVarying` () | Return true if it is possible, but not certain, that this primvar's value changes over time, false otherwise. | ### BlockIndices Block the indices that were previously set. This effectively makes an indexed primvar no longer indexed. This is useful when overriding an existing primvar. ### ComputeFlattened **classmethod** ComputeFlattened(value, time) -> bool Computes the flattened value of the primvar at `time`. If the primvar is not indexed or if the value type of this primvar is a scalar, this returns the authored value, which is the same as Get(). Hence, it’s safe to call ComputeFlattened() on non-indexed primvars. **Parameters** - **value** (VtArray[ScalarType]) – - **time** (TimeCode) – ComputeFlattened(value, time) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the flattened value of the primvar at `time` as a VtValue. **Parameters** - **value** (VtValue) – - **time** (TimeCode) – ComputeFlattened(value, attrVal, indices, errString) -> bool Computes the flattened value of `attrValue` given `indices`. This method is a static convenience function that performs the main work of ComputeFlattened above without needing an instance of a UsdGeomPrimvar. Returns `false` if the value contained in `attrVal` is not a supported type for flattening. Otherwise returns `true`. The output `errString` variable may be populated with an error string if an error occurs. error is encountered during flattening. ### Parameters - **value** (`VtValue`) – - **attrVal** (`VtValue`) – - **indices** (`IntArray`) – - **errString** (`str`) – ### CreateIndicesAttr ```python CreateIndicesAttr() -> Attribute ``` Returns the existing indices attribute if the primvar is indexed or creates a new one. ### Get ```python Get(value, time) -> bool ``` Get the attribute value of the Primvar at `time`. #### Parameters - **value** (`T`) – - **time** (`TimeCode`) – Get(value, time) -> bool #### Parameters - **value** (`str`) – - **time** (`TimeCode`) – Get(value, time) -> bool #### Parameters - **value** (`StringArray`) – - **time** (`TimeCode`) – Get(value, time) -> bool #### Parameters - **value** (`VtValue`) – - **time** (`TimeCode`) – ``` ### GetAttr ```python GetAttr() -> Attribute ``` <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Primvar.GetBaseName"> <span class="sig-name descname"> <span class="pre"> GetBaseName <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> str <dd> <p> UsdAttribute::GetBaseName() <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Primvar.GetDeclarationInfo"> <span class="sig-name descname"> <span class="pre"> GetDeclarationInfo <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> name , <em class="sig-param"> <span class="n"> <span class="pre"> typeName , <em class="sig-param"> <span class="n"> <span class="pre"> interpolation , <em class="sig-param"> <span class="n"> <span class="pre"> elementSize <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> None <dd> <p> Convenience function for fetching all information required to properly declare this Primvar. <p> The <code class="docutils literal notranslate"> <span class="pre"> name returned is the”client name”, stripped of the”primvars”namespace, i.e. equivalent to GetPrimvarName() <p> May also be more efficient than querying key individually. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> name ( <em> str ) – <li> <p> <strong> typeName ( <em> ValueTypeName ) – <li> <p> <strong> interpolation ( <em> str ) – <li> <p> <strong> elementSize ( <em> int ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Primvar.GetElementSize"> <span class="sig-name descname"> <span class="pre"> GetElementSize <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> int <dd> <p> Return the”element size”for this Primvar, which is 1 if unauthored. <p> If this Primvar’s type is <em> not an array type, (e.g.”Vec3f[]”), then elementSize is irrelevant. <p> ElementSize does <em> not generally encode the length of an array-type primvar, and rarely needs to be authored. ElementSize can be thought of as a way to create an”aggregate interpolatable type”, by dictating how many consecutive elements in the value array should be taken as an atomic element to be interpolated over a gprim. <p> For example, spherical harmonics are often represented as a collection of nine floating-point coefficients, and the coefficients need to be sampled across a gprim’s surface: a perfect case for primvars. However, USD has no <code class="docutils literal notranslate"> <span class="pre"> float9 datatype. But we can communicate the aggregation of nine floats successfully to renderers by declaring a simple float-array valued primvar, and setting its <em> elementSize to 9. To author a <em> uniform spherical harmonic primvar on a Mesh of 42 faces, the primvar’s array value would contain 9*42 = 378 float elements. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Primvar.GetIndices"> <span class="sig-name descname"> <span class="pre"> GetIndices <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> indices , <em class="sig-param"> <span class="n"> <span class="pre"> time <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Returns the value of the indices array associated with the indexed primvar at <code class="docutils literal notranslate"> <span class="pre"> time . <p> SetIndices() , Proper Client Handling of”Indexed”Primvars <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> - **indices** (**IntArray**) – - **time** (**TimeCode**) – ### GetIndicesAttr ```python GetIndicesAttr() → Attribute ``` Returns a valid indices attribute if the primvar is indexed. Returns an invalid attribute otherwise. ### GetInterpolation ```python GetInterpolation() → str ``` Return the Primvar’s interpolation, which is UsdGeomTokens->constant if unauthored. Interpolation determines how the Primvar interpolates over a geometric primitive. See Interpolation of Geometric Primitive Variables ### GetName ```python GetName() → str ``` UsdAttribute::GetName() ### GetNamespace ```python GetNamespace() → str ``` UsdAttribute::GetNamespace() ### GetPrimvarName ```python GetPrimvarName() → str ``` Returns the primvar’s name, devoid of the”primvars:”namespace. This is the name by which clients should refer to the primvar, if not by its full attribute name - i.e. they should **not**, in general, use GetBaseName(). In the error condition in which this Primvar object is not backed by a properly namespaced UsdAttribute, return an empty TfToken. ### GetTimeSamples ```python GetTimeSamples(times) → bool ``` Populates a vector with authored sample times for this primvar. Returns false on error. This considers any timeSamples authored on the associated”indices”attribute if the primvar is indexed. UsdAttribute::GetTimeSamples **Parameters** - **times** (list [float]) – ### GetTimeSamplesInInterval ```python GetTimeSamplesInInterval(interval, times) ``` ### pxr.UsdGeom.Primvar.GetTimeSamplesInInterval - **Description**: Populates a vector with authored sample times in `interval`. This considers any timeSamples authored on the associated "indices" attribute if the primvar is indexed. - **Function**: UsdAttribute::GetTimeSamplesInInterval - **Parameters**: - **interval** (Interval) – - **times** (list [float]) – ### pxr.UsdGeom.Primvar.GetTypeName - **Description**: UsdAttribute::GetTypeName() ### pxr.UsdGeom.Primvar.GetUnauthoredValuesIndex - **Description**: Returns the index that represents unauthored values in the indices array. - **Function**: SetUnauthoredValuesIndex() ### pxr.UsdGeom.Primvar.HasAuthoredElementSize - **Description**: Has elementSize been explicitly authored on this Primvar? - **Function**: GetElementSize() ### pxr.UsdGeom.Primvar.HasAuthoredInterpolation - **Description**: Has interpolation been explicitly authored on this Primvar? - **Function**: GetInterpolationSize() ### pxr.UsdGeom.Primvar.HasAuthoredValue - **Description**: Return true if the underlying attribute has an unblocked, authored value. ### pxr.UsdGeom.Primvar.HasValue - **Description**: Return true if the underlying attribute has a value, either from authored scene description or a fallback. ### pxr.UsdGeom.Primvar.IsDefined - **Description**: Return true if the underlying attribute has a value, either from authored scene description or a fallback. ### pxr.UsdGeom.Primvar.IsDefined Return true if the underlying UsdAttribute::IsDefined(), and in addition the attribute is identified as a Primvar. Does not imply that the primvar provides a value ### pxr.UsdGeom.Primvar.IsIdTarget Returns true if the primvar is an Id primvar. UsdGeomPrimvar_Id_primvars ### pxr.UsdGeom.Primvar.IsIndexed Returns true if the primvar is indexed, i.e., if it has an associated "indices" attribute. If you are going to query the indices anyways, prefer to simply consult the return-value of GetIndices(), which will be more efficient. ### pxr.UsdGeom.Primvar.IsPrimvar **classmethod** IsPrimvar(attr) -> bool Test whether a given UsdAttribute represents valid Primvar, which implies that creating a UsdGeomPrimvar from the attribute will succeed. Success implies that `attr.IsDefined()` is true. **Parameters** - **attr** (Attribute) – ### pxr.UsdGeom.Primvar.IsValidInterpolation **classmethod** IsValidInterpolation(interpolation) -> bool Validate that the provided `interpolation` is a valid setting for interpolation as defined by Interpolation of Geometric Primitive Variables. **Parameters** - **interpolation** (str) – ### pxr.UsdGeom.Primvar.IsValidPrimvarName **classmethod** IsValidPrimvarName(name) -> bool Test whether a given `name` represents a valid name of a primvar, which implies that creating a UsdGeomPrimvar with the given name will succeed. **Parameters** - **name** (str) – ### pxr.UsdGeom.Primvar.NameContainsNamespaces Returns true if this primvar contains any namespaces other than the "primvars:" namespace. Some clients may only wish to consume primvars that have no extra namespaces in their names, for ease of translating to other systems that do not allow namespaces. ### Set Set ( value , time ) → bool Set the attribute value of the Primvar at time . Parameters - value (T) – - time (TimeCode) – ### SetElementSize SetElementSize ( eltSize ) → bool Set the elementSize for this Primvar. Errors and returns false if eltSize less than 1. GetElementSize() Parameters - eltSize (int) – ### SetIdTarget SetIdTarget ( path ) → bool This primvar must be of String or StringArray type for this method to succeed. If not, a coding error is raised. UsdGeomPrimvar_Id_primvars Parameters - path (Path) – ### SetIndices SetIndices ( indices , time ) → bool Sets the indices value of the indexed primvar at time. The values in the indices array must be valid indices into the authored array returned by Get(). The element numerality of the primvar’s’interpolation’metadata applies to the”indices”array, not the attribute value array (returned by Get()). Parameters - indices (IntArray) – - time (TimeCode) – ### SetInterpolation SetInterpolation ( interpolation ) → bool Set the interpolation type for this Primvar. Parameters - interpolation (Interpolation) – ### SetInterpolation ```python SetInterpolation(interpolation) -> bool ``` Set the Primvar’s interpolation. Errors and returns false if `interpolation` is out of range as defined by IsValidInterpolation() . No attempt is made to validate that the Primvar’s value contains the right number of elements to match its interpolation to its topology. - **Parameters** - **interpolation** (`str`) – ### SetUnauthoredValuesIndex ```python SetUnauthoredValuesIndex(unauthoredValuesIndex) -> bool ``` Set the index that represents unauthored values in the indices array. Some apps (like Maya) allow you to author primvars sparsely over a surface. Since most apps can’t handle sparse primvars, Maya needs to provide a value even for the elements it didn’t author. This metadatum provides a way to recover the information in apps that do support sparse authoring / representation of primvars. The fallback value of unauthoredValuesIndex is -1, which indicates that there are no unauthored values. - **Parameters** - **unauthoredValuesIndex** (`int`) – ### SplitName ```python SplitName() -> list[str] ``` UsdAttribute::SplitName() ### StripPrimvarsName ```python classmethod StripPrimvarsName(name) -> str ``` Returns the `name`, devoid of the "primvars:" token if present, otherwise returns the `name` unchanged. - **Parameters** - **name** (`str`) – ### ValueMightBeTimeVarying ```python ValueMightBeTimeVarying() -> bool ``` Return true if it is possible, but not certain, that this primvar’s value changes over time, false otherwise. This considers time-varyingness of the associated "indices" attribute if the primvar is indexed. ### PrimvarsAPI class pxr.UsdGeom.PrimvarsAPI UsdGeomPrimvarsAPI encodes geometric "primitive variables", as UsdGeomPrimvar, which interpolate across a primitive’s topology, can override shader inputs, and inherit down namespace. ## Which Method to Use to Retrieve Primvars While creating primvars is unambiguous (CreatePrimvar()), there are quite a few methods available for retrieving primvars, making it potentially confusing knowing which one to use. Here are some guidelines: > - **If you are populating a GUI with the primvars already available for authoring values on a prim, use GetPrimvars().** > - **If you want all of the "useful" (e.g. to a renderer) primvars available at a prim, including those inherited from ancestor prims, use FindPrimvarsWithInheritance(). Note that doing so individually for many prims will be inefficient.** > - **To find a particular primvar defined directly on a prim, which may or may not provide a value, use GetPrimvar().** > - **To find a particular primvar defined on a prim or inherited from ancestors, which may or may not provide a value, use FindPrimvarWithInheritance().** > - **To efficiently query for primvars using the overloads of FindPrimvarWithInheritance() and FindPrimvarsWithInheritance(), one must first cache the results of FindIncrementallyInheritablePrimvars() for each non-leaf prim on the stage.** **Methods:** | Method | Description | |--------|-------------| | `BlockPrimvar(name)` | Remove all time samples on the primvar and its associated indices attr, and author a block default value. | | `CanContainPropertyName(name) -> bool` | **classmethod** CanContainPropertyName(name) -> bool | | `CreateIndexedPrimvar(name, typeName, value, ...)` | Author scene description to create an attribute and authoring a value on this prim that will be recognized as an indexed Primvar with indices appropriately set (i.e. | | `CreateNonIndexedPrimvar(name, typeName, ...)` | Author scene description to create an attribute and authoring a value on this prim that will be recognized as a Primvar (i.e. | | `CreatePrimvar(name, typeName, interpolation, ...)` | Author scene description to create an attribute on this prim that will be recognized as Primvar (i.e. | | `FindIncrementallyInheritablePrimvars(...)` | Compute the primvars that can be inherited from this prim by its child prims, starting from the set of primvars inherited from this prim's ancestors. | | `FindInheritablePrimvars()` | Compute the primvars that can be inherited from this prim by its child prims, including the primvars that this prim inherits from ancestor prims. | | `FindPrimvarWithInheritance(name)` | Like GetPrimvar(), but if the named primvar does not exist or has no authored value on this prim, search for the named, value-producing primvar on ancestor prims. | | `FindPrimvarsWithInheritance(...)` | (Description not provided in the HTML) | FindPrimvarsWithInheritance ``` Find all of the value-producing primvars either defined on this prim, or inherited from ancestor prims. ```markdown Get ``` **classmethod** Get(stage, path) -> PrimvarsAPI ```markdown GetAuthoredPrimvars ``` Like GetPrimvars() , but include only primvars that have some authored scene description (though not necessarily a value). ```markdown GetPrimvar ``` Return the Primvar object named by `name` , which will be valid if a Primvar attribute definition already exists. ```markdown GetPrimvars ``` Return valid UsdGeomPrimvar objects for all defined Primvars on this prim, similarly to UsdPrim::GetAttributes() . ```markdown GetPrimvarsWithAuthoredValues ``` Like GetPrimvars() , but include only primvars that have an **authored** value. ```markdown GetPrimvarsWithValues ``` Like GetPrimvars() , but include only primvars that have some value, whether it comes from authored scene description or a schema fallback. ```markdown GetSchemaAttributeNames ``` **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] ```markdown HasPossiblyInheritedPrimvar ``` Is there a Primvar named `name` with an authored value on this prim or any of its ancestors? ```markdown HasPrimvar ``` Is there a defined Primvar `name` on this prim? ```markdown RemovePrimvar ``` Author scene description to delete an attribute on this prim that was recognized as Primvar (i.e. ```markdown BlockPrimvar ``` Remove all time samples on the primvar and its associated indices attr, and author a **block** `None` value. This will cause authored opinions in weaker layers to be ignored. UsdAttribute::Block() , UsdGeomPrimvar::BlockIndices Parameters ---------- name (str) – Parameters ---------- name (str) – classmethod CanContainPropertyName(name) -> bool Test whether a given `name` contains the "primvars:" prefix. Parameters ---------- name (str) – CreateIndexedPrimvar(name, typeName, value, indices, interpolation, elementSize, time) → Primvar Author scene description to create an attribute and authoring a `value` on this prim that will be recognized as an indexed Primvar with `indices` appropriately set (i.e. will present as a valid UsdGeomPrimvar). will present as a valid UsdGeomPrimvar). an invalid UsdGeomPrimvar on error, a valid UsdGeomPrimvar otherwise. It is fine to call this method multiple times, and in different UsdEditTargets, even if there is an existing primvar of the same name, indexed or not. CreatePrimvar() , CreateNonIndexedPrimvar() , UsdPrim::CreateAttribute() , UsdGeomPrimvar::IsPrimvar() Parameters ---------- name (str) – typeName (ValueTypeName) – value (T) – indices (IntArray) – interpolation (str) – elementSize (int) – time (TimeCode) – CreateNonIndexedPrimvar(name, typeName, value) ### CreateNonIndexedPrimvar **Parameters** - **name** (str) – - **typeName** (ValueTypeName) – - **value** (T) – - **interpolation** (str) – - **elementSize** (int) – - **time** (TimeCode) – **Description** Author scene description to create an attribute and authoring a `value` on this prim that will be recognized as a Primvar (i.e. will present as a valid UsdGeomPrimvar). Note that unlike CreatePrimvar using this API explicitly authors a block for the indices attr associated with the primvar, thereby blocking any indices set in any weaker layers. An invalid UsdGeomPrimvar on error, a valid UsdGeomPrimvar otherwise. It is fine to call this method multiple times, and in different UsdEditTargets, even if there is an existing primvar of the same name, indexed or not. Related methods: CreatePrimvar(), CreateIndexedPrimvar(), UsdPrim::CreateAttribute(), UsdGeomPrimvar::IsPrimvar() ### CreatePrimvar **Parameters** - **name** (str) – - **typeName** (str) – - **interpolation** (str) – - **elementSize** (int) – **Description** Author scene description to create an attribute on this prim that will be recognized as Primvar (i.e. will present as a valid UsdGeomPrimvar). The name of the created attribute may or may not be the specified `name`, due to the possible need to apply property namespacing for primvars. See Creating and Accessing Primvars for more information. Creation may fail and return an invalid Primvar if `name` contains a reserved keyword, such as the “indices” suffix we use for indexed primvars. The behavior with respect to the provided `typeName` is the same as for UsdAttributes::Create(), and `interpolation` and `elementSize` are as described in UsdGeomPrimvar::GetInterpolation() and UsdGeomPrimvar::GetElementSize(). If `interpolation` and/or `elementSize` are left unspecified, we will author no opinions for them, which means any (strongest) opinion already authored in any contributing layer for these fields will become the Primvar’s values, or the fallbacks if no opinions have been authored. An invalid UsdGeomPrimvar if we failed to create a valid attribute, a valid UsdGeomPrimvar otherwise. It is not an error to create over an existing, compatible attribute. Related methods: UsdPrim::CreateAttribute(), UsdGeomPrimvar::IsPrimvar() - **ValueTypeName** – - **interpolation** (str) – - **elementSize** (int) – ### FindIncrementallyInheritablePrimvars(inheritedFromAncestors) - Compute the primvars that can be inherited from this prim by its child prims, starting from the set of primvars inherited from this prim’s ancestors. - If this method returns an empty vector, then this prim’s children should inherit the same set of primvars available to this prim, i.e. the input `inheritedFromAncestors`. - As opposed to FindInheritablePrimvars(), which always recurses up through all of the prim’s ancestors, this method allows more efficient computation of inheritable primvars by starting with the list of primvars inherited from this prim’s ancestors, and returning a newly allocated vector only when this prim makes a change to the set of inherited primvars. This enables O(n) inherited primvar computation for all prims on a Stage, with potential to share computed results that are identical (i.e. when this method returns an empty vector, its parent’s result can (and must!) be reused for all of the prim’s children. - Which Method to Use to Retrieve Primvars - **Parameters** - **inheritedFromAncestors** (list [Primvar]) – ### FindInheritablePrimvars() - Compute the primvars that can be inherited from this prim by its child prims, including the primvars that this prim inherits from ancestor prims. - Inherited primvars will be bound to attributes on the corresponding ancestor prims. - Only primvars with authored, non-blocked, constant interpolation values are inheritable; fallback values are not inherited. The order of the returned primvars is undefined. - It is not generally useful to call this method on UsdGeomGprim leaf prims, and furthermore likely to be expensive since most primvars are defined on Gprims. - Which Method to Use to Retrieve Primvars ### FindPrimvarWithInheritance(name) - Like GetPrimvar(), but if the named primvar does not exist or has no authored value on this prim, search for the named, value-producing primvar on ancestor prims. - The returned primvar will be bound to the attribute on the corresponding ancestor prim on which it was found (if any). If neither this prim nor any ancestor contains a value-producing primvar, then the returned primvar will be the same as that returned by GetPrimvar(). - This is probably the method you want to call when needing to consume a primvar of a particular name. - Which Method to Use to Retrieve Primvars - **Parameters** - **name** (str) – <em>str --- FindPrimvarWithInheritance(name, inheritedFromAncestors) -> Primvar This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This version of FindPrimvarWithInheritance() takes the pre-computed set of primvars inherited from this prim’s ancestors, as computed by FindInheritablePrimvars() or FindIncrementallyInheritablePrimvars() on the prim’s parent. Which Method to Use to Retrieve Primvars Parameters: - **name** (str) – - **inheritedFromAncestors** (list[Primvar]) – --- FindPrimvarsWithInheritance(inheritedFromAncestors) -> list[Primvar] This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This version of FindPrimvarsWithInheritance() takes the pre-computed set of primvars inherited from this prim’s ancestors, as computed by FindInheritablePrimvars() or FindIncrementallyInheritablePrimvars() on the prim’s parent. Which Method to Use to Retrieve Primvars Parameters: - **inheritedFromAncestors** (list[Primvar]) – --- classmethod Get(stage, path) -> PrimvarsAPI Return a UsdGeomPrimvarsAPI holding the prim adhering to this schema at path on stage. If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdGeomPrimvarsAPI(stage->GetPrimAtPath(path)); ``` Parameters: - **stage** (Stage) – - **path** (Path) – --- GetAuthoredPrimvars() -> list[Primvar] ### GetAuthoredPrimvars Like GetPrimvars(), but include only primvars that have some authored scene description (though not necessarily a value). Which Method to Use to Retrieve Primvars ### GetPrimvar Return the Primvar object named by `name`, which will be valid if a Primvar attribute definition already exists. Name lookup will account for Primvar namespacing, which means that this method will succeed in some cases where ```python UsdGeomPrimvar(prim->GetAttribute(name)) ``` will not, unless `name` is properly namespace prefixed. Just because a Primvar is valid and defined, and even if its underlying UsdAttribute (GetAttr()) answers HasValue() affirmatively, one must still check the return value of Get(), due to the potential of time-varying value blocks (see Attribute Value Blocking). HasPrimvar(), Which Method to Use to Retrieve Primvars Parameters - **name** (str) – ### GetPrimvars Return valid UsdGeomPrimvar objects for all defined Primvars on this prim, similarly to UsdPrim::GetAttributes(). The returned primvars may not possess any values, and therefore not be useful to some clients. For the primvars useful for inheritance computations, see GetPrimvarsWithAuthoredValues(), and for primvars useful for direct consumption, see GetPrimvarsWithValues(). Which Method to Use to Retrieve Primvars ### GetPrimvarsWithAuthoredValues Like GetPrimvars(), but include only primvars that have an **authored** value. This is the query used when computing inheritable primvars, and is generally more useful than GetAuthoredPrimvars(). Which Method to Use to Retrieve Primvars ### GetPrimvarsWithValues Like GetPrimvars(), but include only primvars that have some value, whether it comes from authored scene description or a schema fallback. For most purposes, this method is more useful than GetPrimvars(). Which Method to Use to Retrieve Primvars ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – ### HasPossiblyInheritedPrimvar HasPossiblyInheritedPrimvar(name) -> bool Is there a Primvar named `name` with an authored value on this prim or any of its ancestors? This is probably the method you want to call when wanting to know whether or not the prim "has" a primvar of a particular name. **Parameters** - **name** (str) – ### HasPrimvar HasPrimvar(name) -> bool Is there a defined Primvar `name` on this prim? Name lookup will account for Primvar namespacing. Like GetPrimvar(), a return value of `true` for HasPrimvar() does not guarantee the primvar will produce a value. **Parameters** - **name** (str) – ### RemovePrimvar RemovePrimvar(name) -> bool Author scene description to delete an attribute on this prim that was recognized as Primvar (i.e. will present as a valid UsdGeomPrimvar), in the current UsdEditTarget. Because this method can only remove opinions about the primvar from the current EditTarget, you may generally find it more useful to use BlockPrimvar() which will ensure that all values from the EditTarget and weaker layers for the primvar and its indices will be ignored. Removal may fail and return false if `name` contains a reserved keyword, such as the "indices" suffix we use for indexed primvars. Note this will also remove the indices attribute associated with an indiced primvar. true if UsdGeomPrimvar and indices attribute was successfully removed, false otherwise. **Parameters** - **name** (str) – | Define | classmethod Define(stage, path) -> Scope | |--------|-------------------------------------------| | Get | classmethod Get(stage, path) -> Scope | | GetSchemaAttributeNames | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | ### Define **classmethod** Define(stage, path) -> Scope Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ### Get **classmethod** Get(stage, path) -> Scope Return a UsdGeomScope holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```text UsdGeomScope(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ## pxr.UsdGeom.Scope.GetSchemaAttributeNames ### Description ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ## pxr.UsdGeom.Sphere ### Description Defines a primitive sphere centered at the origin. The fallback values for Cube, Sphere, Cone, and Cylinder are set so that they all pack into the same volume/bounds. ### Methods: | Method | Description | |--------|-------------| | `CreateExtentAttr(defaultValue, writeSparsely)` | See GetExtentAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateRadiusAttr(defaultValue, writeSparsely)` | See GetRadiusAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `Define(stage, path)` | `classmethod Define(stage, path) -> Sphere` | | `Get(stage, path)` | `classmethod Get(stage, path) -> Sphere` | | `GetExtentAttr()` | Extent is re-defined on Sphere only to provide a fallback value. | | `GetRadiusAttr()` | Indicates the sphere's radius. | | `GetSchemaAttributeNames(includeInherited)` | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | ### Detailed Method Descriptions #### CreateExtentAttr(defaultValue, writeSparsely) See GetExtentAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is ``` ```code true ``` - the default for ```code writeSparsely ``` is ```code false ``` . ``` Parameters ``` - ``` defaultValue ``` (``` VtValue ```) – - ``` writeSparsely ``` (``` bool ```) – ``` CreateRadiusAttr ```(``` defaultValue ```, ``` writeSparsely ```) ``` Attribute ``` See GetRadiusAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ``` defaultValue ``` as the attribute’s default, sparsely (when it makes sense to do so) if ``` writeSparsely ``` is ``` true ``` - the default for ``` writeSparsely ``` is ``` false ```. ``` Parameters ``` - ``` defaultValue ``` (``` VtValue ```) – - ``` writeSparsely ``` (``` bool ```) – ``` static ``` ``` Define ```() ``` classmethod ``` Define(stage, path) -> Sphere Attempt to ensure a ``` UsdPrim ``` adhering to this schema at ``` path ``` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at ``` path ``` is already defined on this stage, return that prim. Otherwise author an ``` SdfPrimSpec ``` with ``` specifier ``` == ``` SdfSpecifierDef ``` and this schema’s prim type name for the prim at ``` path ``` at the current EditTarget. Author ``` SdfPrimSpec ```s with ``` specifier ``` == ``` SdfSpecifierDef ``` and empty typeName at the current EditTarget for any nonexistent, or existing but not ``` Defined ``` ancestors. The given ``` path ``` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case ``` path ``` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid ``` UsdPrim ```. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. ``` Parameters ``` - ``` stage ``` (``` Stage ```) – - ``` path ``` (``` Path ```) – ### Get(stage, path) -> Sphere Return a UsdGeomSphere holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```text UsdGeomSphere(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### GetExtentAttr() -> Attribute Extent is re-defined on Sphere only to provide a fallback value. UsdGeomGprim::GetExtentAttr(). #### Declaration ```text float3[] extent = [(-1, -1, -1), (1, 1, 1)] ``` #### C++ Type VtArray<GfVec3f> #### Usd Type SdfValueTypeNames->Float3Array ### GetRadiusAttr() -> Attribute Indicates the sphere’s radius. If you author `radius` you must also author `extent`. #### Declaration ```text double radius = 1 ``` #### C++ Type double #### Usd Type SdfValueTypeNames->Double ### GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (`bool`) – ### pxr.UsdGeom.Subset Encodes a subset of a piece of geometry (i.e. a UsdGeomImageable) as a set of indices. Currently only supports encoding of face-subsets, but could be extended in the future to support subsets representing edges, segments, points etc. To apply to a geometric prim, a GeomSubset prim must be the prim’s direct child in namespace, and possess a concrete defining specifier (i.e. def). This restriction makes it easy and efficient to discover subsets of a prim. We might want to relax this restriction if it’s common to have multiple **families** of subsets on a gprim and if it’s useful to be able to organize subsets belonging to a family under a common scope. See 'familyName' attribute for more info on defining a family of subsets. Note that a GeomSubset isn’t an imageable (i.e. doesn’t derive from UsdGeomImageable). So, you can’t author **visibility** for it or override its **purpose**. Materials are bound to GeomSubsets just as they are for regular geometry using API available in UsdShade (UsdShadeMaterial::Bind). For any described attribute *Fallback* *Value* or *Allowed* *Values* below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded as the value. **Methods:** | Method Name | Description | |-------------|-------------| | CreateElementTypeAttr(defaultValue, ...) | See GetElementTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateFamilyNameAttr(defaultValue, writeSparsely) | See GetFamilyNameAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateGeomSubset(geom, subsetName, elementType, indices, familyName, familyType) -> Subset | classmethod | | CreateIndicesAttr(defaultValue, writeSparsely) | See GetIndicesAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateUniqueGeomSubset(geom, subsetName, elementType, indices, familyName, familyType) -> Subset | classmethod | | Define(stage, path) -> Subset | classmethod | | Get(stage, path) -> Subset | classmethod | | GetAllGeomSubsetFamilyNames(geom) -> str.Set | classmethod | | GetAllGeomSubsets(geom) -> list[Subset] | classmethod | | GetElementTypeAttr() | The type of element that the indices target. | | GetFamilyNameAttr() | The name of the family of subsets that this subset belongs to. | | GetFamilyType() | | | Method | Description | | ------ | ----------- | | `GetFamilyType` | `classmethod GetFamilyType(geom, familyName) -> str` | | `GetGeomSubsets` | `classmethod GetGeomSubsets(geom, elementType, familyName) -> list[Subset]` | | `GetIndicesAttr` | The set of indices included in this subset. | | `GetSchemaAttributeNames` | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | | `GetUnassignedIndices` | `classmethod GetUnassignedIndices(subsets, elementCount, time) -> IntArray` | | `SetFamilyType` | `classmethod SetFamilyType(geom, familyName, familyType) -> bool` | | `ValidateFamily` | `classmethod ValidateFamily(geom, elementType, familyName, reason) -> bool` | | `ValidateSubsets` | `classmethod ValidateSubsets(subsets, elementCount, familyType, reason) -> bool` | ### CreateElementTypeAttr ```python CreateElementTypeAttr(defaultValue, writeSparsely) -> Attribute ``` See GetElementTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateFamilyNameAttr ```python CreateFamilyNameAttr(defaultValue, writeSparsely) -> Attribute ``` <span class="sig-return-typehint"> Attribute See GetFamilyNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – static CreateGeomSubset(geom, subsetName, elementType, indices, familyName, familyType) -> Subset --------------------------------------------------------------------------------------------------- Creates a new GeomSubset below the given `geom` with the given name, `subsetName`, element type, `elementType` and `indices`. If a subset named `subsetName` already exists below `geom`, then this updates its attributes with the values of the provided arguments (indices value at time’default’will be updated) and returns it. The family type is set / updated on `geom` only if a non-empty value is passed in for `familyType` and `familyName`. Parameters ---------- - **geom** (`Imageable`) – - **subsetName** (`str`) – - **elementType** (`str`) – - **indices** (`IntArray`) – - **familyName** (`str`) – - **familyType** (`str`) – CreateIndicesAttr(defaultValue, writeSparsely) -> Attribute ----------------------------------------------------------- See GetIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. - the default for ```code``` writeSparsely ```code``` is ```code``` false ```code``` . ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### classmethod CreateUniqueGeomSubset(geom, subsetName, elementType, indices, familyName, familyType) -> Subset Creates a new GeomSubset below the given imageable, ```code``` geom ```code``` with the given name, ```code``` subsetName ```code``` , element type, ```code``` elementType ```code``` and ```code``` indices ```code``` . If a subset named ```code``` subsetName ```code``` already exists below ```code``` geom ```code``` , then this creates a new subset by appending a suitable index as suffix to ```code``` subsetName ```code``` (eg, subsetName_1) to avoid name collisions. The family type is set / updated on ```code``` geom ```code``` only if a non-empty value is passed in for ```code``` familyType ```code``` and ```code``` familyName ```code``` . #### Parameters - **geom** (`Imageable`) – - **subsetName** (`str`) – - **elementType** (`str`) – - **indices** (`IntArray`) – - **familyName** (`str`) – - **familyType** (`str`) – ### classmethod Define(stage, path) -> Subset Attempt to ensure a `UsdPrim` adhering to this schema at ```code``` path ```code``` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at ```code``` path ```code``` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at ```code``` path ```code``` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. <p> Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> **stage** (**Stage**) – <li> <p> **path** (**Path**) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Subset.Get"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Get <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdGeom.Subset.Get" title="Permalink to this definition">  <dd> <p> **classmethod** Get(stage, path) -&gt; Subset <p> Return a UsdGeomSubset holding the prim adhering to this schema at path on stage. <p> If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: <div class="highlight-text notranslate"> <div class="highlight"> <pre><span> <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> **stage** (**Stage**) – <li> <p> **path** (**Path**) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Subset.GetAllGeomSubsetFamilyNames"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> GetAllGeomSubsetFamilyNames <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdGeom.Subset.GetAllGeomSubsetFamilyNames" title="Permalink to this definition">  <dd> <p> **classmethod** GetAllGeomSubsetFamilyNames(geom) -&gt; str.Set <p> Returns the names of all the families of GeomSubsets defined on the given imageable, geom. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> **geom** (**Imageable**) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Subset.GetAllGeomSubsets"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> GetAllGeomSubsets <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdGeom.Subset.GetAllGeomSubsets" title="Permalink to this definition">  <dd> <p> **classmethod** GetAllGeomSubsets(geom) -&gt; list[Subset] <p> Returns all the GeomSubsets defined on the given imageable, geom. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> **geom** (**Imageable**) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Subset.GetElementTypeAttr"> <span class="sig-name descname"> <span class="pre"> GetElementTypeAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <a class="reference internal" href="Usd.html#pxr.Usd.Attribute" title="pxr.Usd.Attribute"> <span class="pre"> Attribute <a class="headerlink" href="#pxr.UsdGeom.Subset.GetElementTypeAttr" title="Permalink to this definition">  <dd> <p> The type of element that the indices target. <p> Currently only allows”face”and defaults to it. <p> Declaration <p> <code class="docutils literal notranslate"> <span class="pre"> uniform <span class="pre"> <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Subset.GetFamilyNameAttr"> <span class="sig-name descname"> <span class="pre">GetFamilyNameAttr <span class="sig-paren">( <span class="sig-paren">) <span class="sig-return"> <span class="sig-return-icon">→ <span class="sig-return-typehint"> <span class="pre">Attribute <a class="headerlink" href="#pxr.UsdGeom.Subset.GetFamilyNameAttr" title="Permalink to this definition"> <dd> <p>The name of the family of subsets that this subset belongs to. <p>This is optional and is primarily useful when there are multiple families of subsets under a geometric prim. In some cases, this could also be used for achieving proper roundtripping of subset data between DCC apps. When multiple subsets belonging to a prim have the same familyName, they are said to belong to the family. A <em>familyType <blockquote> <div> <ul class="simple"> <li> <p><strong>UsdGeomTokens-&gt;partition <li> <p><strong>UsdGeomTokens-&gt;nonOverlapping <li> <p><strong>UsdGeomTokens-&gt;unrestricted <p>The validity of subset data is not enforced by the authoring APIs, however they can be checked using UsdGeomSubset::ValidateFamily(). <p>Declaration <p><code class="docutils literal notranslate"><span class="pre">uniform token familyName ="" <p>C++ Type <p>TfToken <p>Usd Type <p>SdfValueTypeNames-&gt;Token <p>Variability <p>SdfVariabilityUniform If the `familyName` in the code block: ```html <span class="pre"> familyName ``` is left empty, then all subsets of the specified `elementType` in the code block: ```html <code class="docutils literal notranslate"> <span class="pre"> elementType ``` will be returned. ### Parameters - **geom** (Imageable) – - **elementType** (str) – - **familyName** (str) – ### GetIndicesAttr The set of indices included in this subset. The indices need not be sorted, but the same index should not appear more than once. Declaration: ``` int[] indices = [] ``` C++ Type: VtArray&lt;int&gt; Usd Type: SdfValueTypeNames->IntArray ### GetSchemaAttributeNames ``` classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters: - **includeInherited** (bool) – ### GetUnassignedIndices ``` classmethod GetUnassignedIndices(subsets, elementCount, time) -> IntArray ``` Utility for getting the list of indices that are not assigned to any of the GeomSubsets in `subsets` at the timeCode, `time`, given the element count (total number of indices in the array being subdivided), `elementCount`. Parameters: - **subsets** (list[Subset]) – - **elementCount** (int) – - **time** (TimeCode) – <p>This method returns the family name of the <code class="docutils literal notranslate"><span class="pre">geom <p>See UsdGeomSubset::GetFamilyNameAttr for the possible values for <code class="docutils literal notranslate"><span class="pre">familyType <p>When a family of GeomSubsets is tagged as a UsdGeomTokens-&gt;partition or UsdGeomTokens-&gt;nonOverlapping, the validity of the data (i.e. mutual exclusivity and/or wholeness) is not enforced by the authoring APIs. Use ValidateFamily() to validate the data in a family of GeomSubsets. <p>Returns false upon failure to create or set the appropriate attribute on <code class="docutils literal notranslate"><span class="pre">geom <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p><strong>geom <li> <p><strong>familyName <li> <p><strong>familyType <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Subset.ValidateFamily"> <em class="property"><span class="pre">static <span class="sig-name descname"><span class="pre">ValidateFamily <span class="sig-paren">() <a class="headerlink" href="#pxr.UsdGeom.Subset.ValidateFamily" title="Permalink to this definition"> <dd> <p><strong>classmethod <p>Validates whether the family of subsets identified by the given <code class="docutils literal notranslate"><span class="pre">familyName <p>If the family is designated as a partition or as non-overlapping using SetFamilyType() , then the validity of the data is checked. If the familyType is”unrestricted”, then this performs only bounds checking of the values in the”indices”arrays. <p>If <code class="docutils literal notranslate"><span class="pre">reason <p>The python version of this method returns a tuple containing a (bool, string), where the bool has the validity of the family and the string contains the reason (if it’s invalid). <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p><strong>geom <li> <p><strong>elementType <li> <p><strong>familyName <li> <p><strong>reason <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Subset.ValidateSubsets"> <em class="property"><span class="pre">static <span class="sig-name descname"><span class="pre">ValidateSubsets <span class="sig-paren">() <a class="headerlink" href="#pxr.UsdGeom.Subset.ValidateSubsets" title="Permalink to this definition"> <dd> <p><strong>classmethod <p>Validates the data in the given set of GeomSubsets, <code class="docutils literal notranslate"><span class="pre">subsets <p>For proper validation of indices in <code class="docutils literal notranslate"><span class="pre">subsets <p>If one or more subsets contain invalid data, then false is returned and <code class="docutils literal notranslate"><span class="pre">reason <p>The python version of this method returns a tuple containing a (bool, string), where the bool has the validity of the subsets and the string contains the reason (if they’re invalid). <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p><strong>subsets - **elementCount** (**int**) – - **familyType** (**str**) – - **reason** (**str**) – class pxr.UsdGeom.Tokens **Attributes:** - accelerations - all - angularVelocities - axis - basis - bezier - bilinear - boundaries - bounds - box - bspline - cards - catmullClark - catmullRom - clippingPlanes <p> <code>elementSize <p> <p> <code>elementType <p> <p> <code>exposure <p> <p> <code>extent <p> <p> <code>extentsHint <p> <p> <code>fStop <p> <p> <code>face <p> <p> <code>faceVarying <p> <p> <code>faceVaryingLinearInterpolation <p> <p> <code>faceVertexCounts <p> <p> <code>faceVertexIndices <p> <p> <code>familyName <p> <p> <code>focalLength <p> <p> <code>focusDistance <p> <p> <code>form <p> <p> <code>fromTexture <p> <p> <code>guide <p> <p> <code>guideVisibility <p> <p> height <p> <p> hermite <p> <p> holeIndices <p> <p> horizontalAperture <p> <p> horizontalApertureOffset <p> <p> ids <p> <p> inactiveIds <p> <p> indices <p> <p> inherited <p> <p> interpolateBoundary <p> <p> interpolation <p> <p> invisible <p> <p> invisibleIds <p> <p> knots <p> <p> left <p> <p> leftHanded <p> <p> length <p> <p> linear <p> <p> loop - `loop` - `metersPerUnit` - `modelApplyDrawMode` - `modelCardGeometry` - `modelCardTextureXNeg` - `modelCardTextureXPos` - `modelCardTextureYNeg` - `modelCardTextureYPos` - `modelCardTextureZNeg` - `modelCardTextureZPos` - `modelDrawMode` - `modelDrawModeColor` - `mono` - `motionBlurScale` - `motionNonlinearSampleCount` - `motionVelocityScale` - `nonOverlapping` - `none` - `nonperiodic` nonperiodic normals open order orientation orientations origin orthographic partition periodic perspective pinned pivot pointWeights points positions power primvarsDisplayColor primvarsDisplayOpacity projection protoIndices prototypes proxy proxyPrim proxyVisibility purpose radius ranges render renderVisibility right rightHanded scales shutterClose shutterOpen size smooth - `stereoRole` - `subdivisionScheme` - `tangents` - `triangleSubdivisionRule` - `trimCurveCounts` - `trimCurveKnots` - `trimCurveOrders` - `trimCurvePoints` - `trimCurveRanges` - `trimCurveVertexCounts` - `type` - `uForm` - `uKnots` - `uOrder` - `uRange` - `uVertexCount` - `unauthoredValuesIndex` - `uniform` - `unrestricted` unrestricted upAxis vForm vKnots vOrder vRange vVertexCount varying velocities vertex verticalAperture verticalApertureOffset visibility visible width widths wrap x xformOpOrder 'bspline' 'cards' 'catmullClark' 'catmullRom' 'clippingPlanes' 'clippingRange' 'closed' 'constant' 'cornerIndices' 'cornerSharpnesses' 'cornersOnly' 'cornersPlus1' 'cornersPlus2' ## cornersPlus2 - **Property**: cornersPlus2 - **Value**: 'cornersPlus2' ## creaseIndices - **Property**: creaseIndices - **Value**: 'creaseIndices' ## creaseLengths - **Property**: creaseLengths - **Value**: 'creaseLengths' ## creaseSharpnesses - **Property**: creaseSharpnesses - **Value**: 'creaseSharpnesses' ## cross - **Property**: cross - **Value**: 'cross' ## cubic - **Property**: cubic - **Value**: 'cubic' ## curveVertexCounts - **Property**: curveVertexCounts - **Value**: 'curveVertexCounts' ## default_ - **Property**: default_ - **Value**: 'default' ## doubleSided - **Property**: doubleSided - **Value**: 'doubleSided' ## edgeAndCorner - **Property**: edgeAndCorner - **Value**: 'edgeAndCorner' ## edgeOnly - **Property**: edgeOnly - **Value**: 'edgeOnly' ## elementSize - **Property**: elementSize - **Value**: 'elementSize' elementType = 'elementType' exposure = 'exposure' extent = 'extent' extentsHint = 'extentsHint' fStop = 'fStop' face = 'face' faceVarying = 'faceVarying' faceVaryingLinearInterpolation = 'faceVaryingLinearInterpolation' faceVertexCounts = 'faceVertexCounts' faceVertexIndices = 'faceVertexIndices' familyName = 'familyName' focalLength = 'focalLength' focusDistance = 'focusDistance' guide = 'guide' guideVisibility = 'guideVisibility' height = 'height' hermite = 'hermite' holeIndices = 'holeIndices' horizontalAperture = 'horizontalAperture' horizontalApertureOffset = 'horizontalApertureOffset' ids = 'ids' inactiveIds = 'inactiveIds' ## inactiveIds ## indices ## inherited ## interpolateBoundary ## interpolation ## invisible ## invisibleIds ## knots ## left ## leftHanded ## length ## linear ## loop = 'loop' metersPerUnit = 'metersPerUnit' modelApplyDrawMode = 'model:applyDrawMode' modelCardGeometry = 'model:cardGeometry' modelCardTextureXNeg = 'model:cardTextureXNeg' modelCardTextureXPos = 'model:cardTextureXPos' modelCardTextureYNeg = 'model:cardTextureYNeg' modelCardTextureYPos = 'model:cardTextureYPos' modelCardTextureZNeg = 'model:cardTextureZNeg' modelCardTextureZPos = 'model:cardTextureZPos' modelDrawMode = 'model:drawMode' modelDrawModeColor = 'model:drawModeColor' ### pxr.UsdGeom.Tokens.modelDrawModeColor - **Description**: - **Value**: `'model:drawModeColor'` ### pxr.UsdGeom.Tokens.mono - **Description**: - **Value**: `'mono'` ### pxr.UsdGeom.Tokens.motionBlurScale - **Description**: - **Value**: `'motion:blurScale'` ### pxr.UsdGeom.Tokens.motionNonlinearSampleCount - **Description**: - **Value**: `'motion:nonlinearSampleCount'` ### pxr.UsdGeom.Tokens.motionVelocityScale - **Description**: - **Value**: `'motion:velocityScale'` ### pxr.UsdGeom.Tokens.nonOverlapping - **Description**: - **Value**: `'nonOverlapping'` ### pxr.UsdGeom.Tokens.none - **Description**: - **Value**: `'none'` ### pxr.UsdGeom.Tokens.nonperiodic - **Description**: - **Value**: `'nonperiodic'` ### pxr.UsdGeom.Tokens.normals - **Description**: - **Value**: `'normals'` ### pxr.UsdGeom.Tokens.open - **Description**: - **Value**: `'open'` ### pxr.UsdGeom.Tokens.order - **Description**: - **Value**: `'order'` ### pxr.UsdGeom.Tokens.orientation - **Description**: - **Value**: `'orientation'` ### pxr.UsdGeom.Tokens.orientations - **Description**: - **Value**: `'orientations'` - `orientations` = 'orientations' - `origin` = 'origin' - `orthographic` = 'orthographic' - `partition` = 'partition' - `periodic` = 'periodic' - `perspective` = 'perspective' - `pinned` = 'pinned' - `pivot` = 'pivot' - `pointWeights` = 'pointWeights' - `points` = 'points' - `positions` = 'positions' - `power` = 'power' - `primvarsDisplayColor` = 'primvarsDisplayColor' <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'primvars:displayColor' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.primvarsDisplayOpacity"> <span class="sig-name descname"> <span class="pre"> primvarsDisplayOpacity <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'primvars:displayOpacity' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.projection"> <span class="sig-name descname"> <span class="pre"> projection <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'projection' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.protoIndices"> <span class="sig-name descname"> <span class="pre"> protoIndices <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'protoIndices' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.prototypes"> <span class="sig-name descname"> <span class="pre"> prototypes <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'prototypes' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.proxy"> <span class="sig-name descname"> <span class="pre"> proxy <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'proxy' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.proxyPrim"> <span class="sig-name descname"> <span class="pre"> proxyPrim <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'proxyPrim' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.proxyVisibility"> <span class="sig-name descname"> <span class="pre"> proxyVisibility <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'proxyVisibility' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.purpose"> <span class="sig-name descname"> <span class="pre"> purpose <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'purpose' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.radius"> <span class="sig-name descname"> <span class="pre"> radius <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'radius' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.ranges"> <span class="sig-name descname"> <span class="pre"> ranges <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'ranges' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.render"> <span class="sig-name descname"> <span class="pre"> render <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'render' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.Tokens.renderVisibility"> <span class="sig-name descname"> <span class="pre"> renderVisibility <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'renderVisibility' <dd> renderVisibility = 'renderVisibility' right = 'right' rightHanded = 'rightHanded' scales = 'scales' shutterClose = 'shutter:close' shutterOpen = 'shutter:open' size = 'size' smooth = 'smooth' stereoRole = 'stereoRole' subdivisionScheme = 'subdivisionScheme' tangents = 'tangents' triangleSubdivisionRule = 'triangleSubdivisionRule' trimCurveCounts = 'trimCurve:counts' trimCurveKnots = 'trimCurve:knots' trimCurveOrders = 'trimCurve:orders' trimCurvePoints = 'trimCurve:points' trimCurveRanges = 'trimCurve:ranges' trimCurveVertexCounts = 'trimCurve:vertexCounts' type = 'type' uForm = 'uForm' uKnots = 'uKnots' uOrder = 'uOrder' uRange = 'uRange' uVertexCount = 'uVertexCount' ## Attributes ### uVertexCount - **Description**: uVertexCount - **Value**: 'uVertexCount' ### unauthoredValuesIndex - **Description**: unauthoredValuesIndex - **Value**: 'unauthoredValuesIndex' ### uniform - **Description**: uniform - **Value**: 'uniform' ### unrestricted - **Description**: unrestricted - **Value**: 'unrestricted' ### upAxis - **Description**: upAxis - **Value**: 'upAxis' ### vForm - **Description**: vForm - **Value**: 'vForm' ### vKnots - **Description**: vKnots - **Value**: 'vKnots' ### vOrder - **Description**: vOrder - **Value**: 'vOrder' ### vRange - **Description**: vRange - **Value**: 'vRange' ### vVertexCount - **Description**: vVertexCount - **Value**: 'vVertexCount' ### varying - **Description**: varying - **Value**: 'varying' ### velocities - **Description**: velocities - **Value**: 'velocities' ### vertex - **Description**: vertex - **Value**: 'vertex' ### vertex ### verticalAperture ### verticalApertureOffset ### visibility ### visible ### width ### widths ### wrap ### x ### xformOpOrder ### y ### z ### VisibilityAPI ### pxr.UsdGeom.VisibilityAPI UsdGeomVisibilityAPI introduces properties that can be used to author visibility opinions. Currently, this schema only introduces the attributes that are used to control purpose visibility. Later, this schema will define *all* visibility-related properties and UsdGeomImageable will no longer define those properties. The purpose visibility attributes added by this schema, *guideVisibility*, *proxyVisibility*, and *renderVisibility* can each be used to control visibility for geometry of the corresponding purpose values, with the overall *visibility* attribute acting as an override. I.e., if *visibility* evaluates to "invisible", purpose visibility is invisible; otherwise, purpose visibility is determined by the corresponding purpose visibility attribute. Note that the behavior of *guideVisibility* is subtly different from the *proxyVisibility* and *renderVisibility* attributes, in that "guide" purpose visibility always evaluates to either "invisible" or "visible", whereas the other attributes may yield computed values of "inherited" if there is no authored opinion on the attribute or inherited from an ancestor. This is motivated by the fact that, in Pixar's user workflows, we have never found a need to have all guides visible in a scene by default, whereas we do find that flexibility useful for "proxy" and "render" geometry. This schema can only be applied to UsdGeomImageable prims. The UseGeomImageable schema provides API for computing the purpose visibility values that result from the attributes introduced by this schema. For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value "rightHanded", use UsdGeomTokens->rightHanded as the value. **Methods:** | Method | Description | |--------|-------------| | `Apply(prim) -> VisibilityAPI` | classmethod Apply(prim) -> VisibilityAPI | | `CanApply(prim, whyNot) -> bool` | classmethod CanApply(prim, whyNot) -> bool | | `CreateGuideVisibilityAttr(defaultValue, ...)` | See GetGuideVisibilityAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateProxyVisibilityAttr(defaultValue, ...)` | See GetProxyVisibilityAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateRenderVisibilityAttr(defaultValue, ...)` | See GetRenderVisibilityAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `Get(stage, path) -> VisibilityAPI` | classmethod Get(stage, path) -> VisibilityAPI | | `GetGuideVisibilityAttr()` | This attribute controls visibility for geometry with purpose "guide". | | `GetProxyVisibilityAttr()` | This attribute controls visibility for geometry with purpose "proxy". | | `GetPurposeVisibilityAttr(purpose)` | Return the attribute that is used for expressing visibility opinions for the given purpose | | Method Name | Description | |-------------|-------------| | `GetRenderVisibilityAttr()` | This attribute controls visibility for geometry with purpose "render". | | `GetSchemaAttributeNames()` | `classmethod` GetSchemaAttributeNames(includeInherited) -> list[TfToken] | ### Apply `static` `Apply()` `classmethod` Apply(prim) -> VisibilityAPI Applies this single-apply API schema to the given `prim`. This information is stored by adding "VisibilityAPI" to the token-valued, listOp metadata `apiSchemas` on the prim. A valid UsdGeomVisibilityAPI object is returned upon success. An invalid (or empty) UsdGeomVisibilityAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters: - `prim` (Prim) – ### CanApply `static` `CanApply()` `classmethod` CanApply(prim, whyNot) -> bool Returns true if this single-apply API schema can be applied to the given `prim`. If this schema can not be applied to the prim, this returns false and, if provided, populates `whyNot` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters: - `prim` (Prim) – - `whyNot` (str) – ### CreateGuideVisibilityAttr `CreateGuideVisibilityAttr(defaultValue, writeSparsely)` -> `Attribute` See GetGuideVisibilityAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. <p> <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.VisibilityAPI.CreateProxyVisibilityAttr"> <span class="sig-name descname"> <span class="pre"> CreateProxyVisibilityAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetProxyVisibilityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.VisibilityAPI.CreateRenderVisibilityAttr"> <span class="sig-name descname"> <span class="pre"> CreateRenderVisibilityAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetRenderVisibilityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.VisibilityAPI.Get"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Get <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod Get(stage, path) -&gt; VisibilityAPI <p> Return a UsdGeomVisibilityAPI holding the prim adhering to this schema at <code class="docutils literal notranslate"> <span class="pre"> path on <code class="docutils literal notranslate"> <span class="pre"> stage . , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```cpp UsdGeomVisibilityAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetGuideVisibilityAttr This attribute controls visibility for geometry with purpose "guide". Unlike overall visibility, guideVisibility is uniform, and therefore cannot be animated. Also unlike overall visibility, guideVisibility is tri-state, in that a descendant with an opinion of "visible" overrides an ancestor opinion of "invisible". The guideVisibility attribute works in concert with the overall visibility attribute: The visibility of a prim with purpose "guide" is determined by the inherited values it receives for the visibility and guideVisibility attributes. If visibility evaluates to "invisible", the prim is invisible. If visibility evaluates to "inherited" and guideVisibility evaluates to "visible", then the prim is visible. **Otherwise, it is invisible.** Declaration: ``` uniform token guideVisibility ="invisible" ``` C++ Type: TfToken Usd Type: SdfValueTypeNames->Token Variability: SdfVariabilityUniform Allowed Values: inherited, invisible, visible ### GetProxyVisibilityAttr This attribute controls visibility for geometry with purpose "proxy". Unlike overall visibility, proxyVisibility is uniform, and therefore cannot be animated. Also unlike overall visibility, proxyVisibility is tri-state, in that a descendant with an opinion of "visible" overrides an ancestor opinion of "invisible". The proxyVisibility attribute works in concert with the overall visibility attribute: The visibility of a prim with purpose "proxy" is determined by the inherited values it receives for the visibility and proxyVisibility attributes. If visibility evaluates to "invisible", the prim is invisible. If visibility evaluates to "inherited" then: If proxyVisibility evaluates to "visible", then the prim is visible; if proxyVisibility evaluates to "invisible", then the prim is invisible; if proxyVisibility evaluates to "inherited", then the prim may either be visible or invisible, depending on a fallback value determined by the calling context. Declaration: ``` uniform token proxyVisibility ="inherited" ``` C++ Type: TfToken Usd Type: SdfValueTypeNames->Token Variability: SdfVariabilityUniform Allowed Values: inherited, invisible, visible ### GetPurposeVisibilityAttr ```python def GetPurposeVisibilityAttr(): return Attribute ``` Return the attribute that is used for expressing visibility opinions for the given purpose. The valid purpose tokens are "guide", "proxy", and "render" which return the attributes guideVisibility, proxyVisibility, and renderVisibility respectively. Note that while "default" is a valid purpose token for UsdGeomImageable::GetPurposeVisibilityAttr, it is not a valid purpose for this function, as UsdGeomVisibilityAPI itself does not have a default visibility attribute. Calling this function with “default will result in a coding error. #### Parameters - **purpose** (str) – ### GetRenderVisibilityAttr ```python def GetRenderVisibilityAttr(): return Attribute ``` This attribute controls visibility for geometry with purpose "render". Unlike overall visibility, renderVisibility is uniform, and therefore cannot be animated. Also unlike overall visibility, renderVisibility is tri-state, in that a descendant with an opinion of "visible" overrides an ancestor opinion of "invisible". The renderVisibility attribute works in concert with the overall visibility attribute: The visibility of a prim with purpose "render" is determined by the inherited values it receives for the visibility and renderVisibility attributes. If visibility evaluates to "invisible", the prim is invisible. If visibility evaluates to "inherited" then: If renderVisibility evaluates to "visible", then the prim is visible; if renderVisibility evaluates to "invisible", then the prim is invisible; if renderVisibility evaluates to "inherited", then the prim may either be visible or invisible, depending on a fallback value determined by the calling context. Declaration ```python uniform token renderVisibility = "inherited" ``` C++ Type: TfToken Usd Type: SdfValueTypeNames->Token Variability: SdfVariabilityUniform Allowed Values: inherited, invisible, visible ### GetSchemaAttributeNames ```python @classmethod def GetSchemaAttributeNames(includeInherited) -> list[TfToken]: return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. ``` Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ### Xform Concrete prim schema for a transform, which implements Xformable #### Methods: - Define ``` ## Define **classmethod** Define(stage, path) -> Xform Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ## Get **classmethod** Get(stage, path) -> Xform Return a UsdGeomXform holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```text UsdGeomXform(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ## GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] ### pxr.UsdGeom.XformCache A caching mechanism for transform matrices. For best performance, this object should be reused for multiple CTM queries. Instances of this type can be copied, though using Swap() may result in better performance. It is valid to cache prims from multiple stages in a single XformCache. WARNING: this class does not automatically invalidate cached values based on changes to the stage from which values were cached. Additionally, a separate instance of this class should be used per-thread, calling the Get* methods from multiple threads is not safe, as they mutate internal state. **Methods:** - **Clear**(): Clears all pre-cached values. - **ComputeRelativeTransform**(prim, ancestor, ...): Returns the result of concatenating all transforms beneath `ancestor` that affect `prim`. - **GetLocalToWorldTransform**(prim): Compute the transformation matrix for the given `prim`, including the transform authored on the Prim itself, if present. - **GetLocalTransformation**(prim, resetsXformStack): Returns the local transformation of the prim. - **GetParentToWorldTransform**(prim): Compute the transformation matrix for the given `prim`, but do NOT include the transform authored on the prim itself. - **GetTime**(): Get the current time from which this cache is reading values. - **SetTime**(time): Use the new `time` when computing values and may clear any existing values cached for the previous time. - **Swap**(other): Swap the contents of this XformCache with `other`. ## Method Definitions ### Clear ``` Clears all pre-cached values. ``` ### ComputeRelativeTransform ``` ComputeRelativeTransform(prim, ancestor, resetXformStack) ``` Returns the result of concatenating all transforms beneath `ancestor` that affect `prim`. This includes the local transform of `prim` itself, but not the local transform of `ancestor`. If `ancestor` is not an ancestor of `prim`, the resulting transform is the local-to-world transformation of `prim`. The `resetXformStack` pointer must be valid. If any intermediate prims reset the transform stack, `resetXformStack` will be set to true. Intermediate transforms are cached, but the result of this call itself is not cached. **Parameters** - **prim** (`Prim`) – - **ancestor** (`Prim`) – - **resetXformStack** (`bool`) – ``` ### GetLocalToWorldTransform ``` GetLocalToWorldTransform(prim) ``` Compute the transformation matrix for the given `prim`, including the transform authored on the Prim itself, if present. This method may mutate internal cache state and is not thread safe. **Parameters** - **prim** (`Prim`) – ``` ### GetLocalTransformation ``` GetLocalTransformation(prim, resetsXformStack) ``` Returns the local transformation of the prim. Uses the cached XformQuery to compute the result quickly. The `resetsXformStack` parameter is used to determine if the transform stack should be reset. ``` <code>resetsXformStack pointer must be valid. It will be set to true if <code>prim resets the transform stack. The result of this call is cached. ### Parameters - **prim** (<em>Prim - **resetsXformStack** (<em>bool ### GetParentToWorldTransform Compute the transformation matrix for the given <code>prim This method may mutate internal cache state and is not thread safe. #### Parameters - **prim** (<em>Prim ### GetTime Get the current time from which this cache is reading values. ### SetTime Use the new <code>time Setting <code>time #### Parameters - **time** (<em>TimeCode ### Swap Swap the contents of this XformCache with <code>other #### Parameters - **other** (<em>XformCache This class provides API for authoring and retrieving a standard set of component transformations which include a scale, a rotation, a scale-rotate pivot and a translation. The goal of the API is to enhance component-wise interchange. It achieves this by limiting the set of allowed basic ops and by specifying the order in which they are applied. In addition to the basic set of ops, the 'resetXformStack' bit can also be set to indicate whether the underlying xformable resets the parent transformation (i.e. does not inherit it's parent's transformation). UsdGeomXformCommonAPI::GetResetXformStack() UsdGeomXformCommonAPI::SetResetXformStack() The operator-bool for the class will inform you whether an existing xformable is compatible with this API. The scale-rotate pivot is represented by a pair of (translate, inverse-translate) xformOps around the scale and rotate operations. The rotation operation can be any of the six allowed Euler angle sets. UsdGeomXformOp::Type. The xformOpOrder of an xformable that has all of the supported basic ops is as follows: ["xformOp:translate","xformOp:translate:pivot","xformOp:rotateXYZ","xformOp:scale","!invert!xformOp:translate:pivot"]. It is worth noting that all of the ops are optional. For example, an xformable may have only a translate or a rotate. It would still be considered as compatible with this API. Individual SetTranslate() , SetRotate() , SetScale() and SetPivot() methods are provided by this API to allow such sparse authoring. **Classes:** | Name | Description | | --- | --- | | OpFlags | Enumerates the categories of ops that can be handled by XformCommonAPI. | | RotationOrder | Enumerates the rotation order of the 3-angle Euler rotation. | **Methods:** | Name | Description | | --- | --- | | CanConvertOpTypeToRotationOrder | classmethod CanConvertOpTypeToRotationOrder(opType) -> bool | | ConvertOpTypeToRotationOrder | classmethod ConvertOpTypeToRotationOrder(opType) -> RotationOrder | | ConvertRotationOrderToOpType | classmethod ConvertRotationOrderToOpType(rotOrder) -> XformOp.Type | | CreateXformOps | Creates the specified XformCommonAPI-compatible xform ops, or returns the existing ops if they already exist. | | Get | classmethod Get(stage, path) -> XformCommonAPI | | GetResetXformStack | Returns whether the xformable resets the transform stack. | | GetRotationTransform | classmethod GetRotationTransform(rotation, rotationOrder) -> Matrix4d | | GetSchemaAttributeNames | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | GetXformVectors | | | Method | Description | | --- | --- | | GetXformOpOrder | Retrieve the order of xformOps. | | GetXformOpByIndex | Retrieve an xformOp by index. | | GetXformOpByName | Retrieve an xformOp by name. | | GetXformOpOrder | Retrieve the order of xformOps. | | GetXformVectors | Retrieve values of the various component xformOps at a given time. | | GetXformVectorsByAccumulation | Retrieve values of the various component xformOps at a given time. | | SetPivot | Set pivot position at time to pivot. | | SetResetXformStack | Set whether the xformable resets the transform stack. | | SetRotate | Set rotation at time to rotation. | | SetScale | Set scale at time to scale. | | SetTranslate | Set translation at time to translation. | | SetXformVectors | Set values for the various component xformOps at a given time. | **Attributes:** | Attribute | Description | | --- | --- | | OpPivot | | | OpRotate | | | OpScale | | | OpTranslate | | | RotationOrderXYZ | | | RotationOrderXZY | | --- | | RotationOrderYXZ | | RotationOrderYZX | | RotationOrderZXY | | RotationOrderZYX | class OpFlags --------------- class RotationOrder -------------------- Enumerates the rotation order of the 3-angle Euler rotation. **Methods:** | GetValueFromName | | --- | **Attributes:** | allValues | | --- | ### allValues - `allValues` ### GetValueFromName - `static GetValueFromName()` ### allValues - `allValues = (UsdGeom.XformCommonAPI.RotationOrderXYZ, UsdGeom.XformCommonAPI.RotationOrderXZY, UsdGeom.XformCommonAPI.RotationOrderYXZ, UsdGeom.XformCommonAPI.RotationOrderYZX, UsdGeom.XformCommonAPI.RotationOrderZXY, UsdGeom.XformCommonAPI.RotationOrderZYX)` ### CanConvertOpTypeToRotationOrder - `classmethod CanConvertOpTypeToRotationOrder(opType) -> bool` - Whether the given `opType` has a corresponding value in the UsdGeomXformCommonAPI::RotationOrder enum (i.e., whether it is a three-axis rotation). - Parameters: - **opType** (`XformOp.Type`) – ### ConvertOpTypeToRotationOrder - `classmethod ConvertOpTypeToRotationOrder(opType) -> RotationOrder` - Converts the given `opType` to the corresponding value in the UsdGeomXformCommonAPI::RotationOrder enum. - For example, TypeRotateYZX corresponds to RotationOrderYZX. Raises a coding error if `opType` is not convertible to RotationOrder (i.e., if it isn’t a three-axis rotation) and returns the default RotationOrderXYZ instead. - Parameters: - **opType** (`XformOp.Type`) – ### ConvertRotationOrderToOpType - `classmethod ConvertRotationOrderToOpType(rotOrder) -> XformOp.Type` - Converts the given `rotOrder` to the corresponding value in the UsdGeomXformOp::Type enum. - For example, RotationOrderYZX corresponds to TypeRotateYZX. Raises a coding error if `rotOrder` is not one of the named enumerators of RotationOrder. - Parameters: - **rotOrder** (`RotationOrder`) – CreateXformOps(rotOrder, op1, op2, op3, op4) -> Ops Creates the specified XformCommonAPI-compatible xform ops, or returns the existing ops if they already exist. If successful, returns an Ops object with all the ops on this prim, identified by type. If the requested xform ops couldn’t be created or the prim is not XformCommonAPI-compatible, returns an Ops object with all invalid ops. The `rotOrder` is only used if OpRotate is specified. Otherwise, it is ignored. (If you don’t need to create a rotate op, you might find it helpful to use the other overload that takes no rotation order.) Parameters: - **rotOrder** (RotationOrder) – - **op1** (OpFlags) – - **op2** (OpFlags) – - **op3** (OpFlags) – - **op4** (OpFlags) – CreateXformOps(op1, op2, op3, op4) -> Ops This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This overload does not take a rotation order. If you specify OpRotate, then this overload assumes RotationOrderXYZ or the previously-authored rotation order. (If you do need to create a rotate op, you might find it helpful to use the other overload that explicitly takes a rotation order.) Parameters: - **op1** (OpFlags) – - **op2** (OpFlags) – - **op3** (OpFlags) – - **op4** (OpFlags) – classmethod Get(stage, path) -> XformCommonAPI Return a UsdGeomXformCommonAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: UsdGeomXformCommonAPI(stage->GetPrimAtPath(path)); ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetResetXformStack ```python GetResetXformStack() -> bool ``` Returns whether the xformable resets the transform stack. i.e., does not inherit the parent transformation. ### GetRotationTransform ```python classmethod GetRotationTransform(rotation, rotationOrder) -> Matrix4d ``` Return the 4x4 matrix that applies the rotation encoded by rotation vector `rotation` using the rotation order `rotationOrder`. Deprecated: Please use the result of ConvertRotationOrderToOpType() along with UsdGeomXformOp::GetOpTransform() instead. #### Parameters - **rotation** (Vec3f) – - **rotationOrder** (XformCommonAPI.RotationOrder) – ### GetSchemaAttributeNames ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ### GetXformVectors ```python GetXformVectors(translation, rotation, scale, pivot, rotOrder, time) -> bool ``` Retrieve values of the various component xformOps at a given `time`. Identity values are filled in for the component xformOps that don’t exist or don’t have an authored value. This method works even on prims with an incompatible xform schema, i.e. when the bool operator returns false. When the underlying xformable has an incompatible xform schema, it performs a full-on ``` matrix decomposition to XYZ rotation order. ### Parameters - **translation** (Vec3d) – - **rotation** (Vec3f) – - **scale** (Vec3f) – - **pivot** (Vec3f) – - **rotOrder** (RotationOrder) – - **time** (TimeCode) – ### GetXformVectorsByAccumulation ```python GetXformVectorsByAccumulation(translation, rotation, scale, pivot, rotOrder, time) -> bool ``` Retrieve values of the various component xformOps at a given time. Identity values are filled in for the component xformOps that don’t exist or don’t have an authored value. This method allows some additional flexibility for xform schemas that do not strictly adhere to the xformCommonAPI. For incompatible schemas, this method will attempt to reduce the schema into one from which component vectors can be extracted by accumulating xformOp transforms of the common types. When the underlying xformable has a compatible xform schema, the usual component value extraction method is used instead. When the xform schema is incompatible and it cannot be reduced by accumulating transforms, it performs a full-on matrix decomposition to XYZ rotation order. #### Parameters - **translation** (Vec3d) – - **rotation** (Vec3f) – - **scale** (Vec3f) – - **pivot** (Vec3f) – - **rotOrder** (XformCommonAPI.RotationOrder) – - **time** (TimeCode) – ### SetPivot ```python SetPivot(pivot, time) -> bool ### SetPivot Set pivot position at `time` to `pivot`. #### Parameters - **pivot** (Vec3f) – - **time** (TimeCode) – ### SetResetXformStack Set whether the xformable resets the transform stack. i.e., does not inherit the parent transformation. #### Parameters - **resetXformStack** (bool) – ### SetRotate Set rotation at `time` to `rotation`. #### Parameters - **rotation** (Vec3f) – - **rotOrder** (XformCommonAPI.RotationOrder) – - **time** (TimeCode) – ### SetScale Set scale at `time` to `scale`. #### Parameters - **scale** (Vec3f) – - **time** (TimeCode) – ### SetTranslate Set translation at `time` to `translation`. #### Parameters - **translation** (Vec3f) – - **time** (TimeCode) – ### SetTranslate ```cpp SetTranslate(translation, time) ``` - Returns: `bool` #### Description Set translation at `time` to `translation`. #### Parameters - **translation** (`Vec3d`) – - **time** (`TimeCode`) – ### SetXformVectors ```cpp SetXformVectors(translation, rotation, scale, pivot, rotOrder, time) ``` - Returns: `bool` #### Description Set values for the various component xformOps at a given `time`. #### Parameters - **translation** (`Vec3d`) – - **rotation** (`Vec3f`) – - **scale** (`Vec3f`) – - **pivot** (`Vec3f`) – - **rotOrder** (`RotationOrder`) – - **time** (`TimeCode`) – ### OpPivot ```cpp OpPivot = UsdGeom.XformCommonAPI.OpPivot ``` ### OpRotate ```cpp OpRotate = UsdGeom.XformCommonAPI.OpRotate ``` OpScale = UsdGeom.XformCommonAPI.OpScale OpTranslate = UsdGeom.XformCommonAPI.OpTranslate RotationOrderXYZ = UsdGeom.XformCommonAPI.RotationOrderXYZ RotationOrderXZY = UsdGeom.XformCommonAPI.RotationOrderXZY RotationOrderYXZ = UsdGeom.XformCommonAPI.RotationOrderYXZ RotationOrderYZX = UsdGeom.XformCommonAPI.RotationOrderYZX RotationOrderZXY = UsdGeom.XformCommonAPI.RotationOrderZXY RotationOrderZYX = UsdGeom.XformCommonAPI.RotationOrderZYX class pxr.UsdGeom.XformOp Schema wrapper for UsdAttribute for authoring and computing transformation operations, as consumed by UsdGeomXformable schema. The semantics of an op are determined primarily by its name, which allows us to decode an op very efficiently. All ops are independent attributes, which must live in the "xformOp" property namespace. The op’s primary name within the namespace must be one of UsdGeomXformOpTypes, which determines the type of transformation operation, and its secondary name (or suffix) within the namespace (which is not required to exist), can be any name that distinguishes it from other ops of the same type. Suffixes are generally imposed by higher level xform API schemas. **On packing order of rotateABC triples** The order in which the axis rotations are recorded in a Vec3* for the six rotateABC Euler triples **is always the same**: vec[0] = X, vec[1] = Y, vec[2] = Z. The A, B, C in the op name dictate the order in which their corresponding elements are consumed by the rotation, not how they are laid out. **Classes:** | Precision | Precision with which the value of the transformation operation is encoded. | | --- | --- | | Type | Enumerates the set of all transformation operation types. | **Methods:** | Get | Get the attribute value of the XformOp at time. | | --- | --- | | GetAttr | Explicit UsdAttribute extractor. | | GetBaseName | UsdAttribute::GetBaseName() | | GetName | UsdAttribute::GetName() | | GetNamespace | UsdAttribute::GetNamespace() | | GetNumTimeSamples | Returns the number of time samples authored for this xformOp. | | GetOpName | **classmethod** GetOpName(opType, opSuffix, inverse) -> str | | GetOpTransform | **classmethod** GetOpTransform(time) -> Matrix4d | | GetOpType | Return the operation type of this op, one of UsdGeomXformOp::Type. | | GetOpTypeEnum | **classmethod** GetOpTypeEnum(opTypeToken) -> Type | | GetOpTypeToken | **classmethod** GetOpTypeToken(opType) -> str | | GetPrecision | Returns the precision level of the xform op. | | GetTimeSamples | Populates the list of time samples at which the associated attribute is authored. | | Method | Description | | --- | --- | | `GetTimeSamplesInInterval(interval, times)` | Populates the list of time samples within the given interval, at which the associated attribute is authored. | | `GetTypeName()` | UsdAttribute::GetTypeName() | | `IsDefined()` | Return true if the wrapped UsdAttribute::IsDefined() , and in addition the attribute is identified as a XformOp. | | `IsInverseOp()` | Returns whether the xformOp represents an inverse operation. | | `MightBeTimeVarying()` | Determine whether there is any possibility that this op's value may vary over time. | | `Set(value, time)` | Set the attribute value of the XformOp at time. | | `SplitName()` | UsdAttribute::SplitName() | **Attributes:** | Attribute | Description | | --- | --- | | `PrecisionDouble` | | | `PrecisionFloat` | | | `PrecisionHalf` | | | `TypeInvalid` | | | `TypeOrient` | | | `TypeRotateX` | | | `TypeRotateXYZ` | | | `TypeRotateXZY` | | | `TypeRotateY` | | <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TypeRotateY <td> <p> <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.XformOp.TypeRotateYXZ" title="pxr.UsdGeom.XformOp.TypeRotateYXZ"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TypeRotateYXZ <td> <p> <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.XformOp.TypeRotateYZX" title="pxr.UsdGeom.XformOp.TypeRotateYZX"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TypeRotateYZX <td> <p> <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.XformOp.TypeRotateZ" title="pxr.UsdGeom.XformOp.TypeRotateZ"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TypeRotateZ <td> <p> <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.XformOp.TypeRotateZXY" title="pxr.UsdGeom.XformOp.TypeRotateZXY"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TypeRotateZXY <td> <p> <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.XformOp.TypeRotateZYX" title="pxr.UsdGeom.XformOp.TypeRotateZYX"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TypeRotateZYX <td> <p> <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.XformOp.TypeScale" title="pxr.UsdGeom.XformOp.TypeScale"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TypeScale <td> <p> <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.XformOp.TypeTransform" title="pxr.UsdGeom.XformOp.TypeTransform"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TypeTransform <td> <p> <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.XformOp.TypeTranslate" title="pxr.UsdGeom.XformOp.TypeTranslate"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TypeTranslate <td> <p> <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdGeom.XformOp.Precision"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-name descname"> <span class="pre"> Precision <a class="headerlink" href="#pxr.UsdGeom.XformOp.Precision" title="Permalink to this definition">  <dd> <p> Precision with which the value of the tranformation operation is encoded. <p> <strong> Methods: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.XformOp.Precision.GetValueFromName" title="pxr.UsdGeom.XformOp.Precision.GetValueFromName"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetValueFromName <td> <p> <p> <strong> Attributes: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdGeom.XformOp.Precision.allValues" title="pxr.UsdGeom.XformOp.Precision.allValues"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> allValues <td> <p> <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.XformOp.Precision.GetValueFromName"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> GetValueFromName <span class="sig-paren"> () <a class="headerlink" href="#pxr.UsdGeom.XformOp.Precision.GetValueFromName" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdGeom.XformOp.Precision.allValues"> <span class="sig-name descname"> <span class="pre"> allValues <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> (UsdGeom.XformOp.PrecisionDouble, <span class="pre"> UsdGeom.XformOp.PrecisionFloat, <span class="pre"> UsdGeom.XformOp.PrecisionHalf) <a class="headerlink" href="#pxr.UsdGeom.XformOp.Precision.allValues" title="Permalink to this definition">  <dd> <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdGeom.XformOp.Type"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-name descname"> ### Type Enumerates the set of all transformation operation types. **Methods:** | Method Name | Description | |-------------|-------------| | `GetValueFromName` | | **Attributes:** | Attribute Name | Description | |----------------|-------------| | `allValues` | | **static GetValueFromName()** **allValues = (UsdGeom.XformOp.TypeInvalid, UsdGeom.XformOp.TypeTranslate, UsdGeom.XformOp.TypeScale, UsdGeom.XformOp.TypeRotateX, UsdGeom.XformOp.TypeRotateY, UsdGeom.XformOp.TypeRotateZ, UsdGeom.XformOp.TypeRotateXYZ, UsdGeom.XformOp.TypeRotateXZY, UsdGeom.XformOp.TypeRotateYXZ, UsdGeom.XformOp.TypeRotateYZX, UsdGeom.XformOp.TypeRotateZXY, UsdGeom.XformOp.TypeRotateZYX, UsdGeom.XformOp.TypeOrient, UsdGeom.XformOp.TypeTransform)** **Get(value, time) → bool** Get the attribute value of the XformOp at `time`. For inverted ops, this returns the raw, uninverted value. **Parameters** - **value** (T) - **time** (TimeCode) **GetAttr() → Attribute** Explicit UsdAttribute extractor. **GetBaseName() → str** ### UsdAttribute::GetBaseName() ### UsdAttribute::GetName() ### UsdAttribute::GetNamespace() ### GetNumTimeSamples() Returns the number of time samples authored for this xformOp. ### GetOpName() **classmethod** GetOpName(opType, opSuffix, inverse) -> str Returns the xformOp’s name as it appears in xformOpOrder, given the opType, the (optional) suffix and whether it is an inverse operation. Parameters: - **opType** (Type) – - **opSuffix** (str) – - **inverse** (bool) – GetOpName() -> str Returns the opName as it appears in the xformOpOrder attribute. This will begin with”!invert!:xformOp:” if it is an inverse xform operation. If it is not an inverse xformOp, it will begin with ‘xformOp:’. This will be empty for an invalid xformOp. ### GetOpTransform() **classmethod** GetOpTransform(time) -> Matrix4d Return the 4x4 matrix that applies the transformation encoded in this op at time. Returns the identity matrix and issues a coding error if the op is invalid. If the op is valid, but has no authored value, the identity matrix is returned and no error is issued. Parameters: - **time** (TimeCode) – GetOpTransform(opType, opVal, isInverseOp) -> Matrix4d Return the 4x4 matrix that applies the transformation encoded by op opType and data value opVal. If isInverseOp is true, then the inverse of the transformation represented by the op/value pair is returned. An error will be issued if opType is not one of the values in the enum UsdGeomXformOp::Type or if opVal cannot be converted to a suitable input to opType. Parameters: - **opType** (Type) – - **opVal** (str) – - **isInverseOp** (bool) – * **Type** (VtValue) – * **opVal** (VtValue) – * **isInverseOp** (bool) – ### GetOpType ```python GetOpType() -> Type ``` Return the operation type of this op, one of UsdGeomXformOp::Type. ### GetOpTypeEnum ```python classmethod GetOpTypeEnum(opTypeToken) -> Type ``` Returns the Type enum associated with the given `opTypeToken`. **Parameters** * **opTypeToken** (str) – ### GetOpTypeToken ```python classmethod GetOpTypeToken(opType) -> str ``` Returns the TfToken used to encode the given `opType`. Note that an empty TfToken is used to represent TypeInvalid **Parameters** * **opType** (Type) – ### GetPrecision ```python GetPrecision() -> Precision ``` Returns the precision level of the xform op. ### GetTimeSamples ```python GetTimeSamples(times) -> bool ``` Populates the list of time samples at which the associated attribute is authored. **Parameters** * **times** (list[float]) – ### GetTimeSamplesInInterval ```python GetTimeSamplesInInterval(interval, times) -> bool ``` Populates the list of time samples within the given interval. **Parameters** * **interval** – * **times** – `interval`, at which the associated attribute is authored. ### Parameters - **interval** (`Interval`) – - **times** (`list[float]`) – ### GetTypeName ``` GetTypeName() → ValueTypeName ``` UsdAttribute::GetTypeName() ### IsDefined ``` IsDefined() → bool ``` Return true if the wrapped UsdAttribute::IsDefined(), and in addition the attribute is identified as a XformOp. ### IsInverseOp ``` IsInverseOp() → bool ``` Returns whether the xformOp represents an inverse operation. ### MightBeTimeVarying ``` MightBeTimeVarying() → bool ``` Determine whether there is any possibility that this op’s value may vary over time. The determination is based on a snapshot of the authored state of the op, and may become invalid in the face of further authoring. ### Set ``` Set(value, time) → bool ``` Set the attribute value of the XformOp at `time`. This only works on non-inverse operations. If invoked on an inverse xform operation, a coding error is issued and no value is authored. #### Parameters - **value** (`T`) – - **time** (`TimeCode`) – ### SplitName ``` SplitName() → list[str] ``` UsdAttribute::SplitName() PrecisionDouble = UsdGeom.XformOp.PrecisionDouble PrecisionFloat = UsdGeom.XformOp.PrecisionFloat PrecisionHalf = UsdGeom.XformOp.PrecisionHalf TypeInvalid = UsdGeom.XformOp.TypeInvalid TypeOrient = UsdGeom.XformOp.TypeOrient TypeRotateX = UsdGeom.XformOp.TypeRotateX TypeRotateXYZ = UsdGeom.XformOp.TypeRotateXYZ TypeRotateXZY = UsdGeom.XformOp.TypeRotateXZY TypeRotateY = UsdGeom.XformOp.TypeRotateY TypeRotateYXZ = UsdGeom.XformOp.TypeRotateYXZ TypeRotateYZX = UsdGeom.XformOp.TypeRotateYZX TypeRotateZ = UsdGeom.XformOp.TypeRotateZ ### UsdGeom.XformOp.TypeRotateZ ### UsdGeom.XformOp.TypeRotateZXY ### UsdGeom.XformOp.TypeRotateZYX ### UsdGeom.XformOp.TypeScale ### UsdGeom.XformOp.TypeTransform ### UsdGeom.XformOp.TypeTranslate ### pxr.UsdGeom.XformOpTypes **Attributes:** - orient - resetXformStack - rotateX - rotateXYZ - rotateXZY - rotateY - rotateYXZ - rotateYZX rotateYZX rotateZ rotateZXY rotateZYX scale transform translate orient = 'orient' resetXformStack = '!resetXformStack!' rotateX = 'rotateX' rotateXYZ = 'rotateXYZ' rotateXZY = 'rotateXZY' rotateY = 'rotateY' rotateYXZ = 'rotateYXZ' rotateYZX = 'rotateYZX' ## rotateYZX ## rotateZ ## rotateZXY ## rotateZYX ## scale ## transform ## translate ## Xformable ### Description Base class for all transformable prims, which allows arbitrary sequences of component affine transformations to be encoded. You may find it useful to review Linear Algebra in UsdGeom while reading this class description. **Supported Component Transformation Operations** UsdGeomXformable currently supports arbitrary sequences of the following operations, each of which can be encoded in an attribute of the proper shape in any supported precision: - translate - 3D - scale - 3D - rotateX - 1D angle in degrees - rotateY - 1D angle in degrees - rotateZ - 1D angle in degrees - rotateABC - 3D where ABC can be any combination of the six principle Euler Angle sets: XYZ, XZY, YXZ, YZX, ZXY, ZYX. See note on rotation packing order - orient - 4D (quaternion) - transform - 4x4D **Creating a Component Transformation** To add components to a UsdGeomXformable prim, simply call AddXformOp() with the desired op type, as enumerated in UsdGeomXformOp::Type, and the desired precision, which is one of UsdGeomXformOp::Precision. Optionally, you can also provide an “op suffix” for the operator that disambiguates it from other components of the same type on the same prim. Application-specific transform schemas can use the suffixes to fill a role similar to that played by AbcGeom::XformOp’s “Hint” enums for their own round-tripping logic. We also provide specific “Add” API for each type, for clarity and conciseness, e.g. AddTranslateOp() , AddRotateXYZOp() etc. AddXformOp() will return a UsdGeomXformOp object, which is a schema on a newly created UsdAttribute that provides convenience API for authoring and computing the component transformations. The UsdGeomXformOp can then be used to author any number of timesamples and default for the op. Each successive call to AddXformOp() adds an operator that will be applied “more locally” than the preceding operator, just as if we were pushing transforms onto a transformation stack - which is precisely what should happen when the operators are consumed by a reader. If you can, please try to use the UsdGeomXformCommonAPI, which wraps the UsdGeomXformable with an interface in which Op creation is taken care of for you, and there is a much higher chance that the data you author will be importable without flattening into other DCC’s, as it conforms to a fixed set of Scale-Rotate-Translate Ops. Using the Authoring API **Data Encoding and Op Ordering** Because there is no "fixed schema" of operations, all of the attributes that encode transform operations are dynamic, and are scoped in the namespace "xformOp". The second component of an attribute's name provides the *type* of operation, as listed above. An "xformOp" attribute can have additional namespace components derived from the *opSuffix* argument to the AddXformOp() suite of methods, which provides a preferred way of naming the ops such that we can have multiple "translate" ops with unique attribute names. For example, in the attribute named "xformOp:translate:maya:pivot", "translate" is the type of operation and "maya:pivot" is the suffix. The following ordered list of attribute declarations in usda define a basic Scale-Rotate-Translate with XYZ Euler angles, wherein the translation is double-precision, and the remainder of the ops are single, in which we will: > - Scale by 2.0 in each dimension > - Rotate about the X, Y, and Z axes by 30, 60, and 90 degrees, respectively > - Translate by 100 units in the Y direction ``` ```markdown float3 xformOp:rotateXYZ = (30, 60, 90) float3 xformOp:scale = (2, 2, 2) double3 xformOp:translate = (0, 100, 0) uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale" ] ``` The attributes appear in the dictionary order in which USD, by default, sorts them. To ensure the ops are recovered and evaluated in the correct order, the schema introduces the **xformOpOrder** attribute, which contains the names of the op attributes, in the precise sequence in which they should be pushed onto a transform stack. **Note** that the order is opposite to what you might expect, given the matrix algebra described in Linear Algebra in UsdGeom. This also dictates order of op creation, since each call to AddXformOp() adds a new op to the end of the **xformOpOrder** array, as a new "most-local" operation. See Example 2 below for C++ code that could have produced this USD. If it were important for the prim's rotations to be independently overridable, we could equivalently (at some performance cost) encode the transformation also like so: ```markdown float xformOp:rotateX = 30 float xformOp:rotateY = 60 float xformOp:rotateZ = 90 float3 xformOp:scale = (2, 2, 2) double3 xformOp:translate = (0, 100, 0) uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateZ", "xformOp:rotateY", "xformOp:rotateX", "xformOp:scale" ] ``` Again, note that although we are encoding an XYZ rotation, the three rotations appear in the **xformOpOrder** in the opposite order, with Z, followed, by Y, followed by X. Were we to add a Maya-style scalePivot to the above example, it might look like the following: ```markdown float3 xformOp:rotateXYZ = (30, 60, 90) float3 xformOp:scale = (2, 2, 2) double3 xformOp:translate = (0, 100, 0) double3 xformOp:translate:scalePivot uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:translate:scalePivot", "xformOp:scale" ] ``` **Paired "Inverted" Ops** We have been claiming that the ordered list of ops serves as a set of instructions to a transform stack, but you may have noticed in the last example that there is a missing operation - the pivot for the scale op needs to be applied in its inverse-form as a final (most local) op! In the AbcGeom::Xform schema, we would have encoded an actual "final" translation op whose value was authored by the exporter as the negation of the pivot's value. However, doing so would be brittle in USD, given that each op can be independently overridden, and the constraint that one attribute must be maintained as the negation of the other in order for successful re-importation of the schema cannot be expressed in USD. Our solution leverages the **xformOpOrder** member of the schema, which, in addition to ordering the ops, may also contain one of two special tokens that address the paired op and "stack resetting" behavior. The "paired op" behavior is encoded as an "!invert!" prefix in **xformOpOrder**, as the result of an AddXformOp(isInverseOp=True) call. The **xformOpOrder** for the last example would look like: ```markdown uniform token[] xformOpOrder = [ "xformOp:translate", "xformOp:rotateXYZ", "xformOp:translate:scalePivot", "xformOp:scale", "!invert!xformOp:translate:scalePivot" ] ``` When asked for its value via UsdGeomXformOp::GetOpTransform(), an "inverted" Op (i.e. the "inverted" half of a set of paired Ops) will fetch the value of its paired attribute and return its negation. This works for all op types - an error will be issued if a "transform" type op is singular and cannot be inverted. When getting the authored value of an inverted op via UsdGeomXformOp::Get(), the raw, uninverted value of the associated attribute is returned. For the sake of robustness, **setting a value on an inverted op is disallowed.** Attempting to set a value on an inverted op will result in a coding error and no value being set. **Resetting the Transform Stack** The other special op/token that can appear in *xformOpOrder* is *"!resetXformStack!"*, which, appearing as the first element of *xformOpOrder*, indicates this prim should not inherit the transformation of its namespace parent. See SetResetXformStack() **Expected Behavior for "Missing" Ops** If an importer expects Scale-Rotate-Translate operations, but a prim has only translate and rotate ops authored, the importer should assume an identity scale. This allows us to optimize the data a bit, if only a few components of a very rich schema (like Maya's) are authored in the app. **Using the C++ API** #1. Creating a simple transform matrix encoding #2. Creating the simple SRT from the example above #3. Creating a parameterized SRT with pivot using UsdGeomXformCommonAPI #4. Creating a rotate-only pivot transform with animated rotation and translation | AddOrientOp (precision, opSuffix, isInverseOp) | Add a orient op (arbitrary axis/angle rotation) to the local stack represented by this xformable. | |-----------------------------------------------|--------------------------------------------------------| | AddRotateXOp (precision, opSuffix, isInverseOp) | Add a rotation about the X-axis to the local stack represented by this xformable. | | AddRotateXYZOp (precision, opSuffix, isInverseOp) | Add a rotation op with XYZ rotation order to the local stack represented by this xformable. | | AddRotateXZYOp (precision, opSuffix, isInverseOp) | Add a rotation op with XZY rotation order to the local stack represented by this xformable. | | AddRotateYOp (precision, opSuffix, isInverseOp) | Add a rotation about the YX-axis to the local stack represented by this xformable. | | AddRotateYXZOp (precision, opSuffix, isInverseOp) | Add a rotation op with YXZ rotation order to the local stack represented by this xformable. | | AddRotateYZXOp (precision, opSuffix, isInverseOp) | Add a rotation op with YZX rotation order to the local stack represented by this xformable. | | AddRotateZOp (precision, opSuffix, isInverseOp) | Add a rotation about the Z-axis to the local stack represented by this xformable. | | AddRotateZXYOp (precision, opSuffix, isInverseOp) | Add a rotation op with ZXY rotation order to the local stack represented by this xformable. | | AddRotateZYXOp (precision, opSuffix, isInverseOp) | Add a rotation op with ZYX rotation order to the local stack represented by this xformable. | | AddScaleOp (precision, opSuffix, isInverseOp) | Add a scale operation to the local stack represented by this xformable. | | AddTransformOp (precision, opSuffix, isInverseOp) | Add a tranform op (4x4 matrix transformation) to the local stack represented by this xformable. | | AddTranslateOp (precision, opSuffix, isInverseOp) | Add a translate operation to the local stack represented by this xformable. | | AddXformOp (opType, precision, opSuffix, ...) | Add an affine transformation to the local stack represented by this Xformable. | | ClearXformOpOrder | Clear the order of xform operations on this xformable. | | 方法 | 描述 | | --- | --- | | ClearXformOpOrder | Clears the local transform stack. | | CreateXformOpOrderAttr(defaultValue, ...) | See GetXformOpOrderAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | Get | classmethod Get(stage, path) -> Xformable | | GetLocalTransformation | Compute the fully-combined, local-to-parent transformation for this prim. | | GetOrderedXformOps | Return the ordered list of transform operations to be applied to this prim, in least-to-most-local order. | | GetResetXformStack | Does this prim reset its parent's inherited transformation? | | GetSchemaAttributeNames | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | GetTimeSamples | classmethod GetTimeSamples(times) -> bool | | GetTimeSamplesInInterval | classmethod GetTimeSamplesInInterval(interval, times) -> bool | | GetXformOpOrderAttr | Encodes the sequence of transformation operations in the order in which they should be pushed onto a transform stack while visiting a UsdStage's prims in a graph traversal that will effect the desired positioning for this prim and its descendant prims. | | IsTransformationAffectedByAttrNamed | classmethod IsTransformationAffectedByAttrNamed(attrName) -> bool | | MakeMatrixXform | Clears the existing local transform stack and creates a new xform op of type'transform'. | | SetResetXformStack(resetXform) | Specify whether this prim's transform should reset the transformation stack inherited from its parent prim. | | SetXformOpOrder(orderedXformOps, resetXformStack) | Reorder the already-existing transform ops on this prim. | <span class="pre"> TransformMightBeTimeVarying () <td> <p> Determine whether there is any possibility that this prim's <em> local transformation may vary over time. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Xformable.AddOrientOp"> <span class="sig-name descname"> <span class="pre"> AddOrientOp <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> precision , <em class="sig-param"> <span class="n"> <span class="pre"> opSuffix , <em class="sig-param"> <span class="n"> <span class="pre"> isInverseOp <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> XformOp <a class="headerlink" href="#pxr.UsdGeom.Xformable.AddOrientOp" title="Permalink to this definition">  <dd> <p> Add a orient op (arbitrary axis/angle rotation) to the local stack represented by this xformable. <p> AddXformOp() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> precision ( <em> XformOp.Precision ) – <li> <p> <strong> opSuffix ( <em> str ) – <li> <p> <strong> isInverseOp ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Xformable.AddRotateXOp"> <span class="sig-name descname"> <span class="pre"> AddRotateXOp <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> precision , <em class="sig-param"> <span class="n"> <span class="pre"> opSuffix , <em class="sig-param"> <span class="n"> <span class="pre"> isInverseOp <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> XformOp <a class="headerlink" href="#pxr.UsdGeom.Xformable.AddRotateXOp" title="Permalink to this definition">  <dd> <p> Add a rotation about the X-axis to the local stack represented by this xformable. <p> Set the angle value of the resulting UsdGeomXformOp <strong> in degrees <p> AddXformOp() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> precision ( <em> XformOp.Precision ) – <li> <p> <strong> opSuffix ( <em> str ) – <li> <p> <strong> isInverseOp ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdGeom.Xformable.AddRotateXYZOp"> <span class="sig-name descname"> <span class="pre"> AddRotateXYZOp <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> precision , <em class="sig-param"> <span class="n"> <span class="pre"> opSuffix , <em class="sig-param"> <span class="n"> <span class="pre"> isInverseOp <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> XformOp <a class="headerlink" href="#pxr.UsdGeom.Xformable.AddRotateXYZOp" title="Permalink to this definition">  <dd> <p> Add a rotation op with XYZ rotation order to the local stack represented by this xformable. <p> Set the angle value of the resulting UsdGeomXformOp <strong> in degrees <p> AddXformOp() , note on angle packing order <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> precision ( <em> XformOp.Precision ) – <li> <p> <strong> opSuffix ( <em> str ) – <li> <p> <strong> isInverseOp ( <em> bool ) – ### AddRotateXZYOp Add a rotation op with XZY rotation order to the local stack represented by this xformable. Set the angle values of the resulting UsdGeomXformOp **in degrees** AddXformOp() , note on angle packing order **Parameters** - **precision** (XformOp.Precision) – - **opSuffix** (str) – - **isInverseOp** (bool) – ### AddRotateYOp Add a rotation about the YX-axis to the local stack represented by this xformable. Set the angle value of the resulting UsdGeomXformOp **in degrees** AddXformOp() **Parameters** - **precision** (XformOp.Precision) – - **opSuffix** (str) – - **isInverseOp** (bool) – ### AddRotateYXZOp Add a rotation op with YXZ rotation order to the local stack represented by this xformable. Set the angle values of the resulting UsdGeomXformOp **in degrees** AddXformOp() , note on angle packing order **Parameters** - **precision** (XformOp.Precision) – - **opSuffix** (str) – - **isInverseOp** (bool) – ### AddRotateYZXOp ```python AddRotateYZXOp(precision, opSuffix, isInverseOp) -> XformOp ``` Add a rotation op with YZX rotation order to the local stack represented by this xformable. Set the angle values of the resulting UsdGeomXformOp in degrees. #### Parameters - **precision** (XformOp.Precision) – - **opSuffix** (str) – - **isInverseOp** (bool) – ### AddRotateZOp ```python AddRotateZOp(precision, opSuffix, isInverseOp) -> XformOp ``` Add a rotation about the Z-axis to the local stack represented by this xformable. #### Parameters - **precision** (XformOp.Precision) – - **opSuffix** (str) – - **isInverseOp** (bool) – ### AddRotateZXYOp ```python AddRotateZXYOp(precision, opSuffix, isInverseOp) -> XformOp ``` Add a rotation op with ZXY rotation order to the local stack represented by this xformable. Set the angle values of the resulting UsdGeomXformOp in degrees. #### Parameters - **precision** (XformOp.Precision) – - **opSuffix** (str) – - **isInverseOp** (bool) – ### AddRotateZYXOp Add a rotation op with ZYX rotation order to the local stack represented by this xformable. Set the angle values of the resulting UsdGeomXformOp **in degrees**. AddXformOp() , note on angle packing order **Parameters** - **precision** (XformOp.Precision) – - **opSuffix** (str) – - **isInverseOp** (bool) – ### AddScaleOp Add a scale operation to the local stack represented by this xformable. AddXformOp() **Parameters** - **precision** (XformOp.Precision) – - **opSuffix** (str) – - **isInverseOp** (bool) – ### AddTransformOp Add a tranform op (4x4 matrix transformation) to the local stack represented by this xformable. AddXformOp() Note: This method takes a precision argument only to be consistent with the other types of xformOps. The only valid precision here is double since matrix values cannot be encoded in floating-pt precision in Sdf. **Parameters** - **precision** (XformOp.Precision) – - **opSuffix** (str) – - **isInverseOp** (bool) – ### AddTranslateOp ```python AddTranslateOp(precision, opSuffix, isInverseOp) ``` - Returns: XformOp **Description:** Add a translate operation to the local stack represented by this xformable. **Parameters:** - **precision** (XformOp.Precision) - **opSuffix** (str) - **isInverseOp** (bool) ### AddXformOp ```python AddXformOp(opType, precision, opSuffix, isInverseOp) ``` - Returns: XformOp **Description:** Add an affine transformation to the local stack represented by this Xformable. **Parameters:** - **opType** (XformOp.Type) - **precision** (XformOp.Precision) - **opSuffix** (str) - **isInverseOp** (bool) ### ClearXformOpOrder ```python ClearXformOpOrder() ``` - Returns: bool **Description:** Clears the local transform stack. ## CreateXformOpOrderAttr See GetXformOpOrderAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## Get **classmethod** Get(stage, path) -> Xformable Return a UsdGeomXformable holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdGeomXformable(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ## GetLocalTransformation Compute the fully-combined, local-to-parent transformation for this prim. If a client does not need to manipulate the individual ops themselves, and requires only the combined transform on this prim, this method will take care of all the data marshalling and linear algebra needed to combine the ops into a 4x4 affine transformation matrix, in double-precision, regardless of the precision of the op inputs. The python version of this function only returns the computed local-to-parent transformation. Clients must independently call GetResetXformStack() to be able to construct the local-to-world transformation. ## GetOrderedXformOps Return the ordered list of transform operations to be applied to this prim, in least-to-most-local order. This is determined by the intersection of authored op-attributes and the explicit ordering of those attributes encoded in the “xformOpOrder” attribute on this prim. Any entries in “xformOpOrder” that do not correspond to valid attributes on the xformable prim are skipped and a warning is issued. A UsdGeomTransformable that has not had any ops added via AddXformOp() will return an empty vector. The python version of this function only returns the ordered list of xformOps. Clients must independently call GetResetXformStack() if they need the info. ### GetResetXformStack ( ) → bool Does this prim reset its parent’s inherited transformation? Returns true if "!resetXformStack!" appears anywhere in xformOpOrder. When this returns true, all ops upto the last "!resetXformStack!" in xformOpOrder are ignored when computing the local transformation. ### GetSchemaAttributeNames ( ) **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – ### GetTimeSamples ( ) **classmethod** GetTimeSamples(times) -> bool Sets `times` to the union of all the timesamples at which xformOps that are included in the xformOpOrder attribute are authored. This clears the `times` vector before accumulating sample times from all the xformOps. **Parameters** - **times** (list[float]) – ### GetTimeSamplesInInterval ( ) **classmethod** GetTimeSamplesInInterval(interval, times) -> bool Sets `times` to the union of all the timesamples in the interval, `interval`, at which xformOps that are included in the xformOpOrder attribute are authored. This clears the `times` vector before accumulating sample times from all the xformOps. **Parameters** - **interval** (Interval) – - **times** (list[float]) – - **orderedXformOps** (list [XformOp]) – - **interval** (Interval) – - **times** (list [float]) – ``` ```markdown GetTimeSamplesInInterval(orderedXformOps, interval, times) -> bool ``` ```markdown Returns the union of all the timesamples in the interval at which the attributes belonging to the given orderedXformOps are authored. ``` ```markdown This clears the times vector before accumulating sample times from orderedXformOps. ``` ```markdown UsdGeomXformable::GetTimeSamplesInInterval ``` ```markdown Parameters ``` ```markdown - **orderedXformOps** (list [XformOp]) – - **interval** (Interval) – - **times** (list [float]) – ``` ```markdown GetXformOpOrderAttr() -> Attribute ``` ```markdown Encodes the sequence of transformation operations in the order in which they should be pushed onto a transform stack while visiting a UsdStage’s prims in a graph traversal that will effect the desired positioning for this prim and its descendant prims. ``` ```markdown You should rarely, if ever, need to manipulate this attribute directly. It is managed by the AddXformOp(), SetResetXformStack(), and SetXformOpOrder(), and consulted by GetOrderedXformOps() and GetLocalTransformation(). ``` ```markdown Declaration ``` ```markdown uniform token[] xformOpOrder ``` ```markdown C++ Type ``` ```markdown VtArray<TfToken> ``` ```markdown Usd Type ``` ```markdown SdfValueTypeNames->TokenArray ``` ```markdown Variability ``` ```markdown SdfVariabilityUniform ``` ```markdown static classmethod IsTransformationAffectedByAttrNamed(attrName) -> bool ``` ```markdown Returns true if the attribute named attrName could affect the local transformation of an xformable prim. ``` ```markdown Parameters ``` ```markdown - attrName (str) – ``` ```markdown MakeMatrixXform() -> XformOp ``` ```markdown Clears the existing local transform stack and creates a new xform op of type’transform’. ``` ```markdown This API is provided for convenience since this is the most common xform authoring operation. ``` ```markdown ClearXformOpOrder() ``` ```markdown AddTransformOp() ``` ```markdown SetResetXformStack(resetXform) -> ... ``` <span class="sig-return-typehint"> <span class="pre"> bool <dt> <dd> <p> Specify whether this prim’s transform should reset the transformation stack inherited from its parent prim. <p> By default, parent transforms are inherited. SetResetXformStack() can be called at any time during authoring, but will always add a 'resetXformStack' op as the first op in the ordered list, if one does not exist already. If one already exists, and resetXform is false, it will remove all ops upto and including the last 'resetXformStack' op. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> resetXform ( <em> bool ) – <dt> <dd> <p> Reorder the already-existing transform ops on this prim. <p> All elements in orderedXformOps must be valid and represent attributes on this prim. Note that it is not required that all the existing operations be present in orderedXformOps, so this method can be used to completely change the transformation structure applied to the prim. <p> If resetXformStack is set to true, then 'resetXformOp will be set as the first op in xformOpOrder, to indicate that the prim does not inherit its parent’s transformation. <p> If you wish to re-specify a prim’s transformation completely in a stronger layer, you should first call this method with an empty orderedXformOps vector. From there you can call AddXformOp() just as if you were authoring to the prim from scratch. <p> false if any of the elements of orderedXformOps are not extant on this prim, or if an error occurred while authoring the ordering metadata. Under either condition, no scene description is authored. <p> GetOrderedXformOps() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> orderedXformOps ( <em> list <em> [ <em> XformOp <em> ] ) – <li> <p> <strong> resetXformStack ( <em> bool ) – <dt> <dd> <p> Determine whether there is any possibility that this prim’s local transformation may vary over time. <p> The determination is based on a snapshot of the authored state of the op attributes on the prim, and may become invalid in the face of further authoring. <hr /> <p> TransformMightBeTimeVarying(ops) -> bool <p> This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Determine whether there is any possibility that this prim’s local transformation may vary over time, using a pre-fetched (cached) list of ordered xform ops supplied by the client. <p> The determination is based on a snapshot of the authored state of the op attributes on the prim, and may become invalid in the face of further authoring. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> ops ( <em> list <em> [ <em> XformOp <em> ] ) –
498,274
UsdHydra.md
# UsdHydra module Summary: The UsdHydra module. ## Classes: | Class | Description | |-------|-------------| | GenerativeProceduralAPI | This API extends and configures the core UsdProcGenerativeProcedural schema defined within usdProc for use with hydra generative procedurals as defined within hdGp. | | Tokens | | ## GenerativeProceduralAPI This API extends and configures the core UsdProcGenerativeProcedural schema defined within usdProc for use with hydra generative procedurals as defined within hdGp. For any described attribute *Fallback*, *Value*, or *Allowed* *Values* below that are text/tokens, the actual token is published and defined in UsdHydraTokens. So to set an attribute to the value "rightHanded", use UsdHydraTokens->rightHanded as the value. ### Methods: | Method | Description | |--------|-------------| | Apply | **classmethod** Apply(prim) -> GenerativeProceduralAPI | | CanApply | **classmethod** CanApply(prim, whyNot) -> bool | | CreateProceduralSystemAttr | See GetProceduralSystemAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateProceduralTypeAttr | | <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateProceduralTypeAttr (defaultValue, ...) See GetProceduralTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> Get classmethod Get(stage, path) -> GenerativeProceduralAPI <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetProceduralSystemAttr () This value should correspond to a configured instance of HdGpGenerativeProceduralResolvingSceneIndex which will evaluate the procedural. <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetProceduralTypeAttr () The registered name of a HdGpGenerativeProceduralPlugin to be executed. <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetSchemaAttributeNames classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Apply <span class="sig-paren"> () classmethod Apply(prim) -> GenerativeProceduralAPI Applies this single-apply API schema to the given prim. This information is stored by adding "HydraGenerativeProceduralAPI" to the token-valued, listOp metadata apiSchemas on the prim. A valid UsdHydraGenerativeProceduralAPI object is returned upon success. An invalid (or empty) UsdHydraGenerativeProceduralAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters prim (Prim) – <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> CanApply <span class="sig-paren"> () classmethod CanApply(prim, whyNot) -> bool Returns true if this single-apply API schema can be applied to the given prim. If this schema can not be a applied to the prim, this returns false and, if provided, populates whyNot with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters prim (Prim) – whyNot (str) – ## CreateProceduralSystemAttr ```CreateProceduralSystemAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See GetProceduralSystemAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateProceduralTypeAttr ```CreateProceduralTypeAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See GetProceduralTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## Get ```static``` ```Get```() ```classmethod``` Get(stage, path) -> GenerativeProceduralAPI Return a UsdHydraGenerativeProceduralAPI holding the prim adhering to this schema at ```path``` on ```stage```. If no prim exists at ```path``` on ```stage```, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdHydraGenerativeProceduralAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetProceduralSystemAttr ``` → Attribute ``` This value should correspond to a configured instance of HdGpGenerativeProceduralResolvingSceneIndex which will evaluate the procedural. The default value of "hydraGenerativeProcedural" matches the equivalent default of HdGpGenerativeProceduralResolvingSceneIndex. Multiple instances of the scene index can be used to determine where within a scene index chain a given procedural will be evaluated. Declaration ``` token proceduralSystem = "hydraGenerativeProcedural" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token ``` ### GetProceduralTypeAttr ``` → Attribute ``` The registered name of a HdGpGenerativeProceduralPlugin to be executed. Declaration ``` token primvars:hdGp:proceduralType ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token ``` ### GetSchemaAttributeNames ``` classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters ``` includeInherited (bool) – ``` ### pxr.UsdHydra.Tokens Attributes: ``` HwPrimvar_1 HwPtexTexture_1 HwUvTexture_1 black clamp displayLookBxdf ``` - `displayLookBxdf` - `faceIndex` - `faceOffset` - `frame` - `hydraGenerativeProcedural` - `infoFilename` - `infoVarname` - `linear` - `linearMipmapLinear` - `linearMipmapNearest` - `magFilter` - `minFilter` - `mirror` - `nearest` - `nearestMipmapLinear` - `nearestMipmapNearest` - `primvarsHdGpProceduralType` - `proceduralSystem` - `repeat` <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> repeat <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdHydra.Tokens.textureMemory" title="pxr.UsdHydra.Tokens.textureMemory"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> textureMemory <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdHydra.Tokens.useMetadata" title="pxr.UsdHydra.Tokens.useMetadata"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> useMetadata <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdHydra.Tokens.uv" title="pxr.UsdHydra.Tokens.uv"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> uv <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdHydra.Tokens.wrapS" title="pxr.UsdHydra.Tokens.wrapS"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> wrapS <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdHydra.Tokens.wrapT" title="pxr.UsdHydra.Tokens.wrapT"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> wrapT <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.HwPrimvar_1"> <span class="sig-name descname"> <span class="pre"> HwPrimvar_1 <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'HwPrimvar_1' <a class="headerlink" href="#pxr.UsdHydra.Tokens.HwPrimvar_1" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.HwPtexTexture_1"> <span class="sig-name descname"> <span class="pre"> HwPtexTexture_1 <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'HwPtexTexture_1' <a class="headerlink" href="#pxr.UsdHydra.Tokens.HwPtexTexture_1" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.HwUvTexture_1"> <span class="sig-name descname"> <span class="pre"> HwUvTexture_1 <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'HwUvTexture_1' <a class="headerlink" href="#pxr.UsdHydra.Tokens.HwUvTexture_1" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.black"> <span class="sig-name descname"> <span class="pre"> black <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'black' <a class="headerlink" href="#pxr.UsdHydra.Tokens.black" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.clamp"> <span class="sig-name descname"> <span class="pre"> clamp <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'clamp' <a class="headerlink" href="#pxr.UsdHydra.Tokens.clamp" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.displayLookBxdf"> <span class="sig-name descname"> <span class="pre"> displayLookBxdf <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'displayLook:bxdf' <a class="headerlink" href="#pxr.UsdHydra.Tokens.displayLookBxdf" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.faceIndex"> <span class="sig-name descname"> <span class="pre"> faceIndex <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'faceIndex' <a class="headerlink" href="#pxr.UsdHydra.Tokens.faceIndex" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.faceOffset"> <span class="sig-name descname"> <span class="pre"> faceOffset <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'faceOffset' <a class="headerlink" href="#pxr.UsdHydra.Tokens.faceOffset" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.frame"> frame = 'frame' hydraGenerativeProcedural = 'hydraGenerativeProcedural' infoFilename = 'inputs:file' infoVarname = 'inputs:varname' linear = 'linear' linearMipmapLinear = 'linearMipmapLinear' linearMipmapNearest = 'linearMipmapNearest' magFilter = 'magFilter' minFilter = 'minFilter' mirror = 'mirror' nearest = 'nearest' nearestMipmapLinear = 'nearestMipmapLinear' <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.nearestMipmapNearest"> <span class="sig-name descname"> <span class="pre"> nearestMipmapNearest <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'nearestMipmapNearest' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.primvarsHdGpProceduralType"> <span class="sig-name descname"> <span class="pre"> primvarsHdGpProceduralType <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'primvars:hdGp:proceduralType' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.proceduralSystem"> <span class="sig-name descname"> <span class="pre"> proceduralSystem <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'proceduralSystem' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.repeat"> <span class="sig-name descname"> <span class="pre"> repeat <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'repeat' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.textureMemory"> <span class="sig-name descname"> <span class="pre"> textureMemory <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'textureMemory' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.useMetadata"> <span class="sig-name descname"> <span class="pre"> useMetadata <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'useMetadata' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.uv"> <span class="sig-name descname"> <span class="pre"> uv <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'uv' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.wrapS"> <span class="sig-name descname"> <span class="pre"> wrapS <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'wrapS' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdHydra.Tokens.wrapT"> <span class="sig-name descname"> <span class="pre"> wrapT <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'wrapT' <dd>
15,568
UsdLux.md
# UsdLux module Summary: The UsdLux module provides a representation for lights and related components that are common to many graphics environments. ## Classes: - `BoundableLightBase`: Base class for intrinsic lights that are boundable. - `CylinderLight`: Light emitted outward from a cylinder. - `DiskLight`: Light emitted from one side of a circular disk. - `DistantLight`: Light emitted from a distant source along the -Z axis. - `DomeLight`: Light emitted inward from a distant external environment, such as a sky or IBL light probe. - `GeometryLight`: Deprecated - `LightAPI`: API schema that imparts the quality of being a light onto a prim. - `LightFilter`: A light filter modifies the effect of a light. - `LightListAPI`: API schema to support discovery and publishing of lights in a scene. - `ListAPI`: Deprecated - `MeshLightAPI`: This is the preferred API schema to apply to Mesh type prims when adding light behaviors to a mesh. - `NonboundableLightBase`: Base class for intrinsic lights that are not boundable. | Class Name | Description | |---------------------|--------------------------------------------------------------------------------------------------| | PluginLight | Light that provides properties that allow it to identify an external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be provided to render delegates without the need to provide a schema definition for the light's type. | | PluginLightFilter | Light filter that provides properties that allow it to identify an external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be provided to render delegates without the need to provide a schema definition for the light filter's type. | | PortalLight | A rectangular portal in the local XY plane that guides sampling of a dome light. | | RectLight | Light emitted from one side of a rectangle. | | ShadowAPI | Controls to refine a light's shadow behavior. | | ShapingAPI | Controls for shaping a light's emission. | | SphereLight | Light emitted outward from a sphere. | | Tokens | | | VolumeLightAPI | This is the preferred API schema to apply to Volume type prims when adding light behaviors to a volume. | ### BoundableLightBase Base class for intrinsic lights that are boundable. The primary purpose of this class is to provide a direct API to the functions provided by LightAPI for concrete derived light types. **Methods:** - `CreateColorAttr(defaultValue, writeSparsely)` - See UsdLuxLightAPI::CreateColorAttr(). - `CreateColorTemperatureAttr(defaultValue, ...)` - See UsdLuxLightAPI::CreateColorTemperatureAttr(). - `CreateDiffuseAttr(defaultValue, writeSparsely)` - See UsdLuxLightAPI::CreateDiffuseAttr(). - `CreateEnableColorTemperatureAttr(...)` - See UsdLuxLightAPI::CreateEnableColorTemperatureAttr(). - `CreateExposureAttr(defaultValue, writeSparsely)` - See UsdLuxLightAPI::CreateExposureAttr(). - `CreateFiltersRel()` - See UsdLuxLightAPI::CreateFiltersRel(). - `CreateIntensityAttr(defaultValue, writeSparsely)` - See UsdLuxLightAPI::CreateIntensityAttr(). - `CreateNormalizeAttr(defaultValue, writeSparsely)` - See UsdLuxLightAPI::CreateNormalizeAttr(). - `CreateSpecularAttr(defaultValue, writeSparsely)` - See UsdLuxLightAPI::CreateSpecularAttr(). | Method | Description | | --- | --- | | `Get(stage, path) -> BoundableLightBase` | classmethod | | `GetColorAttr()` | See UsdLuxLightAPI::GetColorAttr() | | `GetColorTemperatureAttr()` | See UsdLuxLightAPI::GetColorTemperatureAttr() | | `GetDiffuseAttr()` | See UsdLuxLightAPI::GetDiffuseAttr() | | `GetEnableColorTemperatureAttr()` | See UsdLuxLightAPI::GetEnableColorTemperatureAttr() | | `GetExposureAttr()` | See UsdLuxLightAPI::GetExposureAttr() | | `GetFiltersRel()` | See UsdLuxLightAPI::GetFiltersRel() | | `GetIntensityAttr()` | See UsdLuxLightAPI::GetIntensityAttr() | | `GetNormalizeAttr()` | See UsdLuxLightAPI::GetNormalizeAttr() | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | classmethod | | `GetSpecularAttr()` | See UsdLuxLightAPI::GetSpecularAttr() | | `LightAPI()` | Constructs and returns a UsdLuxLightAPI object for this light. | ### CreateColorAttr(defaultValue, writeSparsely) -> Attribute See UsdLuxLightAPI::CreateColorAttr(). - **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateColorTemperatureAttr(defaultValue, writeSparsely) -> Attribute See UsdLuxLightAPI::CreateColorTemperatureAttr(). - **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateDiffuseAttr ```CreateDiffuseAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See UsdLuxLightAPI::CreateDiffuseAttr(). ### Parameters - ```defaultValue``` (```VtValue```) – - ```writeSparsely``` (```bool```) – ## CreateEnableColorTemperatureAttr ```CreateEnableColorTemperatureAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See UsdLuxLightAPI::CreateEnableColorTemperatureAttr(). ### Parameters - ```defaultValue``` (```VtValue```) – - ```writeSparsely``` (```bool```) – ## CreateExposureAttr ```CreateExposureAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See UsdLuxLightAPI::CreateExposureAttr(). ### Parameters - ```defaultValue``` (```VtValue```) – - ```writeSparsely``` (```bool```) – ## CreateFiltersRel ```CreateFiltersRel```() → ```Relationship``` See UsdLuxLightAPI::CreateFiltersRel(). ## CreateIntensityAttr ```CreateIntensityAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See UsdLuxLightAPI::CreateIntensityAttr(). ### Parameters - ```defaultValue``` (```VtValue```) – - ```writeSparsely``` (```bool```) – ## CreateNormalizeAttr ```python CreateNormalizeAttr(defaultValue, writeSparsely) -> Attribute ``` See UsdLuxLightAPI::CreateNormalizeAttr(). ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateSpecularAttr ```python CreateSpecularAttr(defaultValue, writeSparsely) -> Attribute ``` See UsdLuxLightAPI::CreateSpecularAttr(). ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## Get ```python classmethod Get(stage, path) -> BoundableLightBase ``` Return a UsdLuxBoundableLightBase holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdLuxBoundableLightBase(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ## GetColorAttr ```python GetColorAttr() -> Attribute ``` See UsdLuxLightAPI::GetColorAttr(). ## GetColorTemperatureAttr ```python GetColorTemperatureAttr() -> Attribute ``` See UsdLuxLightAPI::GetColorTemperatureAttr(). ## GetDiffuseAttr ```python GetDiffuseAttr() -> Attribute ``` See UsdLuxLightAPI::GetDiffuseAttr(). → Attribute See UsdLuxLightAPI::GetDiffuseAttr() . → Attribute See UsdLuxLightAPI::GetEnableColorTemperatureAttr() . → Attribute See UsdLuxLightAPI::GetExposureAttr() . → Relationship See UsdLuxLightAPI::GetFiltersRel() . → Attribute See UsdLuxLightAPI::GetIntensityAttr() . → Attribute See UsdLuxLightAPI::GetNormalizeAttr() . static GetSchemaAttributeNames() **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters **includeInherited** (bool) – → Attribute See UsdLuxLightAPI::GetSpecularAttr() . → LightAPI Contructs and returns a UsdLuxLightAPI object for this light. class pxr.UsdLux.CylinderLight Light emitted outward from a cylinder. The cylinder is centered at the origin and has its major axis on the X axis. The cylinder does not emit light from the flat end-caps. **Methods:** | Method | Description | |--------|-------------| | `CreateLengthAttr(defaultValue, writeSparsely)` | See GetLengthAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateRadiusAttr(defaultValue, writeSparsely)` | See GetRadiusAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateTreatAsLineAttr(defaultValue, ...)` | See GetTreatAsLineAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `Define(stage, path) -> CylinderLight` | classmethod | | `Get(stage, path) -> CylinderLight` | classmethod | | `GetLengthAttr()` | Width of the rectangle, in the local X axis. | | `GetRadiusAttr()` | Radius of the cylinder. | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | classmethod | | `GetTreatAsLineAttr()` | A hint that this light can be treated as a 'line' light (effectively, a zero-radius cylinder) by renderers that benefit from non-area lighting. | ### CreateLengthAttr(defaultValue, writeSparsely) - **Description:** See GetLengthAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. - **Parameters:** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateRadiusAttr(defaultValue, writeSparsely) - **Description:** See GetRadiusAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. - **Parameters:** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateTreatAsLineAttr ```python CreateTreatAsLineAttr(defaultValue, writeSparsely) -> Attribute ``` See GetTreatAsLineAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### Define ```python classmethod Define(stage, path) -> CylinderLight ``` Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### Get ```python classmethod Get(stage, path) -> CylinderLight ``` Return a UsdLuxCylinderLight holding the prim adhering to this schema at `path`. <code class="docutils literal notranslate"> <span class="pre"> path on <code class="docutils literal notranslate"> <span class="pre"> stage . <p> If no prim exists at <code class="docutils literal notranslate"> <span class="pre"> path on <code class="docutils literal notranslate"> <span class="pre"> stage , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: <div class="highlight-text notranslate"> <div class="highlight"> <pre><span> <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> stage ( <em> Stage ) – <li> <p> <strong> path ( <em> Path ) – <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> GetLengthAttr <span class="sig-paren"> () <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <dd> <p> Width of the rectangle, in the local X axis. <p> Declaration <p> <code class="docutils literal notranslate"> <span class="pre"> float <span class="pre"> inputs:length <span class="pre"> = <span class="pre"> 1 <p> C++ Type <p> float <p> Usd Type <p> SdfValueTypeNames-&gt;Float <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> GetRadiusAttr <span class="sig-paren"> () <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <dd> <p> Radius of the cylinder. <p> Declaration <p> <code class="docutils literal notranslate"> <span class="pre"> float <span class="pre"> inputs:radius <span class="pre"> = <span class="pre"> 0.5 <p> C++ Type <p> float <p> Usd Type <p> SdfValueTypeNames-&gt;Float <dl class="py method"> <dt class="sig sig-object py"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> GetSchemaAttributeNames <span class="sig-paren"> () <dd> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <p> Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. <p> Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> includeInherited ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> GetTreatAsLineAttr <span class="sig-paren"> () <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <dd> <p> A hint that this light can be treated as a’line’light (effectively, a zero-radius cylinder) by renderers that benefit from non-area lighting. <p> Renderers that only support area lights can disregard this. <p> Declaration <p> <code class="docutils literal notranslate"> <span class="pre"> bool <span class="pre"> treatAsLine <span class="pre"> = <span class="pre"> 0 <p> C++ Type <p> bool <p> Usd Type <p> SdfValueTypeNames-&gt;Bool | 方法名 | 描述 | | --- | --- | | `CreateRadiusAttr(defaultValue, writeSparsely)` | 参见 GetRadiusAttr(),以及创建与获取属性方法的使用时机。 | | `Define(stage, path) -> DiskLight` | 类方法,尝试确保在指定路径上定义一个遵循此架构的 UsdPrim。 | | `Get(stage, path) -> DiskLight` | 类方法,获取指定路径上的 DiskLight。 | | `GetRadiusAttr()` | 磁盘的半径。 | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | 类方法,获取架构属性名称。 | ### CreateRadiusAttr(defaultValue, writeSparsely) 参见 GetRadiusAttr(),以及创建与获取属性方法的使用时机。 如果指定,将 `defaultValue` 作为属性的默认值,如果 `writeSparsely` 为 `true`,则稀疏地(在合理的情况下)写入。默认情况下,`writeSparsely` 为 `false`。 **参数:** - **defaultValue** (VtValue) - **writeSparsely** (bool) ### Define(stage, path) -> DiskLight 类方法,尝试确保在指定路径上定义一个遵循此架构的 UsdPrim。 如果指定路径上已经定义了遵循此架构的 Prim,则返回该 Prim。否则,为 Prim 在当前编辑目标上创建一个 SdfPrimSpec,指定符为 SdfSpecifierDef,架构的 Prim 类型名为路径。为任何不存在或已存在但未定义的祖先创建指定符为 SdfSpecifierDef 且类型名为空的 SdfPrimSpec。 给定的路径必须是绝对 Prim 路径,不包含任何变体选择。 如果无法创建必要的 PrimSpecs(例如,路径无法映射到当前 UsdEditTarget 的命名空间),则发出错误并返回无效的 UsdPrim。 注意,此方法可能返回一个定义的 Prim,其类型名未指定此架构类,如果更强的类型名意见覆盖了当前编辑目标的意见。 **参数:** - **stage** (Stage) - **path** (str) <em> <a> ) – <li> <p> <strong> path ( <em> Path ) – <dl class="py method"> <dt class="sig sig-object py"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Get <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod Get(stage, path) -&gt; DiskLight <p> Return a UsdLuxDiskLight holding the prim adhering to this schema at <code> path on <code> stage . <p> If no prim exists at <code> path on <code> stage , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: <div class="highlight"> <pre>UsdLuxDiskLight(stage-&gt;GetPrimAtPath(path)); <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> stage ( <em> Stage ) – <li> <p> <strong> path ( <em> Path ) – <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> GetRadiusAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> Radius of the disk. <p> Declaration <p> <code> float inputs:radius = 0.5 <p> C++ Type <p> float <p> Usd Type <p> SdfValueTypeNames-&gt;Float <dl class="py method"> <dt class="sig sig-object py"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> GetSchemaAttributeNames <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <p> Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. <p> Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> includeInherited ( <em> bool ) – <dl class="py class"> <dt class="sig sig-object py"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.UsdLux. <span class="sig-name descname"> <span class="pre"> DistantLight <dd> <p> Light emitted from a distant source along the -Z axis. Also known as a directional light. <p> <strong> Methods: <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code> CreateAngleAttr(defaultValue, writeSparsely) <td> <p> See GetAngleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <code> Define(stage, path) <td> <p> <strong> classmethod Define(stage, path) -&gt; DistantLight <tr class="row-odd"> <td> <p> <code> Get(stage, path) <td> <p> <strong> classmethod Get(stage, path) -&gt; DistantLight <tr class="row-even"> <td> <p> <code> GetAngleAttr() <td> <p> <strong> classmethod GetAngleAttr() | Angular size of the light in degrees. | |--------------------------------------| | `GetSchemaAttributeNames` | | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | ### CreateAngleAttr ```python CreateAngleAttr(defaultValue, writeSparsely) -> Attribute ``` See GetAngleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### Define ```python classmethod Define(stage, path) -> DistantLight ``` Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. #### Parameters - **stage** (Stage) – - **path** (Path) – ### Get ```python classmethod Get(stage, path) -> DistantLight ``` Return a UsdLuxDistantLight holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, return an invalid `UsdPrim`. stage ``` , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```html <div class="highlight-text notranslate"> <div class="highlight"> <pre><span> ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetAngleAttr ``` GetAngleAttr() → Attribute ``` Angular size of the light in degrees. As an example, the Sun is approximately 0.53 degrees as seen from Earth. Higher values broaden the light and therefore soften shadow edges. Declaration ``` float inputs:angle = 0.53 ``` C++ Type: float Usd Type: SdfValueTypeNames->Float ### GetSchemaAttributeNames ``` classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters: - **includeInherited** (bool) – ### DomeLight Light emitted inward from a distant external environment, such as a sky or IBL light probe. The orientation of a dome light with a latlong texture is expected to match the OpenEXR specification for latlong environment maps. Latitude-Longitude Map: The environment is projected onto the image using polar coordinates (latitude and longitude). A pixel’s x coordinate corresponds to its longitude, and the y coordinate corresponds to its latitude. Pixel (dataWindow.min.x, dataWindow.min.y) has latitude +pi/2 and longitude +pi; pixel (dataWindow.max.x, dataWindow.max.y) has latitude -pi/2 and longitude -pi. In 3D space, latitudes -pi/2 and +pi/2 correspond to the negative and positive y direction. Latitude 0, longitude 0 points into positive z direction; and latitude 0, longitude pi/2 points into positive x direction. The size of the data window should be 2*N by N pixels (width by height). For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdLuxTokens. So to set an attribute to the value”rightHanded”, use UsdLuxTokens->rightHanded as the value. Methods: - **CreateGuideRadiusAttr** (defaultValue, ...) - **CreatePortalsRel** () - **CreateTextureFileAttr** (defaultValue, ...) - **CreateTextureFormatAttr** (defaultValue, ...) | Define | classmethod Define(stage, path) -> DomeLight | | --- | --- | | Get | classmethod Get(stage, path) -> DomeLight | | GetGuideRadiusAttr() | The radius of guide geometry to use to visualize the dome light. | | GetPortalsRel() | Optional portals to guide light sampling. | | GetSchemaAttributeNames | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | GetTextureFileAttr() | A color texture to use on the dome, such as an HDR (high dynamic range) texture intended for IBL (image based lighting). | | GetTextureFormatAttr() | Specifies the parameterization of the color map file. | | OrientToStageUpAxis() | Adds a transformation op, if neeeded, to orient the dome to align with the stage's up axis. | ### CreateGuideRadiusAttr(defaultValue, writeSparsely) -> Attribute See GetGuideRadiusAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. - **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreatePortalsRel() -> Relationship See GetPortalsRel() , and also Create vs Get Property Methods for when to use Get vs Create. ### CreateTextureFileAttr(defaultValue, writeSparsely) -> Attribute See GetTextureFileAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. See GetTextureFormatAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### classmethod Define(stage, path) -> DomeLight Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. #### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### classmethod Get(stage, path) -> DomeLight Return a UsdLuxDomeLight holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` ```text UsdLuxDomeLight(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (Stage) – - **path** (Path) – ### GetGuideRadiusAttr() -> Attribute The radius of guide geometry to use to visualize the dome light. The default is 1 km for scenes whose metersPerUnit is the USD default of 0.01 (i.e., 1 world unit is 1 cm). #### Declaration ```text float guideRadius = 100000 ``` #### C++ Type float #### Usd Type SdfValueTypeNames->Float ### GetPortalsRel() -> Relationship Optional portals to guide light sampling. ### classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ### GetTextureFileAttr() -> Attribute A color texture to use on the dome, such as an HDR (high dynamic range) texture intended for IBL (image based lighting). #### Declaration ```text asset inputs:texture:file ``` #### C++ Type SdfAssetPath #### Usd Type SdfValueTypeNames->Asset ### GetTextureFormatAttr() -> Attribute Specifies the parameterization of the color map file. Valid values are: - automatic: Tries to determine the layout from the file itself. For example, Renderman texture files embed an explicit ``` - **parameterization** - **latlong**: Latitude as X, longitude as Y. - **mirroredBall**: An image of the environment reflected in a sphere, using an implicitly orthogonal projection. - **angular**: Similar to mirroredBall but the radial dimension is mapped linearly to the angle, providing better sampling at the edges. - **cubeMapVerticalCross**: A cube map with faces laid out as a vertical cross. ### Declaration ``` token inputs:texture:format ="automatic" ``` ### C++ Type TfToken ### Usd Type SdfValueTypeNames->Token ### Allowed Values automatic, latlong, mirroredBall, angular, cubeMapVerticalCross ### OrientToStageUpAxis Adds a transformation op, if needed, to orient the dome to align with the stage’s up axis. Uses UsdLuxTokens->orientToStageUpAxis as the op suffix. If an op with this suffix already exists, this method assumes it is already applying the proper correction and does nothing further. If no op is required to match the stage’s up axis, no op will be created. - **UsdGeomXformOp** - **UsdGeomGetStageUpAxis** ### pxr.UsdLux.GeometryLight Deprecated Light emitted outward from a geometric prim (UsdGeomGprim), which is typically a mesh. **Methods:** - **CreateGeometryRel()** See GetGeometryRel() , and also Create vs Get Property Methods for when to use Get vs Create. - **Define(stage, path) -> GeometryLight** Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined() ) on this stage. - **Get(stage, path) -> GeometryLight** - **GetGeometryRel()** Relationship to the geometry to use as the light source. - **GetSchemaAttributeNames(includeInherited) -> list[TfToken]** ### CreateGeometryRel() See GetGeometryRel() , and also Create vs Get Property Methods for when to use Get vs Create. ### Define(stage, path) -> GeometryLight Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at path is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with specifier == SdfSpecifierDef and this schema’s prim type name for the prim at path. <p> with <code> specifier == <em> SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not <em> Defined ancestors. <p> The given <em> path must be an absolute prim path that does not contain any variant selections. <p> If it is impossible to author any of the necessary PrimSpecs, (for example, in case <em> path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid <em> UsdPrim . <p> Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. <dl> <dt>Parameters <dd> <ul> <li> <p><strong>stage <li> <p><strong>path <p><strong>classmethod <p>Return a UsdLuxGeometryLight holding the prim adhering to this schema at <code>path <p>If no prim exists at <code>path <div class="highlight"> <pre>UsdLuxGeometryLight(stage-&gt;GetPrimAtPath(path)); <dl> <dt>Parameters <dd> <ul> <li> <p><strong>stage <li> <p><strong>path <p>Relationship to the geometry to use as the light source. <p><strong>classmethod <p>Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. <p>Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl> <dt>Parameters <dd> <p><strong>includeInherited set includeRoot to false and explicitly include the desired objects. These are complementary approaches that may each be preferable depending on the scenario and how to best express the intent of the light setup. For any described attribute **Fallback** **Value** or **Allowed** **Values** below that are text/tokens, the actual token is published and defined in UsdLuxTokens. So to set an attribute to the value "rightHanded", use UsdLuxTokens->rightHanded as the value. **Methods:** | Method Name | Description | |-------------|-------------| | `Apply(prim) -> LightAPI` | classmethod Apply(prim) -> LightAPI | | `CanApply(prim, whyNot) -> bool` | classmethod CanApply(prim, whyNot) -> bool | | `ConnectableAPI()` | Contructs and returns a UsdShadeConnectableAPI object with this light. | | `CreateColorAttr(defaultValue, writeSparsely)` | See GetColorAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateColorTemperatureAttr(defaultValue, ...)` | See GetColorTemperatureAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateDiffuseAttr(defaultValue, writeSparsely)` | See GetDiffuseAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateEnableColorTemperatureAttr(...)` | See GetEnableColorTemperatureAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateExposureAttr(defaultValue, writeSparsely)` | See GetExposureAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateFiltersRel()` | See GetFiltersRel() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateInput(name, typeName)` | Create an input which can either have a value or can be connected. | | `CreateIntensityAttr(defaultValue, writeSparsely)` | See GetIntensityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateMaterialSyncModeAttr(defaultValue, ...)` | See GetMaterialSyncModeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateNormalizeAttr(defaultValue, writeSparsely)` | See GetNormalizeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateOutput(name, typeName)` | Create an output which can either have a value or can be connected. | | `CreateShaderIdAttr(defaultValue, writeSparsely)` | See GetShaderIdAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateShaderIdAttrForRenderContext(...)` | Creates the shader ID attribute for the given `renderContext`. | <p> CreateSpecularAttr (defaultValue, writeSparsely) <p> See GetSpecularAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> Get <p> classmethod Get(stage, path) -> LightAPI <p> GetColorAttr () <p> The color of emitted light, in energy-linear terms. <p> GetColorTemperatureAttr () <p> Color temperature, in degrees Kelvin, representing the white point. <p> GetDiffuseAttr () <p> A multiplier for the effect of this light on the diffuse response of materials. <p> GetEnableColorTemperatureAttr () <p> Enables using colorTemperature. <p> GetExposureAttr () <p> Scales the power of the light exponentially as a power of 2 (similar to an F-stop control over exposure). <p> GetFiltersRel () <p> Relationship to the light filters that apply to this light. <p> GetInput (name) <p> Return the requested input if it exists. <p> GetInputs (onlyAuthored) <p> Inputs are represented by attributes in the"inputs:"namespace. <p> GetIntensityAttr () <p> Scales the power of the light linearly. <p> GetLightLinkCollectionAPI () <p> Return the UsdCollectionAPI interface used for examining and modifying the light-linking of this light. <p> GetMaterialSyncModeAttr () <p> For a LightAPI applied to geometry that has a bound Material, which is entirely or partly emissive, this specifies the relationship of the Material response to the lighting response. <p> GetNormalizeAttr () <p> Normalizes power by the surface area of the light. <p> GetOutput (name) <p> Return the requested output if it exists. <p> GetOutputs (onlyAuthored) <p> Outputs are represented by attributes in the"outputs:"namespace. <p> GetSchemaAttributeNames <p> classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <p> GetShaderId (renderContexts) <p> Return the light's shader ID for the given list of available renderContexts. <p> GetShaderIdAttr () <p> Default ID for the light's shader. <p> <code>GetShaderIdAttrForRenderContext (renderContext) <p> Returns the shader ID attribute for the given <code>renderContext <p> <code>GetShadowLinkCollectionAPI () <p> Return the UsdCollectionAPI interface used for examining and modifying the shadow-linking of this light. <p> <code>GetSpecularAttr () <p> A multiplier for the effect of this light on the specular response of materials. <dl> <dt> <em>static <code>Apply () <dd> <p><strong>classmethod <p>Applies this <strong>single-apply <p>This information is stored by adding”LightAPI”to the token-valued, listOp metadata <em>apiSchemas <p>A valid UsdLuxLightAPI object is returned upon success. An invalid (or empty) UsdLuxLightAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. <p>UsdPrim::GetAppliedSchemas() <p>UsdPrim::HasAPI() <p>UsdPrim::CanApplyAPI() <p>UsdPrim::ApplyAPI() <p>UsdPrim::RemoveAPI() <dl> <dt>Parameters <dd> <p><strong>prim <dl> <dt> <em>static <code>CanApply (prim, whyNot) -&gt; bool <dd> <p><strong>classmethod <p>Returns true if this <strong>single-apply <p>If this schema can not be a applied to the prim, this returns false and, if provided, populates <code>whyNot <p>Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. <p>UsdPrim::GetAppliedSchemas() <p>UsdPrim::HasAPI() <p>UsdPrim::CanApplyAPI() <p>UsdPrim::ApplyAPI() <p>UsdPrim::RemoveAPI() <dl> <dt>Parameters <dd> <ul> <li><p><strong>prim <li><p><strong>whyNot <dl> <dt><code>ConnectableAPI <dd> <p>Contructs and returns a UsdShadeConnectableAPI object with this light. <p>Note that most tasks can be accomplished without explicitly constructing a UsdShadeConnectable API, since connection-related API such as UsdShadeConnectableAPI::ConnectToSource() are static methods, and UsdLuxLightAPI will auto-convert to a UsdShadeConnectableAPI when passed to functions that want to act generically on a connectable UsdShadeConnectableAPI object. <dl> <dt><code>CreateColorAttr <dd> <p> See GetColorAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl> <dt> Parameters <dd> <ul> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl> <dt> <span> <span> CreateColorTemperatureAttr <span> ( <em> <span> defaultValue , <em> <span> writeSparsely <span> ) <span> <span> → <span> Attribute <dd> <p> See GetColorTemperatureAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl> <dt> Parameters <dd> <ul> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl> <dt> <span> <span> CreateDiffuseAttr <span> ( <em> <span> defaultValue , <em> <span> writeSparsely <span> ) <span> <span> → <span> Attribute <dd> <p> See GetDiffuseAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl> <dt> Parameters <dd> <ul> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl> <dt> <span> <span> CreateEnableColorTemperatureAttr <span> ( <em> <span> defaultValue , <em> <span> writeSparsely <span> ) <span> <span> → <span> Attribute <dd> <p> See GetEnableColorTemperatureAttr() , and also Create vs Get Property Methods for when to use Get vs Create. Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateExposureAttr ``` CreateExposureAttr(defaultValue, writeSparsely) → Attribute ``` See GetExposureAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateFiltersRel ``` CreateFiltersRel() → Relationship ``` See GetFiltersRel() , and also Create vs Get Property Methods for when to use Get vs Create. ### CreateInput ``` CreateInput(name, typeName) → Input ``` Create an input which can either have a value or can be connected. The attribute representing the input is created in the "inputs:" namespace. Inputs on lights are connectable. ### Parameters - **name** (`str`) – - **typeName** (`ValueTypeName`) – ### CreateIntensityAttr ``` CreateIntensityAttr(defaultValue, writeSparsely) → Attribute ## CreateMaterialSyncModeAttr ```cpp CreateMaterialSyncModeAttr(defaultValue, writeSparsely) ``` - Returns: `Attribute` See GetMaterialSyncModeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateNormalizeAttr ```cpp CreateNormalizeAttr(defaultValue, writeSparsely) ``` - Returns: `Attribute` See GetNormalizeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateOutput ```cpp CreateOutput(name, typeName) ``` - Returns: `Output` See GetNormalizeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – Create an output which can either have a value or can be connected. The attribute representing the output is created in the "outputs:" namespace. Outputs on a light cannot be connected, as their value is assumed to be computed externally. Parameters ---------- - **name** (`str`) – - **typeName** (`ValueTypeName`) – CreateShaderIdAttr ------------------ ```python CreateShaderIdAttr(defaultValue, writeSparsely) ``` - Returns: `Attribute` See GetShaderIdAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – CreateShaderIdAttrForRenderContext ---------------------------------- ```python CreateShaderIdAttrForRenderContext(renderContext, defaultValue, writeSparsely) ``` - Returns: `Attribute` Creates the shader ID attribute for the given `renderContext`. See GetShaderIdAttrForRenderContext() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - **renderContext** (`str`) – - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – CreateSpecularAttr ------------------ ```python CreateSpecularAttr(defaultValue, writeSparsely) ``` - Returns: `Attribute` ``` See GetSpecularAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### classmethod Get(stage, path) -> LightAPI Return a UsdLuxLightAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdLuxLightAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### GetColorAttr() → Attribute The color of emitted light, in energy-linear terms. #### Declaration ``` color3f inputs:color = (1, 1, 1) ``` #### C++ Type GfVec3f #### Usd Type SdfValueTypeNames->Color3f ### GetColorTemperatureAttr() → Attribute Color temperature, in degrees Kelvin, representing the white point. The default is a common white point, D65. Lower values are warmer and higher values are cooler. The valid range is from 1000 to 10000. Only takes effect when enableColorTemperature is set to true. When active, the computed result multiplies against the color attribute. See UsdLuxBlackbodyTemperatureAsRgb(). #### Declaration ``` float inputs:colorTemperature = 6500 ``` #### C++ Type float #### Usd Type SdfValueTypeNames->Float ### GetDiffuseAttr() → Attribute A multiplier for the effect of this light on the diffuse response of materials. This is a non-physical control. Declaration ``` float inputs:diffuse = 1 ``` C++ Type float Usd Type SdfValueTypeNames->Float --- ``` GetEnableColorTemperatureAttr () → Attribute ``` Enables using colorTemperature. Declaration ``` bool inputs:enableColorTemperature = 0 ``` C++ Type bool Usd Type SdfValueTypeNames->Bool --- ``` GetExposureAttr () → Attribute ``` Scales the power of the light exponentially as a power of 2 (similar to an F-stop control over exposure). The result is multiplied against the intensity. Declaration ``` float inputs:exposure = 0 ``` C++ Type float Usd Type SdfValueTypeNames->Float --- ``` GetFiltersRel () → Relationship ``` Relationship to the light filters that apply to this light. --- ``` GetInput (name) → Input ``` Return the requested input if it exists. Parameters - **name** (str) – --- ``` GetInputs (onlyAuthored) → list [Input] ``` Inputs are represented by attributes in the "inputs:" namespace. If `onlyAuthored` is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. Parameters - **onlyAuthored** (bool) – ### Attribute Scales the power of the light linearly. #### Declaration ``` float inputs:intensity = 1 ``` #### C++ Type float #### Usd Type SdfValueTypeNames->Float ### GetLightLinkCollectionAPI Return the UsdCollectionAPI interface used for examining and modifying the light-linking of this light. Light-linking controls which geometry this light illuminates. ### GetMaterialSyncModeAttr For a LightAPI applied to geometry that has a bound Material, which is entirely or partly emissive, this specifies the relationship of the Material response to the lighting response. Valid values are: - materialGlowTintsLight: All primary and secondary rays see the emissive/glow response as dictated by the bound Material while the base color seen by light rays (which is then modulated by all of the other LightAPI controls) is the multiplication of the color feeding the emission/glow input of the Material (i.e. its surface or volume shader) with the scalar or pattern input to inputs:color. This allows the light’s color to tint the geometry’s glow color while preserving access to intensity and other light controls as ways to further modulate the illumination. - independent: All primary and secondary rays see the emissive/glow response as dictated by the bound Material, while the base color seen by light rays is determined solely by inputs:color. Note that for partially emissive geometry (in which some parts are reflective rather than emissive), a suitable pattern must be connected to the light’s color input, or else the light will radiate uniformly from the geometry. - noMaterialResponse: The geometry behaves as if there is no Material bound at all, i.e. there is no diffuse, specular, or transmissive response. The base color of light rays is entirely controlled by the inputs:color. This is the standard mode for”canonical”lights in UsdLux and indicates to renderers that a Material will either never be bound or can always be ignored. #### Declaration ``` uniform token light:materialSyncMode = "noMaterialResponse" ``` #### C++ Type TfToken #### Usd Type SdfValueTypeNames->Token #### Variability SdfVariabilityUniform #### Allowed Values materialGlowTintsLight, independent, noMaterialResponse ### GetNormalizeAttr Normalizes power by the surface area of the light. This makes it easier to independently adjust the power and shape of the light, by causing the power to not vary with the area or angular size of the light. #### Declaration ``` bool inputs:normalize = 0 ``` #### C++ Type bool #### Usd Type SdfValueTypeNames->Bool ### GetOutput Return the requested output if it exists. #### Parameters - **name** (str) – ## GetOutputs ### Description Outputs are represented by attributes in the "outputs:" namespace. If `onlyAuthored` is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. ### Parameters - **onlyAuthored** (bool) – ## GetSchemaAttributeNames ### Description Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - **includeInherited** (bool) – ## GetShaderId ### Description Return the light’s shader ID for the given list of available `renderContexts`. The shader ID returned by this function is the identifier to use when looking up the shader definition for this light in the shader registry. The render contexts are expected to be listed in priority order, so for each render context provided, this will try to find the shader ID attribute specific to that render context (see GetShaderIdAttrForRenderContext()) and will return the value of the first one found that has a non-empty value. If no shader ID value can be found for any of the given render contexts or `renderContexts` is empty, then this will return the value of the default shader ID attribute (see GetShaderIdAttr()). ### Parameters - **renderContexts** (list[TfToken]) – ## GetShaderIdAttr ### Description Default ID for the light’s shader. This defines the shader ID for this light when a render context specific shader ID is not available. The default shaderId for the intrinsic UsdLux lights (RectLight, DistantLight, etc.) are set to default to the light’s type name. For each intrinsic UsdLux light, we will always register an SdrShaderNode in the SdrRegistry, with the identifier matching the type name and the source type "USD", that corresponds to the light’s inputs. ### Declaration ``` uniform token light:shaderId ="" ``` ### C++ Type TfToken ### Usd Type SdfValueTypeNames->Token ### Variability SdfVariabilityUniform ## GetShaderIdAttrForRenderContext ### Description Get the shader ID attribute for a specific render context. ### Parameters - **renderContext** (TfToken) – ### Attribute Returns the shader ID attribute for the given `renderContext`. If `renderContext` is non-empty, this will try to return an attribute named *light:shaderId* with the namespace prefix `renderContext`. For example, if the passed in render context is "ri" then the attribute returned by this function would have the following signature: #### Declaration ``` token ri:light:shaderId ``` #### C++ Type TfToken #### Usd Type SdfValueTypeNames->Token If the render context is empty, this will return the default shader ID attribute as returned by GetShaderIdAttr(). #### Parameters - **renderContext** (str) – ### GetShadowLinkCollectionAPI Return the UsdCollectionAPI interface used for examining and modifying the shadow-linking of this light. Shadow-linking controls which geometry casts shadows from this light. ### GetSpecularAttr A multiplier for the effect of this light on the specular response of materials. This is a non-physical control. #### Declaration ``` float inputs:specular = 1 ``` #### C++ Type float #### Usd Type SdfValueTypeNames->Float ### LightFilter A light filter modifies the effect of a light. Lights refer to filters via relationships so that filters may be shared. #### Linking Filters can be linked to geometry. Linking controls which geometry a light-filter affects, when considering the light filters attached to a light illuminating the geometry. Linking is specified as a collection (UsdCollectionAPI) which can be accessed via GetFilterLinkCollection(). For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdLuxTokens. So to set an attribute to the value "rightHanded", use UsdLuxTokens->rightHanded as the value. #### Methods: - **ConnectableAPI** () - Constructs and returns a UsdShadeConnectableAPI object with this light filter. - **CreateInput** (name, typeName) - Create an input which can either have a value or can be connected. - **CreateOutput** (name, typeName) - Create an output which can either have a value or can be connected. - **CreateShaderIdAttr** (defaultValue, writeSparsely) - See GetShaderIdAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateShaderIdAttrForRenderContext** (defaultValue, writeSparsely) - See GetShaderIdAttr(), and also Create vs Get Property Methods for when to use Get vs Create. Creates the shader ID attribute for the given `renderContext`. ```python Define ``` ```python classmethod Define(stage, path) -> LightFilter ``` ```python Get ``` ```python classmethod Get(stage, path) -> LightFilter ``` ```python GetFilterLinkCollectionAPI() ``` Return the UsdCollectionAPI interface used for examining and modifying the filter-linking of this light filter. ```python GetInput(name) ``` Return the requested input if it exists. ```python GetInputs(onlyAuthored) ``` Inputs are represented by attributes in the "inputs:" namespace. ```python GetOutput(name) ``` Return the requested output if it exists. ```python GetOutputs(onlyAuthored) ``` Outputs are represented by attributes in the "outputs:" namespace. ```python GetSchemaAttributeNames() ``` ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` ```python GetShaderId(renderContexts) ``` Return the light filter's shader ID for the given list of available `renderContexts`. ```python GetShaderIdAttr() ``` Default ID for the light filter's shader. ```python GetShaderIdAttrForRenderContext(renderContext) ``` Returns the shader ID attribute for the given `renderContext`. ```python ConnectableAPI() ``` Contructs and returns a UsdShadeConnectableAPI object with this light filter. Note that most tasks can be accomplished without explicitly constructing a UsdShadeConnectable API, since connection-related API such as UsdShadeConnectableAPI::ConnectToSource() are static methods, and UsdLuxLightFilter will auto-convert to a UsdShadeConnectableAPI when passed to functions that want to act generically on a connectable UsdShadeConnectableAPI object. ```python CreateInput(name, typeName) ``` Create an input which can either have a value or can be connected. The attribute representing the input is created in the "inputs:" namespace. Inputs on light filters are connectable. Parameters: - name (str) – - typeName (str) – ``` ### typeName (ValueTypeName) – ### CreateOutput (name, typeName) → Output Create an output which can either have a value or can be connected. The attribute representing the output is created in the "outputs:" namespace. Outputs on a light filter cannot be connected, as their value is assumed to be computed externally. #### Parameters - **name** (str) – - **typeName** (ValueTypeName) – ### CreateShaderIdAttr (defaultValue, writeSparsely) → Attribute See GetShaderIdAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateShaderIdAttrForRenderContext (renderContext, defaultValue, writeSparsely) → Attribute Creates the shader ID attribute for the given `renderContext`. See GetShaderIdAttrForRenderContext() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **renderContext** (str) – - **defaultValue** (VtValue) – ### Define Class Method **classmethod** Define(stage, path) -> LightFilter - Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined()) on this stage. - If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. - The given `path` must be an absolute prim path that does not contain any variant selections. - If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget’s namespace) issue an error and return an invalid `UsdPrim`. - Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters:** - **stage** (`Stage`) – - **path** (`Path`) – ### Get Class Method **classmethod** Get(stage, path) -> LightFilter - Return a UsdLuxLightFilter holding the prim adhering to this schema at `path` on `stage`. - If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. **Parameters:** - **stage** (`Stage`) – - **path** (`Path`) – ### GetFilterLinkCollectionAPI Method - Return the UsdCollectionAPI interface used for examining and modifying the filter-linking of this light filter. - Linking controls which geometry this light filter affects. ### GetInput Method - GetInput(name) -> Input - Returns the input of the specified name. ### GetInput ``` Input ``` Return the requested input if it exists. #### Parameters - **name** (`str`) – ``` ### GetInputs ``` GetInputs(onlyAuthored) ``` → list[Input] Inputs are represented by attributes in the "inputs:" namespace. If `onlyAuthored` is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. #### Parameters - **onlyAuthored** (`bool`) – ``` ### GetOutput ``` GetOutput(name) ``` → Output Return the requested output if it exists. #### Parameters - **name** (`str`) – ``` ### GetOutputs ``` GetOutputs(onlyAuthored) ``` → list[Output] Outputs are represented by attributes in the "outputs:" namespace. If `onlyAuthored` is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. #### Parameters - **onlyAuthored** (`bool`) – ``` ### GetSchemaAttributeNames ``` static classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (`bool`) – ``` ### GetShaderId ``` GetShaderId(renderContexts) ``` → str Return the light filter’s shader ID for the given list of available `renderContexts`. The shader ID returned by this function is the identifier to use when looking up the shader definition for this light filter in the shader registry. The render contexts are expected to be listed in priority order, so for each render context provided, this will try to find the shader ID. attribute specific to that render context (see GetShaderIdAttrForRenderContext() ) and will return the value of the first one found that has a non-empty value. If no shader ID value can be found for any of the given render contexts or ```code``` ```python 01 def Xform "BigSetWithLights" ( 02 kind = "assembly" 03 payload = @BigSetWithLights.usd@ // Heavy payload 04 ) { 05 // Pre-computed, cached list of lights inside payload 06 rel lightList = [ 07 &lt;./Lights/light_1&gt;, 08 &lt;./Lights/light_2&gt;, 09 \.\.\. 10 ] 11 token lightList:cacheBehavior = "consumeAndContinue"; 12 } ``` The lightList relationship encodes a set of lights, and the lightList:cacheBehavior property provides fine-grained control over how to use that cache. The cache can be created by first invoking ComputeLightList(ComputeModeIgnoreCache) to pre-compute the list and then storing the result with UsdLuxLightListAPI::StoreLightList(). To enable efficient retrieval of the cache, it should be stored on a model hierarchy prim. Furthermore, note that while you can use a UsdLuxLightListAPI bound to the pseudo-root prim to query the lights (as in the example above) because it will perform a traversal over descendants, you cannot store the cache back to the pseduo-root prim. To consult the cached list, we invoke ComputeLightList(ComputeModeConsultModelHierarchyCache): ```python 01 // Find and load all lights, using lightList cache where available 02 UsdLuxLightListAPI list(stage->GetPseudoRoot()); 03 SdfPathSet lights = list.ComputeLightList( 04 UsdLuxLightListAPI::ComputeModeConsultModelHierarchyCache); 05 stage.LoadAndUnload(lights, SdfPathSet()); ``` In this mode, ComputeLightList() will traverse the model hierarchy, accumulating cached light lists. ## Controlling Cache Behavior The lightList:cacheBehavior property gives additional fine-grained control over cache behavior: > - The fallback value, "ignore", indicates that the lightList should be disregarded. This provides a way to invalidate cache entries. Note that unless "ignore" is specified, a lightList with an empty list of targets is considered a cache indicating that no lights are present. > - The value "consumeAndContinue" indicates that the cache should be consulted to contribute lights to the scene, and that recursion should continue down the model hierarchy in case additional lights are added as descendants. This is the default value established when StoreLightList() is invoked. This behavior allows the lights within a large model, such as the BigSetWithLights example above, to be published outside the payload, while also allowing referencing and layering to add additional lights over that set. > - The value "consumeAndHalt" provides a way to terminate recursive traversal of the scene for light discovery. The cache will be consulted but no descendant prims will be examined. ## Instancing Where instances are present, UsdLuxLightListAPI::ComputeLightList() will return the instance-unique paths to any lights discovered within those instances. Lights within a UsdGeomPointInstancer will not be returned, however, since they cannot be referred to solely via paths. For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdLuxTokens. So to set an attribute to the value "rightHanded", use UsdLuxTokens->rightHanded as the value. **Classes:** - `ComputeMode`: Runtime control over whether to consult stored lightList caches. **Methods:** - `Apply(prim) -> LightListAPI`: classmethod - `CanApply(prim, whyNot) -> bool`: classmethod - `ComputeLightList(mode)`: Computes and returns the list of lights and light filters in the stage, optionally consulting a cached result. - `CreateLightListCacheBehaviorAttr(...)`: See GetLightListCacheBehaviorAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateLightListRel()`: See GetLightListRel() , and also Create vs Get Property Methods for when to use Get vs Create. - `Get(stage, path) -> LightListAPI`: classmethod - `GetLightListCacheBehaviorAttr()`: Controls how the lightList should be interpreted. | 方法 | 描述 | | --- | --- | | `GetLightListRel()` | Relationship to lights in the scene. | | `GetSchemaAttributeNames` | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | | `InvalidateLightList()` | Mark any stored lightlist as invalid, by setting the lightList:cacheBehavior attribute to ignore. | | `StoreLightList(arg1)` | Store the given paths as the lightlist for this prim. | **Attributes:** | 属性 | 描述 | | --- | --- | | `ComputeModeConsultModelHierarchyCache` | | | `ComputeModeIgnoreCache` | | **ComputeMode class:** Runtime control over whether to consult stored lightList caches. **Methods:** | 方法 | 描述 | | --- | --- | | `GetValueFromName` | | **Attributes:** | 属性 | 描述 | | --- | --- | | `allValues` | | **static GetValueFromName():** **allValues = (UsdLux.LightListAPI.ComputeModeConsultModelHierarchyCache, UsdLux.LightListAPI.ComputeModeIgnoreCache)** **classmethod Apply(prim) -> LightListAPI:** Applies this single-apply API schema to the given `prim`. This information is stored by adding "LightListAPI" to the token-valued, listOp metadata `apiSchemas` on the prim. A valid UsdLuxLightListAPI object is returned upon success. An invalid (or empty) UsdLuxLightListAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() **Parameters** - **prim** (Prim) – <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> CanApply <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod CanApply(prim, whyNot) -&gt; bool <p> Returns true if this <strong> single-apply API schema can be applied to the given <code class="docutils literal notranslate"> <span class="pre"> prim . <p> If this schema can not be a applied to the prim, this returns false and, if provided, populates <code class="docutils literal notranslate"> <span class="pre"> whyNot with the reason it can not be applied. <p> Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> prim ( <em> Prim ) – <li> <p> <strong> whyNot ( <em> str ) – <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> ComputeLightList <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> mode <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> SdfPathSet <dd> <p> Computes and returns the list of lights and light filters in the stage, optionally consulting a cached result. <p> In ComputeModeIgnoreCache mode, caching is ignored, and this does a prim traversal looking for prims that have a UsdLuxLightAPI or are of type UsdLuxLightFilter. <p> In ComputeModeConsultModelHierarchyCache, this does a traversal only of the model hierarchy. In this traversal, any lights that live as model hierarchy prims are accumulated, as well as any paths stored in lightList caches. The lightList:cacheBehavior attribute gives further control over the cache behavior; see the class overview for details. <p> When instances are present, ComputeLightList(ComputeModeIgnoreCache) will return the instance-uniqiue paths to any lights discovered within those instances. Lights within a UsdGeomPointInstancer will not be returned, however, since they cannot be referred to solely via paths. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> mode ( <em> ComputeMode ) – <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> CreateLightListCacheBehaviorAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <a class="reference internal" href="Usd.html#pxr.Usd.Attribute" title="pxr.Usd.Attribute"> <span class="pre"> Attribute <dd> <p> See GetLightListCacheBehaviorAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> CreateLightListRel <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <a class="reference internal" href="Usd.html#pxr.Usd.Relationship" title="pxr.Usd.Relationship"> <span class="pre"> Relationship <dd> <p> See GetLightListRel() , and also Create vs Get Property Methods for # when to use Get vs Create ## Get ```python classmethod Get(stage, path) -> LightListAPI ``` Return a UsdLuxLightListAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdLuxLightListAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ## GetLightListCacheBehaviorAttr ```python ( ) → Attribute ``` Controls how the lightList should be interpreted. Valid values are: - consumeAndHalt: The lightList should be consulted, and if it exists, treated as a final authoritative statement of any lights that exist at or below this prim, halting recursive discovery of lights. - consumeAndContinue: The lightList should be consulted, but recursive traversal over nameChildren should continue in case additional lights are added by descendants. - ignore: The lightList should be entirely ignored. This provides a simple way to temporarily invalidate an existing cache. This is the fallback behavior. Declaration: ```python token lightList:cacheBehavior ``` C++ Type: TfToken Usd Type: SdfValueTypeNames->Token Allowed Values: consumeAndHalt, consumeAndContinue, ignore ## GetLightListRel ```python ( ) → Relationship ``` Relationship to lights in the scene. ## GetSchemaAttributeNames ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters: - **includeInherited** (bool) – ## InvalidateLightList ```python ( ) → None ``` Mark any stored lightlist as invalid, by setting the lightList:cacheBehavior attribute to ignore. ### StoreLightList Store the given paths as the lightlist for this prim. Paths that do not have this prim’s path as a prefix will be silently ignored. This will set the listList:cacheBehavior to "consumeAndContinue". #### Parameters - **arg1** (`SdfPathSet`) – ### ComputeModeConsultModelHierarchyCache = UsdLux.LightListAPI.ComputeModeConsultModelHierarchyCache ### ComputeModeIgnoreCache = UsdLux.LightListAPI.ComputeModeIgnoreCache ### class pxr.UsdLux.ListAPI Deprecated Use LightListAPI instead For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdLuxTokens. So to set an attribute to the value "rightHanded", use UsdLuxTokens->rightHanded as the value. #### Classes: - **ComputeMode** - Runtime control over whether to consult stored lightList caches. #### Methods: - **Apply** - `classmethod Apply(prim) -> ListAPI` - **CanApply** - `classmethod CanApply(prim, whyNot) -> bool` - **ComputeLightList** - `ComputeLightList(mode)` - Computes and returns the list of lights and light filters in the stage, optionally consulting a cached result. - **CreateLightListCacheBehaviorAttr** - `...` - See GetLightListCacheBehaviorAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateLightListRel** - `()` - See GetLightListRel(), and also Create vs Get Property Methods for when to use Get vs Create. - **Get** - `classmethod Get(stage, path) -> ListAPI` - **GetLightListCacheBehaviorAttr** - `()` - Controls how the lightList should be interpreted. - **GetLightListRel** - `()` - Relationship to lights in the scene. - **GetSchemaAttributeNames** | Method Name | Description | |-------------|-------------| | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | | | `InvalidateLightList()` | Mark any stored lightlist as invalid, by setting the lightList:cacheBehavior attribute to ignore. | | `StoreLightList(arg1)` | Store the given paths as the lightlist for this prim. | **Attributes:** | Attribute Name | Description | |----------------|-------------| | `ComputeModeConsultModelHierarchyCache` | | | `ComputeModeIgnoreCache` | | **ComputeMode Class:** Runtime control over whether to consult stored lightList caches. **Methods:** | Method Name | Description | |-------------|-------------| | `GetValueFromName` | | **Attributes:** | Attribute Name | Description | |----------------|-------------| | `allValues` | = (UsdLux.ListAPI.ComputeModeConsultModelHierarchyCache, UsdLux.ListAPI.ComputeModeIgnoreCache) | **static GetValueFromName():** **static Apply(prim) -> ListAPI:** Applies this single-apply API schema to the given prim. This information is stored by adding "ListAPI" to the token-valued, listOp metadata apiSchemas on the prim. A valid UsdLuxListAPI object is returned upon success. An invalid (or empty) UsdLuxListAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters: - **prim** (Prim) – **static CanApply(prim, whyNot) -> bool:** Returns true if this single-apply API schema can be applied to the given prim. If this schema can not be applied to the prim, this returns false and, if provided, populates ```python whyNot ``` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters ---------- - **prim** (Prim) – - **whyNot** (str) – ```python ComputeLightList(mode) ``` → SdfPathSet Computes and returns the list of lights and light filters in the stage, optionally consulting a cached result. In ComputeModeIgnoreCache mode, caching is ignored, and this does a prim traversal looking for prims that have a UsdLuxLightAPI or are of type UsdLuxLightFilter. In ComputeModeConsultModelHierarchyCache, this does a traversal only of the model hierarchy. In this traversal, any lights that live as model hierarchy prims are accumulated, as well as any paths stored in lightList caches. The lightList:cacheBehavior attribute gives further control over the cache behavior; see the class overview for details. When instances are present, ComputeLightList(ComputeModeIgnoreCache) will return the instance-uniqiue paths to any lights discovered within those instances. Lights within a UsdGeomPointInstancer will not be returned, however, since they cannot be referred to solely via paths. Parameters ---------- - **mode** (ComputeMode) – ```python CreateLightListCacheBehaviorAttr(defaultValue, writeSparsely) ``` → Attribute See GetLightListCacheBehaviorAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ```python CreateLightListRel() ``` → Relationship See GetLightListRel() , and also Create vs Get Property Methods for when to use Get vs Create. ```python static Get(stage, path) ``` → ListAPI Return a UsdLuxListAPI holding the prim adhering to this schema at `path` on `stage`. This is shorthand for the following: ```cpp UsdLuxListAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetLightListCacheBehaviorAttr() - **Returns**: Attribute - **Description**: Controls how the lightList should be interpreted. - **Valid values are**: - consumeAndHalt: The lightList should be consulted, and if it exists, treated as a final authoritative statement of any lights that exist at or below this prim, halting recursive discovery of lights. - consumeAndContinue: The lightList should be consulted, but recursive traversal over nameChildren should continue in case additional lights are added by descendants. - ignore: The lightList should be entirely ignored. This provides a simple way to temporarily invalidate an existing cache. This is the fallback behavior. - **Declaration**: token lightList:cacheBehavior - **C++ Type**: TfToken - **Usd Type**: SdfValueTypeNames->Token - **Allowed Values**: consumeAndHalt, consumeAndContinue, ignore ### GetLightListRel() - **Returns**: Relationship - **Description**: Relationship to lights in the scene. ### GetSchemaAttributeNames() - **Description**: Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. - **Parameters**: - includeInherited (bool) – ### InvalidateLightList() - **Returns**: None - **Description**: Mark any stored lightlist as invalid, by setting the lightList:cacheBehavior attribute to ignore. ### StoreLightList(arg1) - **Returns**: None - **Description**: Store the given paths as the lightlist for this prim. Paths that do not have this prim’s path as a prefix will be silently ignored. This will set the listList:cacheBehavior to "consumeAndContinue". - **Parameters**: - arg1 (SdfPathSet) – ComputeModeConsultModelHierarchyCache = UsdLux.ListAPI.ComputeModeConsultModelHierarchyCache ComputeModeIgnoreCache = UsdLux.ListAPI.ComputeModeIgnoreCache class pxr.UsdLux.MeshLightAPI This is the preferred API schema to apply to Mesh type prims when adding light behaviors to a mesh. At its base, this API schema has the built-in behavior of applying LightAPI to the mesh and overriding the default materialSyncMode to allow the emission/glow of the bound material to affect the color of the light. But, it additionally serves as a hook for plugins to attach additional properties to “mesh lights” through the creation of API schemas which are authored to auto-apply to MeshLightAPI. Auto applied API schemas **Methods:** | Method | Description | | --- | --- | | Apply | classmethod Apply(prim) -> MeshLightAPI | | CanApply | classmethod CanApply(prim, whyNot) -> bool | | Get | classmethod Get(stage, path) -> MeshLightAPI | | GetSchemaAttributeNames | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | static Apply(prim) -> MeshLightAPI - Applies this single-apply API schema to the given prim. - This information is stored by adding “MeshLightAPI” to the token-valued, listOp metadata apiSchemas on the prim. - A valid UsdLuxMeshLightAPI object is returned upon success. An invalid (or empty) UsdLuxMeshLightAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() Parameters: - prim (Prim) – static CanApply(prim, whyNot) -> bool - Returns true if this single-apply API schema can be applied to the given prim. - If this schema can not be applied to the prim, this returns false and, if provided, populates whyNot with the reason it can not be applied. - Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() Parameters: - prim - Prim – - whyNot (str) – ### classmethod Get(stage, path) -> MeshLightAPI Return a UsdLuxMeshLightAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdLuxMeshLightAPI(stage->GetPrimAtPath(path)); ``` #### Parameters - stage (Stage) – - path (Path) – ### classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - includeInherited (bool) – ### class pxr.UsdLux.NonboundableLightBase Base class for intrinsic lights that are not boundable. The primary purpose of this class is to provide a direct API to the functions provided by LightAPI for concrete derived light types. #### Methods: - CreateColorAttr(defaultValue, writeSparsely) See UsdLuxLightAPI::CreateColorAttr(). - CreateColorTemperatureAttr(defaultValue, ...) See UsdLuxLightAPI::CreateColorTemperatureAttr(). - CreateDiffuseAttr(defaultValue, writeSparsely) See UsdLuxLightAPI::CreateDiffuseAttr(). - CreateEnableColorTemperatureAttr(...) See UsdLuxLightAPI::CreateEnableColorTemperatureAttr(). - CreateExposureAttr(defaultValue, writeSparsely) See UsdLuxLightAPI::CreateExposureAttr(). - CreateFiltersRel() See UsdLuxLightAPI::CreateFiltersRel(). - CreateIntensityAttr(defaultValue, writeSparsely) See UsdLuxLightAPI::CreateIntensityAttr(). | Method Name | Description | |-------------|-------------| | `CreateNormalizeAttr(defaultValue, writeSparsely)` | See UsdLuxLightAPI::CreateNormalizeAttr() . | | `CreateSpecularAttr(defaultValue, writeSparsely)` | See UsdLuxLightAPI::CreateSpecularAttr() . | | `Get(stage, path) -> NonboundableLightBase` | classmethod Get(stage, path) -> NonboundableLightBase | | `GetColorAttr()` | See UsdLuxLightAPI::GetColorAttr() . | | `GetColorTemperatureAttr()` | See UsdLuxLightAPI::GetColorTemperatureAttr() . | | `GetDiffuseAttr()` | See UsdLuxLightAPI::GetDiffuseAttr() . | | `GetEnableColorTemperatureAttr()` | See UsdLuxLightAPI::GetEnableColorTemperatureAttr() . | | `GetExposureAttr()` | See UsdLuxLightAPI::GetExposureAttr() . | | `GetFiltersRel()` | See UsdLuxLightAPI::GetFiltersRel() . | | `GetIntensityAttr()` | See UsdLuxLightAPI::GetIntensityAttr() . | | `GetNormalizeAttr()` | See UsdLuxLightAPI::GetNormalizeAttr() . | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | `GetSpecularAttr()` | See UsdLuxLightAPI::GetSpecularAttr() . | | `LightAPI()` | Contructs and returns a UsdLuxLightAPI object for this light. | ### CreateColorAttr ```python CreateColorAttr(defaultValue, writeSparsely) -> Attribute ``` See UsdLuxLightAPI::CreateColorAttr() . **Parameters:** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateColorTemperatureAttr ```python CreateColorTemperatureAttr(defaultValue, writeSparsely) -> Attribute ``` See UsdLuxLightAPI::CreateColorTemperatureAttr() . **Parameters:** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateColorTemperatureAttr ```python CreateColorTemperatureAttr(defaultValue: VtValue, writeSparsely: bool) -> Attribute ``` See UsdLuxLightAPI::CreateColorTemperatureAttr(). **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateDiffuseAttr ```python CreateDiffuseAttr(defaultValue: VtValue, writeSparsely: bool) -> Attribute ``` See UsdLuxLightAPI::CreateDiffuseAttr(). **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateEnableColorTemperatureAttr ```python CreateEnableColorTemperatureAttr(defaultValue: VtValue, writeSparsely: bool) -> Attribute ``` See UsdLuxLightAPI::CreateEnableColorTemperatureAttr(). **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateExposureAttr ```python CreateExposureAttr(defaultValue: VtValue, writeSparsely: bool) -> Attribute ``` See UsdLuxLightAPI::CreateExposureAttr(). **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateFiltersRel ```python CreateFiltersRel() -> Relationship ``` See UsdLuxLightAPI::CreateFiltersRel(). ### CreateIntensityAttr ```python CreateIntensityAttr(defaultValue: VtValue, writeSparsely: bool) -> Attribute ``` See UsdLuxLightAPI::CreateIntensityAttr(). **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateIntensityAttr See UsdLuxLightAPI::CreateIntensityAttr(). #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateNormalizeAttr See UsdLuxLightAPI::CreateNormalizeAttr(). #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateSpecularAttr See UsdLuxLightAPI::CreateSpecularAttr(). #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### Get **classmethod** Get(stage, path) -> NonboundableLightBase Return a UsdLuxNonboundableLightBase holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdLuxNonboundableLightBase(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (Stage) – - **path** (Path) – ### GetColorAttr See UsdLuxLightAPI::GetColorAttr(). ### GetColorTemperatureAttr See UsdLuxLightAPI::GetColorTemperatureAttr() . ``` ### GetDiffuseAttr See UsdLuxLightAPI::GetDiffuseAttr() . ``` ### GetEnableColorTemperatureAttr See UsdLuxLightAPI::GetEnableColorTemperatureAttr() . ``` ### GetExposureAttr See UsdLuxLightAPI::GetExposureAttr() . ``` ### GetFiltersRel See UsdLuxLightAPI::GetFiltersRel() . ``` ### GetIntensityAttr See UsdLuxLightAPI::GetIntensityAttr() . ``` ### GetNormalizeAttr See UsdLuxLightAPI::GetNormalizeAttr() . ``` ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters includeInherited (bool) – ``` ### GetSpecularAttr See UsdLuxLightAPI::GetSpecularAttr() . ``` ### LightAPI Contructs and returns a UsdLuxLightAPI object for this light. ``` class pxr.UsdLux.PluginLight =========================== Light that provides properties that allow it to identify an external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be provided to render delegates without the need to provide a schema definition for the light’s type. Plugin Lights and Light Filters ------------------------------- **Methods:** - **Define** - *classmethod* - Define(stage, path) -> PluginLight - **Get** - *classmethod* - Get(stage, path) -> PluginLight - **GetNodeDefAPI**() - Convenience method for accessing the UsdShadeNodeDefAPI functionality for this prim. - **GetSchemaAttributeNames** - *classmethod* - GetSchemaAttributeNames(includeInherited) -> list[TfToken] static Define(stage, path) -> PluginLight ----------------------------------------- Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at path is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with specifier == SdfSpecifierDef and this schema’s prim type name for the prim at path at the current EditTarget. Author SdfPrimSpec s with specifier == SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors. The given path must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid UsdPrim. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (Stage) – - **path** (Path) – static Get(stage, path) -> PluginLight -------------------------------------- Return a UsdLuxPluginLight holding the prim adhering to this schema at path on stage. If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdLuxPluginLight(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetNodeDefAPI ```python GetNodeDefAPI() -> NodeDefAPI ``` Convenience method for accessing the UsdShadeNodeDefAPI functionality for this prim. One can also construct a UsdShadeNodeDefAPI directly from a UsdPrim. ### GetSchemaAttributeNames ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ### PluginLightFilter Light filter that provides properties that allow it to identify an external SdrShadingNode definition, through UsdShadeNodeDefAPI, that can be provided to render delegates without the need to provide a schema definition for the light filter’s type. #### Methods: - **Define** ```python classmethod Define(stage, path) -> PluginLightFilter ``` Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined() ) on this stage. - **Get** ```python classmethod Get(stage, path) -> PluginLightFilter ``` - **GetNodeDefAPI** ```python GetNodeDefAPI() ``` Convenience method for accessing the UsdShadeNodeDefAPI functionality for this prim. - **GetSchemaAttributeNames** ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` example, in case **path** cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (**Stage**) – - **path** (**Path**) – **classmethod** Get(stage, path) -> PluginLightFilter Return a UsdLuxPluginLightFilter holding the prim adhering to this schema at **path** on **stage**. If no prim exists at **path** on **stage**, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdLuxPluginLightFilter(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (**Stage**) – - **path** (**Path**) – **GetNodeDefAPI**() -> **NodeDefAPI** Convenience method for accessing the UsdShadeNodeDefAPI functionality for this prim. One can also construct a UsdShadeNodeDefAPI directly from a UsdPrim. **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (**bool**) – **class** pxr.UsdLux.**PortalLight** A rectangular portal in the local XY plane that guides sampling of a dome light. Transmits light in the -Z direction. The rectangle is 1 unit in length. **Methods:** - **Define**(stage, path) -> PortalLight - **Get**(stage, path) -> PortalLight - **GetSchemaAttributeNames**(includeInherited) -> list[TfToken] **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] **classmethod** Define(stage, path) -> PortalLight Attempt to ensure a **UsdPrim** adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an **SdfPrimSpec** with **specifier** == **SdfSpecifierDef** and this schema’s prim type name for the prim at `path` at the current EditTarget. Author **SdfPrimSpec**s with `specifier` == **SdfSpecifierDef** and empty typeName at the current EditTarget for any nonexistent, or existing but not **Defined** ancestors. The given **path** must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case **path** cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (Stage) – - **path** (Path) – **classmethod** Get(stage, path) -> PortalLight Return a UsdLuxPortalLight holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```text UsdLuxPortalLight(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – <dl> <dt> <p> Light emitted from one side of a rectangle. The rectangle is centered in the XY plane and emits light along the -Z axis. The rectangle is 1 unit in length in the X and Y axis. In the default position, a texture file’s min coordinates should be at (+X, +Y) and max coordinates at (-X, -Y). <p> <strong> Methods: <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr> <td> <p> <code> CreateHeightAttr (defaultValue, writeSparsely) <td> <p> See GetHeightAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr> <td> <p> <code> CreateTextureFileAttr (defaultValue, ...) <td> <p> See GetTextureFileAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr> <td> <p> <code> CreateWidthAttr (defaultValue, writeSparsely) <td> <p> See GetWidthAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr> <td> <p> <code> Define <td> <p> <strong> classmethod Define(stage, path) -&gt; RectLight <tr> <td> <p> <code> Get <td> <p> <strong> classmethod Get(stage, path) -&gt; RectLight <tr> <td> <p> <code> GetHeightAttr () <td> <p> Height of the rectangle, in the local Y axis. <tr> <td> <p> <code> GetSchemaAttributeNames <td> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <tr> <td> <p> <code> GetTextureFileAttr () <td> <p> A color texture to use on the rectangle. <tr> <td> <p> <code> GetWidthAttr () <td> <p> Width of the rectangle, in the local X axis. <dl> <dt> <span> CreateHeightAttr ( <em> defaultValue , <em> writeSparsely ) <span> → <span> Attribute <dd> <p> See GetHeightAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl> <dt> Parameters <dd> <ul> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl> <dt> <span> CreateTextureFileAttr ( <em> defaultValue , <em> writeSparsely ) <span> → <span> Attribute <!-- Additional content for CreateTextureFileAttr would be here if available --> See GetTextureFileAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – See GetWidthAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – **classmethod** Define(stage, path) -> RectLight Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ## Get ### Description ```python classmethod Get(stage, path) -> RectLight ``` Return a UsdLuxRectLight holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdLuxRectLight(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ## GetHeightAttr ### Description Height of the rectangle, in the local Y axis. ### Declaration ```python float inputs:height = 1 ``` ### C++ Type float ### Usd Type SdfValueTypeNames->Float ## GetSchemaAttributeNames ### Description ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - **includeInherited** (`bool`) – ## GetTextureFileAttr ### Description A color texture to use on the rectangle. ### Declaration ```python asset inputs:texture:file ``` ### C++ Type SdfAssetPath ### Usd Type SdfValueTypeNames->Asset ## GetWidthAttr ### Description Width of the rectangle, in the local X axis. ### Declaration ```python float inputs:width = 1 ``` ### C++ Type float ### Usd Type SdfValueTypeNames->Float ### ShadowAPI Controls to refine a light’s shadow behavior. These are non-physical controls that are valuable for visual lighting work. **Methods:** | Method | Description | |--------|-------------| | `Apply` | `classmethod Apply(prim) -> ShadowAPI` | | `CanApply` | `classmethod CanApply(prim, whyNot) -> bool` | | `ConnectableAPI` | Constructs and returns a UsdShadeConnectableAPI object with this shadow API prim. | | `CreateInput` | Create an input which can either have a value or can be connected. | | `CreateOutput` | Create an output which can either have a value or can be connected. | | `CreateShadowColorAttr` | See GetShadowColorAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateShadowDistanceAttr` | See GetShadowDistanceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateShadowEnableAttr` | See GetShadowEnableAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateShadowFalloffAttr` | See GetShadowFalloffAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateShadowFalloffGammaAttr` | See GetShadowFalloffGammaAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Get` | `classmethod Get(stage, path) -> ShadowAPI` | | `GetInput` | Return the requested input if it exists. | | `GetInputs` | Inputs are represented by attributes in the "inputs:" namespace. | | `GetOutput` | Return the requested output if it exists. | | `GetOutputs` | Outputs are represented by attributes in the "outputs:" namespace. | | `GetSchemaAttributeNames` | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | | `GetShadowColorAttr` | The color of shadows cast by the light. | | `GetShadowDistanceAttr` | The maximum distance shadows are cast. | <table> <tbody> <tr class="row-odd"> <td> <p> <code>GetShadowEnableAttr() <td> <p> Enables shadows to be cast by this light. <tr class="row-even"> <td> <p> <code>GetShadowFalloffAttr() <td> <p> The near distance at which shadow falloff begins. <tr class="row-odd"> <td> <p> <code>GetShadowFalloffGammaAttr() <td> <p> A gamma (i.e., exponential) control over shadow strength with linear distance within the falloff zone. <dl> <dt> <em>static <span>Apply() <dd> <p> <strong>classmethod Apply(prim) -&gt; ShadowAPI <p> Applies this <strong>single-apply <p> This information is stored by adding “ShadowAPI” to the token-valued, listOp metadata <em>apiSchemas <p> A valid UsdLuxShadowAPI object is returned upon success. An invalid (or empty) UsdLuxShadowAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl> <dt>Parameters <dd> <p> <strong>prim <dl> <dt> <em>static <span>CanApply() <dd> <p> <strong>classmethod CanApply(prim, whyNot) -&gt; bool <p> Returns true if this <strong>single-apply <p> If this schema can not be a applied to the prim, this returns false and, if provided, populates <code>whyNot <p> Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl> <dt>Parameters <dd> <ul> <li> <p> <strong>prim <li> <p> <strong>whyNot <dl> <dt> <span>ConnectableAPI() <span>→ <span>ConnectableAPI <dd> <p> Contructs and returns a UsdShadeConnectableAPI object with this shadow API prim. <p> Note that a valid UsdLuxShadowAPI will only return a valid UsdShadeConnectableAPI if the its prim’s Typed schema type is actually connectable. <dl> <dt> <span>CreateInput() <em>name <em>typeName <span>→ <span>Input <dd> <p> Create an input which can either have a value or can be connected. <p> The attribute representing the input is created in the “inputs:” namespace. Inputs on shadow API are connectable. - **name** (`str`) – - **typeName** (`ValueTypeName`) – ### CreateOutput (name, typeName) → `Output` Create an output which can either have a value or can be connected. The attribute representing the output is created in the "outputs:" namespace. Outputs on a shadow API cannot be connected, as their value is assumed to be computed externally. - **name** (`str`) – - **typeName** (`ValueTypeName`) – ### CreateShadowColorAttr (defaultValue, writeSparsely) → `Attribute` See GetShadowColorAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateShadowDistanceAttr (defaultValue, writeSparsely) → `Attribute` See GetShadowDistanceAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateShadowEnableAttr ```python CreateShadowEnableAttr(defaultValue, writeSparsely) -> Attribute ``` See GetShadowEnableAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateShadowFalloffAttr ```python CreateShadowFalloffAttr(defaultValue, writeSparsely) -> Attribute ``` See GetShadowFalloffAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateShadowFalloffGammaAttr ```python CreateShadowFalloffGammaAttr(defaultValue, writeSparsely) -> Attribute ``` See GetShadowFalloffGammaAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## Get `classmethod` Get(stage, path) -> ShadowAPI Return a UsdLuxShadowAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```text UsdLuxShadowAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ## GetInput Return the requested input if it exists. ### Parameters - **name** (str) – ## GetInputs Inputs are represented by attributes in the "inputs:" namespace. If `onlyAuthored` is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. ### Parameters - **onlyAuthored** (bool) – ## GetOutput Return the requested output if it exists. ### Parameters - **name** (str) – ## GetOutputs If `onlyAuthored` is true (the default), then only return authored outputs; otherwise, this also returns un-authored builtins. ### Parameters - **onlyAuthored** (bool) – <dl> <dt> Outputs are represented by attributes in the "outputs:" namespace. <dd> <p> If <code>onlyAuthored is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> onlyAuthored ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> GetSchemaAttributeNames <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <p> Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. <p> Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> includeInherited ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> GetShadowColorAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> The color of shadows cast by the light. <p> This is a non-physical control. The default is to cast black shadows. <p> Declaration <p> <code> color3f inputs:shadow:color = (0, 0, 0) <p> C++ Type <p> GfVec3f <p> Usd Type <p> SdfValueTypeNames-&gt;Color3f <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> GetShadowDistanceAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> The maximum distance shadows are cast. <p> The default value (-1) indicates no limit. <p> Declaration <p> <code> float inputs:shadow:distance = -1 <p> C++ Type <p> float <p> Usd Type <p> SdfValueTypeNames-&gt;Float <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> GetShadowEnableAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> Enables shadows to be cast by this light. <p> Declaration <p> <code> bool inputs:shadow:enable = 1 <p> C++ Type <p> bool <p> Usd Type <p> SdfValueTypeNames-&gt;Bool <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> GetShadowFalloffAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> The near distance at which shadow falloff begins. <p> The default value (-1) indicates no falloff. <p> Declaration <p> <code> float inputs:shadow:falloff = -1 <p> C++ Type <p> float <p> Usd Type <p> SdfValueTypeNames-&gt;Float ## GetShadowFalloffGammaAttr A gamma (i.e., exponential) control over shadow strength with linear distance within the falloff zone. This requires the use of shadowDistance and shadowFalloff. ### Declaration float inputs:shadow:falloffGamma = 1 ``` ### C++ Type ``` float ``` ### Usd Type ``` SdfValueTypeNames->Float ``` ## ShapingAPI Controls for shaping a light’s emission. ### Methods: | Method | Description | |--------|-------------| | `Apply` | `classmethod Apply(prim) -> ShapingAPI` | | `CanApply` | `classmethod CanApply(prim, whyNot) -> bool` | | `ConnectableAPI` | Contructs and returns a UsdShadeConnectableAPI object with this shaping API prim. | | `CreateInput` | Create an input which can either have a value or can be connected. | | `CreateOutput` | Create an output which can either have a value or can be connected. | | `CreateShapingConeAngleAttr` | See GetShapingConeAngleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateShapingConeSoftnessAttr` | See GetShapingConeSoftnessAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateShapingFocusAttr` | See GetShapingFocusAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateShapingFocusTintAttr` | See GetShapingFocusTintAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateShapingIesAngleScaleAttr` | See GetShapingIesAngleScaleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateShapingIesFileAttr` | See GetShapingIesFileAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateShapingIesNormalizeAttr` | See GetShapingIesNormalizeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Get` | `classmethod Get(stage, path) -> ShapingAPI` | | Function | Description | |-------------------------|-----------------------------------------------------------------------------| | `GetInput(name)` | Return the requested input if it exists. | | `GetInputs(onlyAuthored)` | Inputs are represented by attributes in the "inputs:" namespace. | | `GetOutput(name)` | Return the requested output if it exists. | | `GetOutputs(onlyAuthored)` | Outputs are represented by attributes in the "outputs:" namespace. | | `GetSchemaAttributeNames(includeInherited)` | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | `GetShapingConeAngleAttr()` | Angular limit off the primary axis to restrict the light spread. | | `GetShapingConeSoftnessAttr()` | Controls the cutoff softness for cone angle. | | `GetShapingFocusAttr()` | A control to shape the spread of light. | | `GetShapingFocusTintAttr()` | Off-axis color tint. | | `GetShapingIesAngleScaleAttr()` | Rescales the angular distribution of the IES profile. | | `GetShapingIesFileAttr()` | An IES (Illumination Engineering Society) light profile describing the angular distribution of light. | | `GetShapingIesNormalizeAttr()` | Normalizes the IES profile so that it affects the shaping of the light while preserving the overall energy output. | ### Apply **classmethod** Apply(prim) -> ShapingAPI - Applies this **single-apply** API schema to the given `prim`. - This information is stored by adding "ShapingAPI" to the token-valued, listOp metadata *apiSchemas* on the prim. - A valid UsdLuxShapingAPI object is returned upon success. An invalid (or empty) UsdLuxShapingAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() **Parameters** - **prim** (Prim) – ### CanApply **classmethod** CanApply(prim, whyNot) -> bool - Returns true if this **single-apply** API schema can be applied to the given `prim`. - If this schema can not be applied to the prim, this returns false and, if provided, populates `whyNot` with the reason it can not be applied. that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters ========== - **prim** (Prim) – - **whyNot** (str) – ConnectableAPI =============== Contructs and returns a UsdShadeConnectableAPI object with this shaping API prim. Note that a valid UsdLuxShapingAPI will only return a valid UsdShadeConnectableAPI if the its prim’s Typed schema type is actually connectable. CreateInput =========== Create an input which can either have a value or can be connected. The attribute representing the input is created in the”inputs:”namespace. Inputs on shaping API are connectable. Parameters ---------- - **name** (str) – - **typeName** (ValueTypeName) – CreateOutput ============ Create an output which can either have a value or can be connected. The attribute representing the output is created in the”outputs:”namespace. Outputs on a shaping API cannot be connected, as their value is assumed to be computed externally. Parameters ---------- - **name** (str) – - **typeName** (ValueTypeName) – CreateShapingConeAngleAttr =========================== See GetShapingConeAngleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. <p> The default value of <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> CreateShapingConeSoftnessAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetShapingConeSoftnessAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> CreateShapingFocusAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetShapingFocusAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"> <span class="pre"> CreateShapingFocusTintAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetShapingFocusTintAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – is ``` ``` false ``` ```markdown Parameters ``` ```markdown - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ``` ```markdown CreateShapingIesAngleScaleAttr ``` ```markdown ( ``` ```markdown defaultValue ``` ```markdown , ``` ```markdown writeSparsely ``` ```markdown ) ``` ```markdown → Attribute ``` ```markdown See GetShapingIesAngleScaleAttr() , and also Create vs Get Property Methods for when to use Get vs Create. ``` ```markdown If specified, author ``` ``` defaultValue ``` ```markdown as the attribute’s default, sparsely (when it makes sense to do so) if ``` ``` writeSparsely ``` ```markdown is ``` ``` true ``` ```markdown - the default for ``` ``` writeSparsely ``` ```markdown is ``` ``` false ``` ```markdown Parameters ``` ```markdown - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ``` ```markdown CreateShapingIesFileAttr ``` ```markdown ( ``` ```markdown defaultValue ``` ```markdown , ``` ```markdown writeSparsely ``` ```markdown ) ``` ```markdown → Attribute ``` ```markdown See GetShapingIesFileAttr() , and also Create vs Get Property Methods for when to use Get vs Create. ``` ```markdown If specified, author ``` ``` defaultValue ``` ```markdown as the attribute’s default, sparsely (when it makes sense to do so) if ``` ``` writeSparsely ``` ```markdown is ``` ``` true ``` ```markdown - the default for ``` ``` writeSparsely ``` ```markdown is ``` ``` false ``` ```markdown Parameters ``` ```markdown - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ``` ```markdown CreateShapingIesNormalizeAttr ``` ```markdown ( ``` ```markdown defaultValue ``` ```markdown , ``` ```markdown writeSparsely ``` ```markdown ) ``` ```markdown → Attribute ``` ```markdown See GetShapingIesNormalizeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. ``` ```markdown If specified, author ``` ``` defaultValue ``` ```markdown as the attribute’s default, sparsely (when it makes sense to do so) if ``` ``` writeSparsely ``` ```markdown is ``` ``` true ``` ```markdown - the default for ``` ``` writeSparsely ``` ```markdown is ``` ``` false ``` <p> <code class="docutils literal notranslate"><span class="pre">false . <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <dl class="py method"> <dt class="sig sig-object py"> <em class="property"><span class="pre">static <span class="sig-name descname"><span class="pre">Get <span class="sig-paren">() <dd> <p><strong>classmethod <p>Return a UsdLuxShapingAPI holding the prim adhering to this schema at <code class="docutils literal notranslate"><span class="pre">path <p>If no prim exists at <code class="docutils literal notranslate"><span class="pre">path <div class="highlight-text notranslate"> <div class="highlight"> <pre>UsdLuxShapingAPI(stage-&gt;GetPrimAtPath(path)); <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p><strong>stage <li> <p><strong>path <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"><span class="pre">GetInput <span class="sig-paren">(<em class="sig-param"><span class="n"><span class="pre">name <span class="sig-return">→ <span class="sig-return-typehint"><span class="pre">Input <dd> <p>Return the requested input if it exists. <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <p><strong>name <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"><span class="pre">GetInputs <span class="sig-paren">(<em class="sig-param"><span class="n"><span class="pre">onlyAuthored <span class="sig-return">→ <span class="sig-return-typehint"><span class="pre">list <dd> <p>Inputs are represented by attributes in the”inputs:”namespace. <p>If <code class="docutils literal notranslate"><span class="pre">onlyAuthored <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <p><strong>onlyAuthored <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"><span class="pre">GetOutput <span class="sig-paren">(<em class="sig-param"><span class="n"><span class="pre">name <span class="sig-return">→ <span class="sig-return-typehint"><span class="pre">Output <dd> <p>Return the requested output if it exists. <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <p><strong>name <dl class="py method"> <dt class="sig sig-object py"> <span class="sig-name descname"><span class="pre">GetOutputs <span class="sig-paren">(<em class="sig-param"> ### onlyAuthored Outputs are represented by attributes in the "outputs:" namespace. If `onlyAuthored` is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. #### Parameters - **onlyAuthored** (bool) – ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ### GetShapingConeAngleAttr Angular limit off the primary axis to restrict the light spread. Declaration ``` float inputs:shaping:cone:angle = 90 ``` C++ Type: float Usd Type: SdfValueTypeNames->Float ### GetShapingConeSoftnessAttr Controls the cutoff softness for cone angle. TODO: clarify semantics Declaration ``` float inputs:shaping:cone:softness = 0 ``` C++ Type: float Usd Type: SdfValueTypeNames->Float ### GetShapingFocusAttr A control to shape the spread of light. Higher focus values pull light towards the center and narrow the spread. Implemented as an off-axis cosine power exponent. TODO: clarify semantics Declaration ``` float inputs:shaping:focus = 0 ``` C++ Type: float Usd Type: SdfValueTypeNames->Float ### GetShapingFocusTintAttr Off-axis color tint. This tints the emission in the falloff region. The default tint is ``` black. TODO: clarify semantics Declaration ``` color3f inputs:shaping:focusTint = (0, 0, 0) ``` C++ Type GfVec3f Usd Type SdfValueTypeNames->Color3f --- Rescales the angular distribution of the IES profile. TODO: clarify semantics Declaration ``` float inputs:shaping:ies:angleScale = 0 ``` C++ Type float Usd Type SdfValueTypeNames->Float --- An IES (Illumination Engineering Society) light profile describing the angular distribution of light. Declaration ``` asset inputs:shaping:ies:file ``` C++ Type SdfAssetPath Usd Type SdfValueTypeNames->Asset --- Normalizes the IES profile so that it affects the shaping of the light while preserving the overall energy output. Declaration ``` bool inputs:shaping:ies:normalize = 0 ``` C++ Type bool Usd Type SdfValueTypeNames->Bool --- Light emitted outward from a sphere. **Methods:** - `CreateRadiusAttr(defaultValue, writeSparsely)` - See GetRadiusAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateTreatAsPointAttr(defaultValue, ...)` - See GetTreatAsPointAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `Define` - **classmethod** Define(stage, path) -> SphereLight - `Get` - **classmethod** Get(stage, path) -> SphereLight - `GetRadiusAttr()` - Radius of the sphere. | Method Name | Description | |-------------|-------------| | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | A classmethod that returns a list of attribute names. | | `GetTreatAsPointAttr()` | A hint that this light can be treated as a 'point' light (effectively, a zero-radius sphere) by renderers that benefit from non-area lighting. | ### CreateRadiusAttr(defaultValue, writeSparsely) -> Attribute See GetRadiusAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters:** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateTreatAsPointAttr(defaultValue, writeSparsely) -> Attribute See GetTreatAsPointAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters:** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### static Define(stage, path) -> SphereLight Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget. current EditTarget for any nonexistent, or existing but not **Defined** ancestors. The given **path** must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case **path** cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. Parameters ---------- - **stage** (Stage) – - **path** (Path) – classmethod Get(stage, path) -> SphereLight -------------------------------------------- Return a UsdLuxSphereLight holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdLuxSphereLight(stage->GetPrimAtPath(path)); ``` Parameters ---------- - **stage** (Stage) – - **path** (Path) – GetRadiusAttr() -> Attribute ---------------------------- Radius of the sphere. Declaration ``` float inputs:radius = 0.5 ``` C++ Type: float Usd Type: SdfValueTypeNames->Float classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ---------------------------------------------------------------------- Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters ---------- - **includeInherited** (bool) – GetTreatAsPointAttr() -> Attribute ----------------------------------- A hint that this light can be treated as a’point’light (effectively, a zero-radius sphere) by renderers that benefit from non-area lighting. Renderers that only support area lights can disregard this. Declaration ``` bool treatAsPoint = false ``` <span class="pre"> 0 C++ Type bool Usd Type SdfValueTypeNames->Bool class pxr.UsdLux. Tokens **Attributes:** | Attribute | Description | |-----------|-------------| | angular | | | automatic | | | collectionFilterLinkIncludeRoot | | | collectionLightLinkIncludeRoot | | | collectionShadowLinkIncludeRoot | | | consumeAndContinue | | | consumeAndHalt | | | cubeMapVerticalCross | | | cylinderLight | | | diskLight | | | distantLight | | | domeLight | | | extent | | | filterLink | | | geometry | | | geometryLight | | | guideRadius | | | ignore | | | independent | | | inputsAngle | | | inputsColor | | | inputsColorTemperature | | <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsDiffuse <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsEnableColorTemperature <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsExposure <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsHeight <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsIntensity <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsLength <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsNormalize <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsRadius <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShadowColor <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShadowDistance <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShadowEnable <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShadowFalloff <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShadowFalloffGamma <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShapingConeAngle <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShapingConeSoftness <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShapingFocus <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShapingFocusTint <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShapingIesAngleScale <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShapingIesFile <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsShapingIesNormalize <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsSpecular <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsTextureFile <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsTextureFormat <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> inputsWidth | latlong | |---------| | lightFilterShaderId | | lightFilters | | lightLink | | lightList | | lightListCacheBehavior | | lightMaterialSyncMode | | lightShaderId | | materialGlowTintsLight | | meshLight | | mirroredBall | | noMaterialResponse | | orientToStageUpAxis | | portalLight | | portals | | rectLight | | shadowLink | | sphereLight | | treatAsLine | | treatAsPoint | | volumeLight | ### angular = 'angular' ### automatic = 'automatic' ### collectionFilterLinkIncludeRoot = 'collectionFilterLinkIncludeRoot' - `collectionFilterLinkIncludeRoot = 'collection:filterLink:includeRoot'` - `collectionLightLinkIncludeRoot = 'collection:lightLink:includeRoot'` - `collectionShadowLinkIncludeRoot = 'collection:shadowLink:includeRoot'` - `consumeAndContinue = 'consumeAndContinue'` - `consumeAndHalt = 'consumeAndHalt'` - `cubeMapVerticalCross = 'cubeMapVerticalCross'` - `cylinderLight = 'CylinderLight'` - `diskLight = 'DiskLight'` - `distantLight = 'DistantLight'` - `domeLight = 'DomeLight'` - `extent = 'extent'` - `filterLink = 'filterLink'` - `geometry = 'geometry'` - `geometryLight = 'GeometryLight'` - `guideRadius = 'guideRadius'` - `ignore = 'ignore'` - `independent = 'independent'` - `inputsAngle = 'inputs:angle'` - `inputsColor = 'inputs:color'` - `inputsColorTemperature = 'inputs:colorTemperature'` - `inputsDiffuse = 'inputs:diffuse'` - `inputsEnableColorTemperature = 'inputs:enableColorTemperature'` - `inputsExposure = 'inputs:exposure'` - `inputsHeight = 'inputs:height'` - `inputsIntensity = 'inputs:intensity'` - `inputsLength = 'inputs:length'` - `inputsNormalize = 'inputs:normalize'` - `inputsRadius = 'inputs:radius'` - `inputsShadowColor = 'inputs:shadow:color'` - `inputsShadowDistance = 'inputs:shadow:distance'` - `inputsShadowEnable = 'inputs:shadow:enable'` - `inputsShadowFalloff = 'inputs:shadow:falloff'` - `inputsShadowFalloffGamma = 'inputs:shadow:falloffGamma'` - `inputsShapingConeAngle = 'inputs:shaping:cone:angle'` - `inputsShapingConeSoftness = 'inputs:shaping:cone:softness'` - `inputsShapingFocus = 'inputs:shaping:focus'` - `inputsShapingFocusTint = 'inputs:shaping:focusTint'` - `inputsShapingIesAngleScale = 'inputs:shaping:ies:angleScale'` - `inputsShapingIesFile = 'inputs:shaping:ies:file'` - `inputsShapingIesNormalize = 'inputs:shaping:ies:normalize'` - `inputsSpecular = 'inputs:specular'` - `inputsTextureFile = 'inputs:texture:file'` - `inputsTextureFormat = 'inputs:texture:format'` - `inputsWidth = 'inputs:width'` - `latlong = 'latlong'` - `latlong` = 'latlong' - `lightFilterShaderId` = 'lightFilter:shaderId' - `lightFilters` = 'light:filters' - `lightLink` = 'lightLink' - `lightList` = 'lightList' - `lightListCacheBehavior` = 'lightList:cacheBehavior' - `lightMaterialSyncMode` = 'light:materialSyncMode' - `lightShaderId` = 'light:shaderId' - `materialGlowTintsLight` = 'materialGlowTintsLight' - `meshLight` = 'MeshLight' - `mirroredBall` = 'mirroredBall' - `noMaterialResponse` = 'noMaterialResponse' - `orientToStageUpAxis` = 'orientToStageUpAxis' - `portalLight` = 'PortalLight' - `portals` = 'portals' ### Attributes - `rectLight` = 'RectLight' - `shadowLink` = 'shadowLink' - `sphereLight` = 'SphereLight' - `treatAsLine` = 'treatAsLine' - `treatAsPoint` = 'treatAsPoint' - `volumeLight` = 'VolumeLight' ### Class: pxr.UsdLux.VolumeLightAPI This is the preferred API schema to apply to Volume type prims when adding light behaviors to a volume. At its base, this API schema has the built-in behavior of applying LightAPI to the volume and overriding the default materialSyncMode to allow the emission/glow of the bound material to affect the color of the light. But, it additionally serves as a hook for plugins to attach additional properties to “volume lights” through the creation of API schemas which are authored to auto-apply to VolumeLightAPI. #### Auto applied API schemas #### Methods: | Method | Description | |--------|-------------| | `Apply` | classmethod Apply(prim) -> VolumeLightAPI | | `CanApply` | classmethod CanApply(prim, whyNot) -> bool | | `Get` | classmethod Get(stage, path) -> VolumeLightAPI | | `GetSchemaAttributeNames` | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | #### Static Method: Apply - **classmethod** Apply(prim) -> VolumeLightAPI - Applies this single-apply API schema to the given `prim`. - This information is stored by adding “VolumeLightAPI” to the token-valued, listOp metadata `apiSchemas` on the prim. - A valid UsdLuxVolumeLightAPI object is returned upon success. An invalid (or empty) UsdLuxVolumeLightAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() Parameters: - **prim** (Prim) – ## CanApply ```classmethod``` CanApply(prim, whyNot) -> bool Returns true if this ```single-apply``` API schema can be applied to the given ```prim```. If this schema can not be a applied to the prim, this returns false and, if provided, populates ```whyNot``` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() ### Parameters - ```prim``` (Prim) – - ```whyNot``` (str) – ## Get ```classmethod``` Get(stage, path) -> VolumeLightAPI Return a UsdLuxVolumeLightAPI holding the prim adhering to this schema at ```path``` on ```stage```. If no prim exists at ```path``` on ```stage```, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdLuxVolumeLightAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - ```stage``` (Stage) – - ```path``` (Path) – ## GetSchemaAttributeNames ```classmethod``` GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - ```includeInherited``` (bool) –
155,170
UsdMedia.md
# UsdMedia module Summary: The UsdMedia module provides a representation for including other media, such as audio, in the context of a stage. UsdMedia currently contains one media type, UsdMediaSpatialAudio, which allows the playback of audio files both spatially and non-spatially. ## Classes: | Class | Description | |-------|-------------| | [SpatialAudio](#pxr.UsdMedia.SpatialAudio) | The SpatialAudio primitive defines basic properties for encoding playback of an audio file or stream within a USD Stage. | | [Tokens](#pxr.UsdMedia.Tokens) | | ### pxr.UsdMedia.SpatialAudio The SpatialAudio primitive defines basic properties for encoding playback of an audio file or stream within a USD Stage. The SpatialAudio schema derives from UsdGeomXformable since it can support full spatial audio while also supporting non-spatial mono and stereo sounds. One or more SpatialAudio prims can be placed anywhere in the namespace, though it is advantageous to place truly spatial audio prims under/inside the models from which the sound emanates, so that the audio prim need only be transformed relative to the model, rather than copying its animation. #### Timecode Attributes and Time Scaling `startTime` and `endTime` are timecode valued attributes which gives them the special behavior that layer offsets affecting the layer in which one of these values is authored are applied to the attribute’s value itself during value resolution. This allows audio playback to be kept in sync with time sampled animation as the animation is affected by layer offsets in the composition. But this behavior brings with it some interesting edge cases and caveats when it comes to layer offsets that include scale. Although authored layer offsets may have a time scale which can scale the duration between an authored `startTime` and `endTime`, we make no attempt to infer any playback dilation of the actual audio media itself. Given that `startTime` and `endTime` can be independently authored in different layers with differing time scales, it is not possible, in general, to define an "original timeframe" from which we can compute a dilation to composed stage-time. Even if we could compute a composed dilation this way, it would still be impossible to flatten a stage or layer stack into a single layer and still retain the composed audio dilation using this schema. Although we do not expect it to be common, it is possible to apply a negative time scale to USD layers, which mostly has the effect of reversing animation in the affected composition. If a negative scale is applied to a composition that contains authored `startTime` and `endTime`, it will reverse their relative ordering in time. Therefore, when `playbackMode` is "onceFromStartToEnd" or "loopFromStartToEnd", if `endTime` is less than **startTime** , then begin playback at **endTime** , and continue until **startTime** . When **startTime** and **endTime** are inverted, we do not, however, stipulate that playback of the audio media itself be inverted, since doing so”successfully”would require perfect knowledge of when, within the audio clip, relevant audio ends (so that we know how to offset the reversed audio to align it so that we reach the”beginning”at **startTime** ), and sounds played in reverse are not likely to produce desirable results. For any described attribute **Fallback** **Value** or **Allowed** **Values** below that are text/tokens, the actual token is published and defined in UsdMediaTokens. So to set an attribute to the value”rightHanded”, use UsdMediaTokens->rightHanded as the value. **Methods:** | Method Name | Description | |-------------|-------------| | CreateAuralModeAttr(defaultValue, writeSparsely) | See GetAuralModeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateEndTimeAttr(defaultValue, writeSparsely) | See GetEndTimeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateFilePathAttr(defaultValue, writeSparsely) | See GetFilePathAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateGainAttr(defaultValue, writeSparsely) | See GetGainAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateMediaOffsetAttr(defaultValue, ...) | See GetMediaOffsetAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreatePlaybackModeAttr(defaultValue, ...) | See GetPlaybackModeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | CreateStartTimeAttr(defaultValue, writeSparsely) | See GetStartTimeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | Define(stage, path) -> SpatialAudio | **classmethod** Define(stage, path) -> SpatialAudio | | Get(stage, path) -> SpatialAudio | **classmethod** Get(stage, path) -> SpatialAudio | | GetAuralModeAttr() | Determines how audio should be played. | | GetEndTimeAttr() | Expressed in the timeCodesPerSecond of the containing stage, **endTime** specifies when the audio stream will cease playing during animation playback if the length of the referenced audio clip is longer than desired. | | Method | Description | | --- | --- | | `GetFilePathAttr()` | Path to the audio file. | | `GetGainAttr()` | Multiplier on the incoming audio signal. | | `GetMediaOffsetAttr()` | Expressed in seconds, `mediaOffset` specifies the offset from the referenced audio file's beginning at which we should begin playback when stage playback reaches the time that prim's audio should start. | | `GetPlaybackModeAttr()` | Along with `startTime` and `endTime`, determines when the audio playback should start and stop during the stage's animation playback and whether the audio should loop during its duration. | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | **classmethod** | | `GetStartTimeAttr()` | Expressed in the timeCodesPerSecond of the containing stage, `startTime` specifies when the audio stream will start playing during animation playback. | ### CreateAuralModeAttr(defaultValue, writeSparsely) -> Attribute See GetAuralModeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateEndTimeAttr(defaultValue, writeSparsely) -> Attribute ## 方法说明 ### CreateFilePathAttr - **Parameters**: - **defaultValue** (`VtValue`) - **writeSparsely** (`bool`) ### CreateGainAttr - **Parameters**: - **defaultValue** (`VtValue`) - **writeSparsely** (`bool`) ### CreateMediaOffsetAttr - **Parameters**: - **defaultValue** (`VtValue`) - **writeSparsely** (`bool`) ### CreateEndTimeAttr - **Parameters**: - **defaultValue** (`VtValue`) - **writeSparsely** (`bool`) ### CreateFilePathAttr - **Parameters**: - **defaultValue** (`VtValue`) - **writeSparsely** (`bool`) ### CreateGainAttr - **Parameters**: - **defaultValue** (`VtValue`) - **writeSparsely** (`bool`) ### CreateMediaOffsetAttr - **Parameters**: - **defaultValue** (`VtValue`) - **writeSparsely** (`bool`) ### CreateMediaOffsetAttr() See GetMediaOffsetAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreatePlaybackModeAttr() See GetPlaybackModeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateStartTimeAttr() See GetStartTimeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### Define **classmethod** Define(stage, path) -> SpatialAudio Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined()) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget’s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ### Get **classmethod** Get(stage, path) -> SpatialAudio Return a UsdMediaSpatialAudio holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdMediaSpatialAudio(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ### GetAuralModeAttr → `Attribute` Determines how audio should be played. Valid values are: - spatial: Play the audio in 3D space if the device can support spatial audio. If not, fall back to mono. - nonSpatial: Play the audio without regard to the SpatialAudio prim’s position. If the audio media contains any form of stereo or other multi-channel sound, it is left to the application to determine whether the listener’s position should be taken into account. We expect nonSpatial to be the choice for ambient sounds and music sound-tracks. Declaration ``` ```markdown uniform token auralMode = "spatial" ``` ```markdown C++ Type TfToken Usd Type SdfValueTypeNames->Token Variability SdfVariabilityUniform Allowed Values spatial, nonSpatial ``` ```markdown GetEndTimeAttr() → Attribute ``` ```markdown Expressed in the timeCodesPerSecond of the containing stage, endTime specifies when the audio stream will cease playing during animation playback if the length of the referenced audio clip is longer than desired. This only applies if playbackMode is set to onceFromStartToEnd or loopFromStartToEnd, otherwise the endTimeCode of the stage is used instead of endTime. If endTime is less than startTime, it is expected that the audio will instead be played from endTime to startTime. Note that endTime is expressed as a timecode so that the stage can properly apply layer offsets when resolving its value. See Timecode Attributes and Time Scaling for more details and caveats. Declaration ``` ```markdown uniform timecode endTime = 0 ``` ```markdown C++ Type SdfTimeCode Usd Type SdfValueTypeNames->TimeCode Variability SdfVariabilityUniform ``` ```markdown GetFilePathAttr() → Attribute ``` ```markdown Path to the audio file. In general, the formats allowed for audio files is no more constrained by USD than is image-type. As with images, however, usdz has stricter requirements based on DMA and format support in browsers and consumer devices. The allowed audio filetypes for usdz are M4A, MP3, WAV (in order of preference). Usdz Specification Declaration ``` ```markdown uniform asset filePath = @@ ``` ```markdown C++ Type SdfAssetPath Usd Type SdfValueTypeNames->Asset Variability SdfVariabilityUniform ``` ```markdown GetGainAttr() → Attribute ``` ```markdown Multiplier on the incoming audio signal. A value of 0 "mutes" the signal. Negative values will be clamped to 0. Declaration ``` ```markdown double gain = 1 ``` ```markdown C++ Type double Usd Type SdfValueTypeNames->Double ``` <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdMedia.SpatialAudio.GetMediaOffsetAttr"> <span class="sig-name descname"> <span class="pre"> GetMediaOffsetAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <span class="headerlink">  <dd> <p> Expressed in seconds, <em> mediaOffset specifies the offset from the referenced audio file’s beginning at which we should begin playback when stage playback reaches the time that prim’s audio should start. <p> If the prim’s <em> playbackMode is a looping mode, <em> mediaOffset is applied only to the first run-through of the audio clip; the second and all other loops begin from the start of the audio clip. <p> Declaration <p> <code> <span class="pre"> uniform <span class="pre"> double <span class="pre"> mediaOffset <span class="pre"> = <span class="pre"> 0 <p> C++ Type <p> double <p> Usd Type <p> SdfValueTypeNames-&gt;Double <p> Variability <p> SdfVariabilityUniform <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdMedia.SpatialAudio.GetPlaybackModeAttr"> <span class="sig-name descname"> <span class="pre"> GetPlaybackModeAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <span class="headerlink">  <dd> <p> Along with <em> startTime and <em> endTime , determines when the audio playback should start and stop during the stage’s animation playback and whether the audio should loop during its duration. <p> Valid values are: <blockquote> <div> <ul> <li> <p> onceFromStart: Play the audio once, starting at <em> startTime , continuing until the audio completes. <li> <p> onceFromStartToEnd: Play the audio once beginning at <em> startTime , continuing until <em> endTime or until the audio completes, whichever comes first. <li> <p> loopFromStart: Start playing the audio at <em> startTime and continue looping through to the stage’s authored <em> endTimeCode . <li> <p> loopFromStartToEnd: Start playing the audio at <em> startTime and continue looping through, stopping the audio at <em> endTime . <li> <p> loopFromStage: Start playing the audio at the stage’s authored <em> startTimeCode and continue looping through to the stage’s authored <em> endTimeCode . This can be useful for ambient sounds that should always be active. <p> Declaration <p> <code> <span class="pre"> uniform <span class="pre"> token <span class="pre"> playbackMode <span class="pre"> ="onceFromStart" <p> C++ Type <p> TfToken <p> Usd Type <p> SdfValueTypeNames-&gt;Token <p> Variability <p> SdfVariabilityUniform <p> Allowed Values <p> onceFromStart, onceFromStartToEnd, loopFromStart, loopFromStartToEnd, loopFromStage <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdMedia.SpatialAudio.GetSchemaAttributeNames"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> GetSchemaAttributeNames <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="headerlink">  <dd> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <p> Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. <p> Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> includeInherited ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdMedia.SpatialAudio.GetStartTimeAttr"> <span class="sig-name descname"> <span class="pre"> GetStartTimeAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> → <span class="sig-return-typehint"> Attribute  <dd> <p> Expressed in the timeCodesPerSecond of the containing stage, <em> startTime specifies when the audio stream will start playing during animation playback. <p> This value is ignored when <em> playbackMode is set to loopFromStage as, in this mode, the audio will always start at the stage’s authored <em> startTimeCode . Note that <em> startTime is expressed as a timecode so that the stage can properly apply layer offsets when resolving its value. See Timecode Attributes and Time Scaling for more details and caveats. <p> Declaration <p> <code class="docutils literal notranslate"> uniform timecode startTime = 0 <p> C++ Type <p> SdfTimeCode <p> Usd Type <p> SdfValueTypeNames->TimeCode <p> Variability <p> SdfVariabilityUniform <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdMedia.Tokens"> <em class="property"> class <span class="sig-prename descclassname"> pxr.UsdMedia. <span class="sig-name descname"> Tokens  <dd> <p> <strong> Attributes: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> auralMode <td> <p> <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> endTime <td> <p> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> filePath <td> <p> <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> gain <td> <p> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> loopFromStage <td> <p> <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> loopFromStart <td> <p> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> loopFromStartToEnd <td> <p> <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> mediaOffset <td> <p> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> nonSpatial <td> <p> <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> onceFromStart <td> <p> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> onceFromStartToEnd <td> <p> <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> playbackMode <td> <p> playbackMode spatial startTime auralMode = 'auralMode' endTime = 'endTime' filePath = 'filePath' gain = 'gain' loopFromStage = 'loopFromStage' loopFromStart = 'loopFromStart' loopFromStartToEnd = 'loopFromStartToEnd' mediaOffset = 'mediaOffset' nonSpatial = 'nonSpatial' onceFromStart = 'onceFromStart' onceFromStartToEnd ## onceFromStartToEnd `= 'onceFromStartToEnd'` ## playbackMode `= 'playbackMode'` ## spatial `= 'spatial'` ## startTime `= 'startTime'`
20,662
UsdPhysics.md
# UsdPhysics module Summary: The UsdPhysics module defines the physics-related prim and property schemas that together form a physics simulation representation. ## Classes: - **ArticulationRootAPI** - PhysicsArticulationRootAPI can be applied to a scene graph node, and marks the subtree rooted here for inclusion in one or more reduced coordinate articulations. - **CollisionAPI** - Applies collision attributes to a UsdGeomXformable prim. - **CollisionGroup** - Defines a collision group for coarse filtering. - **CollisionGroupTable** - (No description provided) - **DistanceJoint** - Predefined distance joint type (Distance between rigid bodies may be limited to given minimum or maximum distance.) - **DriveAPI** - The PhysicsDriveAPI when applied to any joint primitive will drive the joint towards a given target. - **FilteredPairsAPI** - API to describe fine-grained filtering. - **FixedJoint** - Predefined fixed joint type (All degrees of freedom are removed.) - **Joint** - (No description provided) A joint constrains the movement of rigid bodies. LimitAPI ======== The PhysicsLimitAPI can be applied to a PhysicsJoint and will restrict the movement along an axis. MassAPI ======= Defines explicit mass properties (mass, density, inertia etc.). MassUnits ========= Container class for static double-precision symbols representing common mass units of measure expressed in kilograms. MaterialAPI =========== Adds simulation material properties to a Material. MeshCollisionAPI ================= Attributes to control how a Mesh is made into a collider. PrismaticJoint ============== Predefined prismatic joint type (translation along prismatic joint axis is permitted.) RevoluteJoint ============= Predefined revolute joint type (rotation along revolute joint axis is permitted.) RigidBodyAPI ============ Applies physics body attributes to any UsdGeomXformable prim and marks that prim to be driven by a simulation. Scene ===== General physics simulation properties, required for simulation. SphericalJoint ============== Predefined spherical joint type (Removes linear degrees of freedom, cone limit may restrict the motion in a given range.) It allows two limit values, which when equal create a circular, else an elliptic cone limit around the limit axis. Tokens ====== ``` ArticulationRootAPI =================== PhysicsArticulationRootAPI can be applied to a scene graph node, and marks the subtree rooted here for inclusion in one or more reduced coordinate articulations. For floating articulations, this should be on the root body. For fixed articulations (robotics jargon for e.g. a robot arm for welding that is bolted to the floor), this API can be on a direct or indirect parent of the root joint which is connected to the world, or on the joint itself. **Methods:** - **classmethod** Apply(prim) -> ArticulationRootAPI - **classmethod** CanApply(prim, whyNot) -> bool | Method | Description | |--------|-------------| | `Get` | `classmethod Get(stage, path) -> ArticulationRootAPI` | | `GetSchemaAttributeNames` | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.ArticulationRootAPI.Apply"> <em class="property"> <span class="pre">static <span class="sig-name descname"> <span class="pre">Apply <a class="headerlink" href="#pxr.UsdPhysics.ArticulationRootAPI.Apply" title="Permalink to this definition"> <dd> <p> <strong>classmethod Apply(prim) -> ArticulationRootAPI <p> Applies this <strong>single-apply <p> This information is stored by adding”PhysicsArticulationRootAPI”to the token-valued, listOp metadata <em>apiSchemas <p> A valid UsdPhysicsArticulationRootAPI object is returned upon success. An invalid (or empty) UsdPhysicsArticulationRootAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <p> <strong>prim <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.ArticulationRootAPI.CanApply"> <em class="property"> <span class="pre">static <span class="sig-name descname"> <span class="pre">CanApply <a class="headerlink" href="#pxr.UsdPhysics.ArticulationRootAPI.CanApply" title="Permalink to this definition"> <dd> <p> <strong>classmethod CanApply(prim, whyNot) -> bool <p> Returns true if this <strong>single-apply <p> If this schema can not be a applied to the prim, this returns false and, if provided, populates <code>whyNot <p> Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong>prim <li> <p> <strong>whyNot <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.ArticulationRootAPI.Get"> <em class="property"> <span class="pre">static <span class="sig-name descname"> <span class="pre">Get <a class="headerlink" href="#pxr.UsdPhysics.ArticulationRootAPI.Get" title="Permalink to this definition"> <dd> <p> <strong>classmethod Get(stage, path) -> ArticulationRootAPI <p> Return a UsdPhysicsArticulationRootAPI holding the prim adhering to this schema at <code>path <p> If no prim exists at <code>path <div class="highlight-text notranslate"> <div class="highlight"> <pre>UsdPhysicsArticulationRootAPI(stage->GetPrimAtPath(path)); <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong>stage <li> <p> <strong>path ### Stage ### Path ### classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ### class pxr.UsdPhysics.CollisionAPI Applies collision attributes to a UsdGeomXformable prim. If a simulation is running, this geometry will collide with other geometries that have PhysicsCollisionAPI applied. If a prim in the parent hierarchy has the RigidBodyAPI applied, this collider is a part of that body. If there is no body in the parent hierarchy, this collider is considered to be static. #### Methods: - **Apply** (prim) -> CollisionAPI - **CanApply** (prim, whyNot) -> bool - **CreateCollisionEnabledAttr** (defaultValue, ...) - **CreateSimulationOwnerRel** () - **Get** (stage, path) -> CollisionAPI - **GetCollisionEnabledAttr** () - **GetSchemaAttributeNames** (includeInherited) -> list[TfToken] - **GetSimulationOwnerRel** () ### Apply ```python Apply(prim) -> CollisionAPI ``` Applies this **single-apply** API schema to the given `prim`. This information is stored by adding "PhysicsCollisionAPI" to the token-valued, listOp metadata `apiSchemas` on the prim. A valid UsdPhysicsCollisionAPI object is returned upon success. An invalid (or empty) UsdPhysicsCollisionAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() #### Parameters - **prim** (`Prim`) – ### CanApply ```python CanApply(prim, whyNot) -> bool ``` Returns true if this **single-apply** API schema can be applied to the given `prim`. If this schema can not be applied to the prim, this returns false and, if provided, populates `whyNot` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() #### Parameters - **prim** (`Prim`) – - **whyNot** (`str`) – ### CreateCollisionEnabledAttr ```python CreateCollisionEnabledAttr(defaultValue, writeSparsely) -> Attribute ``` See GetCollisionEnabledAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateSimulationOwnerRel ```python CreateSimulationOwnerRel() -> Relationship ``` ## pxr.UsdPhysics.CollisionAPI.CreateSimulationOwnerRel - See GetSimulationOwnerRel() , and also Create vs Get Property Methods for when to use Get vs Create. ## pxr.UsdPhysics.CollisionAPI.Get - **classmethod** Get(stage, path) -> CollisionAPI - Return a UsdPhysicsCollisionAPI holding the prim adhering to this schema at `path` on `stage`. - If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. - This is shorthand for the following: ``` UsdPhysicsCollisionAPI(stage->GetPrimAtPath(path)); ``` - **Parameters** - **stage** (Stage) – - **path** (Path) – ## pxr.UsdPhysics.CollisionAPI.GetCollisionEnabledAttr - Determines if the PhysicsCollisionAPI is enabled. - Declaration: `bool physics:collisionEnabled = 1` - C++ Type: bool - Usd Type: SdfValueTypeNames->Bool ## pxr.UsdPhysics.CollisionAPI.GetSchemaAttributeNames - **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. - **Parameters** - **includeInherited** (bool) – ## pxr.UsdPhysics.CollisionAPI.GetSimulationOwnerRel - Single PhysicsScene that will simulate this collider. - By default this object belongs to the first PhysicsScene. Note that if a RigidBodyAPI in the hierarchy above has a different simulationOwner then it has a precedence over this relationship. pair is filtered. See filteredGroups attribute. A CollectionAPI:colliders maintains a list of PhysicsCollisionAPI rel-s that defines the members of this Collisiongroup. **Methods:** | Method | Description | | --- | --- | | `ComputeCollisionGroupTable` | classmethod ComputeCollisionGroupTable(stage) -> CollisionGroupTable | | `CreateFilteredGroupsRel` | See GetFilteredGroupsRel() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateInvertFilteredGroupsAttr` | See GetInvertFilteredGroupsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateMergeGroupNameAttr` | See GetMergeGroupNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Define` | classmethod Define(stage, path) -> CollisionGroup | | `Get` | classmethod Get(stage, path) -> CollisionGroup | | `GetCollidersCollectionAPI` | Return the UsdCollectionAPI interface used for defining what colliders belong to the CollisionGroup. | | `GetFilteredGroupsRel` | References a list of PhysicsCollisionGroups with which collisions should be ignored. | | `GetInvertFilteredGroupsAttr` | Normally, the filter will disable collisions against the selected filter groups. | | `GetMergeGroupNameAttr` | If non-empty, any collision groups in a stage with a matching mergeGroup should be considered to refer to the same collection. | | `GetSchemaAttributeNames` | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | **ComputeCollisionGroupTable** ```python static ComputeCollisionGroupTable(stage) -> CollisionGroupTable ``` Compute a table encoding all the collision groups filter rules for a stage. This can be used as a reference to validate an implementation of the ``` collision groups filters. The returned table is diagonally symmetric. ### Parameters - **stage** (Stage) – ### CreateFilteredGroupsRel - **CreateFilteredGroupsRel**() → Relationship - See GetFilteredGroupsRel() , and also Create vs Get Property Methods for when to use Get vs Create. ### CreateInvertFilteredGroupsAttr - **CreateInvertFilteredGroupsAttr**(defaultValue, writeSparsely) → Attribute - See GetInvertFilteredGroupsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateMergeGroupNameAttr - **CreateMergeGroupNameAttr**(defaultValue, writeSparsely) → Attribute - See GetMergeGroupNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### Define - **Define**() - **classmethod** Define(stage, path) -> CollisionGroup Attempt to ensure a **UsdPrim** adhering to this schema at ```path``` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at ```path``` is already defined on this stage, return that prim. Otherwise author an **SdfPrimSpec** with **specifier** == **SdfSpecifierDef** and this schema’s prim type name for the prim at ```path``` at the current EditTarget. Author **SdfPrimSpec** s with ```specifier``` == **SdfSpecifierDef** and empty typeName at the current EditTarget for any nonexistent, or existing but not **Defined** ancestors. The given **path** must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case **path** cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (Stage) – - **path** (Path) – **classmethod** Get(stage, path) -> CollisionGroup Return a UsdPhysicsCollisionGroup holding the prim adhering to this schema at ```path``` on ```stage```. If no prim exists at ```path``` on ```stage```, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdPhysicsCollisionGroup(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – Return the UsdCollectionAPI interface used for defining what colliders belong to the CollisionGroup. References a list of PhysicsCollisionGroups with which collisions should be ignored. ``` ### pxr.UsdPhysics.CollisionGroup.GetInvertFilteredGroupsAttr → Attribute Normally, the filter will disable collisions against the selected filter groups. However, if this option is set, the filter will disable collisions against all colliders except for those in the selected filter groups. Declaration ```python bool physics:invertFilteredGroups ``` C++ Type ``` bool ``` Usd Type ``` SdfValueTypeNames->Bool ``` ### pxr.UsdPhysics.CollisionGroup.GetMergeGroupNameAttr → Attribute If non-empty, any collision groups in a stage with a matching mergeGroup should be considered to refer to the same collection. Matching collision groups should behave as if there were a single group containing referenced colliders and filter groups from both collections. Declaration ```python string physics:mergeGroup ``` C++ Type ``` std::string ``` Usd Type ``` SdfValueTypeNames->String ``` ### pxr.UsdPhysics.CollisionGroup.GetSchemaAttributeNames ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters ``` includeInherited (bool) – ``` ### pxr.UsdPhysics.CollisionGroupTable Methods: - GetGroups - IsCollisionEnabled ### pxr.UsdPhysics.CollisionGroupTable.GetGroups ### pxr.UsdPhysics.CollisionGroupTable.IsCollisionEnabled ### pxr.UsdPhysics.DistanceJoint Predefined distance joint type (Distance between rigid bodies may be limited to given minimum or maximum distance.) **Methods:** | Method | Description | |------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------| | `CreateMaxDistanceAttr(defaultValue, ...)` | See GetMaxDistanceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateMinDistanceAttr(defaultValue, ...)` | See GetMinDistanceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Define(stage, path) -> DistanceJoint` | classmethod Define(stage, path) -> DistanceJoint | | `Get(stage, path) -> DistanceJoint` | classmethod Get(stage, path) -> DistanceJoint | | `GetMaxDistanceAttr()` | Maximum distance. | | `GetMinDistanceAttr()` | Minimum distance. | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | **CreateMaxDistanceAttr** ```python CreateMaxDistanceAttr(defaultValue, writeSparsely) -> Attribute ``` See GetMaxDistanceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – **CreateMinDistanceAttr** ```python CreateMinDistanceAttr(defaultValue, writeSparsely) -> Attribute ### Attribute See GetMinDistanceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### Define **classmethod** Define(stage, path) -> DistanceJoint Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. #### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### Get **classmethod** Get(stage, path) -> DistanceJoint Return a UsdPhysicsDistanceJoint holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdPhysicsDistanceJoint(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (`Stage`) – - **path** (`Path`) – (**Path**) – ## GetMaxDistanceAttr ```python GetMaxDistanceAttr() → Attribute ``` Maximum distance. If attribute is negative, the joint is not limited. Units: distance. Declaration ```python float physics:maxDistance = -1 ``` C++ Type: float Usd Type: SdfValueTypeNames->Float ## GetMinDistanceAttr ```python GetMinDistanceAttr() → Attribute ``` Minimum distance. If attribute is negative, the joint is not limited. Units: distance. Declaration ```python float physics:minDistance = -1 ``` C++ Type: float Usd Type: SdfValueTypeNames->Float ## GetSchemaAttributeNames ```python static GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters - **includeInherited** (bool) – ## DriveAPI class pxr.UsdPhysics.DriveAPI The PhysicsDriveAPI when applied to any joint primitive will drive the joint towards a given target. The PhysicsDriveAPI is a multipleApply schema: drive can be set per axis "transX", "transY", "transZ", "rotX", "rotY", "rotZ" or its "linear" for prismatic joint or "angular" for revolute joints. Setting these as a multipleApply schema TfToken name will define the degree of freedom the DriveAPI is applied to. Each drive is an implicit force-limited damped spring: Force or acceleration = stiffness * (targetPosition - position) ```python damping * (targetVelocity - velocity) ``` For any described attribute **Fallback Value** or **Allowed Values** below that are text/tokens, the actual token is published and defined in UsdPhysicsTokens. So to set an attribute to the value "rightHanded", use UsdPhysicsTokens->rightHanded as the value. **Methods:** - **Apply** ```python classmethod Apply(prim, name) -> DriveAPI ``` - **CanApply** ```python classmethod CanApply(prim, name, whyNot) -> bool ``` - `CreateDampingAttr(defaultValue, writeSparsely)` - See GetDampingAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - `CreateMaxForceAttr(defaultValue, writeSparsely)` - See GetMaxForceAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - `CreateStiffnessAttr(defaultValue, writeSparsely)` - See GetStiffnessAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - `CreateTargetPositionAttr(defaultValue, ...)` - See GetTargetPositionAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - `CreateTargetVelocityAttr(defaultValue, ...)` - See GetTargetVelocityAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - `CreateTypeAttr(defaultValue, writeSparsely)` - See GetTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - `Get` - `classmethod Get(stage, path) -> DriveAPI` - `GetAll` - `classmethod GetAll(prim) -> list[DriveAPI]` - `GetDampingAttr()` - Damping of the drive. - `GetMaxForceAttr()` - Maximum force that can be applied to drive. - `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` - `classmethod` - `GetStiffnessAttr()` - Stiffness of the drive. - `GetTargetPositionAttr()` - Target value for position. - `GetTargetVelocityAttr()` - Target value for velocity. - `GetTypeAttr()` - (Note: The content for `GetTypeAttr()` is incomplete in the provided HTML snippet.) <span class="pre"> GetTypeAttr () <td> <p> Drive spring is for the acceleration at the joint (rather than the force). <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdPhysics.DriveAPI.IsPhysicsDriveAPIPath" title="pxr.UsdPhysics.DriveAPI.IsPhysicsDriveAPIPath"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> IsPhysicsDriveAPIPath <td> <p> <strong> classmethod IsPhysicsDriveAPIPath(path, name) -> bool <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.DriveAPI.Apply"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Apply <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdPhysics.DriveAPI.Apply" title="Permalink to this definition">  <dd> <p> <strong> classmethod Apply(prim, name) -> DriveAPI <p> Applies this <strong> multiple-apply API schema to the given <code class="docutils literal notranslate"> <span class="pre"> prim along with the given instance name, <code class="docutils literal notranslate"> <span class="pre"> name . <p> This information is stored by adding”PhysicsDriveAPI:<i>name the token-valued, listOp metadata <em> apiSchemas on the prim. For example, if <code class="docutils literal notranslate"> <span class="pre"> name is’instance1’, the token’PhysicsDriveAPI:instance1’is added to’apiSchemas’. <p> A valid UsdPhysicsDriveAPI object is returned upon success. An invalid (or empty) UsdPhysicsDriveAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> prim (<a class="reference internal" href="Usd.html#pxr.Usd.Prim" title="pxr.Usd.Prim"> <em> Prim <li> <p> <strong> name (<em> str <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.DriveAPI.CanApply"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> CanApply <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdPhysics.DriveAPI.CanApply" title="Permalink to this definition">  <dd> <p> <strong> classmethod CanApply(prim, name, whyNot) -> bool <p> Returns true if this <strong> multiple-apply API schema can be applied, with the given instance name, <code class="docutils literal notranslate"> <span class="pre"> name , to the given <code class="docutils literal notranslate"> <span class="pre"> prim . <p> If this schema can not be a applied the prim, this returns false and, if provided, populates <code class="docutils literal notranslate"> <span class="pre"> whyNot with the reason it can not be applied. <p> Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> prim (<a class="reference internal" href="Usd.html#pxr.Usd.Prim" title="pxr.Usd.Prim"> <em> Prim <li> <p> <strong> name (<em> str <li> <p> <strong> whyNot (<em> str <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.DriveAPI.CreateDampingAttr"> <span class="sig-name descname"> <span class="pre"> CreateDampingAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <a class="reference internal" href="Usd.html#pxr.Usd.Attribute" title="pxr.Usd.Attribute"> <span class="pre"> Attribute <a class="headerlink" href="#pxr.UsdPhysics.DriveAPI.CreateDampingAttr" title="Permalink to this definition">  <dd> <p> See GetDampingAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateMaxForceAttr ```python CreateMaxForceAttr(defaultValue, writeSparsely) -> Attribute ``` See GetMaxForceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateStiffnessAttr ```python CreateStiffnessAttr(defaultValue, writeSparsely) -> Attribute ``` See GetStiffnessAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateTargetPositionAttr ```python CreateTargetPositionAttr(defaultValue, writeSparsely) -> Attribute ``` See GetTargetPositionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateTargetPositionAttr See GetTargetPositionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateTargetVelocityAttr See GetTargetVelocityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateTypeAttr See GetTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## Get static Get ### Get(stage, path) -> DriveAPI Return a UsdPhysicsDriveAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. `path` must be of the format `<path>.drive:name`. This is shorthand for the following: ```text TfToken name = SdfPath::StripNamespace(path.GetToken()); UsdPhysicsDriveAPI( stage->GetPrimAtPath(path.GetPrimPath()), name); ``` #### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### Get(prim, name) -> DriveAPI Return a UsdPhysicsDriveAPI with name `name` holding the prim `prim`. Shorthand for UsdPhysicsDriveAPI(prim, name); #### Parameters - **prim** (`Prim`) – - **name** (`str`) – ### GetAll(prim) -> list[DriveAPI] Return a vector of all named instances of UsdPhysicsDriveAPI on the given `prim`. #### Parameters - **prim** (`Prim`) – ### GetDampingAttr() -> Attribute Damping of the drive. Units: if linear drive: mass/second If angular drive: mass*DIST_UNITS*DIST_UNITS/second/second/degrees. Declaration: `float physics:damping = 0` C++ Type: float Usd Type: SdfValueTypeNames->Float ### GetMaxForceAttr() -> Attribute Maximum force that can be applied to drive. Units: if linear drive: mass*DIST_UNITS/second/second if angular drive: mass*DIST_UNITS*DIST_UNITS/second/second inf means not limited. Must be non-negative. Declaration ``` float physics:maxForce = inf ``` C++ Type float Usd Type SdfValueTypeNames->Float ``` classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters includeInherited (bool) – GetSchemaAttributeNames(includeInherited, instanceName) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes for a given instance name. Does not include attributes that may be authored by custom/extended methods of the schemas involved. The names returned will have the proper namespace prefix. Parameters includeInherited (bool) – instanceName (str) – Stiffness of the drive. Units: if linear drive: mass/second/second if angular drive: mass*DIST_UNITS*DIST_UNITS/degree/second/second. ``` float physics:stiffness = 0 ``` C++ Type float Usd Type SdfValueTypeNames->Float Target value for position. Units: if linear drive: distance if angular drive: degrees. ``` float physics:targetPosition = 0 ``` C++ Type float Usd Type SdfValueTypeNames->Float Target value for velocity. Units: if linear drive: distance/second if angular drive: degrees/second. ``` float physics:targetVelocity = 0 ``` C++ Type float Usd Type SdfValueTypeNames->Float ``` <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.DriveAPI.GetTypeAttr"> <span class="sig-name descname"> <span class="pre"> GetTypeAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdPhysics.DriveAPI.GetTypeAttr" title="Permalink to this definition">  <dd> <p> Drive spring is for the acceleration at the joint (rather than the force). <p> Declaration <p> <code> uniform token physics:type ="force" <p> C++ Type <p> TfToken <p> Usd Type <p> SdfValueTypeNames->Token <p> Variability <p> SdfVariabilityUniform <p> Allowed Values <p> force, acceleration <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.DriveAPI.IsPhysicsDriveAPIPath"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> IsPhysicsDriveAPIPath <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdPhysics.DriveAPI.IsPhysicsDriveAPIPath" title="Permalink to this definition">  <dd> <p> <strong> classmethod IsPhysicsDriveAPIPath(path, name) -> bool <p> Checks if the given path <code> path is of an API schema of type PhysicsDriveAPI. <p> If so, it stores the instance name of the schema in <code> name and returns true. Otherwise, it returns false. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul> <li> <p> <strong> path (Path) – <li> <p> <strong> name (str) – <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdPhysics.FilteredPairsAPI"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.UsdPhysics. <span class="sig-name descname"> <span class="pre"> FilteredPairsAPI <a class="headerlink" href="#pxr.UsdPhysics.FilteredPairsAPI" title="Permalink to this definition">  <dd> <p> API to describe fine-grained filtering. If a collision between two objects occurs, this pair might be filtered if the pair is defined through this API. This API can be applied either to a body or collision or even articulation. The”filteredPairs”defines what objects it should not collide against. Note that FilteredPairsAPI filtering has precedence over CollisionGroup filtering. <p> <strong> Methods: <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code> Apply <td> <p> <strong> classmethod Apply(prim) -> FilteredPairsAPI <tr class="row-even"> <td> <p> <code> CanApply <td> <p> <strong> classmethod CanApply(prim, whyNot) -> bool <tr class="row-odd"> <td> <p> <code> CreateFilteredPairsRel <td> <p> See GetFilteredPairsRel() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <code> Get <td> <p> <strong> classmethod Get(stage, path) -> FilteredPairsAPI <tr class="row-odd"> <td> <p> <code> GetFilteredPairsRel <td> <p> relationship to objects that should be filtered. <tr class="row-even"> <td> <p> <code> GetSchemaAttributeNames <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetSchemaAttributeNames <td> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.FilteredPairsAPI.Apply"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Apply <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdPhysics.FilteredPairsAPI.Apply" title="Permalink to this definition">  <dd> <p> <strong> classmethod Apply(prim) -> FilteredPairsAPI <p> Applies this <strong> single-apply API schema to the given <code class="docutils literal notranslate"> <span class="pre"> prim . <p> This information is stored by adding”PhysicsFilteredPairsAPI”to the token-valued, listOp metadata <em> apiSchemas on the prim. <p> A valid UsdPhysicsFilteredPairsAPI object is returned upon success. An invalid (or empty) UsdPhysicsFilteredPairsAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> prim ( <em> Prim ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.FilteredPairsAPI.CanApply"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> CanApply <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdPhysics.FilteredPairsAPI.CanApply" title="Permalink to this definition">  <dd> <p> <strong> classmethod CanApply(prim, whyNot) -> bool <p> Returns true if this <strong> single-apply API schema can be applied to the given <code class="docutils literal notranslate"> <span class="pre"> prim . <p> If this schema can not be a applied to the prim, this returns false and, if provided, populates <code class="docutils literal notranslate"> <span class="pre"> whyNot with the reason it can not be applied. <p> Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> prim ( <em> Prim ) – <li> <p> <strong> whyNot ( <em> str ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.FilteredPairsAPI.CreateFilteredPairsRel"> <span class="sig-name descname"> <span class="pre"> CreateFilteredPairsRel <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Relationship <a class="headerlink" href="#pxr.UsdPhysics.FilteredPairsAPI.CreateFilteredPairsRel" title="Permalink to this definition">  <dd> <p> See GetFilteredPairsRel() , and also Create vs Get Property Methods for when to use Get vs Create. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.FilteredPairsAPI.Get"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Get <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdPhysics.FilteredPairsAPI.Get" title="Permalink to this definition">  <dd> <p> <strong> classmethod Get(stage, path) -> FilteredPairsAPI <p> Return a UsdPhysicsFilteredPairsAPI holding the prim adhering to this schema at <code class="docutils literal notranslate"> <span class="pre"> path on <code class="docutils literal notranslate"> <span class="pre"> stage . <p> If no prim exists at <code class="docutils literal notranslate"> <span class="pre"> path on <code class="docutils literal notranslate"> <span class="pre"> stage , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: <div class="highlight-text notranslate"> <div class="highlight"> <pre><span> ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetFilteredPairsRel - **Function**: GetFilteredPairsRel() → Relationship - **Description**: Relationship to objects that should be filtered. ### GetSchemaAttributeNames - **Function**: classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] - **Description**: Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - **Parameters**: - **includeInherited** (bool) – ### FixedJoint - **Description**: Predefined fixed joint type (All degrees of freedom are removed.) - **Methods**: - **Define**: classmethod Define(stage, path) -> FixedJoint - **Get**: classmethod Get(stage, path) -> FixedJoint - **GetSchemaAttributeNames**: classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] #### Define - **Function**: classmethod Define(stage, path) -> FixedJoint - **Description**: Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined() ) on this stage. and empty typeName at the current EditTarget for any nonexistent, or existing but not **Defined** ancestors. The given **path** must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case **path** cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **Stage** (Stage) – - **path** (Path) – **classmethod** Get(stage, path) -> FixedJoint Return a UsdPhysicsFixedJoint holding the prim adhering to this schema at **path** on **stage**. If no prim exists at **path** on **stage**, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdPhysicsFixedJoint(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – **class** pxr.UsdPhysics.Joint A joint constrains the movement of rigid bodies. Joint can be created between two rigid bodies or between one rigid body and world. By default joint primitive defines a D6 joint where all degrees of freedom are free. Three linear and three angular degrees of freedom. Note that default behavior is to disable collision between jointed bodies. **Methods:** - **CreateBody0Rel** () See GetBody0Rel() , and also Create vs Get Property Methods for when to use Get vs Create. - **CreateBody1Rel** () See GetBody1Rel() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateBreakForceAttr (defaultValue, writeSparsely) <p> See GetBreakForceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateBreakTorqueAttr (defaultValue, ...) <p> See GetBreakTorqueAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateCollisionEnabledAttr (defaultValue, ...) <p> See GetCollisionEnabledAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateExcludeFromArticulationAttr (...) <p> See GetExcludeFromArticulationAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateJointEnabledAttr (defaultValue, ...) <p> See GetJointEnabledAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateLocalPos0Attr (defaultValue, writeSparsely) <p> See GetLocalPos0Attr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateLocalPos1Attr (defaultValue, writeSparsely) <p> See GetLocalPos1Attr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateLocalRot0Attr (defaultValue, writeSparsely) <p> See GetLocalRot0Attr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateLocalRot1Attr (defaultValue, writeSparsely) <p> See GetLocalRot1Attr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> Define <p> classmethod Define(stage, path) -> Joint <p> Get <p> classmethod Get(stage, path) -> Joint <p> GetBody0Rel () <p> Relationship to any UsdGeomXformable. <p> GetBody1Rel () <p> Relationship to any UsdGeomXformable. <p> GetBreakForceAttr () <p> Joint break force. ### Joint Attributes - **GetBreakTorqueAttr()** - Joint break torque. - **GetCollisionEnabledAttr()** - Determines if the jointed subtrees should collide or not. - **GetExcludeFromArticulationAttr()** - Determines if the joint can be included in an Articulation. - **GetJointEnabledAttr()** - Determines if the joint is enabled. - **GetLocalPos0Attr()** - Relative position of the joint frame to body0's frame. - **GetLocalPos1Attr()** - Relative position of the joint frame to body1's frame. - **GetLocalRot0Attr()** - Relative orientation of the joint frame to body0's frame. - **GetLocalRot1Attr()** - Relative orientation of the joint frame to body1's frame. - **GetSchemaAttributeNames()** - `classmethod` GetSchemaAttributeNames(includeInherited) -> list[TfToken] ### Joint Methods - **CreateBody0Rel()** - Returns: Relationship - See GetBody0Rel(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateBody1Rel()** - Returns: Relationship - See GetBody1Rel(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateBreakForceAttr(defaultValue, writeSparsely)** - Returns: Attribute - See GetBreakForceAttr(), and also Create vs Get Property Methods for when to use Get vs Create. when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateBreakTorqueAttr ( `defaultValue`, `writeSparsely` ) → `Attribute` See GetBreakTorqueAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateCollisionEnabledAttr ( `defaultValue`, `writeSparsely` ) → `Attribute` See GetCollisionEnabledAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateExcludeFromArticulationAttr ( `defaultValue`, `writeSparsely` ) → `Attribute` ## CreateExcludeFromArticulationAttr See GetExcludeFromArticulationAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateJointEnabledAttr See GetJointEnabledAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateLocalPos0Attr See GetLocalPos0Attr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateLocalPos1Attr See GetLocalPos1Attr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateLocalPos1Attr ```python CreateLocalPos1Attr(defaultValue, writeSparsely) → Attribute ``` See GetLocalPos1Attr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateLocalRot0Attr ```python CreateLocalRot0Attr(defaultValue, writeSparsely) → Attribute ``` See GetLocalRot0Attr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateLocalRot1Attr ```python CreateLocalRot1Attr(defaultValue, writeSparsely) → Attribute ``` See GetLocalRot1Attr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### Define ```python @classmethod Define(stage, path) -> Joint ``` Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ### Get ```python @classmethod Get(stage, path) -> Joint ``` Return a UsdPhysicsJoint holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdPhysicsJoint(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ### GetBody0Rel ```python GetBody0Rel() -> Relationship ``` Relationship to any UsdGeomXformable. ### GetBody1Rel ```python GetBody1Rel() -> Relationship ``` Relationship to any UsdGeomXformable. ### Relationship Relationship to any UsdGeomXformable. ### GetBreakForceAttr Joint break force. If set, joint is to break when this force limit is reached. (Used for linear DOFs.) Units: mass * distance / second / second Declaration float physics:breakForce = inf ``` C++ Type ``` float ``` Usd Type ``` SdfValueTypeNames->Float ``` ### GetBreakTorqueAttr Joint break torque. If set, joint is to break when this torque limit is reached. (Used for angular DOFs.) Units: mass * distance * distance / second / second Declaration float physics:breakTorque = inf ``` C++ Type ``` float ``` Usd Type ``` SdfValueTypeNames->Float ``` ### GetCollisionEnabledAttr Determines if the jointed subtrees should collide or not. Declaration bool physics:collisionEnabled = 0 ``` C++ Type ``` bool ``` Usd Type ``` SdfValueTypeNames->Bool ``` ### GetExcludeFromArticulationAttr Determines if the joint can be included in an Articulation. Declaration uniform bool physics:excludeFromArticulation = 0 ``` C++ Type ``` bool ``` Usd Type ``` SdfValueTypeNames->Bool ``` Variability ``` SdfVariabilityUniform ``` ### GetJointEnabledAttr Determines if the joint is enabled. Declaration bool physics:jointEnabled = 0 ``` C++ Type ``` bool ``` Usd Type ``` SdfValueTypeNames->Bool ``` bool physics:jointEnabled = 1 C++ Type bool Usd Type SdfValueTypeNames->Bool ### GetLocalPos0Attr Relative position of the joint frame to body0’s frame. Declaration ``` point3f physics:localPos0 = (0, 0, 0) ``` C++ Type GfVec3f Usd Type SdfValueTypeNames->Point3f ### GetLocalPos1Attr Relative position of the joint frame to body1’s frame. Declaration ``` point3f physics:localPos1 = (0, 0, 0) ``` C++ Type GfVec3f Usd Type SdfValueTypeNames->Point3f ### GetLocalRot0Attr Relative orientation of the joint frame to body0’s frame. Declaration ``` quatf physics:localRot0 = (1, 0, 0, 0) ``` C++ Type GfQuatf Usd Type SdfValueTypeNames->Quatf ### GetLocalRot1Attr Relative orientation of the joint frame to body1’s frame. Declaration ``` quatf physics:localRot1 = (1, 0, 0, 0) ``` C++ Type GfQuatf Usd Type SdfValueTypeNames->Quatf ### GetSchemaAttributeNames ``` static GetSchemaAttributeNames () ``` ## GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - **includeInherited** (bool) – ## pxr.UsdPhysics.LimitAPI The PhysicsLimitAPI can be applied to a PhysicsJoint and will restrict the movement along an axis. PhysicsLimitAPI is a multipleApply schema: The PhysicsJoint can be restricted along "transX", "transY", "transZ", "rotX", "rotY", "rotZ", "distance". Setting these as a multipleApply schema TfToken name will define the degree of freedom the PhysicsLimitAPI is applied to. Note that if the low limit is higher than the high limit, motion along this axis is considered locked. ### Methods: - **classmethod** Apply(prim, name) -> LimitAPI - **classmethod** CanApply(prim, name, whyNot) -> bool - **classmethod** CreateHighAttr(defaultValue, writeSparsely) - **classmethod** CreateLowAttr(defaultValue, writeSparsely) - **classmethod** Get(stage, path) -> LimitAPI - **classmethod** GetAll(prim) -> list[LimitAPI] - **classmethod** GetHighAttr() - **classmethod** GetLowAttr() - **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] - **classmethod** IsPhysicsLimitAPIPath(path, name) -> bool ## Apply Method **classmethod** Apply(prim, name) -> LimitAPI Applies this **multiple-apply** API schema to the given `prim` along with the given instance name, `name`. This information is stored by adding "PhysicsLimitAPI:<i>name A valid UsdPhysicsLimitAPI object is returned upon success. An invalid (or empty) UsdPhysicsLimitAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() ### Parameters - **prim** (Prim) – - **name** (str) – ## CanApply Method **classmethod** CanApply(prim, name, whyNot) -> bool Returns true if this **multiple-apply** API schema can be applied, with the given instance name, `name`, to the given `prim`. If this schema can not be applied to the prim, this returns false and, if provided, populates `whyNot` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() ### Parameters - **prim** (Prim) – - **name** (str) – - **whyNot** (str) – ## CreateHighAttr Method See GetHighAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateLowAttr CreateLowAttr(defaultValue, writeSparsely) → Attribute See GetLowAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## Get **classmethod** Get(stage, path) -> LimitAPI Return a UsdPhysicsLimitAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. `path` must be of the format<path>.limit:name. This is shorthand for the following: ```python TfToken name = SdfPath::StripNamespace(path.GetToken()); UsdPhysicsLimitAPI(stage->GetPrimAtPath(path.GetPrimPath()), name); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – Get(prim, name) -> LimitAPI Return a UsdPhysicsLimitAPI with name `name` holding the prim `prim`. Shorthand for UsdPhysicsLimitAPI(prim, name); ### Parameters - **prim** (Prim) – - **name** (str) – ## GetAll **classmethod** GetAll(prim) -> list[LimitAPI] Return a vector of all named instances of UsdPhysicsLimitAPI on the given `prim`. ## Parameters - **prim** (Prim) – ## GetHighAttr - Upper limit. - Units: degrees or distance depending on trans or rot axis applied to. inf means not limited in positive direction. ### Declaration ``` float physics:high = inf ``` ### C++ Type - float ### Usd Type - SdfValueTypeNames->Float ## GetLowAttr - Lower limit. - Units: degrees or distance depending on trans or rot axis applied to. -inf means not limited in negative direction. ### Declaration ``` float physics:low = -inf ``` ### C++ Type - float ### Usd Type - SdfValueTypeNames->Float ## GetSchemaAttributeNames - **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - **includeInherited** (bool) – - GetSchemaAttributeNames(includeInherited, instanceName) -> list[TfToken] - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes for a given instance name. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. The names returned will have the proper namespace prefix. ### Parameters - **includeInherited** (bool) – - **instanceName** (str) – ## IsPhysicsLimitAPIPath - **classmethod** IsPhysicsLimitAPIPath(path, name) -> bool - Checks if the given path `path` is of an API schema of type PhysicsLimitAPI. - If so, it stores the instance name of the schema in `name` and returns true. Otherwise, it returns false. ### Parameters - **path** (Path) – - **name** (str) – ### MassAPI Defines explicit mass properties (mass, density, inertia etc.). MassAPI can be applied to any object that has a PhysicsCollisionAPI or a PhysicsRigidBodyAPI. **Methods:** - `Apply(prim) -> MassAPI` - `CanApply(prim, whyNot) -> bool` - `CreateCenterOfMassAttr(defaultValue, ...)` - `CreateDensityAttr(defaultValue, writeSparsely)` - `CreateDiagonalInertiaAttr(defaultValue, ...)` - `CreateMassAttr(defaultValue, writeSparsely)` - `CreatePrincipalAxesAttr(defaultValue, ...)` - `Get(stage, path) -> MassAPI` - `GetCenterOfMassAttr()` - `GetDensityAttr()` - `GetDiagonalInertiaAttr()` - `GetMassAttr()` If non-zero, directly specifies the mass of the object. <code class="xref py py-obj docutils literal notranslate"><span class="pre">GetPrincipalAxesAttr Orientation of the inertia tensor's principal axes in the prim's local space. <code class="xref py py-obj docutils literal notranslate"><span class="pre">GetSchemaAttributeNames <strong>classmethod <strong>static <strong>classmethod Applies this <strong>single-apply This information is stored by adding”PhysicsMassAPI”to the token-valued, listOp metadata <em>apiSchemas A valid UsdPhysicsMassAPI object is returned upon success. An invalid (or empty) UsdPhysicsMassAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters <strong>prim <strong>static <strong>classmethod Returns true if this <strong>single-apply If this schema can not be a applied to the prim, this returns false and, if provided, populates <code class="docutils literal notranslate"><span class="pre">whyNot Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters <strong>prim <strong>whyNot <span class="pre">CreateCenterOfMassAttr See GetCenterOfMassAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author <code class="docutils literal notranslate"><span class="pre">defaultValue . false . Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – CreateDensityAttr ( defaultValue , writeSparsely ) → Attribute See GetDensityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false . Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – CreateDiagonalInertiaAttr ( defaultValue , writeSparsely ) → Attribute See GetDiagonalInertiaAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false . Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – CreateMassAttr ( defaultValue , writeSparsely ) → Attribute See GetMassAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false . Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – writeSparsely is true - the default for writeSparsely is false. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreatePrincipalAxesAttr (defaultValue, writeSparsely) → Attribute See GetPrincipalAxesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### Get static classmethod Get(stage, path) -> MassAPI Return a UsdPhysicsMassAPI holding the prim adhering to this schema at path on stage. If no prim exists at path on stage, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdPhysicsMassAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### GetCenterOfMassAttr → Attribute Center of mass in the prim’s local space. Units: distance. Declaration ``` point3f physics:centerOfMass ``` ### MassAPI Attributes #### Inertia Tensor - **Type**: GfVec3f - **Values**: (-inf, -inf, -inf) #### C++ Type - **Type**: GfVec3f #### Usd Type - **Type**: SdfValueTypeNames->Point3f ### GetDensityAttr - **Function**: GetDensityAttr() - **Returns**: Attribute - **Description**: If non-zero, specifies the density of the object. Density indirectly results in setting mass via (mass = density x volume of the object). How the volume is computed is up to the implementation of the physics system. It is generally computed from the collision approximation rather than the graphical mesh. In the case where both density and mass are specified for the same object, mass has precedence over density. Unlike mass, a child’s prim’s density overrides parent prim’s density as it is accumulative. Note that density of a collisionAPI can be also alternatively set through a PhysicsMaterialAPI. The material density has the weakest precedence in density definition. Note if density is 0.0 it is ignored. Units: mass/distance/distance/distance. - **Declaration**: float physics:density = 0 - **C++ Type**: float - **Usd Type**: SdfValueTypeNames->Float ### GetDiagonalInertiaAttr - **Function**: GetDiagonalInertiaAttr() - **Returns**: Attribute - **Description**: If non-zero, specifies diagonalized inertia tensor along the principal axes. Note if diagonalInertial is (0.0, 0.0, 0.0) it is ignored. Units: mass*distance*distance. - **Declaration**: float3 physics:diagonalInertia = (0, 0, 0) - **C++ Type**: GfVec3f - **Usd Type**: SdfValueTypeNames->Float3 ### GetMassAttr - **Function**: GetMassAttr() - **Returns**: Attribute - **Description**: If non-zero, directly specifies the mass of the object. Note that any child prim can also have a mass when they apply massAPI. In this case, the precedence rule is ‘parent mass overrides the child’s’. This may come as counter-intuitive, but mass is a computed quantity and in general not accumulative. For example, if a parent has mass of 10, and one of two children has mass of 20, allowing child’s mass to override its parent results in a mass of -10 for the other child. Note if mass is 0.0 it is ignored. Units: mass. - **Declaration**: float physics:mass = 0 - **C++ Type**: float - **Usd Type**: SdfValueTypeNames->Float ### GetPrincipalAxesAttr - **Function**: GetPrincipalAxesAttr() - **Returns**: Attribute - **Description**: Orientation of the inertia tensor’s principal axes in the prim’s local space. - **Declaration**: quatf physics:principalAxes = (0, 0, 0, 0) - **C++ Type**: GfQuatf Usd Type SdfValueTypeNames->Quatf ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – ```python class pxr.UsdPhysics.MassUnits ``` Container class for static double-precision symbols representing common mass units of measure expressed in kilograms. **Attributes:** - **grams** - **kilograms** - **slugs** ```python grams = 0.001 ``` ```python kilograms = 1.0 ``` ```python slugs = 14.5939 ``` ```python class pxr.UsdPhysics.MaterialAPI ``` Adds simulation material properties to a Material. All collisions that have a relationship to this material will have their collision response defined through this material. **Methods:** - **Apply** ```python classmethod Apply(prim) -> MaterialAPI ``` - **CanApply** ```python classmethod CanApply(prim, whyNot) -> bool ``` <p> CreateDensityAttr (defaultValue, writeSparsely) <p> See GetDensityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateDynamicFrictionAttr (defaultValue, ...) <p> See GetDynamicFrictionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateRestitutionAttr (defaultValue, ...) <p> See GetRestitutionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateStaticFrictionAttr (defaultValue, ...) <p> See GetStaticFrictionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> Get <p> classmethod Get(stage, path) -> MaterialAPI <p> GetDensityAttr () <p> If non-zero, defines the density of the material. <p> GetDynamicFrictionAttr () <p> Dynamic friction coefficient. <p> GetRestitutionAttr () <p> Restitution coefficient. <p> GetSchemaAttributeNames <p> classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <p> GetStaticFrictionAttr () <p> Static friction coefficient. <p> static Apply() <p> classmethod Apply(prim) -> MaterialAPI <p> Applies this single-apply API schema to the given prim. <p> This information is stored by adding”PhysicsMaterialAPI”to the token-valued, listOp metadata apiSchemas on the prim. <p> A valid UsdPhysicsMaterialAPI object is returned upon success. An invalid (or empty) UsdPhysicsMaterialAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <p> Parameters <p> prim (Prim) – <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> CanApply <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdPhysics.MaterialAPI.CanApply" title="Permalink to this definition">  <dd> <p> <strong> classmethod CanApply(prim, whyNot) -&gt; bool <p> Returns true if this <strong> single-apply API schema can be applied to the given <code class="docutils literal notranslate"> <span class="pre"> prim . <p> If this schema can not be a applied to the prim, this returns false and, if provided, populates <code class="docutils literal notranslate"> <span class="pre"> whyNot with the reason it can not be applied. <p> Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> prim ( <em> Prim ) – <li> <p> <strong> whyNot ( <em> str ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.MaterialAPI.CreateDensityAttr"> <span class="sig-name descname"> <span class="pre"> CreateDensityAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <a class="headerlink" href="#pxr.UsdPhysics.MaterialAPI.CreateDensityAttr" title="Permalink to this definition">  <dd> <p> See GetDensityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.MaterialAPI.CreateDynamicFrictionAttr"> <span class="sig-name descname"> <span class="pre"> CreateDynamicFrictionAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <a class="headerlink" href="#pxr.UsdPhysics.MaterialAPI.CreateDynamicFrictionAttr" title="Permalink to this definition">  <dd> <p> See GetDynamicFrictionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – ## CreateRestitutionAttr CreateRestitutionAttr(defaultValue, writeSparsely) → Attribute See GetRestitutionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateStaticFrictionAttr CreateStaticFrictionAttr(defaultValue, writeSparsely) → Attribute See GetStaticFrictionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## Get **classmethod** Get(stage, path) -> MaterialAPI Return a UsdPhysicsMaterialAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdPhysicsMaterialAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (**Path**) – ### GetDensityAttr() - If non-zero, defines the density of the material. - This can be used for body mass computation, see PhysicsMassAPI. Note that if the density is 0.0 it is ignored. Units: mass/distance/distance/distance. - Declaration ``` float physics:density = 0 ``` - C++ Type: float - Usd Type: SdfValueTypeNames->Float ### GetDynamicFrictionAttr() - Dynamic friction coefficient. - Unitless. - Declaration ``` float physics:dynamicFriction = 0 ``` - C++ Type: float - Usd Type: SdfValueTypeNames->Float ### GetRestitutionAttr() - Restitution coefficient. - Unitless. - Declaration ``` float physics:restitution = 0 ``` - C++ Type: float - Usd Type: SdfValueTypeNames->Float ### GetSchemaAttributeNames() - **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. - Parameters - **includeInherited** (bool) – ### GetStaticFrictionAttr() - Static friction coefficient. - Unitless. - Declaration ``` float physics:staticFriction = 0 ``` - C++ Type: float - Usd Type: SdfValueTypeNames->Float C++ Type float Usd Type SdfValueTypeNames->Float Attributes to control how a Mesh is made into a collider. Can be applied to only a USDGeomMesh in addition to its PhysicsCollisionAPI. For any described attribute **Fallback**, **Value**, or **Allowed Values** below that are text/tokens, the actual token is published and defined in UsdPhysicsTokens. So to set an attribute to the value "rightHanded", use UsdPhysicsTokens->rightHanded as the value. **Methods:** - **Apply**(prim) -> MeshCollisionAPI - Applies this single-apply API schema to the given prim. - This information is stored by adding "PhysicsMeshCollisionAPI" to the token-valued, listOp metadata apiSchemas on the prim. - A valid UsdPhysicsMeshCollisionAPI object is returned upon success. An invalid (or empty) UsdPhysicsMeshCollisionAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() - Parameters: - **prim** (Prim) – - **CanApply**(prim, whyNot) -> bool - Determines if the API schema can be applied to the given prim, and if not, why not. - **CreateApproximationAttr**(defaultValue, ...) - See GetApproximationAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **Get**(stage, path) -> MeshCollisionAPI - Retrieves the MeshCollisionAPI applied to the given path on the given stage. - **GetApproximationAttr**() - Determines the mesh's collision approximation: "none" - The mesh geometry is used directly as a collider without any approximation. - **GetSchemaAttributeNames**(includeInherited) -> list[TfToken] - Returns the names of all attributes defined on this API schema, optionally including those inherited from parent schemas. ## classmethod CanApply(prim, whyNot) -> bool Returns true if this **single-apply** API schema can be applied to the given `prim`. If this schema can not be applied to the prim, this returns false and, if provided, populates `whyNot` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() ### Parameters - **prim** (`Prim`) – - **whyNot** (`str`) – ## classmethod Get(stage, path) -> MeshCollisionAPI Return a UsdPhysicsMeshCollisionAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdPhysicsMeshCollisionAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ``` ### Attribute Determines the mesh’s collision approximation: - "none" - The mesh geometry is used directly as a collider without any approximation. - "convexDecomposition" - A convex mesh decomposition is performed. This results in a set of convex mesh colliders. - "convexHull" - A convex hull of the mesh is generated and used as the collider. - "boundingSphere" - A bounding sphere is computed around the mesh and used as a collider. - "boundingCube" - An optimally fitting box collider is computed around the mesh. - "meshSimplification" - A mesh simplification step is performed, resulting in a simplified triangle mesh collider. Declaration: ``` ```markdown uniform token physics:approximation="none" ``` C++ Type: TfToken Usd Type: SdfValueTypeNames->Token Variability: SdfVariabilityUniform Allowed Values: none, convexDecomposition, convexHull, boundingSphere, boundingCube, meshSimplification ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters: - **includeInherited** (bool) – ### PrismaticJoint Predefined prismatic joint type (translation along prismatic joint axis is permitted.) For any described attribute **Fallback Value** or **Allowed Values** below that are text/tokens, the actual token is published and defined in UsdPhysicsTokens. So to set an attribute to the value "rightHanded", use UsdPhysicsTokens->rightHanded as the value. **Methods:** - **CreateAxisAttr** (defaultValue, writeSparsely) - See GetAxisAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateLowerLimitAttr** (defaultValue, writeSparsely) - See GetLowerLimitAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateUpperLimitAttr** (defaultValue, writeSparsely) - See GetUpperLimitAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **Define** (stage, path) -> PrismaticJoint - **Get** (stage, path) -> PrismaticJoint - **GetAxisAttr** () ``` Joint axis. GetLowerLimitAttr() Lower limit. GetSchemaAttributeNames() **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] GetUpperLimitAttr() Upper limit. **CreateAxisAttr**(defaultValue, writeSparsely) -> Attribute - See GetAxisAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. - **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – **CreateLowerLimitAttr**(defaultValue, writeSparsely) -> Attribute - See GetLowerLimitAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. - **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – **CreateUpperLimitAttr**(defaultValue, writeSparsely) -> Attribute - See GetUpperLimitAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. - **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – <em> <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dt> <dd> <p> See GetUpperLimitAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.PrismaticJoint.Define"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Define <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod Define(stage, path) -&gt; PrismaticJoint <p> Attempt to ensure a <em> UsdPrim adhering to this schema at <code> path is defined (according to UsdPrim::IsDefined() ) on this stage. <p> If a prim adhering to this schema at <code> path is already defined on this stage, return that prim. Otherwise author an <em> SdfPrimSpec with <em> specifier == <em> SdfSpecifierDef and this schema’s prim type name for the prim at <code> path at the current EditTarget. Author <em> SdfPrimSpec s with <code> specifier == <em> SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not <em> Defined ancestors. <p> The given <em> path must be an absolute prim path that does not contain any variant selections. <p> If it is impossible to author any of the necessary PrimSpecs, (for example, in case <em> path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid <em> UsdPrim . <p> Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> stage ( <em> Stage ) – <li> <p> <strong> path ( <em> Path ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.PrismaticJoint.Get"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Get <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod Get(stage, path) -&gt; PrismaticJoint <p> Return a UsdPhysicsPrismaticJoint holding the prim adhering to this schema at <code> path on <code> stage . <p> If no prim exists at <code> path on <code> stage , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: <div class="highlight-text notranslate"> <div class="highlight"> <pre>UsdPhysicsPrismaticJoint(stage-&gt;GetPrimAtPath(path)); <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> stage ( <em> Stage ) – <li> <p> <strong> path ( <em> Path ) – - Stage – - Path – ### GetAxisAttr() - Joint axis. - Declaration ``` uniform token physics:axis = "X" ``` - C++ Type: TfToken - Usd Type: SdfValueTypeNames->Token - Variability: SdfVariabilityUniform - Allowed Values: X, Y, Z ### GetLowerLimitAttr() - Lower limit. - Units: distance. -inf means not limited in negative direction. - Declaration ``` float physics:lowerLimit = -inf ``` - C++ Type: float - Usd Type: SdfValueTypeNames->Float ### GetSchemaAttributeNames() - **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. - Parameters - **includeInherited** (bool) – ### GetUpperLimitAttr() - Upper limit. - Units: distance. inf means not limited in positive direction. - Declaration ``` float physics:upperLimit = inf ``` - C++ Type: float - Usd Type: SdfValueTypeNames->Float ### RevoluteJoint - Predefined revolute joint type (rotation along revolute joint axis is permitted.) in UsdPhysicsTokens. So to set an attribute to the value "rightHanded", use UsdPhysicsTokens->rightHanded as the value. **Methods:** | Method | Description | |------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------| | `CreateAxisAttr(defaultValue, writeSparsely)` | See GetAxisAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateLowerLimitAttr(defaultValue, writeSparsely)` | See GetLowerLimitAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateUpperLimitAttr(defaultValue, writeSparsely)` | See GetUpperLimitAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `Define(stage, path)` -> RevoluteJoint | classmethod Define(stage, path) -> RevoluteJoint | | `Get(stage, path)` -> RevoluteJoint | classmethod Get(stage, path) -> RevoluteJoint | | `GetAxisAttr()` | Joint axis. | | `GetLowerLimitAttr()` | Lower limit. | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | `GetUpperLimitAttr()` | Upper limit. | ### CreateAxisAttr(defaultValue, writeSparsely) See GetAxisAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters: - **defaultValue** (VtValue) – - **writeSparsely** ### CreateLowerLimitAttr ```python CreateLowerLimitAttr(defaultValue, writeSparsely) -> Attribute ``` See GetLowerLimitAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateUpperLimitAttr ```python CreateUpperLimitAttr(defaultValue, writeSparsely) -> Attribute ``` See GetUpperLimitAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### Define ```python classmethod Define(stage, path) -> RevoluteJoint ``` Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined()) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined`. # 祖先 The given **path** must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case **path** cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. ## 参数 - **stage** (Stage) – - **path** (Path) – ## 类方法 Get **classmethod** Get(stage, path) -> RevoluteJoint Return a UsdPhysicsRevoluteJoint holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdPhysicsRevoluteJoint(stage->GetPrimAtPath(path)); ``` ### 参数 - **stage** (Stage) – - **path** (Path) – ## 方法 GetAxisAttr Joint axis. Declaration: ``` uniform token physics:axis ="X" ``` C++ Type: TfToken Usd Type: SdfValueTypeNames->Token Variability: SdfVariabilityUniform Allowed Values: X, Y, Z ## 方法 GetLowerLimitAttr Lower limit. Units: degrees. -inf means not limited in negative direction. Declaration: ``` float physics:lowerLimit = -inf ``` C++ Type: float Usd Type: SdfValueTypeNames->Float ### GetSchemaAttributeNames(includeInherited) -> list[TfToken] - **classmethod** - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. - **Parameters** - **includeInherited** (bool) – ### GetUpperLimitAttr() -> Attribute - Upper limit. - Units: degrees. inf means not limited in positive direction. - **Declaration** ``` float physics:upperLimit = inf ``` - **C++ Type**: float - **Usd Type**: SdfValueTypeNames->Float ### RigidBodyAPI - Applies physics body attributes to any UsdGeomXformable prim and marks that prim to be driven by a simulation. If a simulation is running it will update this prim’s pose. All prims in the hierarchy below this prim should move accordingly. - **Classes:** - MassInformation - **Methods:** - **Apply(prim) -> RigidBodyAPI** - **CanApply(prim, whyNot) -> bool** - **ComputeMassProperties(diagonalInertia, com, ...)** - Compute mass properties of the rigid body. Computed diagonal of the inertial tensor for the rigid body. - **CreateAngularVelocityAttr(defaultValue, ...)** - See GetAngularVelocityAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateKinematicEnabledAttr(defaultValue, ...)** - See GetKinematicEnabledAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateRigidBodyEnabledAttr(defaultValue, ...)** - See GetRigidBodyEnabledAttr(), and also Create vs Get Property Methods for when to use Get vs Create. <p> See GetRigidBodyEnabledAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateSimulationOwnerRel() <p> See GetSimulationOwnerRel() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateStartsAsleepAttr(defaultValue, ...) <p> See GetStartsAsleepAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateVelocityAttr(defaultValue, writeSparsely) <p> See GetVelocityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> Get <p> <strong>classmethod <p> GetAngularVelocityAttr() <p> Angular velocity in the same space as the node's xform. <p> GetKinematicEnabledAttr() <p> Determines whether the body is kinematic or not. <p> GetRigidBodyEnabledAttr() <p> Determines if this PhysicsRigidBodyAPI is enabled. <p> GetSchemaAttributeNames <p> <strong>classmethod <p> GetSimulationOwnerRel() <p> Single PhysicsScene that will simulate this body. <p> GetStartsAsleepAttr() <p> Determines if the body is asleep when the simulation starts. <p> GetVelocityAttr() <p> Linear velocity in the same space as the node's xform. <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdPhysics.RigidBodyAPI.MassInformation"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-name descname"> <span class="pre"> MassInformation <a class="headerlink" href="#pxr.UsdPhysics.RigidBodyAPI.MassInformation" title="Permalink to this definition">  <dd> <p> <strong> Attributes: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> centerOfMass <td> <p> <tr class="row-even"> <td> <p> inertia <td> <p> | Property | Description | |-------------------|-------------| | inertia | | | localPos | | | localRot | | | volume | | ### centerOfMass - **Type**: property ### inertia - **Type**: property ### localPos - **Type**: property ### localRot - **Type**: property ### volume - **Type**: property ### Apply - **Type**: classmethod - **Description**: Applies this single-apply API schema to the given prim. This information is stored by adding "PhysicsRigidBodyAPI" to the token-valued, listOp metadata apiSchemas on the prim. A valid UsdPhysicsRigidBodyAPI object is returned upon success. An invalid (or empty) UsdPhysicsRigidBodyAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. - **Parameters**: - **prim** (Prim) ### CanApply - **Type**: classmethod - **Description**: Returns true if this single-apply API schema can be applied to the given prim. If this schema cannot be applied to the prim, this returns false. - **Parameters**: - **prim** (Prim) - **whyNot** (str) and, if provided, populates ```python whyNot ``` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters ---------- - **prim** (Prim) – - **whyNot** (str) – ```python ComputeMassProperties(diagonalInertia, com, principalAxes, massInfoFn) ``` Compute mass properties of the rigid body ```python diagonalInertia ``` Computed diagonal of the inertial tensor for the rigid body. ```python com ``` Computed center of mass for the rigid body. ```python principalAxes ``` Inertia tensor’s principal axes orientation for the rigid body. ```python massInfoFn ``` Callback function to get collision mass information. Computed mass of the rigid body Parameters ---------- - **diagonalInertia** (Vec3f) – - **com** (Vec3f) – - **principalAxes** (Quatf) – - **massInfoFn** (MassInformationFn) – ```python CreateAngularVelocityAttr(defaultValue, writeSparsely) ``` See GetAngularVelocityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```python defaultValue ``` as the attribute’s default, sparsely (when it makes sense to do so) if ```python writeSparsely ``` is true - the default for ```python writeSparsely ``` is false. Parameters ---------- - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateKinematicEnabledAttr ```python CreateKinematicEnabledAttr(defaultValue, writeSparsely) ``` - Returns: `Attribute` **See** GetKinematicEnabledAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters:** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – --- ### CreateRigidBodyEnabledAttr ```python CreateRigidBodyEnabledAttr(defaultValue, writeSparsely) ``` - Returns: `Attribute` **See** GetRigidBodyEnabledAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters:** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – --- ### CreateSimulationOwnerRel ```python CreateSimulationOwnerRel() ``` - Returns: `Relationship` **See** GetSimulationOwnerRel(), and also Create vs Get Property Methods for when to use Get vs Create. --- ### CreateStartsAsleepAttr ```python CreateStartsAsleepAttr(defaultValue, writeSparsely) ``` - Returns: `Attribute` **See** GetStartsAsleepAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters:** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – See GetStartsAsleepAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – See GetVelocityAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### static Get(stage, path) -> RigidBodyAPI Return a UsdPhysicsRigidBodyAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdPhysicsRigidBodyAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### GetAngularVelocityAttr() -> Attribute ``` Angular velocity in the same space as the node’s xform. Units: degrees/second. Declaration ``` vector3f physics:angularVelocity = (0, 0, 0) ``` C++ Type GfVec3f Usd Type SdfValueTypeNames->Vector3f Determines whether the body is kinematic or not. A kinematic body is a body that is moved through animated poses or through user defined poses. The simulation derives velocities for the kinematic body based on the external motion. When a continuous motion is not desired, this kinematic flag should be set to false. Declaration ``` bool physics:kinematicEnabled = 0 ``` C++ Type bool Usd Type SdfValueTypeNames->Bool Determines if this PhysicsRigidBodyAPI is enabled. Declaration ``` bool physics:rigidBodyEnabled = 1 ``` C++ Type bool Usd Type SdfValueTypeNames->Bool **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters * **includeInherited** (bool) – Single PhysicsScene that will simulate this body. By default this is the first PhysicsScene found in the stage using UsdStage::Traverse(). Determines if the body is asleep when the simulation starts. Declaration ``` uniform bool physics:startsAsleep ``` <code> <span class="pre"> bool <span class="pre"> physics:is_dynamic <span class="pre"> = <span class="pre"> 0 <p> C++ Type <p> bool <p> Usd Type <p> SdfValueTypeNames->Bool <p> Variability <p> SdfVariabilityUniform <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.RigidBodyAPI.GetVelocityAttr"> <span class="sig-name descname"> <span class="pre"> GetVelocityAttr <span class="sig-paren"> () <span class="sig-return"> → <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdPhysics.RigidBodyAPI.GetVelocityAttr" title="Permalink to this definition">  <dd> <p> Linear velocity in the same space as the node’s xform. <p> Units: distance/second. <p> Declaration <p> <code> <span class="pre"> vector3f <span class="pre"> physics:velocity <span class="pre"> = <span class="pre"> (0, <span class="pre"> 0, <span class="pre"> 0) <p> C++ Type <p> GfVec3f <p> Usd Type <p> SdfValueTypeNames->Vector3f <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Scene"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.UsdPhysics. <span class="sig-name descname"> <span class="pre"> Scene <a class="headerlink" href="#pxr.UsdPhysics.Scene" title="Permalink to this definition">  <dd> <p> General physics simulation properties, required for simulation. <p> <strong> Methods: <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code> <span class="pre"> CreateGravityDirectionAttr (defaultValue, ...) <td> <p> See GetGravityDirectionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <code> <span class="pre"> CreateGravityMagnitudeAttr (defaultValue, ...) <td> <p> See GetGravityMagnitudeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-odd"> <td> <p> <code> <span class="pre"> Define <td> <p> <strong> classmethod Define(stage, path) -> Scene <tr class="row-even"> <td> <p> <code> <span class="pre"> Get <td> <p> <strong> classmethod Get(stage, path) -> Scene <tr class="row-odd"> <td> <p> <code> <span class="pre"> GetGravityDirectionAttr () <td> <p> Gravity direction vector in simulation world space. <tr class="row-even"> <td> <p> <code> <span class="pre"> GetGravityMagnitudeAttr () <td> <p> Gravity acceleration magnitude in simulation world space. <tr class="row-odd"> <td> <p> <code> <span class="pre"> GetSchemaAttributeNames <td> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Scene.CreateGravityDirectionAttr"> <span class="sig-name descname"> <span class="pre"> CreateGravityDirectionAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> → <span class="sig-return-typehint"> Attribute ### CreateGravityDirectionAttr See GetGravityDirectionAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateGravityMagnitudeAttr See GetGravityMagnitudeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### Define **classmethod** Define(stage, path) -> Scene Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined()) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. #### Parameters - **stage** (`Stage`) – ### Scene Schema #### Attributes - **class** (Class) – - **path** (Path) – #### Methods ##### Get ```python classmethod Get(stage, path) -> Scene ``` Return a UsdPhysicsScene holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdPhysicsScene(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – ##### GetGravityDirectionAttr ```python GetGravityDirectionAttr() -> Attribute ``` Gravity direction vector in simulation world space. Will be normalized before use. A zero vector is a request to use the negative upAxis. Unitless. **Declaration** ```python vector3f physics:gravityDirection = (0, 0, 0) ``` **C++ Type** GfVec3f **Usd Type** SdfValueTypeNames->Vector3f ##### GetGravityMagnitudeAttr ```python GetGravityMagnitudeAttr() -> Attribute ``` Gravity acceleration magnitude in simulation world space. A negative value is a request to use a value equivalent to earth gravity regardless of the metersPerUnit scaling used by this scene. Units: distance/second/second. **Declaration** ```python float physics:gravityMagnitude = -inf ``` **C++ Type** float **Usd Type** SdfValueTypeNames->Float ##### GetSchemaAttributeNames ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – ``` class pxr.UsdPhysics.SphericalJoint  Predefined spherical joint type (Removes linear degrees of freedom, cone limit may restrict the motion in a given range.) It allows two limit values, which when equal create a circular, else an elliptic cone limit around the limit axis. For any described attribute **Fallback** **Value** or **Allowed** **Values** below that are text/tokens, the actual token is published and defined in UsdPhysicsTokens. So to set an attribute to the value”rightHanded”, use UsdPhysicsTokens->rightHanded as the value. **Methods:** | Method | Description | | --- | --- | | CreateAxisAttr(defaultValue, writeSparsely) | See GetAxisAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateConeAngle0LimitAttr(defaultValue, ...) | See GetConeAngle0LimitAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateConeAngle1LimitAttr(defaultValue, ...) | See GetConeAngle1LimitAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | Define(stage, path) -> SphericalJoint | classmethod Define(stage, path) -> SphericalJoint | | Get(stage, path) -> SphericalJoint | classmethod Get(stage, path) -> SphericalJoint | | GetAxisAttr() | Cone limit axis. | | GetConeAngle0LimitAttr() | Cone limit from the primary joint axis in the local0 frame toward the next axis. | | GetConeAngle1LimitAttr() | Cone limit from the primary joint axis in the local0 frame toward the second to next axis. | | GetSchemaAttributeNames(includeInherited) -> list[TfToken] | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | CreateAxisAttr(defaultValue, writeSparsely) -> Attribute  See GetAxisAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateConeAngle0LimitAttr ```python CreateConeAngle0LimitAttr(defaultValue, writeSparsely) → Attribute ``` See GetConeAngle0LimitAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateConeAngle1LimitAttr ```python CreateConeAngle1LimitAttr(defaultValue, writeSparsely) → Attribute ``` See GetConeAngle1LimitAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### Define ```python static Define() ``` **classmethod** Define(stage, path) -> SphericalJoint ``` Attempt to ensure a **UsdPrim** adhering to this schema at \`\`\` path \`\`\` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at \`\`\` path \`\`\` is already defined on this stage, return that prim. Otherwise author an **SdfPrimSpec** with **specifier** == **SdfSpecifierDef** and this schema’s prim type name for the prim at \`\`\` path \`\`\` at the current EditTarget. Author **SdfPrimSpec**s with \`\`\` specifier \`\`\` == **SdfSpecifierDef** and empty typeName at the current EditTarget for any nonexistent, or existing but not **Defined** ancestors. The given **path** must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case **path** cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (Stage) – - **path** (Path) – **classmethod** Get(stage, path) -> SphericalJoint Return a UsdPhysicsSphericalJoint holding the prim adhering to this schema at \`\`\` path \`\`\` on \`\`\` stage \`\`\` . If no prim exists at \`\`\` path \`\`\` on \`\`\` stage \`\`\` , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: \`\`\`python UsdPhysicsSphericalJoint(stage->GetPrimAtPath(path)); \`\`\` **Parameters** - **stage** (Stage) – - **path** (Path) – **GetAxisAttr** Cone limit axis. Declaration \`\`\` uniform token physics:axis ="X" \`\`\` C++ Type TfToken Usd Type SdfValueTypeNames->Token Variability SdfVariabilityUniform Allowed Values X, Y, Z **GetConeAngle0LimitAttr** ### Cone limit from the primary joint axis in the local0 frame toward the next axis. (Next axis of X is Y, and of Z is X.) A negative value means not limited. Units: degrees. #### Declaration ```python float physics:coneAngle0Limit = -1 ``` #### C++ Type float #### Usd Type SdfValueTypeNames->Float ### Cone limit from the primary joint axis in the local0 frame toward the second to next axis. A negative value means not limited. Units: degrees. #### Declaration ```python float physics:coneAngle1Limit = -1 ``` #### C++ Type float #### Usd Type SdfValueTypeNames->Float ### classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ### class pxr.UsdPhysics.Tokens #### Attributes: - acceleration - angular - boundingCube - boundingSphere - colliders - convexDecomposition - convexHull distance drive drive_MultipleApplyTemplate_PhysicsDamping drive_MultipleApplyTemplate_PhysicsMaxForce drive_MultipleApplyTemplate_PhysicsStiffness drive_MultipleApplyTemplate_PhysicsTargetPosition drive_MultipleApplyTemplate_PhysicsTargetVelocity drive_MultipleApplyTemplate_PhysicsType force kilogramsPerUnit limit limit_MultipleApplyTemplate_PhysicsHigh limit_MultipleApplyTemplate_PhysicsLow linear meshSimplification none physicsAngularVelocity - `physicsAngularVelocity` - `physicsApproximation` - `physicsAxis` - `physicsBody0` - `physicsBody1` - `physicsBreakForce` - `physicsBreakTorque` - `physicsCenterOfMass` - `physicsCollisionEnabled` - `physicsConeAngle0Limit` - `physicsConeAngle1Limit` - `physicsDensity` - `physicsDiagonalInertia` - `physicsDynamicFriction` - `physicsExcludeFromArticulation` - `physicsFilteredGroups` - `physicsFilteredPairs` - `physicsGravityDirection` - **physicsGravityMagnitude** - **physicsInvertFilteredGroups** - **physicsJointEnabled** - **physicsKinematicEnabled** - **physicsLocalPos0** - **physicsLocalPos1** - **physicsLocalRot0** - **physicsLocalRot1** - **physicsLowerLimit** - **physicsMass** - **physicsMaxDistance** - **physicsMergeGroup** - **physicsMinDistance** - **physicsPrincipalAxes** - **physicsRestitution** - **physicsRigidBodyEnabled** - **physicsSimulationOwner** | physicsStartsAsleep | physicsStaticFriction | physicsUpperLimit | physicsVelocity | rotX | rotY | rotZ | transX | transY | transZ | x | y | z | |---------------------|-----------------------|--------------------|-----------------|------|------|------|--------|--------|--------|---|---|---| | `physicsStartsAsleep` | `physicsStaticFriction` | `physicsUpperLimit` | `physicsVelocity` | `rotX` | `rotY` | `rotZ` | `transX` | `transY` | `transZ` | `x` | `y` | `z` | ``` <dl> <dt>acceleration <dd> = 'acceleration' <dl> <dt>angular <dd> = 'angular' <dl> <dt>boundingCube <dd> = 'boundingCube' <dl> <dt>boundingSphere <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.boundingSphere"> <span class="sig-name descname"> <span class="pre"> boundingSphere <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'boundingSphere' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.colliders"> <span class="sig-name descname"> <span class="pre"> colliders <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'colliders' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.convexDecomposition"> <span class="sig-name descname"> <span class="pre"> convexDecomposition <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'convexDecomposition' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.convexHull"> <span class="sig-name descname"> <span class="pre"> convexHull <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'convexHull' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.distance"> <span class="sig-name descname"> <span class="pre"> distance <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'distance' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.drive"> <span class="sig-name descname"> <span class="pre"> drive <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'drive' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.drive_MultipleApplyTemplate_PhysicsDamping"> <span class="sig-name descname"> <span class="pre"> drive_MultipleApplyTemplate_PhysicsDamping <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'drive:__INSTANCE_NAME__:physics:damping' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.drive_MultipleApplyTemplate_PhysicsMaxForce"> <span class="sig-name descname"> <span class="pre"> drive_MultipleApplyTemplate_PhysicsMaxForce <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'drive:__INSTANCE_NAME__:physics:maxForce' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.drive_MultipleApplyTemplate_PhysicsStiffness"> <span class="sig-name descname"> <span class="pre"> drive_MultipleApplyTemplate_PhysicsStiffness <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'drive:__INSTANCE_NAME__:physics:stiffness' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.drive_MultipleApplyTemplate_PhysicsTargetPosition"> <span class="sig-name descname"> <span class="pre"> drive_MultipleApplyTemplate_PhysicsTargetPosition <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'drive:__INSTANCE_NAME__:physics:targetPosition' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.drive_MultipleApplyTemplate_PhysicsTargetVelocity"> <span class="sig-name descname"> <span class="pre"> drive_MultipleApplyTemplate_PhysicsTargetVelocity <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'drive:__INSTANCE_NAME__:physics:targetVelocity' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.drive_MultipleApplyTemplate_PhysicsType"> <span class="sig-name descname"> <span class="pre"> drive_MultipleApplyTemplate_PhysicsType <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'drive:__INSTANCE_NAME__:physics:type' <dd> drive_MultipleApplyTemplate_PhysicsType = 'drive:__INSTANCE_NAME__:physics:type' force = 'force' kilogramsPerUnit = 'kilogramsPerUnit' limit = 'limit' limit_MultipleApplyTemplate_PhysicsHigh = 'limit:__INSTANCE_NAME__:physics:high' limit_MultipleApplyTemplate_PhysicsLow = 'limit:__INSTANCE_NAME__:physics:low' linear = 'linear' meshSimplification = 'meshSimplification' none = 'none' physicsAngularVelocity = 'physics:angularVelocity' physicsApproximation = 'physics:approximation' physicsAxis = 'physicsAxis' = 'physics:axis' physicsBody0 = 'physics:body0' physicsBody1 = 'physics:body1' physicsBreakForce = 'physics:breakForce' physicsBreakTorque = 'physics:breakTorque' physicsCenterOfMass = 'physics:centerOfMass' physicsCollisionEnabled = 'physics:collisionEnabled' physicsConeAngle0Limit = 'physics:coneAngle0Limit' physicsConeAngle1Limit = 'physics:coneAngle1Limit' physicsDensity = 'physics:density' physicsDiagonalInertia = 'physics:diagonalInertia' physicsDynamicFriction = 'physics:dynamicFriction' <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsDynamicFriction"> <span class="sig-name descname"> <span class="pre"> physicsDynamicFriction <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:dynamicFriction' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsExcludeFromArticulation"> <span class="sig-name descname"> <span class="pre"> physicsExcludeFromArticulation <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:excludeFromArticulation' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsFilteredGroups"> <span class="sig-name descname"> <span class="pre"> physicsFilteredGroups <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:filteredGroups' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsFilteredPairs"> <span class="sig-name descname"> <span class="pre"> physicsFilteredPairs <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:filteredPairs' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsGravityDirection"> <span class="sig-name descname"> <span class="pre"> physicsGravityDirection <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:gravityDirection' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsGravityMagnitude"> <span class="sig-name descname"> <span class="pre"> physicsGravityMagnitude <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:gravityMagnitude' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsInvertFilteredGroups"> <span class="sig-name descname"> <span class="pre"> physicsInvertFilteredGroups <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:invertFilteredGroups' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsJointEnabled"> <span class="sig-name descname"> <span class="pre"> physicsJointEnabled <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:jointEnabled' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsKinematicEnabled"> <span class="sig-name descname"> <span class="pre"> physicsKinematicEnabled <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:kinematicEnabled' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsLocalPos0"> <span class="sig-name descname"> <span class="pre"> physicsLocalPos0 <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:localPos0' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsLocalPos1"> <span class="sig-name descname"> <span class="pre"> physicsLocalPos1 <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:localPos1' <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsLocalRot0"> <span class="sig-name descname"> <span class="pre"> physicsLocalRot0 <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:localRot0' <dd> ## physicsLocalRot1 - **Property**: `= 'physics:localRot1'` ## physicsLowerLimit - **Property**: `= 'physics:lowerLimit'` ## physicsMass - **Property**: `= 'physics:mass'` ## physicsMaxDistance - **Property**: `= 'physics:maxDistance'` ## physicsMergeGroup - **Property**: `= 'physics:mergeGroup'` ## physicsMinDistance - **Property**: `= 'physics:minDistance'` ## physicsPrincipalAxes - **Property**: `= 'physics:principalAxes'` ## physicsRestitution - **Property**: `= 'physics:restitution'` ## physicsRigidBodyEnabled - **Property**: `= 'physics:rigidBodyEnabled'` ## physicsSimulationOwner - **Property**: `= 'physics:simulationOwner'` ## physicsStartsAsleep - **Property**: `= 'physics:startsAsleep'` ## physicsStaticFriction - **Property**: `= 'physics:staticFriction'` <span class="sig-name descname"> <span class="pre"> physicsStaticFriction <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:staticFriction'  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsUpperLimit"> <span class="sig-name descname"> <span class="pre"> physicsUpperLimit <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:upperLimit'  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.physicsVelocity"> <span class="sig-name descname"> <span class="pre"> physicsVelocity <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'physics:velocity'  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.rotX"> <span class="sig-name descname"> <span class="pre"> rotX <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'rotX'  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.rotY"> <span class="sig-name descname"> <span class="pre"> rotY <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'rotY'  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.rotZ"> <span class="sig-name descname"> <span class="pre"> rotZ <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'rotZ'  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.transX"> <span class="sig-name descname"> <span class="pre"> transX <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'transX'  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.transY"> <span class="sig-name descname"> <span class="pre"> transY <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'transY'  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.transZ"> <span class="sig-name descname"> <span class="pre"> transZ <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'transZ'  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.x"> <span class="sig-name descname"> <span class="pre"> x <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'X'  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.y"> <span class="sig-name descname"> <span class="pre"> y <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'Y'  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdPhysics.Tokens.z"> <span class="sig-name descname"> <span class="pre"> z <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'Z'  <dd>
139,750
UsdProc.md
# UsdProc module Summary: The UsdProc module defines schemas for the scene description of procedural data meaningful to downstream systems. ## Classes: ### GenerativeProcedural Represents an abstract generative procedural prim which delivers its input parameters via properties (including relationships) within the "primvars:" namespace. ### Tokens ## GenerativeProcedural Class Represents an abstract generative procedural prim which delivers its input parameters via properties (including relationships) within the "primvars:" namespace. It does not itself have any awareness or participation in the execution of the procedural but rather serves as a means of delivering a procedural’s definition and input parameters. The value of its "proceduralSystem" property (either authored or provided by API schema fallback) indicates to which system the procedural definition is meaningful. For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdProcTokens. So to set an attribute to the value "rightHanded", use UsdProcTokens->rightHanded as the value. ### Methods: #### CreateProceduralSystemAttr(defaultValue, ...) See GetProceduralSystemAttr(), and also Create vs Get Property Methods for when to use Get vs Create. #### Define **classmethod** Define(stage, path) -> GenerativeProcedural #### Get | Method Name | Description | |-------------|-------------| | `classmethod Get(stage, path) -> GenerativeProcedural` | Get a GenerativeProcedural instance. | | `GetProceduralSystemAttr()` | The name or convention of the system responsible for evaluating the procedural. | | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | Get the names of schema attributes. | | `CreateProceduralSystemAttr(defaultValue, writeSparsely)` | See GetProceduralSystemAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `static classmethod Define(stage, path) -> GenerativeProcedural` | Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined() ) on this stage. | ## Get ### Classmethod Get(stage, path) -> GenerativeProcedural Return a UsdProcGenerativeProcedural holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```text UsdProcGenerativeProcedural(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ## GetProceduralSystemAttr The name or convention of the system responsible for evaluating the procedural. NOTE: A fallback value for this is typically set via an API schema. ### Declaration ```text token proceduralSystem ``` ### C++ Type TfToken ### Usd Type SdfValueTypeNames->Token ## GetSchemaAttributeNames ### Classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - **includeInherited** (bool) – ## Tokens ### Attributes: | Attribute | Description | |--------------------------|-------------| | `proceduralSystem` | | ### proceduralSystem = 'proceduralSystem'
3,457
UsdRender.md
# UsdRender module Summary: The UsdRender module provides schemas and behaviors for describing renders. ## Classes: - **DenoisePass** - A RenderDenoisePass generates renders via a denoising process. - **Pass** - A RenderPass prim encapsulates the necessary information to generate multipass renders. - **Product** - A UsdRenderProduct describes an image or other file-like artifact produced by a render. - **Settings** - A UsdRenderSettings prim specifies global settings for a render process, including an enumeration of the RenderProducts that should result, and the UsdGeomImageable purposes that should be rendered. - **SettingsBase** - Abstract base class that defines render settings that can be specified on either a RenderSettings prim or a RenderProduct prim. - **Tokens** - (No description provided) - **Var** - A UsdRenderVar describes a custom data variable for a render to produce. As denoising integration varies so widely across pipelines, all implementation details are left to pipeline-specific prims that inherit from RenderDenoisePass. **Methods:** | Method Name | Description | |-------------|-------------| | `Define` | `classmethod Define(stage, path) -> DenoisePass` | | `Get` | `classmethod Get(stage, path) -> DenoisePass` | | `GetSchemaAttributeNames` | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | **Define** ``` static Define(stage, path) -> DenoisePass ``` Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined()) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget’s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – **Get** ``` static Get(stage, path) -> DenoisePass ``` Return a UsdRenderDenoisePass holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdRenderDenoisePass(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ) – <li> <p> <strong> path ( <em> Path ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdRender.DenoisePass.GetSchemaAttributeNames"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> GetSchemaAttributeNames <span class="sig-paren"> ( <span class="sig-paren"> )  <dd> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <p> Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. <p> Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> includeInherited ( <em> bool ) – <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdRender.Pass"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.UsdRender. <span class="sig-name descname"> <span class="pre"> Pass  <dd> <p> A RenderPass prim encapsulates the necessary information to generate multipass renders. It houses properties for generating dependencies and the necessary commands to run to generate renders, as well as visibility controls for the scene. While RenderSettings describes the information needed to generate images from a single invocation of a renderer, RenderPass describes the additional information needed to generate a time varying set of images. <p> There are two consumers of RenderPass prims - a runtime executable that generates images from usdRender prims, and pipeline specific code that translates between usdRender prims and the pipeline’s resource scheduling software. We’ll refer to the latter as’job submission code’. <p> The name of the prim is used as the pass’s name. <p> For any described attribute <em> Fallback <em> Value or <em> Allowed <em> Values below that are text/tokens, the actual token is published and defined in UsdRenderTokens. So to set an attribute to the value”rightHanded”, use UsdRenderTokens-&gt;rightHanded as the value. <p> <strong> Methods: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateCommandAttr (defaultValue, writeSparsely) <td> <p> See GetCommandAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateDenoiseEnableAttr (defaultValue, ...) <td> <p> See GetDenoiseEnableAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateDenoisePassRel () <td> <p> See GetDenoisePassRel() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateFileNameAttr (defaultValue, writeSparsely) <td> <p> See GetFileNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateInputPassesRel () <td> <p> See GetInputPassesRel() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreatePassTypeAttr (defaultValue, writeSparsely) <td> <p> See GetPassTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateRenderSourceRel () <td> <p> See GetRenderSourceRel() , and also Create vs Get Property Methods for when to use Get vs Create. <p> Define <p> classmethod Define(stage, path) -> Pass <p> Get <p> classmethod Get(stage, path) -> Pass <p> GetCommandAttr <p> The command to run in order to generate renders for this pass. <p> GetDenoiseEnableAttr <p> When True, this Pass pass should be denoised. <p> GetDenoisePassRel <p> The The UsdRenderDenoisePass prim from which to source denoise settings. <p> GetFileNameAttr <p> The asset that contains the rendering prims or other information needed to render this pass. <p> GetInputPassesRel <p> The set of other Passes that this Pass depends on in order to be constructed properly. <p> GetPassTypeAttr <p> A string used to categorize differently structured or executed types of passes within a customized pipeline. <p> GetRenderSourceRel <p> The source prim to render from. <p> GetSchemaAttributeNames <p> classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <p> CreateCommandAttr <p> See GetCommandAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false. <p> Parameters <ul> <li> <p> <strong> defaultValue (VtValue) – <li> <p> <strong> writeSparsely ## CreateDenoiseEnableAttr ```CreateDenoiseEnableAttr```(```defaultValue```, ```writeSparsely```) -> ```Attribute``` See GetDenoiseEnableAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. ### Parameters - **defaultValue** (```VtValue```) – - **writeSparsely** (```bool```) – ## CreateDenoisePassRel ```CreateDenoisePassRel```() -> ```Relationship``` See GetDenoisePassRel() , and also Create vs Get Property Methods for when to use Get vs Create. ## CreateFileNameAttr ```CreateFileNameAttr```(```defaultValue```, ```writeSparsely```) -> ```Attribute``` See GetFileNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. ### Parameters - **defaultValue** (```VtValue```) – - **writeSparsely** (```bool```) – ## CreateInputPassesRel ```CreateInputPassesRel```() -> ```Relationship``` See GetInputPassesRel() , and also Create vs Get Property Methods for when to use Get vs Create. ## CreatePassTypeAttr ```markdown ## CreatePassTypeAttr ```python CreatePassTypeAttr(defaultValue, writeSparsely) -> Attribute ``` See GetPassTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateRenderSourceRel ```python CreateRenderSourceRel() -> Relationship ``` See GetRenderSourceRel() , and also Create vs Get Property Methods for when to use Get vs Create. ## Define ```python static classmethod Define(stage, path) -> Pass ``` Attempt to ensure a UsdPrim adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with `specifier` == SdfSpecifierDef and this schema’s prim type name for the prim at `path` at the current EditTarget. Author SdfPrimSpec s with `specifier` == SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid UsdPrim. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. ### Parameters - **stage** (Stage) – - **path** (Path) – ## Get ```python static classmethod Get(stage, path) -> Pass Get(stage, path) -> Pass Return a UsdRenderPass holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```text UsdRenderPass(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetCommandAttr → Attribute The command to run in order to generate renders for this pass. The job submission code can use this to properly send tasks to the job scheduling software that will generate products. The command can contain variables that will be substituted appropriately during submission, as seen in the example below with {fileName}. For example: command[0] ="prman"command[1] ="-progress"command[2] ="-pixelvariance"command[3] ="-0.15"command[4] ="{fileName}"# the fileName property will be substituted Declaration ```text uniform string[] command ``` C++ Type: VtArray&lt;std::string&gt; Usd Type: SdfValueTypeNames->StringArray Variability: SdfVariabilityUniform ### GetDenoiseEnableAttr → Attribute When True, this Pass pass should be denoised. Declaration ```text uniform bool denoise:enable = 0 ``` C++ Type: bool Usd Type: SdfValueTypeNames->Bool Variability: SdfVariabilityUniform ### GetDenoisePassRel → Relationship The The UsdRenderDenoisePass prim from which to source denoise settings. ### GetFileNameAttr → Attribute The asset that contains the rendering prims or other information needed to render this pass. Declaration ```text uniform asset fileName ``` C++ Type: (Type not specified in the provided HTML) Usd Type: (Type not specified in the provided HTML) Variability: (Type not specified in the provided HTML) SdfAssetPath Usd Type SdfValueTypeNames->Asset Variability SdfVariabilityUniform GetInputPassesRel () → Relationship The set of other Passes that this Pass depends on in order to be constructed properly. For example, a Pass A may generate a texture, which is then used as an input to Pass B. By default, usdRender makes some assumptions about the relationship between this prim and the prims listed in inputPasses. Namely, when per-frame tasks are generated from these pass prims, usdRender will assume a one-to-one relationship between tasks that share their frame number. Consider a pass named 'composite' whose inputPasses targets a Pass prim named 'beauty'. By default, each frame for 'composite' will depend on the same frame from 'beauty': beauty.1 -> composite.1 beauty.2 -> composite.2 etc The consumer of this RenderPass graph of inputs will need to resolve the transitive dependencies. GetPassTypeAttr () → Attribute A string used to categorize differently structured or executed types of passes within a customized pipeline. For example, when multiple DCC’s (e.g. Houdini, Katana, Nuke) each compute and contribute different Products to a final result, it may be clearest and most flexible to create a separate RenderPass for each. Declaration uniform token passType ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Variability SdfVariabilityUniform GetRenderSourceRel () → Relationship The source prim to render from. If fileName is not present, the source is assumed to be a RenderSettings prim present in the current Usd stage. If fileName is present, the source should be found in the file there. This relationship might target a string attribute on this or another prim that identifies the appropriate object in the external container. For example, for a Usd-backed pass, this would point to a RenderSettings prim. Houdini passes would point to a Rop. Nuke passes would point to a write node. GetSchemaAttributeNames () classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters includeInherited (bool) – Product class pxr.UsdRender.Product A UsdRenderProduct describes an image or other file-like artifact produced by a render. A RenderProduct combines one or more RenderVars into a file or interactive buffer. It also provides all the controls established in UsdRenderSettingsBase as optional overrides to whatever the owning UsdRenderSettings prim dictates. Specific renderers may support additional settings, such as a way to configure compression settings, filetype metadata, and so forth. Such settings can be encoded using renderer-specific API schemas applied to the product prim. For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdRenderTokens. So to set an attribute to the value”rightHanded”, use UsdRenderTokens->rightHanded as the value. <p> **Methods:** <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code>CreateOrderedVarsRel () <td> <p> See GetOrderedVarsRel() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <code>CreateProductNameAttr (defaultValue, ...) <td> <p> See GetProductNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-odd"> <td> <p> <code>CreateProductTypeAttr (defaultValue, ...) <td> <p> See GetProductTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <code>Define <td> <p> **classmethod** Define(stage, path) -&gt; Product <tr class="row-odd"> <td> <p> <code>Get <td> <p> **classmethod** Get(stage, path) -&gt; Product <tr class="row-even"> <td> <p> <code>GetOrderedVarsRel () <td> <p> Specifies the RenderVars that should be consumed and combined into the final product. <tr class="row-odd"> <td> <p> <code>GetProductNameAttr () <td> <p> Specifies the name that the output/display driver should give the product. <tr class="row-even"> <td> <p> <code>GetProductTypeAttr () <td> <p> The type of output to produce. <tr class="row-odd"> <td> <p> <code>GetSchemaAttributeNames <td> <p> **classmethod** GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <dl> <dt> <code>CreateOrderedVarsRel () <dd> <p> See GetOrderedVarsRel() , and also Create vs Get Property Methods for when to use Get vs Create. <dl> <dt> <code>CreateProductNameAttr (defaultValue, ...) <dd> <p> See GetProductNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code>defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if ```code writeSparsely ``` is ```code true ``` - the default for ```code writeSparsely ``` is ```code false ``` . ```markdown Parameters ========== - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ``` ```markdown ```code CreateProductTypeAttr ``` ( ```code defaultValue ``` , ```code writeSparsely ``` ) ```markdown See GetProductTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```code defaultValue ``` as the attribute’s default, sparsely (when it makes sense to do so) if ```code writeSparsely ``` is ```code true ``` - the default for ```code writeSparsely ``` is ```code false ``` . ```markdown Parameters ========== - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ``` ```markdown ```code Define ``` ( ) ```markdown classmethod Define(stage, path) -> Product Attempt to ensure a `UsdPrim` adhering to this schema at ```code path ``` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at ```code path ``` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at ```code path ``` at the current EditTarget. Author `SdfPrimSpec`s with ```code specifier ``` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. ```markdown Parameters ========== - **stage** (`Stage`) – - **path** (`Path`) – ``` ### Get ```python classmethod Get(stage, path) -> Product ``` Return a UsdRenderProduct holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdRenderProduct(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (Stage) – - **path** (Path) – ### GetOrderedVarsRel ```python GetOrderedVarsRel() -> Relationship ``` Specifies the RenderVars that should be consumed and combined into the final product. If ordering is relevant to the output driver, then the ordering of targets in this relationship provides the order to use. ### GetProductNameAttr ```python GetProductNameAttr() -> Attribute ``` Specifies the name that the output/display driver should give the product. This is provided as-authored to the driver, whose responsibility it is to situate the product on a filesystem or other storage, in the desired location. Declaration: ``` token productName ="" ``` C++ Type: TfToken Usd Type: SdfValueTypeNames->Token ### GetProductTypeAttr ```python GetProductTypeAttr() -> Attribute ``` The type of output to produce. The default,”raster”, indicates a 2D image. In the future, UsdRender may define additional product types. Declaration: ``` uniform token productType ="raster" ``` C++ Type: TfToken Usd Type: SdfValueTypeNames->Token Variability: SdfVariabilityUniform ### GetSchemaAttributeNames ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. ``` Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - **includeInherited** (`bool`) – ### Class: pxr.UsdRender.Settings A UsdRenderSettings prim specifies global settings for a render process, including an enumeration of the RenderProducts that should result, and the UsdGeomImageable purposes that should be rendered. How settings affect rendering For any described attribute `Fallback` `Value` or `Allowed` `Values` below that are text/tokens, the actual token is published and defined in UsdRenderTokens. So to set an attribute to the value"rightHanded", use UsdRenderTokens->rightHanded as the value. #### Methods: | Method | Description | |--------|-------------| | `CreateIncludedPurposesAttr(defaultValue, ...)` | See GetIncludedPurposesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateMaterialBindingPurposesAttr(...)` | See GetMaterialBindingPurposesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateProductsRel()` | See GetProductsRel() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateRenderingColorSpaceAttr(defaultValue, ...)` | See GetRenderingColorSpaceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Define(stage, path) -> Settings` | **classmethod** Define(stage, path) -> Settings | | `Get(stage, path) -> Settings` | **classmethod** Get(stage, path) -> Settings | | `GetIncludedPurposesAttr()` | The list of UsdGeomImageable `purpose` values that should be included in the render. | | `GetMaterialBindingPurposesAttr()` | Ordered list of material purposes to consider when resolving material bindings in the scene. | | `GetProductsRel()` | The set of RenderProducts the render should produce. | | `GetRenderingColorSpaceAttr()` | Describes a renderer's working (linear) colorSpace where all the renderer/shader math is expected to happen. | | Method Name | Description | |-------------|-------------| | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | A classmethod that returns a list of TfToken for schema attribute names. | | `GetStageRenderSettings(stage) -> Settings` | A classmethod that returns the render settings for a given stage. | ### CreateIncludedPurposesAttr ```python CreateIncludedPurposesAttr(defaultValue, writeSparsely) -> Attribute ``` See [GetIncludedPurposesAttr()](Usd.html#pxr.Usd.Attribute), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters:** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateMaterialBindingPurposesAttr ```python CreateMaterialBindingPurposesAttr(defaultValue, writeSparsely) -> Attribute ``` See [GetMaterialBindingPurposesAttr()](Usd.html#pxr.Usd.Attribute), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters:** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateProductsRel ```python CreateProductsRel() -> Relationship ``` See [GetProductsRel()](Usd.html#pxr.Usd.Relationship), and also Create vs Get Property Methods for when to use Get vs Create. ``` <em> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> See GetRenderingColorSpaceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code> writeSparsely is <code> true - the default for <code> writeSparsely is <code> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdRender.Settings.Define"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Define <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod Define(stage, path) -&gt; Settings <p> Attempt to ensure a <em> UsdPrim adhering to this schema at <code> path is defined (according to UsdPrim::IsDefined() ) on this stage. <p> If a prim adhering to this schema at <code> path is already defined on this stage, return that prim. Otherwise author an <em> SdfPrimSpec with <em> specifier == <em> SdfSpecifierDef and this schema’s prim type name for the prim at <code> path at the current EditTarget. Author <em> SdfPrimSpec s with <code> specifier == <em> SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not <em> Defined ancestors. <p> The given <em> path must be an absolute prim path that does not contain any variant selections. <p> If it is impossible to author any of the necessary PrimSpecs, (for example, in case <em> path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid <em> UsdPrim . <p> Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> stage ( Stage ) – <li> <p> <strong> path ( Path ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdRender.Settings.Get"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Get <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod Get(stage, path) -&gt; Settings <p> Return a UsdRenderSettings holding the prim adhering to this schema at <code> path on <code> stage . <p> If no prim exists at <code> path on <code> stage , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: <div class="highlight-text notranslate"> <div class="highlight"> <pre><span> <dl class="field-list simple"> ### Parameters - **stage** – - **path** – ### GetIncludedPurposesAttr - The list of UsdGeomImageable *purpose* values that should be included in the render. - Note this cannot be specified per-RenderProduct because it is a statement of which geometry is present. - Declaration ``` uniform token[] includedPurposes = ["default","render"] ``` - C++ Type: VtArray&lt;TfToken&gt; - Usd Type: SdfValueTypeNames->TokenArray - Variability: SdfVariabilityUniform ### GetMaterialBindingPurposesAttr - Ordered list of material purposes to consider when resolving material bindings in the scene. - The empty string indicates the "allPurpose" binding. - Declaration ``` uniform token[] materialBindingPurposes = ["full",""] ``` - C++ Type: VtArray&lt;TfToken&gt; - Usd Type: SdfValueTypeNames->TokenArray - Variability: SdfVariabilityUniform - Allowed Values: full, preview, "" ### GetProductsRel - The set of RenderProducts the render should produce. - This relationship should target UsdRenderProduct prims. If no *products* are specified, an application should produce an rgb image according to the RenderSettings configuration, to a default display or image name. ### GetRenderingColorSpaceAttr - Describes a renderer’s working (linear) colorSpace where all the renderer/shader math is expected to happen. - When no renderingColorSpace is provided, renderer should use its own default. - Declaration ``` uniform token renderingColorSpace ``` - C++ Type: TfToken - Usd Type: SdfValueTypeNames->Token - Variability: SdfVariabilityUniform <span class="w"> <span class="sig-name descname"> <span class="pre"> GetSchemaAttributeNames <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <p> Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. <p> Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> includeInherited ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdRender.Settings.GetStageRenderSettings"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> GetStageRenderSettings <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod GetStageRenderSettings(stage) -&gt; Settings <p> Fetch and return <code class="docutils literal notranslate"> <span class="pre"> stage <p> If unauthored, or the metadata does not refer to a valid UsdRenderSettings prim, this will return an invalid UsdRenderSettings prim. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> stage ( <em> UsdStageWeak ) – <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdRender.SettingsBase"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.UsdRender. <span class="sig-name descname"> <span class="pre"> SettingsBase <dd> <p> Abstract base class that defines render settings that can be specified on either a RenderSettings prim or a RenderProduct prim. <p> For any described attribute <em> Fallback <p> <strong> Methods: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateAspectRatioConformPolicyAttr <td> <p> See GetAspectRatioConformPolicyAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateCameraRel <td> <p> See GetCameraRel() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateDataWindowNDCAttr <td> <p> See GetDataWindowNDCAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateDisableMotionBlurAttr <td> <p> See GetDisableMotionBlurAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateInstantaneousShutterAttr <td> <p> See GetInstantaneousShutterAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreatePixelAspectRatioAttr <td> <p> See GetPixelAspectRatioAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> CreateResolutionAttr | Method | Description | | ------ | ----------- | | `CreateResolutionAttr` (defaultValue, writeSparsely) | See GetResolutionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Get` (stage, path) -> SettingsBase | classmethod | | `GetAspectRatioConformPolicyAttr` () | Indicates the policy to use to resolve an aspect ratio mismatch between the camera aperture and image settings. | | `GetCameraRel` () | The *camera* relationship specifies the primary camera to use in a render. | | `GetDataWindowNDCAttr` () | dataWindowNDC specifies the axis-aligned rectangular region in the adjusted aperture window within which the renderer should produce data. | | `GetDisableMotionBlurAttr` () | Disable all motion blur by setting the shutter interval of the targeted camera to [0,0] - that is, take only one sample, namely at the current time code. | | `GetInstantaneousShutterAttr` () | Deprecated - use disableMotionBlur instead. | | `GetPixelAspectRatioAttr` () | The aspect ratio (width/height) of image pixels. | | `GetResolutionAttr` () | The image pixel resolution, corresponding to the camera's screen window. | | `GetSchemaAttributeNames` (includeInherited) -> list[TfToken] | classmethod | ### CreateAspectRatioConformPolicyAttr(defaultValue, writeSparsely) -> Attribute See GetAspectRatioConformPolicyAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateCameraRel ``` (→ Relationship) ``` See GetCameraRel() , and also Create vs Get Property Methods for when to use Get vs Create. ### CreateDataWindowNDCAttr ``` (defaultValue, writeSparsely → Attribute) ``` See GetDataWindowNDCAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateDisableMotionBlurAttr ``` (defaultValue, writeSparsely → Attribute) ``` See GetDisableMotionBlurAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateInstantaneousShutterAttr ``` (defaultValue, writeSparsely → Attribute) ``` See GetInstantaneousShutterAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateInstantaneousShutterAttr See GetInstantaneousShutterAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreatePixelAspectRatioAttr See GetPixelAspectRatioAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ## CreateResolutionAttr See GetResolutionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### Get **classmethod** Get(stage, path) -> SettingsBase Return a UsdRenderSettingsBase holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```text UsdRenderSettingsBase(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (Stage) – - **path** (Path) – ### GetAspectRatioConformPolicyAttr Indicates the policy to use to resolve an aspect ratio mismatch between the camera aperture and image settings. This policy allows a standard render setting to do something reasonable given varying camera inputs. The camera aperture aspect ratio is determined by the aperture attributes on the UsdGeomCamera. The image aspect ratio is determined by the resolution and pixelAspectRatio attributes in the render settings. #### Allowed Values - "expandAperture" - "cropAperture" - "adjustApertureWidth" - "adjustApertureHeight" - "adjustPixelAspectRatio" Declaration: ```text uniform token aspectRatioConformPolicy ="expandAperture" ``` C++ Type: TfToken Usd Type: SdfValueTypeNames->Token Variability: SdfVariabilityUniform ### GetCameraRel The *camera* relationship specifies the primary camera to use in a render. It must target a UsdGeomCamera. ### GetDataWindowNDCAttr dataWindowNDC specifies the axis-aligned rectangular region in the adjusted aperture window within which the renderer should produce data. It is specified as (xmin, ymin, xmax, ymax) in normalized device coordinates, where the range 0 to 1 corresponds to the aperture. (0,0) corresponds to the bottom-left corner and (1,1) corresponds to the upper-right corner. Specifying a window outside the unit square will produce overscan data. Specifying a window that does not cover the unit square will produce a cropped render. A pixel is included in the rendered result if the pixel center is contained by the data window. This is consistent with standard rules used by polygon rasterization engines. UsdRenderRasterization The data window is expressed in NDC so that cropping and overscan may be resolution independent. In interactive workflows, incremental cropping and resolution adjustment may be intermixed to isolate and examine parts of the scene. In compositing workflows, overscan may be used to support image post-processing kernels, and reduced-resolution proxy renders may be used for faster iteration. The dataWindow:ndc coordinate system references the aperture after any adjustments required by aspectRatioConformPolicy. Declaration ``` uniform float4 dataWindowNDC = (0, 0, 1, 1) ``` C++ Type GfVec4f Usd Type SdfValueTypeNames->Float4 Variability SdfVariabilityUniform Disable all motion blur by setting the shutter interval of the targeted camera to [0,0] - that is, take only one sample, namely at the current time code. Declaration ``` uniform bool disableMotionBlur = 0 ``` C++ Type bool Usd Type SdfValueTypeNames->Bool Variability SdfVariabilityUniform Deprecated - use disableMotionBlur instead. Override the targeted camera's shutterClose to be equal to the value of its shutterOpen, to produce a zero-width shutter interval. This gives us a convenient way to disable motion blur. Declaration ``` uniform bool instantaneousShutter = 0 ``` C++ Type bool Usd Type SdfValueTypeNames->Bool Variability SdfVariabilityUniform The aspect ratio (width/height) of image pixels. The default ratio 1.0 indicates square pixels. Declaration ``` uniform float pixelAspectRatio = 1 ``` C++ Type float Usd Type SdfValueTypeNames->Float Variability SdfVariabilityUniform ### Attribute The image pixel resolution, corresponding to the camera’s screen window. #### Declaration ``` uniform int2 resolution = (2048, 1080) ``` #### C++ Type GfVec2i #### Usd Type SdfValueTypeNames->Int2 #### Variability SdfVariabilityUniform ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – ### pxr.UsdRender.Tokens **Attributes:** - adjustApertureHeight - adjustApertureWidth - adjustPixelAspectRatio - aspectRatioConformPolicy - camera - color3f - command - cropAperture - dataType - dataWindowNDC <td> <p> <tr class="row-odd"> <td> <p> ``` denoiseEnable ``` <td> <p> <tr class="row-even"> <td> <p> ``` denoisePass ``` <td> <p> <tr class="row-odd"> <td> <p> ``` disableMotionBlur ``` <td> <p> <tr class="row-even"> <td> <p> ``` expandAperture ``` <td> <p> <tr class="row-odd"> <td> <p> ``` fileName ``` <td> <p> <tr class="row-even"> <td> <p> ``` full ``` <td> <p> <tr class="row-odd"> <td> <p> ``` includedPurposes ``` <td> <p> <tr class="row-even"> <td> <p> ``` inputPasses ``` <td> <p> <tr class="row-odd"> <td> <p> ``` instantaneousShutter ``` <td> <p> <tr class="row-even"> <td> <p> ``` intrinsic ``` <td> <p> <tr class="row-odd"> <td> <p> ``` lpe ``` <td> <p> <tr class="row-even"> <td> <p> ``` materialBindingPurposes ``` <td> <p> <tr class="row-odd"> <td> <p> ``` orderedVars ``` <td> <p> <tr class="row-even"> <td> <p> ``` passType ``` <td> <p> <tr class="row-odd"> <td> <p> ``` pixelAspectRatio ``` <td> <p> <tr class="row-even"> <td> <p> ``` preview ``` <td> <p> <tr class="row-odd"> <td> <p> ``` primvar ``` <td> <p> <tr class="row-even"> <td> <p> ``` productName ``` | Code Block | |------------| | `productType` | | `products` | | `raster` | | `raw` | | `renderSettingsPrimPath` | | `renderSource` | | `renderingColorSpace` | | `resolution` | | `sourceName` | | `sourceType` | ### adjustApertureHeight `adjustApertureHeight = 'adjustApertureHeight'` ### adjustApertureWidth `adjustApertureWidth = 'adjustApertureWidth'` ### adjustPixelAspectRatio `adjustPixelAspectRatio = 'adjustPixelAspectRatio'` ### aspectRatioConformPolicy `aspectRatioConformPolicy = 'aspectRatioConformPolicy'` ### camera `camera = 'camera'` color3f = 'color3f' command = 'command' cropAperture = 'cropAperture' dataType = 'dataType' dataWindowNDC = 'dataWindowNDC' denoiseEnable = 'denoise:enable' denoisePass = 'denoise:pass' disableMotionBlur = 'disableMotionBlur' expandAperture = 'expandAperture' fileName = 'fileName' full = 'full' includedPurposes = 'includedPurposes' ## Definitions ### includedPurposes 'includedPurposes' ### inputPasses 'inputPasses' ### instantaneousShutter 'instantaneousShutter' ### intrinsic 'intrinsic' ### lpe 'lpe' ### materialBindingPurposes 'materialBindingPurposes' ### orderedVars 'orderedVars' ### passType 'passType' ### pixelAspectRatio 'pixelAspectRatio' ### preview 'preview' ### primvar 'primvar' ### productName 'productName' ### productType 'productType' ## Attributes ### productType - **Property**: `productType` - **Value**: `'productType'` ### products - **Property**: `products` - **Value**: `'products'` ### raster - **Property**: `raster` - **Value**: `'raster'` ### raw - **Property**: `raw` - **Value**: `'raw'` ### renderSettingsPrimPath - **Property**: `renderSettingsPrimPath` - **Value**: `'renderSettingsPrimPath'` ### renderSource - **Property**: `renderSource` - **Value**: `'renderSource'` ### renderingColorSpace - **Property**: `renderingColorSpace` - **Value**: `'renderingColorSpace'` ### resolution - **Property**: `resolution` - **Value**: `'resolution'` ### sourceName - **Property**: `sourceName` - **Value**: `'sourceName'` ### sourceType - **Property**: `sourceType` - **Value**: `'sourceType'` ## Class ### Var - **Class**: `pxr.UsdRender.Var` - **Description**: A UsdRenderVar describes a custom data variable for a render to produce. The prim describes the source of the data, which can be a shader output or an LPE (Light Path Expression), and also allows encoding of (generally renderer-specific) parameters that configure the renderer for computing the variable. The name of the RenderVar prim drives the name of the data variable that the renderer will produce. In the future, UsdRender may standardize RenderVar representation for well-known variables under the sourceType `intrinsic`, such as `r`, `g`. **Methods:** | Method Name | Description | |-------------|-------------| | `CreateDataTypeAttr(defaultValue, writeSparsely)` | See GetDataTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateSourceNameAttr(defaultValue, writeSparsely)` | See GetSourceNameAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateSourceTypeAttr(defaultValue, writeSparsely)` | See GetSourceTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | `Define(stage, path)` | **classmethod** Define(stage, path) -> Var | | `Get(stage, path)` | **classmethod** Get(stage, path) -> Var | | `GetDataTypeAttr()` | The type of this channel, as a USD attribute type. | | `GetSchemaAttributeNames(includeInherited)` | **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | `GetSourceNameAttr()` | The renderer should look for an output of this name as the computed value for the RenderVar. | | `GetSourceTypeAttr()` | Indicates the type of the source. | **CreateDataTypeAttr** (defaultValue, writeSparsely) -> Attribute See GetDataTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateSourceNameAttr ``` CreateSourceNameAttr(defaultValue, writeSparsely) -> Attribute ``` See GetSourceNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateSourceTypeAttr ``` CreateSourceTypeAttr(defaultValue, writeSparsely) -> Attribute ``` See GetSourceTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### Define ``` static Define() ``` **classmethod** Define(stage, path) -> Var Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author **SdfPrimSpec** s with specifier ``` == **SdfSpecifierDef** and empty typeName at the current EditTarget for any nonexistent, or existing but not **Defined** ancestors. The given **path** must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case **path** cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (**Stage**) – - **path** (**Path**) – **classmethod** Get(stage, path) -> Var Return a UsdRenderVar holding the prim adhering to this schema at ``` path ``` on ``` stage ``` . If no prim exists at ``` path ``` on ``` stage ``` , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdRenderVar(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (**Stage**) – - **path** (**Path**) – The type of this channel, as a USD attribute type. Declaration ``` uniform token dataType ="color3f" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Variability SdfVariabilityUniform **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (**bool**) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdRender.Var.GetSourceNameAttr"> <span class="sig-name descname"> <span class="pre"> GetSourceNameAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <dd> <p> The renderer should look for an output of this name as the computed value for the RenderVar. <p> Declaration <p> <code> <span class="pre"> uniform <span class="pre"> string <span class="pre"> sourceName <span class="pre"> ="" <p> C++ Type <p> std::string <p> Usd Type <p> SdfValueTypeNames-&gt;String <p> Variability <p> SdfVariabilityUniform <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdRender.Var.GetSourceTypeAttr"> <span class="sig-name descname"> <span class="pre"> GetSourceTypeAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <dd> <p> Indicates the type of the source. <blockquote> <div> <ul> <li> <p> “raw”: The name should be passed directly to the renderer. This is the default behavior. <li> <p> “primvar”: This source represents the name of a primvar. Some renderers may use this to ensure that the primvar is provided; other renderers may require that a suitable material network be provided, in which case this is simply an advisory setting. <li> <p> “lpe”: Specifies a Light Path Expression in the OSL Light Path Expressions language as the source for this RenderVar. Some renderers may use extensions to that syntax, which will necessarily be non-portable. <li> <p> “intrinsic”: This setting is currently unimplemented, but represents a future namespace for UsdRender to provide portable baseline RenderVars, such as camera depth, that may have varying implementations for each renderer. <p> Declaration <p> <code> <span class="pre"> uniform <span class="pre"> token <span class="pre"> sourceType <span class="pre"> ="raw" <p> C++ Type <p> TfToken <p> Usd Type <p> SdfValueTypeNames-&gt;Token <p> Variability <p> SdfVariabilityUniform <p> Allowed Values <p> raw, primvar, lpe, intrinsic
56,833
UsdRi.md
# UsdRi module Summary: The UsdRi module provides schemas and utilities for authoring USD that encodes Renderman-specific information, and USD/RI data conversions. ## Classes: | Class | Description | |-------|-------------| | `MaterialAPI` | Deprecated | | `SplineAPI` | Deprecated | | `StatementsAPI` | Container namespace schema for all renderman statements. | | `TextureAPI` | Deprecated | | `Tokens` | | ### MaterialAPI Deprecated Materials should use UsdShadeMaterial instead. This schema will be removed in a future release. This API provides outputs that connect a material prim to prman shaders and RIS objects. For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdRiTokens. So to set an attribute to the value”rightHanded”, use UsdRiTokens->rightHanded as the value. **Methods:** | Method | Description | |--------|-------------| | `Apply` | `Apply(prim) -> MaterialAPI` | - `CanApply` - `classmethod CanApply(prim, whyNot) -> bool` - `ComputeInterfaceInputConsumersMap` - Walks the namespace subtree below the material and computes a map containing the list of all inputs on the material and the associated vector of consumers of their values. - `CreateDisplacementAttr` - (defaultValue, ...) - See GetDisplacementAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateSurfaceAttr` - (defaultValue, writeSparsely) - See GetSurfaceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateVolumeAttr` - (defaultValue, writeSparsely) - See GetVolumeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `Get` - `classmethod Get(stage, path) -> MaterialAPI` - `GetDisplacement` - (ignoreBaseMaterial) - Returns a valid shader object if the "displacement" output on the material is connected to one. - `GetDisplacementAttr` - Declaration - `GetDisplacementOutput` - Returns the "displacement" output associated with the material. - `GetSchemaAttributeNames` - `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` - `GetSurface` - (ignoreBaseMaterial) - Returns a valid shader object if the "surface" output on the material is connected to one. - `GetSurfaceAttr` - Declaration - `GetSurfaceOutput` - Returns the "surface" output associated with the material. - `GetVolume` - (ignoreBaseMaterial) - Returns a valid shader object if the "volume" output on the material is connected to one. - `GetVolumeAttr` - Declaration | Declaration | Description | | --- | --- | | GetVolumeOutput() | Returns the "volume" output associated with the material. | | SetDisplacementSource(displacementPath) | param displacementPath | | SetSurfaceSource(surfacePath) | param surfacePath | | SetVolumeSource(volumePath) | param volumePath | ### Apply **classmethod** Apply(prim) -> MaterialAPI Applies this **single-apply** API schema to the given `prim`. This information is stored by adding "RiMaterialAPI" to the token-valued, listOp metadata `apiSchemas` on the prim. A valid UsdRiMaterialAPI object is returned upon success. An invalid (or empty) UsdRiMaterialAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() **Parameters** - **prim** (Prim) – ### CanApply **classmethod** CanApply(prim, whyNot) -> bool Returns true if this **single-apply** API schema can be applied to the given `prim`. If this schema can not be a applied to the prim, this returns false and, if provided, populates `whyNot` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() **Parameters** - **prim** (Prim) – - **whyNot** (str) – <dt> <span class="sig-name descname"> <span class="pre"> ComputeInterfaceInputConsumersMap <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> computeTransitiveConsumers <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> NodeGraph.InterfaceInputConsumersMap <a class="headerlink" href="#pxr.UsdRi.MaterialAPI.ComputeInterfaceInputConsumersMap" title="Permalink to this definition">  <dd> <p>Walks the namespace subtree below the material and computes a map containing the list of all inputs on the material and the associated vector of consumers of their values. <p>The consumers can be inputs on shaders within the material or on node-graphs under it. <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <p><strong>computeTransitiveConsumers <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdRi.MaterialAPI.CreateDisplacementAttr"> <span class="sig-name descname"> <span class="pre"> CreateDisplacementAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <a class="headerlink" href="#pxr.UsdRi.MaterialAPI.CreateDisplacementAttr" title="Permalink to this definition">  <dd> <p>See GetDisplacementAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code class="docutils literal notranslate"><span class="pre">defaultValue <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li><p><strong>defaultValue <li><p><strong>writeSparsely <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdRi.MaterialAPI.CreateSurfaceAttr"> <span class="sig-name descname"> <span class="pre"> CreateSurfaceAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <a class="headerlink" href="#pxr.UsdRi.MaterialAPI.CreateSurfaceAttr" title="Permalink to this definition">  <dd> <p>See GetSurfaceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code class="docutils literal notranslate"><span class="pre">defaultValue <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li><p><strong>defaultValue <li><p><strong>writeSparsely <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdRi.MaterialAPI.CreateVolumeAttr"> <span class="sig-name descname"> <span class="pre"> CreateVolumeAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <a class="headerlink" href="#pxr.UsdRi.MaterialAPI.CreateVolumeAttr" title="Permalink to this definition">  <dd> <p>See GetVolumeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code class="docutils literal notranslate"><span class="pre">defaultValue <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li><p><strong>defaultValue <li><p><strong>writeSparsely See GetVolumeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ``` defaultValue ``` as the attribute’s default, sparsely (when it makes sense to do so) if ``` writeSparsely ``` is ``` true ``` - the default for ``` writeSparsely ``` is ``` false ``` . Parameters ---------- - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – classmethod Get(stage, path) -> MaterialAPI -------------------------------------------- Return a UsdRiMaterialAPI holding the prim adhering to this schema at ``` path ``` on ``` stage ``` . If no prim exists at ``` path ``` on ``` stage ``` , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdRiMaterialAPI(stage->GetPrimAtPath(path)); ``` Parameters ---------- - **stage** (`Stage`) – - **path** (`Path`) – GetDisplacement(ignoreBaseMaterial) -> Shader ---------------------------------------------- Returns a valid shader object if the "displacement" output on the material is connected to one. If ``` ignoreBaseMaterial ``` is true and if the "displacement" shader source is specified in the base-material of this material, then this returns an invalid shader object. Parameters ---------- - **ignoreBaseMaterial** (`bool`) – GetDisplacementAttr() -> Attribute ---------------------------------- Declaration ``` token outputs:ri:displacement ``` C++ Type -------- TfToken Usd Type -------- SdfValueTypeNames->Token GetDisplacementOutput() -> Output --------------------------------- ### GetDisplacementOutput Returns the "displacement" output associated with the material. ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – ### GetSurface GetSurface(ignoreBaseMaterial) -> Shader Returns a valid shader object if the "surface" output on the material is connected to one. If `ignoreBaseMaterial` is true and if the "surface" shader source is specified in the base-material of this material, then this returns an invalid shader object. **Parameters** - **ignoreBaseMaterial** (bool) – ### GetSurfaceAttr Declaration `token outputs:ri:surface` C++ Type TfToken Usd Type SdfValueTypeNames->Token ### GetSurfaceOutput Returns the "surface" output associated with the material. ### GetVolume GetVolume(ignoreBaseMaterial) -> Shader Returns a valid shader object if the "volume" output on the material is connected to one. If `ignoreBaseMaterial` is true and if the "volume" shader source is specified in the base-material of this material, then this returns an invalid shader object. **Parameters** - **ignoreBaseMaterial** (bool) – ### GetVolumeAttr GetVolumeAttr() -> Attribute ### GetVolumeAttr - **Declaration** - **Code** ``` token outputs:ri:volume ``` - **C++ Type** - TfToken - **Usd Type** - SdfValueTypeNames->Token ### GetVolumeOutput - **Description** - Returns the "volume" output associated with the material. ### SetDisplacementSource - **Parameters** - **displacementPath** (Path) – ### SetSurfaceSource - **Parameters** - **surfacePath** (Path) – ### SetVolumeSource - **Parameters** - **volumePath** (Path) – ### SplineAPI - **Deprecated** - This API schema will be removed in a future release. - **Description** - RiSplineAPI is a general purpose API schema used to describe a named spline stored as a set of attributes on a prim. - It is an add-on schema that can be applied many times to a prim with different spline names. All the attributes authored by the schema are namespaced under "$NAME:spline:", with the name of the spline providing a namespace for the attributes. - The spline describes a 2D piecewise cubic curve with a position and value for each knot. This is chosen to give straightforward artistic control over the shape. The supported basis types are: - linear - bspline - Catmull-Rom - **Methods:** - (Table not provided in HTML snippet) ### Apply **classmethod** Apply(prim) -> SplineAPI Applies this single-apply API schema to the given prim. This information is stored by adding "RiSplineAPI" to the token-valued, listOp metadata apiSchemas on the prim. A valid UsdRiSplineAPI object is returned upon success. An invalid (or empty) UsdRiSplineAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() ### CanApply **classmethod** CanApply(prim, whyNot) -> bool ### CreateInterpolationAttr (defaultValue, ...) See GetInterpolationAttr(), and also Create vs Get Property Methods for when to use Get vs Create. ### CreatePositionsAttr (defaultValue, writeSparsely) See GetPositionsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. ### CreateValuesAttr (defaultValue, writeSparsely) See GetValuesAttr(), and also Create vs Get Property Methods for when to use Get vs Create. ### Get **classmethod** Get(stage, path) -> SplineAPI ### GetInterpolationAttr Interpolation method for the spline. ### GetPositionsAttr Positions of the knots. ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] ### GetValuesAttr Values of the knots. ### GetValuesTypeName Returns the intended typename of the values attribute of the spline. ### Validate (reason) Validates the attribute values belonging to the spline. UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() ### Parameters - **prim** (Prim) – ### classmethod CanApply(prim, whyNot) -> bool Returns true if this single-apply API schema can be applied to the given prim. If this schema can not be a applied to the prim, this returns false and, if provided, populates whyNot with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() ### Parameters - **prim** (Prim) – - **whyNot** (str) – ### CreateInterpolationAttr(defaultValue, writeSparsely) -> Attribute See GetInterpolationAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreatePositionsAttr(defaultValue, writeSparsely) -> Attribute See GetPositionsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false. ```python false ``` ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ```python CreateValuesAttr(defaultValue, writeSparsely) -> Attribute ``` See GetValuesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ```python static Get() ``` classmethod Get(stage, path) -> SplineAPI Return a UsdRiSplineAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdRiSplineAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ```python GetInterpolationAttr() -> Attribute ``` Interpolation method for the spline. C++ Type: TfToken Usd Type: SdfValueTypeNames->Token Variability: SdfVariabilityUniform Fallback Value: linear Allowed Values : [linear, constant, bspline, catmullRom] ```python GetPositionsAttr() -> Attribute ``` ### GetPositionsAttr Positions of the knots. C++ Type: VtArray&lt;float&gt; Usd Type: SdfValueTypeNames->FloatArray Variability: SdfVariabilityUniform Fallback Value: No Fallback ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – ### GetValuesAttr Values of the knots. C++ Type: See GetValuesTypeName() Usd Type: See GetValuesTypeName() Variability: SdfVariabilityUniform Fallback Value: No Fallback ### GetValuesTypeName Returns the intended typename of the values attribute of the spline. ### Validate Validates the attribute values belonging to the spline. Returns true if the spline has all valid attribute values. Returns false and populates the `reason` output argument if the spline has invalid attribute values. Here’s the list of validations performed by this method: - the SplineAPI must be fully initialized - interpolation attribute must exist and use an allowed value - the positions array must be a float array - the positions array must be sorted by increasing value - the values array must use the correct value type - the positions and values array must have the same size **Parameters** - **reason** (str) – ### StatementsAPI Container namespace schema for all renderman statements. The longer term goal is for clients to go directly to primvar or render-attribute API’s, instead of using UsdRi StatementsAPI for inherited attributes. Anticipating this, StatementsAPI can smooth the way via a few environment variables: - USDRI_STATEMENTS_READ_OLD_ENCODING: Causes StatementsAPI to read old-style attributes instead of primvars in the”ri:”namespace. **Methods:** - Apply - **Apply** - `classmethod` Apply(prim) -> StatementsAPI - **CanApply** - `classmethod` CanApply(prim, whyNot) -> bool - **CreateRiAttribute** - Create a rib attribute on the prim to which this schema is attached. - **Get** - `classmethod` Get(stage, path) -> StatementsAPI - **GetCoordinateSystem** - Returns the value in the "ri:coordinateSystem" attribute if it exists. - **GetModelCoordinateSystems** - Populates the output `targets` with the authored ri:modelCoordinateSystems, if any. - **GetModelScopedCoordinateSystems** - Populates the output `targets` with the authored ri:modelScopedCoordinateSystems, if any. - **GetRiAttribute** - Return a UsdAttribute representing the Ri attribute with the name `name`, in the namespace `nameSpace`. - **GetRiAttributeName** - `classmethod` GetRiAttributeName(prop) -> str - **GetRiAttributeNameSpace** - `classmethod` GetRiAttributeNameSpace(prop) -> str - **GetRiAttributes** - Return all rib attributes on this prim, or under a specific namespace (e.g. "user"). - **GetSchemaAttributeNames** - `classmethod` GetSchemaAttributeNames(includeInherited) -> list[TfToken] - **GetScopedCoordinateSystem** - Returns the value in the "ri:scopedCoordinateSystem" attribute if it exists. - **HasCoordinateSystem** - Returns a boolean indicating if the prim has a coordinate system. Returns true if the underlying prim has a ri:coordinateSystem opinion. ### HasScopedCoordinateSystem Returns true if the underlying prim has a ri:scopedCoordinateSystem opinion. ### IsRiAttribute **classmethod** IsRiAttribute(prop) -> bool ### MakeRiAttributePropertyName **classmethod** MakeRiAttributePropertyName(attrName) -> str ### SetCoordinateSystem Sets the "ri:coordinateSystem" attribute to the given string value, creating the attribute if needed. ### SetScopedCoordinateSystem Sets the "ri:scopedCoordinateSystem" attribute to the given string value, creating the attribute if needed. ### Apply **classmethod** Apply(prim) -> StatementsAPI Applies this **single-apply** API schema to the given `prim`. This information is stored by adding "StatementsAPI" to the token-valued, listOp metadata *apiSchemas* on the prim. A valid UsdRiStatementsAPI object is returned upon success. An invalid (or empty) UsdRiStatementsAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() **Parameters** - **prim** (Prim) – ### CanApply **classmethod** CanApply(prim, whyNot) -> bool Returns true if this **single-apply** API schema can be applied to the given `prim`. If this schema can not be applied to the prim, this returns false and, if provided, populates `whyNot` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() **Parameters** - **prim** (Prim) – - **whyNot** (str) – <dt> <span class="sig-name descname"> <span class="pre"> CreateRiAttribute <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> name , <em class="sig-param"> <span class="n"> <span class="pre"> riType , <em class="sig-param"> <span class="n"> <span class="pre"> nameSpace <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <dd> <p> Create a rib attribute on the prim to which this schema is attached. <p> A rib attribute consists of an attribute <em> “nameSpace” and an attribute <em> “name” . For example, the namespace”cull”may define attributes”backfacing”and”hidden”, and user-defined attributes belong to the namespace”user”. <p> This method makes no attempt to validate that the given <code> <span class="pre"> nameSpace and <em> name are actually meaningful to prman or any other renderer. <p> riType <p> should be a known RenderMan type definition, which can be array- valued. For instance, both”color”and”float[3]”are valid values for <code> <span class="pre"> riType . <dl> <dt> Parameters <dd> <ul> <li> <p> <strong> name ( <em> str ) – <li> <p> <strong> riType ( <em> str ) – <li> <p> <strong> nameSpace ( <em> str ) – <hr> <p> CreateRiAttribute(name, tfType, nameSpace) -&gt; Attribute <p> Creates an attribute of the given <code> <span class="pre"> tfType . <p> This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. <dl> <dt> Parameters <dd> <ul> <li> <p> <strong> name ( <em> str ) – <li> <p> <strong> tfType ( <em> Type ) – <li> <p> <strong> nameSpace ( <em> str ) – ### GetModelCoordinateSystems ```python GetModelCoordinateSystems(targets) -> bool ``` Populates the output `targets` with the authored ri:modelCoordinateSystems, if any. Returns true if the query was successful. **Parameters** - **targets** (list[SdfPath]) – ### GetModelScopedCoordinateSystems ```python GetModelScopedCoordinateSystems(targets) -> bool ``` Populates the output `targets` with the authored ri:modelScopedCoordinateSystems, if any. Returns true if the query was successful. **Parameters** - **targets** (list[SdfPath]) – ### GetRiAttribute ```python GetRiAttribute(name, nameSpace) -> Attribute ``` Return a UsdAttribute representing the Ri attribute with the name `name`, in the namespace `nameSpace`. The attribute returned may or may not **actually** exist so it must be checked for validity. **Parameters** - **name** (str) – - **nameSpace** (str) – ### GetRiAttributeName ```python GetRiAttributeName(prop) -> str ``` Return the base, most-specific name of the rib attribute. For example, the `name` of the rib attribute "cull:backfacing" is "backfacing". **Parameters** - **prop** (Property) – ### GetRiAttributeNameSpace ```python GetRiAttributeNameSpace(prop) -> str ``` Return the namespace of the Ri attribute. **Parameters** - **prop** (Property) – ``` Return the containing namespace of the rib attribute (e.g. "user"). Parameters ---------- - **prop** (`Property`) – Return all rib attributes on this prim, or under a specific namespace (e.g. "user"). As noted above, rib attributes can be either UsdAttribute or UsdRelationship, and like all UsdProperties, need not have a defined value. Parameters ---------- - **nameSpace** (`str`) – classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ------------------------------------------------------------------- Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters ---------- - **includeInherited** (`bool`) – Returns the value in the "ri:scopedCoordinateSystem" attribute if it exists. Returns true if the underlying prim has a ri:coordinateSystem opinion. Returns true if the underlying prim has a ri:scopedCoordinateSystem opinion. classmethod IsRiAttribute(prop) -> bool ----------------------------------------- Return true if the property is in the "ri:attributes" namespace. Parameters ---------- - **prop** (`Property`) – ### MakeRiAttributePropertyName **classmethod** MakeRiAttributePropertyName(attrName) -> str Returns the given `attrName` prefixed with the full Ri attribute namespace, creating a name suitable for an RiAttribute UsdProperty. This handles conversion of common separator characters used in other packages, such as periods and underscores. Will return empty string if attrName is not a valid property identifier; otherwise, will return a valid property name that identifies the property as an RiAttribute, according to the following rules: > - If `attrName` is already a properly constructed RiAttribute property name, return it unchanged. > - If `attrName` contains two or more tokens separated by a **colon**, consider the first to be the namespace, and the rest the name, joined by underscores > - If `attrName` contains two or more tokens separated by a **period**, consider the first to be the namespace, and the rest the name, joined by underscores > - If `attrName` contains two or more tokens separated by an, **underscore**, consider the first to be the namespace, and the rest the name, joined by underscores > - else, assume `attrName` is the name, and "user" is the namespace **Parameters** - **attrName** (str) – ### SetCoordinateSystem SetCoordinateSystem(coordSysName) -> None Sets the "ri:coordinateSystem" attribute to the given string value, creating the attribute if needed. That identifies this prim as providing a coordinate system, which can be retrieved via UsdGeomXformable::GetTransformAttr(). Also adds the owning prim to the ri:modelCoordinateSystems relationship targets on its parent leaf model prim, if it exists. If this prim is not under a leaf model, no relationship targets will be authored. **Parameters** - **coordSysName** (str) – ### SetScopedCoordinateSystem SetScopedCoordinateSystem(coordSysName) -> None Sets the "ri:scopedCoordinateSystem" attribute to the given string value, creating the attribute if needed. That identifies this prim as providing a coordinate system, which can be retrieved via UsdGeomXformable::GetTransformAttr(). Such coordinate systems are local to the RI attribute stack state, but does get updated properly for instances when defined inside an object master. Also adds the owning prim to the ri:modelScopedCoordinateSystems relationship targets on its parent leaf model prim, if it exists. If this prim is not under a leaf model, no relationship targets will be authored. **Parameters** - **coordSysName** (str) – ### TextureAPI Deprecated This API schema will be removed in a future release. RiTextureAPI is an API schema that provides an interface to add Renderman-specific attributes to adjust textures. **Methods:** | Method | Description | |------------------------------------------------------------------------|-----------------------------------------------------------------------------| | `Apply` | `classmethod Apply(prim) -> TextureAPI` | | `CanApply` | `classmethod CanApply(prim, whyNot) -> bool` | | `CreateRiTextureGammaAttr(defaultValue, ...)` | See GetRiTextureGammaAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateRiTextureSaturationAttr(defaultValue, ...)` | See GetRiTextureSaturationAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Get` | `classmethod Get(stage, path) -> TextureAPI` | | `GetRiTextureGammaAttr()` | Gamma-correct the texture. | | `GetRiTextureSaturationAttr()` | Adjust the texture's saturation. | | `GetSchemaAttributeNames(includeInherited)` | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | ### Apply **classmethod** Apply(prim) -> TextureAPI Applies this **single-apply** API schema to the given `prim`. This information is stored by adding”RiTextureAPI”to the token-valued, listOp metadata *apiSchemas* on the prim. A valid UsdRiTextureAPI object is returned upon success. An invalid (or empty) UsdRiTextureAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() **Parameters** - **prim** (Prim) – ### CanApply **classmethod** CanApply(prim, whyNot) -> bool Returns true if this **single-apply** API schema can be applied to the given `prim`. If this schema can not be applied to the prim, this returns false and, if provided, populates `whyNot` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() Parameters ---------- - **prim** (`Prim`) – - **whyNot** (`str`) – CreateRiTextureGammaAttr(defaultValue, writeSparsely) → Attribute ----------------------------------------------------------- See GetRiTextureGammaAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – CreateRiTextureSaturationAttr(defaultValue, writeSparsely) → Attribute --------------------------------------------------------------------- See GetRiTextureSaturationAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – Get() → TextureAPI ------------------ classmethod Get(stage, path) -> TextureAPI Return a UsdRiTextureAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```cpp UsdRiTextureAPI(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – **GetRiTextureGammaAttr**() → Attribute - Gamma-correct the texture. - Declaration: `float ri:texture:gamma` - C++ Type: float - Usd Type: SdfValueTypeNames->Float **GetRiTextureSaturationAttr**() → Attribute - Adjust the texture’s saturation. - Declaration: `float ri:texture:saturation` - C++ Type: float - Usd Type: SdfValueTypeNames->Float **static GetSchemaAttributeNames**(includeInherited) -> list[TfToken] - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. - Parameters: - **includeInherited** (bool) – **pxr.UsdRi.Tokens** - **Attributes:** - **bspline** - **catmullRom** - **constant** constant interpolation linear outputsRiDisplacement outputsRiSurface outputsRiVolume positions renderContext riTextureGamma riTextureSaturation spline values bspline = 'bspline' catmullRom = 'catmull-rom' constant = 'constant' interpolation = 'interpolation' linear = 'linear' <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdRi.Tokens.linear"> <span class="sig-name descname"> <span class="pre"> linear <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'linear' <a class="headerlink" href="#pxr.UsdRi.Tokens.linear" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdRi.Tokens.outputsRiDisplacement"> <span class="sig-name descname"> <span class="pre"> outputsRiDisplacement <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'outputs:ri:displacement' <a class="headerlink" href="#pxr.UsdRi.Tokens.outputsRiDisplacement" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdRi.Tokens.outputsRiSurface"> <span class="sig-name descname"> <span class="pre"> outputsRiSurface <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'outputs:ri:surface' <a class="headerlink" href="#pxr.UsdRi.Tokens.outputsRiSurface" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdRi.Tokens.outputsRiVolume"> <span class="sig-name descname"> <span class="pre"> outputsRiVolume <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'outputs:ri:volume' <a class="headerlink" href="#pxr.UsdRi.Tokens.outputsRiVolume" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdRi.Tokens.positions"> <span class="sig-name descname"> <span class="pre"> positions <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'positions' <a class="headerlink" href="#pxr.UsdRi.Tokens.positions" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdRi.Tokens.renderContext"> <span class="sig-name descname"> <span class="pre"> renderContext <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'ri' <a class="headerlink" href="#pxr.UsdRi.Tokens.renderContext" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdRi.Tokens.riTextureGamma"> <span class="sig-name descname"> <span class="pre"> riTextureGamma <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'ri:texture:gamma' <a class="headerlink" href="#pxr.UsdRi.Tokens.riTextureGamma" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdRi.Tokens.riTextureSaturation"> <span class="sig-name descname"> <span class="pre"> riTextureSaturation <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'ri:texture:saturation' <a class="headerlink" href="#pxr.UsdRi.Tokens.riTextureSaturation" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdRi.Tokens.spline"> <span class="sig-name descname"> <span class="pre"> spline <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'spline' <a class="headerlink" href="#pxr.UsdRi.Tokens.spline" title="Permalink to this definition">  <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdRi.Tokens.values"> <span class="sig-name descname"> <span class="pre"> values <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> 'values' <a class="headerlink" href="#pxr.UsdRi.Tokens.values" title="Permalink to this definition">  <dd>
40,123
usdrt_api.md
# USDRT API ## Directory hierarchy - **dir** `usdrt` - **dir** `usdrt/gf` - **file** `usdrt/gf/half.h` - **file** `usdrt/gf/math.h` - **file** `usdrt/gf/matrix.h` - **file** `usdrt/gf/quat.h` - **file** `usdrt/gf/range.h` - **file** `usdrt/gf/rect.h` - **file** `usdrt/gf/vec.h` - **dir** `usdrt/scenegraph` ### dir - usdrt/scenegraph/base #### dir - usdrt/scenegraph/base/tf - file: usdrt/scenegraph/base/tf/token.h - usdrt/scenegraph/base/vt - file: usdrt/scenegraph/base/vt/array.h ### dir - usdrt/scenegraph/interface - file: usdrt/scenegraph/interface/AccessType.h - file: usdrt/scenegraph/interface/Common.h ### dir - usdrt/scenegraph/usd <details> <summary>dir - file usdrt/scenegraph/usd/destructionSchema/destructibleBaseAPI.h - file usdrt/scenegraph/usd/destructionSchema/destructibleBondAPI.h - file usdrt/scenegraph/usd/destructionSchema/destructibleChunkAPI.h - file usdrt/scenegraph/usd/destructionSchema/destructibleInstAPI.h - file usdrt/scenegraph/usd/destructionSchema/tokens.h <details> <summary>dir - file usdrt/scenegraph/usd/forceFieldSchema/physxForceFieldAPI.h - file usdrt/scenegraph/usd/forceFieldSchema/physxForceFieldConicalAPI.h - file usdrt/scenegraph/usd/forceFieldSchema/physxForceFieldDragAPI.h - file usdrt/scenegraph/usd/forceFieldSchema/physxForceFieldLinearAPI.h - file usdrt/scenegraph/usd/forceFieldSchema/physxForceFieldNoiseAPI.h - file usdrt/scenegraph/usd/forceFieldSchema/physxForceFieldPlanarAPI.h - file usdrt/scenegraph/usd/forceFieldSchema/physxForceFieldRingAPI.h - file - usdrt/scenegraph/usd/forceFieldSchema/physxForceFieldSphericalAPI.h - file - usdrt/scenegraph/usd/forceFieldSchema/physxForceFieldSpinAPI.h - file - usdrt/scenegraph/usd/forceFieldSchema/physxForceFieldWindAPI.h - file - usdrt/scenegraph/usd/forceFieldSchema/tokens.h - dir - usdrt/scenegraph/usd/physxSchema - file - usdrt/scenegraph/usd/physxSchema/jointStateAPI.h - file - usdrt/scenegraph/usd/physxSchema/physxArticulationAPI.h - file - usdrt/scenegraph/usd/physxSchema/physxArticulationForceSensorAPI.h - file - usdrt/scenegraph/usd/physxSchema/physxAutoAttachmentAPI.h - file - usdrt/scenegraph/usd/physxSchema/physxAutoParticleClothAPI.h - file - usdrt/scenegraph/usd/physxSchema/physxCameraAPI.h - file - usdrt/scenegraph/usd/physxSchema/physxCameraDroneAPI.h - file - usdrt/scenegraph/usd/physxSchema/physxCameraFollowAPI.h - file - usdrt/scenegraph/usd/physxSchema/physxCameraFollowLookAPI.h - file - usdrt/scenegraph/usd/physxSchema/physxCameraFollowVelocityAPI.h - file - usdrt/scenegraph/usd/physxSchema/physxCharacterControllerAPI.h - file - usdrt/scenegraph/usd/physxSchema/physxCollisionAPI.h - file usdrt/scenegraph/usd/physxSchema/physxContactReportAPI.h - file usdrt/scenegraph/usd/physxSchema/physxConvexDecompositionCollisionAPI.h - file usdrt/scenegraph/usd/physxSchema/physxConvexHullCollisionAPI.h - file usdrt/scenegraph/usd/physxSchema/physxCookedDataAPI.h - file usdrt/scenegraph/usd/physxSchema/physxDeformableAPI.h - file usdrt/scenegraph/usd/physxSchema/physxDeformableBodyAPI.h - file usdrt/scenegraph/usd/physxSchema/physxDeformableBodyMaterialAPI.h - file usdrt/scenegraph/usd/physxSchema/physxDeformableSurfaceAPI.h - file usdrt/scenegraph/usd/physxSchema/physxDeformableSurfaceMaterialAPI.h - file usdrt/scenegraph/usd/physxSchema/physxDiffuseParticlesAPI.h - file usdrt/scenegraph/usd/physxSchema/physxForceAPI.h - file usdrt/scenegraph/usd/physxSchema/physxHairAPI.h - file usdrt/scenegraph/usd/physxSchema/physxHairMaterialAPI.h - file usdrt/scenegraph/usd/physxSchema/physxJointAPI.h - file usdrt/scenegraph/usd/physxSchema/physxLimitAPI.h - file usdrt/scenegraph/usd/physxSchema/physxMaterialAPI.h - file usdrt/scenegraph/usd/physxSchema/physxPBDMaterialAPI.h - file usdrt/scenegraph/usd/physxSchema/physxParticleAPI.h - file usdrt/scenegraph/usd/physxSchema/physxParticleAnisotropyAPI.h - file usdrt/scenegraph/usd/physxSchema/physxParticleClothAPI.h - file usdrt/scenegraph/usd/physxSchema/physxParticleClothAPI.h - file usdrt/scenegraph/usd/physxSchema/physxParticleIsosurfaceAPI.h - file usdrt/scenegraph/usd/physxSchema/physxParticleSamplingAPI.h - file usdrt/scenegraph/usd/physxSchema/physxParticleSetAPI.h - file usdrt/scenegraph/usd/physxSchema/physxParticleSmoothingAPI.h - file usdrt/scenegraph/usd/physxSchema/physxParticleSystem.h - file usdrt/scenegraph/usd/physxSchema/physxPhysicsAttachment.h - file usdrt/scenegraph/usd/physxSchema/physxPhysicsDistanceJointAPI.h - file usdrt/scenegraph/usd/physxSchema/physxPhysicsGearJoint.h - file usdrt/scenegraph/usd/physxSchema/physxPhysicsInstancer.h - file usdrt/scenegraph/usd/physxSchema/physxPhysicsJointInstancer.h - file usdrt/scenegraph/usd/physxSchema/physxPhysicsRackAndPinionJoint.h - file usdrt/scenegraph/usd/physxSchema/physxRigidBodyAPI.h - file usdrt/scenegraph/usd/physxSchema/physxSDFMeshCollisionAPI.h - file usdrt/scenegraph/usd/physxSchema/physxSceneAPI.h - file usdrt/scenegraph/usd/physxSchema/physxSphereFillCollisionAPI.h - file usdrt/scenegraph/usd/physxSchema/physxTendonAttachmentAPI.h - file usdrt/scenegraph/usd/physxSchema/physxTendonAttachmentLeafAPI.h - file usdrt/scenegraph/usd/physxSchema/physxTendonAttachmentRootAPI.h - file usdrt/scenegraph/usd/physxSchema/physxTendonAxisAPI.h - file usdrt/scenegraph/usd/physxSchema/physxTendonAxisRootAPI.h - file usdrt/scenegraph/usd/physxSchema/physxTriangleMeshCollisionAPI.h - file usdrt/scenegraph/usd/physxSchema/physxTriangleMeshSimplificationCollisionAPI.h - file usdrt/scenegraph/usd/physxSchema/physxTriggerAPI.h - file usdrt/scenegraph/usd/physxSchema/physxTriggerStateAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleAckermannSteeringAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleAutoGearBoxAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleBrakesAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleClutchAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleContextAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleControllerAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleDriveBasicAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleDriveStandardAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleEngineAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleGearsAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleMultiWheelDifferentialAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleSteeringAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleSuspensionAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleSuspensionComplianceAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleTankControllerAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleTankDifferentialAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleTireAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleTireFrictionTable.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleWheelAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleWheelAttachmentAPI.h - file usdrt/scenegraph/usd/physxSchema/physxVehicleWheelControllerAPI.h - file usdrt/scenegraph/usd/physxSchema/plane.h - file usdrt/scenegraph/usd/physxSchema/tetrahedralMesh.h - file usdrt/scenegraph/usd/physxSchema/tokens.h - dir usdrt/scenegraph/usd/rt - file usdrt/scenegraph/usd/rt/boundable.h - file usdrt/scenegraph/usd/rt/changeTracker.h - file usdrt/scenegraph/usd/rt/primSelection.h - file usdrt/scenegraph/usd/rt/tokens.h - file usdrt/scenegraph/usd/rt/xformable.h ### usdrt/scenegraph/usd/sdf - **file** usdrt/scenegraph/usd/sdf/assetPath.h - **file** usdrt/scenegraph/usd/sdf/path.h - **file** usdrt/scenegraph/usd/sdf/types.h - **file** usdrt/scenegraph/usd/sdf/valueTypeName.h ### usdrt/scenegraph/usd/usd - **dir** usdrt/scenegraph/usd/usd/impl - **file** usdrt/scenegraph/usd/usd/impl/usd_decl.h - **file** usdrt/scenegraph/usd/usd/apiSchemaBase.h - **file** usdrt/scenegraph/usd/usd/attribute.h - **file** usdrt/scenegraph/usd/usd/clipsAPI.h - **file** usdrt/scenegraph/usd/usd/collectionAPI.h - **file** usdrt/scenegraph/usd/usd/common.h - **file** usdrt/scenegraph/usd/usd/modelAPI.h - file usdrt/scenegraph/usd/usd/prim.h - file usdrt/scenegraph/usd/usd/primRange.h - file usdrt/scenegraph/usd/usd/relationship.h - file usdrt/scenegraph/usd/usd/schemaRegistry.h - file usdrt/scenegraph/usd/usd/stage.h - file usdrt/scenegraph/usd/usd/tokens.h ### dir usdrt/scenegraph/usd/usdGeom - file usdrt/scenegraph/usd/usdGeom/basisCurves.h - file usdrt/scenegraph/usd/usdGeom/boundable.h - file usdrt/scenegraph/usd/usdGeom/camera.h - file usdrt/scenegraph/usd/usdGeom/capsule.h - file usdrt/scenegraph/usd/usdGeom/cone.h - file usdrt/scenegraph/usd/usdGeom/cube.h - file usdrt/scenegraph/usd/usdGeom/curves.h - file usdrt/scenegraph/usd/usdGeom/cylinder.h - file usdrt/scenegraph/usd/usdGeom/gprim.h - file usdrt/scenegraph/usd/usdGeom/hermiteCurves.h - file usdrt/scenegraph/usd/usdGeom/imageable.h - file usdrt/scenegraph/usd/usdGeom/mesh.h - file usdrt/scenegraph/usd/usdGeom/modelAPI.h - file usdrt/scenegraph/usd/usdGeom/motionAPI.h - file usdrt/scenegraph/usd/usdGeom/nurbsCurves.h - file usdrt/scenegraph/usd/usdGeom/nurbsPatch.h - file usdrt/scenegraph/usd/usdGeom/plane.h - file usdrt/scenegraph/usd/usdGeom/pointBased.h - file usdrt/scenegraph/usd/usdGeom/pointInstancer.h - file usdrt/scenegraph/usd/usdGeom/points.h - file usdrt/scenegraph/usd/usdGeom/primvarsAPI.h - file usdrt/scenegraph/usd/usdGeom/scope.h - file usdrt/scenegraph/usd/usdGeom/sphere.h - file usdrt/scenegraph/usd/usdGeom/subset.h - file usdrt/scenegraph/usd/usdGeom/tokens.h - file usdrt/scenegraph/usd/usdGeom/visibilityAPI.h - file usdrt/scenegraph/usd/usdGeom/xform.h - file usdrt/scenegraph/usd/usdGeom/xformCommonAPI.h - file usdrt/scenegraph/usd/usdGeom/xformable.h - file usdrt/scenegraph/usd/usdLux/boundableLightBase.h - file usdrt/scenegraph/usd/usdLux/cylinderLight.h - file usdrt/scenegraph/usd/usdLux/diskLight.h - file usdrt/scenegraph/usd/usdLux/distantLight.h - file usdrt/scenegraph/usd/usdLux/domeLight.h - file usdrt/scenegraph/usd/usdLux/geometryLight.h - file usdrt/scenegraph/usd/usdLux/light.h - file usdrt/scenegraph/usd/usdLux/lightAPI.h - file usdrt/scenegraph/usd/usdLux/lightFilter.h - file usdrt/scenegraph/usd/usdLux/lightListAPI.h - file usdrt/scenegraph/usd/usdLux/lightPortal.h - file usdrt/scenegraph/usd/usdLux/listAPI.h - file usdrt/scenegraph/usd/usdLux/meshLightAPI.h - file usdrt/scenegraph/usd/usdLux/nonboundableLightBase.h - file usdrt/scenegraph/usd/usdLux/pluginLight.h - file usdrt/scenegraph/usd/usdLux/pluginLightFilter.h - file usdrt/scenegraph/usd/usdLux/portalLight.h - file usdrt/scenegraph/usd/usdLux/rectLight.h - file usdrt/scenegraph/usd/usdLux/shadowAPI.h - file usdrt/scenegraph/usd/usdLux/shapingAPI.h - file usdrt/scenegraph/usd/usdLux/sphereLight.h - file usdrt/scenegraph/usd/usdLux/tokens.h <details class="sd-sphinx-override sd-dropdown sd-card sd-mb-3"> <summary class="sd-summary-title sd-card-header"> dir usdrt/scenegraph/usd/usdLux <div class="sd-summary-content sd-card-body docutils"> <div class="rebreather hierarchy docutils container"> <ul class="simple"> <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdLux/volumeLightAPI.h <details class="sd-sphinx-override sd-dropdown sd-card sd-mb-3"> <summary class="sd-summary-title sd-card-header"> dir usdrt/scenegraph/usd/usdMedia <div class="sd-summary-content sd-card-body docutils"> <div class="rebreather hierarchy docutils container"> <ul class="simple"> <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdMedia/spatialAudio.h <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdMedia/tokens.h <details class="sd-sphinx-override sd-dropdown sd-card sd-mb-3"> <summary class="sd-summary-title sd-card-header"> dir usdrt/scenegraph/usd/usdPhysics <div class="sd-summary-content sd-card-body docutils"> <div class="rebreather hierarchy docutils container"> <ul class="simple"> <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdPhysics/articulationRootAPI.h <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdPhysics/collisionAPI.h <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdPhysics/collisionGroup.h <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdPhysics/distanceJoint.h <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdPhysics/driveAPI.h <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdPhysics/filteredPairsAPI.h <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdPhysics/fixedJoint.h <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdPhysics/joint.h <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdPhysics/limitAPI.h <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdPhysics/massAPI.h <li> <p class="sd-card-text"> file usdrt/scenegraph/usd/usdPhysics/materialAPI.h - file usdrt/scenegraph/usd/usdPhysics/materialAPI.h - file usdrt/scenegraph/usd/usdPhysics/meshCollisionAPI.h - file usdrt/scenegraph/usd/usdPhysics/prismaticJoint.h - file usdrt/scenegraph/usd/usdPhysics/revoluteJoint.h - file usdrt/scenegraph/usd/usdPhysics/rigidBodyAPI.h - file usdrt/scenegraph/usd/usdPhysics/scene.h - file usdrt/scenegraph/usd/usdPhysics/sphericalJoint.h - file usdrt/scenegraph/usd/usdPhysics/tokens.h - dir usdrt/scenegraph/usd/usdRender - file usdrt/scenegraph/usd/usdRender/denoisePass.h - file usdrt/scenegraph/usd/usdRender/pass.h - file usdrt/scenegraph/usd/usdRender/product.h - file usdrt/scenegraph/usd/usdRender/settings.h - file usdrt/scenegraph/usd/usdRender/settingsAPI.h - file usdrt/scenegraph/usd/usdRender/settingsBase.h - file usdrt/scenegraph/usd/usdRender/tokens.h - file usdrt/scenegraph/usd/usdRender/var.h - dir usdrt/scenegraph/usd/usdShade <!-- 此处省略,格式同上 --> ### Files - file usdrt/scenegraph/usd/usdShade/connectableAPI.h - file usdrt/scenegraph/usd/usdShade/coordSysAPI.h - file usdrt/scenegraph/usd/usdShade/material.h - file usdrt/scenegraph/usd/usdShade/materialBindingAPI.h - file usdrt/scenegraph/usd/usdShade/nodeDefAPI.h - file usdrt/scenegraph/usd/usdShade/nodeGraph.h - file usdrt/scenegraph/usd/usdShade/shader.h - file usdrt/scenegraph/usd/usdShade/tokens.h ### Directory - dir usdrt/scenegraph/usd/usdSkel - file usdrt/scenegraph/usd/usdSkel/animation.h - file usdrt/scenegraph/usd/usdSkel/bindingAPI.h - file usdrt/scenegraph/usd/usdSkel/blendShape.h - file usdrt/scenegraph/usd/usdSkel/packedJointAnimation.h - file usdrt/scenegraph/usd/usdSkel/root.h - file usdrt/scenegraph/usd/usdSkel/skeleton.h - file usdrt/scenegraph/usd/usdSkel/tokens.h ### Namespace hierarchy #### namespace omni - namespace omni::fabric ### namespace - **omni::math** - ### namespace - **omni::math::linalg** - enum **omni::math::linalg::EulerRotationOrder** - class **omni::math::linalg::base_matrix** - class **omni::math::linalg::base_vec** - class **omni::math::linalg::half** - class **omni::math::linalg::matrix2** - class **omni::math::linalg::matrix3** - class **omni::math::linalg::matrix4** - class **omni::math::linalg::quat** - class **omni::math::linalg::range1** - class **omni::math::linalg::range2** - class **omni::math::linalg::range3** - class **omni::math::linalg::vec2** - class **omni::math::linalg::vec3** - class **omni::math::linalg::vec4** ### namespace - **std** <details> <summary>class std::hash&lt; usdrt::SdfPath &gt; <details> <summary>namespace usdrt <ul> <li>enum usdrt::AccessType <li>enum usdrt::UsdListPosition <li>enum usdrt::UsdSchemaType <li>struct usdrt::AttrSpec <li>class usdrt::DestructionSchemaDestructibleBaseAPI <li>class usdrt::DestructionSchemaDestructibleBondAPI <li>class usdrt::DestructionSchemaDestructibleChunkAPI <li>class usdrt::DestructionSchemaDestructibleInstAPI <li>class usdrt::DestructionSchemaTokensType <li>struct usdrt::DestructionSchemaTokensTypeAccessor <li>class usdrt::ForceFieldSchemaPhysxForceFieldAPI <li>class usdrt::ForceFieldSchemaPhysxForceFieldConicalAPI <li>class usdrt::ForceFieldSchemaPhysxForceFieldDragAPI <li>class usdrt::ForceFieldSchemaPhysxForceFieldLinearAPI <li>class usdrt::ForceFieldSchemaPhysxForceFieldNoiseAPI <li>class usdrt::ForceFieldSchemaPhysxForceFieldPlanarAPI - class `usdrt::ForceFieldSchemaPhysxForceFieldRingAPI` - class `usdrt::ForceFieldSchemaPhysxForceFieldSphericalAPI` - class `usdrt::ForceFieldSchemaPhysxForceFieldSpinAPI` - class `usdrt::ForceFieldSchemaPhysxForceFieldWindAPI` - struct `usdrt::ForceFieldSchemaTokensType` - struct `usdrt::ForceFieldSchemaTokensTypeAccessor` - struct `usdrt::GfIsFloatingPoint< GfHalf >` - struct `usdrt::GfIsGfMatrix< GfMatrix2d >` - struct `usdrt::GfIsGfMatrix< GfMatrix2f >` - struct `usdrt::GfIsGfMatrix< GfMatrix3d >` - struct `usdrt::GfIsGfMatrix< GfMatrix3f >` - struct `usdrt::GfIsGfMatrix< GfMatrix4d >` - struct `usdrt::GfIsGfMatrix< GfMatrix4f >` - struct `usdrt::GfIsGfQuat< GfQuatd >` - struct `usdrt::GfIsGfQuat< GfQuatf >` - struct `usdrt::GfIsGfQuat< GfQuath >` - struct `usdrt::GfIsGfRange< GfRange1d >` - struct `usdrt::GfIsGfRange< GfRange1f >` - struct `usdrt::GfIsGfRange< GfRange2d >` - struct `usdrt::GfIsGfRange< GfRange2f >` - struct `usdrt::GfIsGfRange< GfRange3d >` - struct `usdrt::GfIsGfRange< GfRange3f >` - struct `usdrt::GfIsGfVec< GfVec2d >` - struct usdrt::GfIsGfVec< GfVec2d > - struct usdrt::GfIsGfVec< GfVec2f > - struct usdrt::GfIsGfVec< GfVec2h > - struct usdrt::GfIsGfVec< GfVec2i > - struct usdrt::GfIsGfVec< GfVec3d > - struct usdrt::GfIsGfVec< GfVec3f > - struct usdrt::GfIsGfVec< GfVec3h > - struct usdrt::GfIsGfVec< GfVec3i > - struct usdrt::GfIsGfVec< GfVec4d > - struct usdrt::GfIsGfVec< GfVec4f > - struct usdrt::GfIsGfVec< GfVec4h > - struct usdrt::GfIsGfVec< GfVec4i > - struct usdrt::GfRect2i - class usdrt::PhysxSchemaJointStateAPI - class usdrt::PhysxSchemaPhysxArticulationAPI - class usdrt::PhysxSchemaPhysxArticulationForceSensorAPI - class usdrt::PhysxSchemaPhysxAutoAttachmentAPI - class usdrt::PhysxSchemaPhysxAutoParticleClothAPI - class usdrt::PhysxSchemaPhysxCameraAPI - class usdrt::PhysxSchemaPhysxCameraDroneAPI - class usdrt::PhysxSchemaPhysxCameraFollowAPI - class usdrt::PhysxSchemaPhysxCameraFollowLookAPI - class usdrt::PhysxSchemaPhysxCameraFollowVelocityAPI - class usdrt::PhysxSchemaPhysxCharacterControllerAPI - class usdrt::PhysxSchemaPhysxCharacterControllerAPI - class usdrt::PhysxSchemaPhysxCollisionAPI - class usdrt::PhysxSchemaPhysxContactReportAPI - class usdrt::PhysxSchemaPhysxConvexDecompositionCollisionAPI - class usdrt::PhysxSchemaPhysxConvexHullCollisionAPI - class usdrt::PhysxSchemaPhysxCookedDataAPI - class usdrt::PhysxSchemaPhysxDeformableAPI - class usdrt::PhysxSchemaPhysxDeformableBodyAPI - class usdrt::PhysxSchemaPhysxDeformableBodyMaterialAPI - class usdrt::PhysxSchemaPhysxDeformableSurfaceAPI - class usdrt::PhysxSchemaPhysxDeformableSurfaceMaterialAPI - class usdrt::PhysxSchemaPhysxDiffuseParticlesAPI - class usdrt::PhysxSchemaPhysxForceAPI - class usdrt::PhysxSchemaPhysxHairAPI - class usdrt::PhysxSchemaPhysxHairMaterialAPI - class usdrt::PhysxSchemaPhysxJointAPI - class usdrt::PhysxSchemaPhysxLimitAPI - class usdrt::PhysxSchemaPhysxMaterialAPI - class usdrt::PhysxSchemaPhysxPBDMaterialAPI - class usdrt::PhysxSchemaPhysxParticleAPI - class usdrt::PhysxSchemaPhysxParticleAnisotropyAPI - class usdrt::PhysxSchemaPhysxParticleClothAPI - class usdrt::PhysxSchemaPhysxParticleIsosurfaceAPI - class usdrt::PhysxSchemaPhysxParticleSamplingAPI - class usdrt::PhysxSchemaPhysxParticleSamplingAPI - class usdrt::PhysxSchemaPhysxParticleSetAPI - class usdrt::PhysxSchemaPhysxParticleSmoothingAPI - class usdrt::PhysxSchemaPhysxParticleSystem - class usdrt::PhysxSchemaPhysxPhysicsAttachment - class usdrt::PhysxSchemaPhysxPhysicsDistanceJointAPI - class usdrt::PhysxSchemaPhysxPhysicsGearJoint - class usdrt::PhysxSchemaPhysxPhysicsInstancer - class usdrt::PhysxSchemaPhysxPhysicsJointInstancer - class usdrt::PhysxSchemaPhysxPhysicsRackAndPinionJoint - class usdrt::PhysxSchemaPhysxRigidBodyAPI - class usdrt::PhysxSchemaPhysxSDFMeshCollisionAPI - class usdrt::PhysxSchemaPhysxSceneAPI - class usdrt::PhysxSchemaPhysxSphereFillCollisionAPI - class usdrt::PhysxSchemaPhysxTendonAttachmentAPI - class usdrt::PhysxSchemaPhysxTendonAttachmentLeafAPI - class usdrt::PhysxSchemaPhysxTendonAttachmentRootAPI - class usdrt::PhysxSchemaPhysxTendonAxisAPI - class usdrt::PhysxSchemaPhysxTendonAxisRootAPI - class usdrt::PhysxSchemaPhysxTriangleMeshCollisionAPI - class usdrt::PhysxSchemaPhysxTriangleMeshSimplificationCollisionAPI - class usdrt::PhysxSchemaPhysxTriggerAPI - class usdrt::PhysxSchemaPhysxTriggerStateAPI - class usdrt::PhysxSchemaPhysxVehicleAPI - class usdrt::PhysxSchemaPhysxVehicleAckermannSteeringAPI - class usdrt::PhysxSchemaPhysxVehicleAutoGearBoxAPI - class usdrt::PhysxSchemaPhysxVehicleBrakesAPI - class usdrt::PhysxSchemaPhysxVehicleClutchAPI - class usdrt::PhysxSchemaPhysxVehicleContextAPI - class usdrt::PhysxSchemaPhysxVehicleControllerAPI - class usdrt::PhysxSchemaPhysxVehicleDriveBasicAPI - class usdrt::PhysxSchemaPhysxVehicleDriveStandardAPI - class usdrt::PhysxSchemaPhysxVehicleEngineAPI - class usdrt::PhysxSchemaPhysxVehicleGearsAPI - class usdrt::PhysxSchemaPhysxVehicleMultiWheelDifferentialAPI - class usdrt::PhysxSchemaPhysxVehicleSteeringAPI - class usdrt::PhysxSchemaPhysxVehicleSuspensionAPI - class usdrt::PhysxSchemaPhysxVehicleSuspensionComplianceAPI - class usdrt::PhysxSchemaPhysxVehicleTankControllerAPI - class usdrt::PhysxSchemaPhysxVehicleTankDifferentialAPI - class usdrt::PhysxSchemaPhysxVehicleTireAPI - class usdrt::PhysxSchemaPhysxVehicleTireFrictionTable - class usdrt::PhysxSchemaPhysxVehicleWheelAPI - class usdrt::PhysxSchemaPhysxVehicleWheelAttachmentAPI - class usdrt::PhysxSchemaPhysxVehicleWheelControllerAPI - class usdrt::PhysxSchemaPlane - class usdrt::PhysxSchemaTetrahedralMesh - struct usdrt::PhysxSchemaTokensType - struct usdrt::PhysxSchemaTokensTypeAccessor - class usdrt::RtBoundable - class usdrt::RtChangeTracker - class usdrt::RtPrimSelection - struct usdrt::RtTokensType - struct usdrt::RtTokensTypeAccessor - class usdrt::RtXformable - class usdrt::SdfAssetPath - class usdrt::SdfPath - class usdrt::SdfPathAncestorsRange - class usdrt::SdfValueTypeName - struct usdrt::SdfValueTypeNamesType - struct usdrt::SdfValueTypeNamesTypeAccessor - class usdrt::TfToken - class usdrt::UsdAPISchemaBase - class usdrt::UsdAttribute - class usdrt::UsdClipsAPI - class usdrt::UsdCollectionAPI - class usdrt::UsdGeomBasisCurves - class usdrt::UsdGeomBoundable - class usdrt::UsdGeomCamera - class usdrt::UsdGeomCapsule - class `usdrt::UsdGeomCone` - class `usdrt::UsdGeomCube` - class `usdrt::UsdGeomCurves` - class `usdrt::UsdGeomCylinder` - class `usdrt::UsdGeomGprim` - class `usdrt::UsdGeomHermiteCurves` - class `usdrt::UsdGeomImageable` - class `usdrt::UsdGeomMesh` - class `usdrt::UsdGeomModelAPI` - class `usdrt::UsdGeomMotionAPI` - class `usdrt::UsdGeomNurbsCurves` - class `usdrt::UsdGeomNurbsPatch` - class `usdrt::UsdGeomPlane` - class `usdrt::UsdGeomPointBased` - class `usdrt::UsdGeomPointInstancer` - class `usdrt::UsdGeomPoints` - class `usdrt::UsdGeomPrimvarsAPI` - class `usdrt::UsdGeomScope` - class `usdrt::UsdGeomSphere` - class `usdrt::UsdGeomSubset` - struct `usdrt::UsdGeomTokensType` - struct `usdrt::UsdGeomTokensTypeAccessor` - class `usdrt::UsdGeomVisibilityAPI` - class `usdrt::UsdGeomXform` - class `usdrt::UsdGeomXformCommonAPI` - class `usdrt::UsdGeomXformable` - class `usdrt::UsdGeomXformable` - class `usdrt::UsdLuxBoundableLightBase` - class `usdrt::UsdLuxCylinderLight` - class `usdrt::UsdLuxDiskLight` - class `usdrt::UsdLuxDistantLight` - class `usdrt::UsdLuxDomeLight` - class `usdrt::UsdLuxGeometryLight` - class `usdrt::UsdLuxLight` - class `usdrt::UsdLuxLightAPI` - class `usdrt::UsdLuxLightFilter` - class `usdrt::UsdLuxLightListAPI` - class `usdrt::UsdLuxLightPortal` - class `usdrt::UsdLuxListAPI` - class `usdrt::UsdLuxMeshLightAPI` - class `usdrt::UsdLuxNonboundableLightBase` - class `usdrt::UsdLuxPluginLight` - class `usdrt::UsdLuxPluginLightFilter` - class `usdrt::UsdLuxPortalLight` - class `usdrt::UsdLuxRectLight` - class `usdrt::UsdLuxShadowAPI` - class `usdrt::UsdLuxShapingAPI` - class `usdrt::UsdLuxSphereLight` - struct `usdrt::UsdLuxTokensType` - struct `usdrt::UsdLuxTokensTypeAccessor` - class `usdrt::UsdLuxVolumeLightAPI` - class `usdrt::UsdMediaSpatialAudio` - class `usdrt::UsdMediaSpatialAudio` - class `usdrt::UsdMediaTokensType` - struct `usdrt::UsdMediaTokensTypeAccessor` - class `usdrt::UsdModelAPI` - class `usdrt::UsdPhysicsArticulationRootAPI` - class `usdrt::UsdPhysicsCollisionAPI` - class `usdrt::UsdPhysicsCollisionGroup` - class `usdrt::UsdPhysicsDistanceJoint` - class `usdrt::UsdPhysicsDriveAPI` - class `usdrt::UsdPhysicsFilteredPairsAPI` - class `usdrt::UsdPhysicsFixedJoint` - class `usdrt::UsdPhysicsJoint` - class `usdrt::UsdPhysicsLimitAPI` - class `usdrt::UsdPhysicsMassAPI` - class `usdrt::UsdPhysicsMaterialAPI` - class `usdrt::UsdPhysicsMeshCollisionAPI` - class `usdrt::UsdPhysicsPrismaticJoint` - class `usdrt::UsdPhysicsRevoluteJoint` - class `usdrt::UsdPhysicsRigidBodyAPI` - class `usdrt::UsdPhysicsScene` - class `usdrt::UsdPhysicsSphericalJoint` - struct `usdrt::UsdPhysicsTokensType` - struct `usdrt::UsdPhysicsTokensTypeAccessor` - class `usdrt::UsdPrim` - class `usdrt::UsdPrimRange` - usdrt::UsdRelationship - usdrt::UsdRenderDenoisePass - usdrt::UsdRenderPass - usdrt::UsdRenderProduct - usdrt::UsdRenderSettings - usdrt::UsdRenderSettingsAPI - usdrt::UsdRenderSettingsBase - usdrt::UsdRenderTokensType - usdrt::UsdRenderTokensTypeAccessor - usdrt::UsdRenderVar - usdrt::UsdSchemaBase - usdrt::UsdSchemaRegistry - usdrt::UsdShadeConnectableAPI - usdrt::UsdShadeCoordSysAPI - usdrt::UsdShadeMaterial - usdrt::UsdShadeMaterialBindingAPI - usdrt::UsdShadeNodeDefAPI - usdrt::UsdShadeNodeGraph - usdrt::UsdShadeShader - usdrt::UsdShadeTokensType - usdrt::UsdShadeTokensTypeAccessor - usdrt::UsdSkelAnimation - usdrt::UsdSkelBindingAPI - usdrt::UsdSkelBlendShape - usdrt::UsdSkelPackedJointAnimation ## API contents - [Classes](#) - [Defines](#) - [Directories](#) - [Enums](#) - [Files](#) - [Functions](#) - [Namespaces](#) - [Pages](#) - [Structs](#) ### Classes - usdrt::UsdSkelRoot - usdrt::UsdSkelSkeleton - usdrt::UsdSkelTokensType - usdrt::UsdSkelTokensTypeAccessor - usdrt::UsdStage - usdrt::UsdTokensType - usdrt::UsdTokensTypeAccessor - usdrt::UsdTyped - usdrt::UsdUIBackdrop - usdrt::UsdUINodeGraphNodeAPI - usdrt::UsdUISceneGraphPrimAPI - usdrt::UsdUITokensType - usdrt::UsdUITokensTypeAccessor - usdrt::UsdVolField3DAsset - usdrt::UsdVolFieldAsset - usdrt::UsdVolFieldBase - usdrt::UsdVolOpenVDBAsset - usdrt::UsdVolTokensType - usdrt::UsdVolTokensTypeAccessor - usdrt::UsdVolVolume - usdrt::VtArray # Table of Contents - Structs - Typedefs - Variables
27,083
usdrt_fsd_geometry.md
# Authoring geometry with USDRT and rendering with Fabric Scene Delegate ## About The Fabric Scene Delegate is the next-generation Omniverse scene delegate for Hydra. It leverages the power and performance of Fabric for a faster, more flexible, streamlined rendering pipeline. As you might expect, Fabric Scene Delegate uses Fabric as its data source for all rendering operations. This is an exciting development, because it opens us to the possibility of authoring renderable data directly to Fabric for use cases where USD data persistence is not required. This document gives a brief example of authoring geometry directly to Fabric using the USDRT Scenegraph API, and rendering with Fabric Scene Delegate. ## Getting Started ### Enable Fabric Scene Delegate Before you begin, you’ll need to enable Fabric Scene Delegate in Kit or Create. Select **Edit->Preferences** in the main toolbar, and in the Preferences tab, click **Rendering**. Then, in the **Fabric Scene Delegate** rendering preferences, toggle the checkbox next to **Enable Fabric delegate**. Finally, open or create a new USD stage to ensure that Fabric Scene Delegate is active. > **Note** > The **Enable Fabric delegate** setting is not sticky, so it currently needs to be re-enabled between Kit sessions. This will likely change in a future release. ### Enable the USDRT Scenegraph API You’ll need to enable the USDRT Scenegraph API as well. Select **Window->Extensions** in the main toolbar, and find **USDRT SCENEGRAPH API** in the extension list. Toggle the slider to enable the extension. Now you’re ready to create some geometry in Fabric! ## Create geometry with USDRT Scenegraph API In the Kit Script Editor window, or your own extension code, authoring geometry is very similar to how it would be accomplished with the USD API. Here’s a small example that creates a triangle using a Mesh prim. ```python import omni.usd from usdrt import Usd, Sdf, UsdGeom, Rt, Gf, Vt stage_id = omni.usd.get_context().get_stage_id() stage = Usd.Stage.Attach(stage_id) prim = stage.DefinePrim("/World/Triangle", "Mesh") mesh = UsdGeom.Mesh(prim) points = mesh.CreatePointsAttr() points.Set(Vt.Vec3fArray([Gf.Vec3f(1.0, 0, 0), Gf.Vec3f(0, 1.0, 0), Gf.Vec3f(-1.0, 0, 0)])) ``` face_vc = mesh.CreateFaceVertexCountsAttr() face_vc.Set(Vt.IntArray([3])) face_vi = mesh.CreateFaceVertexIndicesAttr() face_vi.Set(Vt.IntArray([0, 1, 2])) rtbound = Rt.Boundable(prim) world_ext = rtbound.CreateWorldExtentAttr() world_ext.Set(Gf.Range3d(Gf.Vec3d(-1.0, 0, -1.0), Gf.Vec3d(1.0, 1.0, 1.0))) ``` After this code runs, the triangle should appear in your viewport: One potentially unfamiliar item in this example is the use of the `Rt.Boundable` schema. Fabric Scene Delegate requires that all renderable prims hold an attribute that contains the extents of the prim in world space - the `CreateWorldExtentAttr()` API is the way to create and author that attribute. It is the responsibility of the author to calculate those extents and ensure their correctness. Of course, Fabric Scene Delegate does not support only Mesh prims. Nearly all prim types are supported. Let’s add a Cube to the scene: ```python prim = stage.DefinePrim("/World/Cube", "Cube") rtbound = Rt.Boundable(prim) world_ext = rtbound.CreateWorldExtentAttr() world_ext.Set(Gf.Range3d(Gf.Vec3d(-0.5, -0.5, -0.5), Gf.Vec3d(0.5, 0.5, 0.5))) ``` It should appear in the viewport intersecting the original triangle Mesh: Fabric Scene Delegate also uses the same transform attributes as OmniHydra, as described in the documentation. Let’s adjust the cube so that it sits below the triangle. Note that the world extents for the prim will need to be adjusted after the prim is transformed. ```python xformable = Rt.Xformable(prim) xformable.CreateWorldPositionAttr(Gf.Vec3d(0, -0.5, -0.5)) rtbound = Rt.Boundable(prim) world_ext = rtbound.GetWorldExtentAttr() world_ext.Set(Gf.Range3d(Gf.Vec3d(-0.5, -1, -1), Gf.Vec3d(0.5, 0, 0))) ``` Here is the result: It’s not my dream house, but it will have to do for now!
4,044
usdrt_index.md
# USDRT ## Working with USDRT - USDRT Project Overview - USD, Fabric, and USDRT - Introduction to Fabric - Introduction to Fabric Scene Delegate - Getting the USDRT Scenegraph API - USDRT Scenegraph API usage - Example Kit extension: What's in Fabric? - Fabric Transforms with Fabric Scene Delegate and IFabricHierarchy - Working with OmniHydra Transforms - usdrt::Gf - Change Tracking in USDRT - Authoring geometry for Fabric Scene Delegate - Fast Stage Queries with USDRT Scenegraph API - Efficiently processing sets of prims with USDRT Scenegraph API - Fabric Batch API ## API Documentation - C++ API Docs - Python API Docs ## Documenting - Documentation Guidelines - Restructured Text Guide - C++ Documentation Guide
722
usdrt_prim_selection.md
# Efficiently processing sets of prims with USDRT Scenegraph API ## About Usdrt has new APIs for efficiently processing sets of prims selected from the stage according to some criteria. The APIs support processing on CPU and GPU, in C++ and Python (using NVIDIA Warp). Possible uses include: - A physics system updating all physics meshes. - A clash detector finding collisions between all tagged meshes. - A renderer rendering all meshes. - An animation system updating all skeletons. - A shader compiler compiling all materials. - A procedural mesh system generating meshes for all prims containing input parameters. Using the new APIs has the following advantages compared to the standard USDRT APIs for finding and iterating over prims. - By leveraging Fabric’s stage index, the new APIs find the set of prims in constant time, as opposed to visiting every prim on the stage using a traversal. For example, if you want to select 1000 prims from a stage of 1000000, the search cost is some constant k, not k*1000000 or even k*1000. - The new APIs give access to Fabric’s vectorized memory representation of the selected prims’ attributes, which allows fast, parallelizable access on CPU or GPU. - Accessing the N selected prims using the new APIs is faster than calling the existing APIs N times, as it allows USDRT to amortize overheads. This gives significant performance benefit with N as low as 100. This document reviews these APIs, their behavior, and how you can leverage them to increase performance in your own application or extension. It first describes how to use the new APIs to select which prims and attributes to process, and then how to use a new iterator (on CPU or GPU) to get fast access to the attribute data as we process it. ## Selecting which prims and attributes to process ### API The UsdStage has a new API, SelectPrims, that we use to select the subset of the stage’s prims that we want to work on. We can select prims according to their type and/or what applied schemas they have. Additionally, SelectPrims has a parameter that we use to select the subset of the prims’ attributes that we want to access or modify, and the prim selection will only include prims that have them. Although maybe less useful, it’s also possible to leave prim type and applied schema unspecified, and just find all prims that have particular attributes. SelectPrims is defined as follows. #### C++ ```c++ RtPrimSelection UsdStage::SelectPrims(std::vector<TfToken> requireAppliedSchema, std::vector<AttrSpec> requireAttrs, carb::cpp17::optional<TfToken> requirePrimType = {}, uint32_t device = kDeviceCPU) ``` The Device parameter is an integer that specifies whether to make the RtPrimSelection on CPU or GPU, and specifies a particular GPU on multiple GPU systems. Set device to kDeviceCPU to run on CPU, or 0 to run on CUDA GPU 0. Running on other GPUs in multi GPU systems is not currently supported. # Python ``` ```python Usd.Stage.SelectPrims(device: str, require_applied_schemas=None: list(str), require_attrs=None: list(tuple), require_prim_type=None: str) ``` ```markdown In Python the device is specified by a string, set device to “cpu” to use the CPU, or “cuda:0” to run on CUDA GPU 0. Running on other GPUs in multi GPU systems is not currently supported. ``` ```markdown In both C++ and Python, SelectPrims returns an object of a new type, RtPrimSelection, described in a later section, Processing prims by iterating over the selection. ``` # Populating the stage into Fabric ```markdown Unlike the USDRT query APIs, SelectPrims searches only USD prims that are present in Fabric, not the whole USD stage. For the examples in this document we want to search USD stages loaded from files, so we need the following code to populate Fabric. ``` ## C++ ```cpp // Load a USD stage and populate Fabric with it using namespace usdrt; UsdStageRefPtr stage = UsdStage::Open("./data/usd/tests/cornell.usda"); for (UsdPrim prim : stage->Traverse()) { } // Populate Fabric ``` ## Python ```python # Load a USD stage and populate Fabric with it from usdrt import Sdf, Usd, Rt stage = Usd.Stage.Open(TEST_DIR + "/data/usd/tests/cornell_with_physics.usda") for prim in stage.Traverse(): # Populate Fabric pass ``` # Example 1: Selecting prims by type ```markdown The following example shows how to select all the meshes on the stage using C++ and Python. ``` ## C++ ```cpp using namespace usdrt; RtPrimSelection selection = stage->SelectPrims({}, {}, TfToken("Mesh"), kDeviceCpu); std::cout << "Found " << selection.GetCount() << " meshes\n"; ``` ## Python ```python selection = stage.SelectPrims(require_prim_type="Mesh", device="cpu") print(f"Found {selection.GetCount()} meshes") ``` # Example 2: Selecting prims by applied schema ```markdown With SelectPrims we can also select prims according to which applied schemas they have. The following example shows how to select all physics meshes, which are prims that have type “Mesh” and applied schema “PhysicsRigidBodyAPI”. ``` ## C++ ```cpp using namespace usdrt; std::vector<TfToken> requireAppliedSchemas = {"PhysicsRigidBodyAPI"}; ``` # Processing prims by iterating over the selection Once we’ve made a prim selection we can iterate over it and do some computation. We’ll look at how to do that first in Python, then in C++. ## Python To process the selected prims in Python we use NVIDIA warp to iterate over the prims and apply a kernel function to each. The advantage of using NVIDIA warp is that it allows us to iterate and apply the python kernel on either CPU or GPU. To pass attributes to the kernel function we need to wrap each with warp.fabricarray, and then launch the function using warp.launch. The definitions of warp.fabricarray and warp.launch are as follows. ```python warp.fabricarray(view: dict, attrib: str) ``` ## Example 4: Setting world position In this example we’ll select all the physics meshes on the stage and change their world position. We’ll select the prims for processing on CUDA GPU 0, but if we wanted to use the CPU instead the only change we’d need to make would be to set the device parameter to “cpu”. ```python selection = stage.SelectPrims( require_applied_schemas=["PhysicsRigidBodyAPI"], require_attrs=[(Sdf.ValueTypeNames.Double3, "_worldPosition", Usd.Access.ReadWrite)], require_prim_type="Mesh", device="cuda:0", ) ``` Next we define the kernel function we want to apply to the selected prims. ```python @wp.kernel(enable_backward=False) def move_prims( pos: wp.fabricarray(dtype=wp.vec3d), ): i = wp.tid() old_pos = pos[i] pos[i] = wp.vec3d(old_pos.x + 1, old_pos.y, old_pos.z) ``` Finally we run the kernel on the selection using warp. ```python positions = wp.fabricarray(selection.__fabric_arrays_interface__, "_worldPosition") wp.launch(move_prims, dim=positions.size, inputs=[positions], device="cuda:0") ``` ## Example 5: Setting an array-valued attribute In this example we’ll select all the meshes on the stage and change their color to red. A quirk of USD is that displayColor is an array-valued attribute, even when one color is applied to the whole mesh. We’ll use this example to demonstrate the use of array-valued attributes, even though in this case the array has size one. First we select all the meshes on the stage. ```python selection = stage.SelectPrims( require_attrs=[(Sdf.ValueTypeNames.Color3fArray, UsdGeom.Tokens.primvarsDisplayColor, Usd.Access.ReadWrite)], require_prim_type="Mesh", device="cpu", ) print(f"Found {selection.GetCount()} meshes with displayColor") ``` Next we define the kernel function we want to apply to the selected prims. The main difference compared to the last example is that the type of the colors parameter is fabricarrayarray instead of fabricarray. The parameter is an array-of-arrays, because the selection contains multiple prims, each with an array of colors. We index the array using `colors[i, 0]` to access color 0 of selected prim i. ```python @wp.kernel(enable_backward=False) def change_colors(colors: wp.fabricarrayarray(dtype=wp.vec3d)): i = wp.tid() colors[i, 0] = [1, 0, 0] ``` Finally we make a warp.fabricarray for the attribute we want to pass to the kernel, and then launch it using warp. Note that here the array is a fabricarray, not a fabricarrayarray. ```python colors = wp.fabricarray(selection.__fabric_arrays_interface__, "primvars:displayColor") ``` ```cpp wp.launch(self.change_colors, dim=colors.size, inputs=[colors], device="cpu") ``` ## C++ SelectPrims returns an RtPrimSelection, which has the following methods in C++. ```cpp AttributeRef GetRef(SdfValueTypeName type, const TfToken& name) const; omni::fabric::batch::View GetBatchView() const; size_t GetCount() const; ``` To iterate over the prim selection’s data on CPU or GPU we need to construct a batch::ViewIterator, using GetBatchView as follows. ```cpp batch::ViewIterator iter(selection.GetBatchView()); ``` batch::ViewIterator has the following methods: ```cpp ViewIterator(const batch::View& view, const size_t index = 0) bool peek(); bool advance(const size_t stride = 1); template<typename T> const T& getAttributeRd(const AttributeRef& attributeRef) const; template<typename T> T& getAttributeWr(const AttributeRef& attributeRef) const; template<typename T> SpanOf<const T> getArrayAttributeRd(const AttributeRef& attributeRef) const; template<typename T> SpanOf<T> getArrayAttributeWr(const AttributeRef& attributeRef) const; size_t getGlobalIndex() const; size_t getElementRangesIndex() const; size_t getElementIndex() const; size_t getElementCount(const AttributeRef& attributeRef) const; uint64_t getPath() const; ``` ## Example 6: Setting an array-valued attribute in C++ on CPU As in the Python example, we’ll select all the meshes on the stage and make them red. First we make a prim selection, get an AttributeRef for displayColor, make an RTiterator, then iterate over the data using a while loop. ```cpp TfToken requireType = TfToken("Mesh"); std::vector<AttrSpec> requireAttrs = { AttrSpec{ usdrt::SdfValueTypeNames->Color3fArray, UsdGeomTokens->primvarsDisplayColor, AccessType::eReadWrite } }; ``` RtPrimSelection selection = stage->SelectPrims({}, requireAttrs, requireType, kDeviceCpu); AttributeRef colors = selection.GetRef(usdrt::SdfValueTypeNames->Color3fArray, UsdGeomTokens->primvarsDisplayColor); batch::ViewIterator iter(selection.GetBatchView()); while (iter.advance()) { iter.getArrayAttributeWr<GfVec3f>(colors).elements[0] = {1.0f, 0.0f, 0.0f}; } ``` ```markdown __global__ void changeColors_impl(const omni::fabric::batch::View view, omni::fabric::batch::AttributeRef displayColors) { const unsigned int index = blockIdx.x * blockDim.x + threadIdx.x; const unsigned int gridStride = blockDim.x * gridDim.x; omni::fabric::batch::ViewIterator iter(view, index); while (iter.advance(gridStride)) { iter.getArrayAttributeWr<carb::Float3>(displayColors).elements[0] = {1, 0, 0}; } } void changeColors(const usdrt::RtPrimSelection selection, omni::fabric::batch::AttributeRef displayColors) { const dim3 blockDim(768); const dim3 gridDim((selection.GetCount() + blockDim.x - 1) / blockDim.x); changeColors_impl<<<gridDim, blockDim>>>(selection.GetBatchView(), displayColors); } ``` ```markdown TfToken requireType = TfToken("Mesh"); std::vector<AttrSpec> requireAttrs = {AttrSpec{usdrt::SdfValueTypeNames->Color3fArray}}; ```cpp UsdGeomTokens->primvarsDisplayColor, AccessType::eReadWrite }; RtPrimSelection selection = stage->SelectPrims({}, requireAttrs, requireType, kDeviceCuda0); AttributeRef colors = selection.GetRef(usdrt::SdfValueTypeNames->Color3fArray, UsdGeomTokens->primvarsDisplayColor); // Launch CUDA kernel changeColors(selection, colors); ```
12,042
usdrt_query.md
# Fast Stage Queries with USDRT Scenegraph API ## About usdrt-6.0.6 adds new APIs to the `usdrt::UsdStage` implementation that leverage the capability of Fabric to do constant-time queries of data in Fabric. This document reviews those APIs, their behavior, and how you can leverage them to increase performance in your own application or extension. ## Query the stage for prims by type or applied API schema There are three new APIs to do fast queries of the stage for prims of a given type, prims with a specific applied API schema, or both. These are specific to USDRT’s UsdStage implementation, and leverage Fabric’s unique data layout to return information about the stage without requiring a complete stage traversal with per-prim inquiries. - `std::vector<SdfPath> UsdStage::GetPrimsWithTypeName(TfToken typeName)` - `std::vector<SdfPath> UsdStage::GetPrimsWithAppliedAPIName(TfToken apiName)` - `std::vector<SdfPath> UsdStage::GetPrimsWithTypeAndAppliedAPIName(TfToken typeName, TfTokenVector apiNames)` The first call to any of these APIs will populate Fabric with a minimal representation of the USD stage if necessary. Subsequent calls will leverage the existing data in Fabric and query Fabric directly. ### Query by prim type Both of these examples discover all Mesh prims, and set the `primvars:displayColor` attribute if it exists on the prim. Note that these APIs return a vector of SdfPaths, so an additional call to `UsdStage::GetPrimAtPath` is necessary to access the related UsdPrim. #### C++ ```c++ using namespace usdrt; const TfToken mesh("Mesh"); const TfToken attrName = UsdGeomTokens->primvarsDisplayColor; const VtArray<GfVec3f> red = { GfVec3f(1, 0, 0) }; const SdfPathVector meshPaths = stage->GetPrimsWithTypeName(mesh); for (SdfPath meshPath : meshPaths) { UsdPrim prim = stage->GetPrimAtPath(meshPath); if (prim.HasAttribute(attrName)) { prim.GetAttribute(attrName).Set(red); } } ``` ```markdown ## Python ```python from usdrt import Gf, Sdf, Usd, UsdGeom, Vt red = Vt.Vec3fArray([Gf.Vec3f(1, 0, 0)]) meshPaths = stage.GetPrimsWithTypeName("Mesh") for meshPath in meshPaths: prim = stage.GetPrimAtPath(meshPath) if prim.HasAttribute(UsdGeom.Tokens.primvarsDisplayColor): prim.GetAttribute(UsdGeom.Tokens.primvarsDisplayColor).Set(red) ``` It is also possible to search by *inherited* types. This example discovers all prims where “doubleSided” is true for the stage. ```python from usdrt import Gf, Sdf, Usd, UsdGeom gPrimPaths = stage.GetPrimsWithTypeName("Gprim") attr = UsdGeom.Tokens.doubleSided doubleSided = [] for gPrimPath in gPrimPaths: prim = stage.GetPrimAtPath(gPrimPath) if prim.HasAttribute(attr) and prim.GetAttribute(attr).Get(): doubleSided.append(prim) ``` ## Query by applied API schema It may be useful in some cases to discover every prim where a particular API schema has been applied. It is possible to query by individual API schema, or by a list of API schemas for a specific prim type. The following examples from the USDRT Scenegraph unit tests demonstrate the concept: ```python from usdrt import Gf, Sdf, Usd stage = Usd.Stage.Open(TEST_DIR + "/data/usd/tests/cornell.usda") self.assertTrue(stage) paths = stage.GetPrimsWithAppliedAPIName("ShapingAPI") self.assertEqual(len(paths), 2) paths = stage.GetPrimsWithAppliedAPIName("CollectionAPI:lightLink") self.assertEqual(len(paths), 5) ``` ```python from usdrt import Gf, Sdf, Usd stage = Usd.Stage.Open(TEST_DIR + "/data/usd/tests/cornell.usda") self.assertTrue(stage) paths = stage.GetPrimsWithTypeAndAppliedAPIName("Mesh", ["CollectionAPI:test"]) self.assertEqual(len(paths), 1) ``` ## Get the world bound for the stage An additional API exists that leverages world extent data in Fabric set by Fabric Scene Delegate or the RtBoundable schema to compute the bounding extent for the stage: ``` GfRange3d UsdStage::GetStageExtent() ``` If no world extent data exists in Fabric, this API will populate it from USD using a multi-threaded compute and Fabric queries to target only Boundable prims directly. ```python from usdrt import Gf, Sdf, Usd stage = Usd.Stage.Open(TEST_DIR + "/data/usd/tests/cornell.usda") self.assertTrue(stage) bound = stage.GetStageExtent() self.assertTrue(Gf.IsClose(bound.GetMin(), Gf.Vec3d(-333.8142, -249.9100, -5.444), 0.01)) self.assertTrue(Gf.IsClose(bound.GetMax(), Gf.Vec3d(247.1132, 249.9178, 500.0), 0.01)) ``` ## Using stage queries for optimal performance The key benefit of these query APIs is that they only populate Fabric with the minimal set of data from the underlying USD stage required for each query, and once populated, querying Fabric is extremely fast. Fabric queries are performed in constant time, and unlike stage traversal, do not increase relative to prim count on the USD stage. This performance characteristic is beneficial for modular software architectures where each module may require independent inquiries into the USD stage. For example, consider a hypothetical suite of Kit extensions where each extension needs to do one of the following inquiries into the USD stage in response to a stage-opened event: - A BackupLight extension checks if there are any lights on the USD stage, and if not, creates a default light - A CharacterAnimator extension finds all of the UsdSkel prims on the USD stage and populates a menu with their names - A FastRender extension checks if any Mesh prim names end with the string “_glass” to optimize render settings - A ForkliftSimulator extension finds all prims with the PhysicsDriveAPI schema applied to prepare a simulation context Accomplishing these tasks with the conventional USD API requires each extension to independently perform a complete traversal of the USD stage. However, with the USDRT stage query APIs and underlying Fabric data, at most one USD stage traversal is required for lightweight Fabric population, and subsequent queries after the first leverage the data that has already been populated into Fabric. This makes stage inspection fast and lightweight, and modularity straightforward.
6,103
UsdShade.md
# UsdShade module Summary: The UsdShade module provides schemas and behaviors for creating and binding materials, which encapsulate shading networks. ## Classes: - **AttributeType** - **ConnectableAPI** - UsdShadeConnectableAPI is an API schema that provides a common interface for creating outputs and making connections between shading parameters and outputs. - **ConnectionModification** - **ConnectionSourceInfo** - A compact struct to represent a bundle of information about an upstream source attribute. - **CoordSysAPI** - UsdShadeCoordSysAPI provides a way to designate, name, and discover coordinate systems. - **Input** - This class encapsulates a shader or node-graph input, which is a connectable attribute representing a typed value. - **Material** - A Material provides a container into which multiple "render targets" can add data that defines a "shading material" for a renderer. - **MaterialBindingAPI** - UsdShadeMaterialBindingAPI is an API schema that provides an interface for binding materials to prims or collections of prims (represented by UsdCollectionAPI objects). | UsdShadeNodeDefAPI | An API schema that provides attributes for a prim to select a corresponding Shader Node Definition ("Sdr Node"), as well as to look up a runtime entry for that shader node in the form of an SdrShaderNode. | | --- | --- | | NodeGraph | A node-graph is a container for shading nodes, as well as other node-graphs. | | Output | This class encapsulates a shader or node-graph output, which is a connectable attribute representing a typed, externally computed value. | | Shader | Base class for all USD shaders. | | ShaderDefParserPlugin | Parses shader definitions represented using USD scene description using the schemas provided by UsdShade. | | ShaderDefUtils | This class contains a set of utility functions used for populating the shader registry with shaders definitions specified using UsdShade schemas. | | Tokens | | | Utils | This class contains a set of utility functions used when authoring and querying shading networks. | ### pxr.UsdShade.AttributeType **Attributes:** - Input - Invalid - Output - names - values #### pxr.UsdShade.AttributeType.Input #### pxr.UsdShade.AttributeType.Invalid ### Output ``` ```markdown ### names ``` ```markdown ### values ``` ```markdown ### ConnectableAPI ``` ```markdown UsdShadeConnectableAPI is an API schema that provides a common interface for creating outputs and making connections between shading parameters and outputs. The interface is common to all UsdShade schemas that support Inputs and Outputs, which currently includes UsdShadeShader, UsdShadeNodeGraph, and UsdShadeMaterial. One can construct a UsdShadeConnectableAPI directly from a UsdPrim, or from objects of any of the schema classes listed above. If it seems onerous to need to construct a secondary schema object to interact with Inputs and Outputs, keep in mind that any function whose purpose is either to walk material/shader networks via their connections, or to create such networks, can typically be written entirely in terms of UsdShadeConnectableAPI objects, without needing to care what the underlying prim type is. Additionally, the most common UsdShadeConnectableAPI behaviors (creating Inputs and Outputs, and making connections) are wrapped as convenience methods on the prim schema classes (creation) and UsdShadeInput and UsdShadeOutput. **Methods:** - `CanConnect(input, source) -> bool` - `ClearSource(shadingAttr) -> bool` - `ClearSources(shadingAttr) -> bool` - `ConnectToSource(shadingAttr, source, mod) -> bool` - `CreateInput(name, typeName)` - `CreateOutput(name, typeName)` DisconnectSource ================ classmethod DisconnectSource(shadingAttr, sourceAttr) -> bool Get == classmethod Get(stage, path) -> ConnectableAPI GetConnectedSource =================== classmethod GetConnectedSource(shadingAttr, source, sourceName, sourceType) -> bool GetConnectedSources ==================== classmethod GetConnectedSources(shadingAttr, invalidSourcePaths) -> list[UsdShadeSourceInfo] GetInput ======== Return the requested input if it exists. GetInputs ========= Returns all inputs on the connectable prim (i.e. GetOutput ========= Return the requested output if it exists. GetOutputs ========== Returns all outputs on the connectable prim (i.e. GetRawConnectedSourcePaths ========================== classmethod GetRawConnectedSourcePaths(shadingAttr, sourcePaths) -> bool GetSchemaAttributeNames ======================= classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] HasConnectableAPI ================== classmethod HasConnectableAPI(schemaType) -> bool HasConnectedSource =================== classmethod HasConnectedSource(shadingAttr) -> bool IsContainer =========== Returns true if the prim is a container. IsSourceConnectionFromBaseMaterial =================================== classmethod IsSourceConnectionFromBaseMaterial(shadingAttr) -> bool | RequiresEncapsulation() | | --- | | Returns true if container encapsulation rules should be respected when evaluating connectibility behavior, false otherwise. | | SetConnectedSources | | --- | | classmethod SetConnectedSources(shadingAttr, sourceInfos) -> bool | ### CanConnect **classmethod** CanConnect(input, source) -> bool Determines whether the given input can be connected to the given source attribute, which can be an input or an output. The result depends on the "connectability" of the input and the source attributes. Depending on the prim type, this may require the plugin that defines connectability behavior for that prim type be loaded. UsdShadeInput::SetConnectability UsdShadeInput::GetConnectability **Parameters** - **input** (Input) – - **source** (Attribute) – CanConnect(input, sourceInput) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. **Parameters** - **input** (Input) – - **sourceInput** (Input) – CanConnect(input, sourceOutput) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. **Parameters** - **input** (Input) – - **sourceOutput** (Output) – CanConnect(output, source) -> bool Determines whether the given output can be connected to the given source attribute, which can be an input or an output. An output is considered to be connectable only if it belongs to a node-graph. Shader outputs are not connectable. `source` is an optional argument. If a valid UsdAttribute is supplied for it, this method will return true only if the source attribute is owned by a descendant of the node-graph owning the output. **Parameters** - **output** (Output) – - **source** (Attribute) – CanConnect(output, sourceInput) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. **Parameters** - **output** (Output) – - **sourceInput** (Input) – - **Input** (**Output**) – - **output** (**Output**) – - **sourceOutput** (**Output**) – - **classmethod** ClearSource(shadingAttr) -> bool - Deprecated - This is the older version that only referenced a single source. Please use ClearSources instead. - **Parameters** - **shadingAttr** (**Attribute**) – - **classmethod** ClearSources(shadingAttr) -> bool - Clears sources for this shading attribute in the current UsdEditTarget. - Most of the time, what you probably want is DisconnectSource() rather than this function. - **Parameters** - **shadingAttr** (**Attribute**) – - **classmethod** ConnectToSource(shadingAttr, source, mod) -> bool - Authors a connection for a given shading attribute <span class="pre"> shadingAttr . <p> <code class="docutils literal notranslate"> <span class="pre"> shadingAttr can represent a parameter, an input or an output. <code class="docutils literal notranslate"> <span class="pre"> source is a struct that describes the upstream source attribute with all the information necessary to make a connection. See the documentation for UsdShadeConnectionSourceInfo. <code class="docutils literal notranslate"> <span class="pre"> mod describes the operation that should be applied to the list of connections. By default the new connection will replace any existing connections, but it can add to the list of connections to represent multiple input connections. <p> <code class="docutils literal notranslate"> <span class="pre"> true if a connection was created successfully. <code class="docutils literal notranslate"> <span class="pre"> false if <code class="docutils literal notranslate"> <span class="pre"> shadingAttr or <code class="docutils literal notranslate"> <span class="pre"> source is invalid. <p> This method does not verify the connectability of the shading attribute to the source. Clients must invoke CanConnect() themselves to ensure compatibility. <p> The source shading attribute is created if it doesn’t exist already. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> shadingAttr (Attribute) – <li> <p> <strong> source (ConnectionSourceInfo) – <li> <p> <strong> mod (ConnectionModification) – <hr class="docutils"/> <p> ConnectToSource(input, source, mod) -> bool <p> This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> input (Input) – <li> <p> <strong> source (ConnectionSourceInfo) – <li> <p> <strong> mod (ConnectionModification) – <hr class="docutils"/> <p> ConnectToSource(output, source, mod) -> bool <p> This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> output (Output) – <li> <p> <strong> source (ConnectionSourceInfo) – <li> <p> <strong> mod (ConnectionModification) – <hr class="docutils"/> <p> ConnectToSource(shadingAttr, source, sourceName, sourceType, typeName) -> bool <p> Deprecated <p> Please use the versions that take a UsdShadeConnectionSourceInfo to describe the upstream source This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> shadingAttr (Attribute) – <li> <p> <strong> source (ConnectableAPI) – <li> <p> <strong> sourceName (str) – <li> <p> <strong> sourceType (AttributeType) – <li> <p> <strong> typeName (str) – ### TypeName (ValueTypeName) – ConnectToSource(input, source, sourceName, sourceType, typeName) -> bool Deprecated This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **input** (Input) – - **source** (ConnectableAPI) – - **sourceName** (str) – - **sourceType** (AttributeType) – - **typeName** (ValueTypeName) – ConnectToSource(output, source, sourceName, sourceType, typeName) -> bool Deprecated This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **output** (Output) – - **source** (ConnectableAPI) – - **sourceName** (str) – - **sourceType** (AttributeType) – - **typeName** (ValueTypeName) – ConnectToSource(shadingAttr, sourcePath) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Connect the given shading attribute to the source at path, `sourcePath`. `sourcePath` should be the fully namespaced property path. This overload is provided for convenience, for use in contexts where the prim types are unknown or unavailable. #### Parameters - **shadingAttr** (Attribute) – - **sourcePath** (Path) – ConnectToSource(input, sourcePath) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **input** (Input) – - **sourcePath** (Path) – ConnectToSource(output, sourcePath) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **output** (Output) – - **sourcePath** (Path) – - (**Output**) – - (**Path**) – - (**Attribute**) – - (**Input**) – - (**Input**) – - (**Input**) – - (**Output**) – - (**Input**) – - (**Attribute**) – - (**Output**) – - (**Input**) – - (**Output**) – - (**Output**) – - (**Output**) – ConnectToSource(shadingAttr, sourceInput) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Connect the given shading attribute to the given source input. Parameters: - **shadingAttr** (Attribute) – - **sourceInput** (Input) – ConnectToSource(input, sourceInput) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Parameters: - **input** (Input) – - **sourceInput** (Input) – ConnectToSource(output, sourceInput) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Parameters: - **output** (Output) – - **sourceInput** (Input) – ConnectToSource(shadingAttr, sourceOutput) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Connect the given shading attribute to the given source output. Parameters: - **shadingAttr** (Attribute) – - **sourceOutput** (Output) – ConnectToSource(input, sourceOutput) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Parameters: - **input** (Input) – - **sourceOutput** (Output) – ConnectToSource(output, sourceOutput) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Parameters: - **output** (Output) – - **sourceOutput** (Output) – ### CreateInput Create an input which can both have a value and be connected. The attribute representing the input is created in the "inputs:" namespace. #### Parameters - **name** (str) – - **typeName** (ValueTypeName) – ### CreateOutput Create an output, which represents and externally computed, typed value. Outputs on node-graphs can be connected. The attribute representing an output is created in the "outputs:" namespace. #### Parameters - **name** (str) – - **typeName** (ValueTypeName) – ### DisconnectSource classmethod DisconnectSource(shadingAttr, sourceAttr) -> bool Disconnect source for this shading attribute. If `sourceAttr` is valid it will disconnect the connection to this upstream attribute. Otherwise it will disconnect all connections by authoring an empty list of connections for the attribute `shadingAttr`. This may author more scene description than you might expect - we define the behavior of disconnect to be that, even if a shading attribute becomes connected in a weaker layer than the current UsdEditTarget, the attribute will still be disconnected in the composition, therefore we must "block" it in the current UsdEditTarget. ConnectToSource(). #### Parameters - **shadingAttr** (Attribute) – - **sourceAttr** (Attribute) – DisconnectSource(input, sourceAttr) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **input** (Input) – - **sourceAttr** (Attribute) – DisconnectSource(output, sourceAttr) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **output** (Input) – - **sourceAttr** (Attribute) – ### Parameters - **output** (Output) – - **sourceAttr** (Attribute) – ### Classmethod Get(stage, path) -> ConnectableAPI Return a UsdShadeConnectableAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdShadeConnectableAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ### Classmethod GetConnectedSource(shadingAttr, source, sourceName, sourceType) -> bool Deprecated Shading attributes can have multiple connections and so using GetConnectedSources is needed in general Finds the source of a connection for the given shading attribute. `shadingAttr` is the shading attribute whose connection we want to interrogate. `source` is an output parameter which will be set to the source connectable prim. `sourceName` will be set to the name of the source shading attribute, which may be an input or an output, as specified by `sourceType` `sourceType` will have the type of the source shading attribute, i.e. whether it is an `Input` or `Output` `true` if the shading attribute is connected to a valid, defined source attribute. `false` if the shading attribute is not connected to a single, defined source attribute. Previously this method would silently return false for multiple connections. We are changing the behavior of this method to return the result for the first connection and issue a TfWarn about it. We want to encourage clients to use GetConnectedSources going forward. The python wrapping for this method returns a (source, sourceName, sourceType) tuple if the parameter is connected, else `None` ### Parameters - **shadingAttr** (Attribute) – - **source** (ConnectableAPI) – - **sourceName** (str) – - **sourceType** (AttributeType) – ``` **AttributeType** GetConnectedSource(input, source, sourceName, sourceType) -> bool Deprecated This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. **Parameters** - **input** (Input) – - **source** (ConnectableAPI) – - **sourceName** (str) – - **sourceType** (AttributeType) – GetConnectedSource(output, source, sourceName, sourceType) -> bool Deprecated This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. **Parameters** - **output** (Output) – - **source** (ConnectableAPI) – - **sourceName** (str) – - **sourceType** (AttributeType) – **classmethod** GetConnectedSources(shadingAttr, invalidSourcePaths) -> list[UsdShadeSourceInfo] Finds the valid sources of connections for the given shading attribute. `shadingAttr` is the shading attribute whose connections we want to interrogate. `invalidSourcePaths` is an optional output parameter to collect the invalid source paths that have not been reported in the returned vector. Returns a vector of `UsdShadeConnectionSourceInfo` structs with information about each upstream attribute. If the vector is empty, there have been no connections. A valid connection requires the existence of the source attribute and also requires that the source prim is UsdShadeConnectableAPI compatible. The python wrapping returns a tuple with the valid connections first, followed by the invalid source paths. **Parameters** - **shadingAttr** (Attribute) – - **invalidSourcePaths** (list[SdfPath]) – GetConnectedSources(input, invalidSourcePaths) -> list[UsdShadeSourceInfo] This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. **Parameters** - **input** (Input) – - **invalidSourcePaths** (list[SdfPath]) – GetConnectedSources(output, invalidSourcePaths) -> list[UsdShadeSourceInfo] This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. **Parameters** - **output** (Output) – - **invalidSourcePaths** (list[SdfPath]) – **GetInput** - **Parameters** - **name** (str) – Return the requested input if it exists. `name` is the unnamespaced base name. **GetInputs** - **Parameters** - **onlyAuthored** (bool) – Returns all inputs on the connectable prim (i.e. shader or node-graph). Inputs are represented by attributes in the "inputs:" namespace. If `onlyAuthored` is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. **GetOutput** - **Parameters** - **name** (str) – Return the requested output if it exists. `name` is the unnamespaced base name. **GetOutputs** - **Parameters** - **onlyAuthored** (bool) – Returns all outputs on the connectable prim (i.e. shader or node-graph). Outputs are represented by attributes in the "outputs:" namespace. If `onlyAuthored` is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. authored builtins. ### Parameters - **onlyAuthored** (`bool`) – ### classmethod GetRawConnectedSourcePaths() Deprecated Please use GetConnectedSources to retrieve multiple connections Returns the “raw” (authored) connected source paths for the given shading attribute. #### Parameters - **shadingAttr** (`Attribute`) – - **sourcePaths** (`list[SdfPath]`) – ### GetRawConnectedSourcePaths(input, sourcePaths) -> bool Deprecated This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **input** (`Input`) – - **sourcePaths** (`list[SdfPath]`) – ### GetRawConnectedSourcePaths(output, sourcePaths) -> bool Deprecated This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **output** (`Output`) – - **sourcePaths** (`list[SdfPath]`) – ### classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (`bool`) – ### classmethod HasConnectableAPI(schemaType) -> bool Return true if the `schemaType` has a valid connectableAPIBehavior registered, false otherwise. To check if a prim’s connectableAPI has a behavior defined, use UsdSchemaBase::operator bool(). #### Parameters - **schemaType** (`Type`) – ## Method Details ### HasConnectedSource ```python classmethod HasConnectedSource(shadingAttr) -> bool ``` Returns true if and only if the shading attribute is currently connected to at least one valid (defined) source. If you will be calling GetConnectedSources() afterwards anyways, it will be much faster to instead check if the returned vector is empty: ```python UsdShadeSourceInfoVector connections = UsdShadeConnectableAPI::GetConnectedSources(attribute); if (!connections.empty()){ // process connected attribute } else { // process unconnected attribute } ``` **Parameters** - **shadingAttr** (Attribute) – ### Overloaded Functions ```python HasConnectedSource(input) -> bool ``` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. **Parameters** - **input** (Input) – ```python HasConnectedSource(output) -> bool ``` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. **Parameters** - **output** (Output) – ### IsContainer ```python IsContainer() -> bool ``` Returns true if the prim is a container. The underlying prim type may provide runtime behavior that defines whether it is a container. ### IsSourceConnectionFromBaseMaterial ```python classmethod IsSourceConnectionFromBaseMaterial(shadingAttr) -> bool ``` Returns true if the connection to the given shading attribute’s source, as returned by UsdShadeConnectableAPI::GetConnectedSource(), is authored across a specializes arc, which is used to denote a base material. **Parameters** - **shadingAttr** (Attribute) – ### Overloaded Functions ```python IsSourceConnectionFromBaseMaterial(input) -> bool ``` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. **Parameters** - **input** (Input) – ```python IsSourceConnectionFromBaseMaterial(output) -> bool ``` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. **Parameters** - **output** (Output) – ### RequiresEncapsulation ```python RequiresEncapsulation() -> bool ``` Returns true if the prim requires encapsulation. ``` Returns true if container encapsulation rules should be respected when evaluating connectibility behavior, false otherwise. The underlying prim type may provide runtime behavior that defines if encapsulation rules are respected or not. ### SetConnectedSources ```python classmethod SetConnectedSources(shadingAttr, sourceInfos) -> bool ``` Authors a list of connections for a given shading attribute `shadingAttr`. `shadingAttr` can represent a parameter, an input or an output. `sourceInfos` is a vector of structs that describes the upstream source attributes with all the information necessary to make all the connections. See the documentation for UsdShadeConnectionSourceInfo. `true` if all connection were created successfully. `false` if the `shadingAttr` or one of the sources are invalid. A valid connection is one that has a valid `UsdShadeConnectionSourceInfo`, which requires the existence of the upstream source prim. It does not require the existence of the source attribute as it will be create if necessary. #### Parameters - **shadingAttr** (`Attribute`) – - **sourceInfos** (`list[ConnectionSourceInfo]`) – ### ConnectionModification **Attributes:** | Attribute | Description | |-----------|-------------| | `Append` | | | `Prepend` | | | `Replace` | | | `names` | | | `values` | | #### Append = pxr.UsdShade.ConnectionModification.Append #### Prepend ``` <span class="pre"> Prepend <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> pxr.UsdShade.ConnectionModification.Prepend <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdShade.ConnectionModification.Replace"> <span class="sig-name descname"> <span class="pre"> Replace <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> pxr.UsdShade.ConnectionModification.Replace <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdShade.ConnectionModification.names"> <span class="sig-name descname"> <span class="pre"> names <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> {'Append': <span class="pre"> pxr.UsdShade.ConnectionModification.Append, <span class="pre"> 'Prepend': <span class="pre"> pxr.UsdShade.ConnectionModification.Prepend, <span class="pre"> 'Replace': <span class="pre"> pxr.UsdShade.ConnectionModification.Replace} <dd> <dl class="py attribute"> <dt class="sig sig-object py" id="pxr.UsdShade.ConnectionModification.values"> <span class="sig-name descname"> <span class="pre"> values <em class="property"> <span class="w"> <span class="p"> <span class="pre"> = <span class="w"> <span class="pre"> {0: <span class="pre"> pxr.UsdShade.ConnectionModification.Replace, <span class="pre"> 1: <span class="pre"> pxr.UsdShade.ConnectionModification.Prepend, <span class="pre"> 2: <span class="pre"> pxr.UsdShade.ConnectionModification.Append} <dd> <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdShade.ConnectionSourceInfo"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.UsdShade. <span class="sig-name descname"> <span class="pre"> ConnectionSourceInfo <dd> <p> A compact struct to represent a bundle of information about an upstream source attribute. <p> <strong> Methods: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> IsValid () <td> <p> Return true if this source info is valid for setting up a connection. <p> <strong> Attributes: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> source <td> <p> <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> sourceName <td> <p> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> sourceType <td> <p> <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> typeName <td> <p> <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.ConnectionSourceInfo.IsValid"> <span class="sig-name descname"> <span class="pre"> IsValid <span class="sig-paren"> () <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Return true if this source info is valid for setting up a connection. - **pxr.UsdShade.ConnectionSourceInfo.source** - **source** - **pxr.UsdShade.ConnectionSourceInfo.sourceName** - **sourceName** - **pxr.UsdShade.ConnectionSourceInfo.sourceType** - **sourceType** - **pxr.UsdShade.ConnectionSourceInfo.typeName** - **typeName** - **pxr.UsdShade.CoordSysAPI** - **CoordSysAPI** - UsdShadeCoordSysAPI provides a way to designate, name, and discover coordinate systems. - Coordinate systems are implicitly established by UsdGeomXformable prims, using their local space. That coordinate system may be bound (i.e., named) from another prim. The binding is encoded as a single-target relationship in the”coordSys:”namespace. Coordinate system bindings apply to descendants of the prim where the binding is expressed, but names may be re-bound by descendant prims. - Named coordinate systems are useful in shading workflows. An example is projection paint, which projects a texture from a certain view (the paint coordinate system). Using the paint coordinate frame avoids the need to assign a UV set to the object, and can be a concise way to project paint across a collection of objects with a single shared paint coordinate system. - This is a non-applied API schema. - **Methods:** - **Bind**(name, path) - Bind the name to the given path. - **BlockBinding**(name) - Block the indicated coordinate system binding on this prim by blocking targets on the underlying relationship. - **CanContainPropertyName**(name) -> bool - classmethod - **ClearBinding**(name, removeSpec) - Clear the indicated coordinate system binding on this prim from the current edit target. - **FindBindingsWithInheritance**() - Find the list of coordinate system bindings that apply to this prim, including inherited bindings. - **Get**(stage, path) -> CoordSysAPI - classmethod - **GetCoordSysRelationshipName**(coordSysName) -> str - classmethod - **GetLocalBindings**() - Get the list of coordinate system bindings that are locally set on this prim. | Method Name | Description | |-------------|-------------| | `GetLocalBindings()` | Get the list of coordinate system bindings local to this prim. | | `GetSchemaAttributeNames(includeInherited)` | `classmethod` GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | `HasLocalBindings()` | Returns true if the prim has local coordinate system binding opinions. | ### Bind `Bind(name, path)` -> `bool` - **Description**: Bind the name to the given path. The prim at the given path is expected to be UsdGeomXformable, in order for the binding to be successfully resolved. - **Parameters**: - **name** (str) - **path** (Path) ### BlockBinding `BlockBinding(name)` -> `bool` - **Description**: Block the indicated coordinate system binding on this prim by blocking targets on the underlying relationship. - **Parameters**: - **name** (str) ### CanContainPropertyName `classmethod` CanContainPropertyName(name) -> `bool` - **Description**: Test whether a given `name` contains the "coordSys:" prefix. - **Parameters**: - **name** (str) ### ClearBinding `ClearBinding(name, removeSpec)` -> `bool` - **Description**: Clear the indicated coordinate system binding on this prim from the current edit target. Only remove the spec if `removeSpec` is true (leave the spec to preserve meta-data we may have intentionally authored on the relationship). - **Parameters**: - **name** (str) - **removeSpec** (bool) ### FindBindingsWithInheritance() Find the list of coordinate system bindings that apply to this prim, including inherited bindings. This computation examines this prim and ancestors for the strongest binding for each name. A binding expressed by a child prim supercedes bindings on ancestors. Note that this API does not validate the prims at the target paths; they may be of incorrect type, or missing entirely. Binding relationships with no resolved targets are skipped. ### Get() **classmethod** Get(stage, path) -> CoordSysAPI Return a UsdShadeCoordSysAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdShadeCoordSysAPI(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – ### GetCoordSysRelationshipName() **classmethod** GetCoordSysRelationshipName(coordSysName) -> str Returns the fully namespaced coordinate system relationship name, given the coordinate system name. **Parameters** - **coordSysName** (str) – ### GetLocalBindings() Get the list of coordinate system bindings local to this prim. This does not process inherited bindings. It does not validate that a prim exists at the indicated path. If the binding relationship has multiple targets, only the first is used. ## classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] - Returns a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - **includeInherited** (bool) – ## HasLocalBindings() -> bool - Returns true if the prim has local coordinate system binding opinions. - Note that the resulting binding list may still be empty. ## class pxr.UsdShade.Input - This class encapsulates a shader or node-graph input, which is a connectable attribute representing a typed value. ### Methods: - **CanConnect**(source) - Determines whether this Input can be connected to the given source attribute, which can be an input or an output. - **ClearConnectability**() - Clears any authored connectability on the Input. - **ClearSdrMetadata**() - Clears any "sdrMetadata" value authored on the Input in the current EditTarget. - **ClearSdrMetadataByKey**(key) - Clears the entry corresponding to the given key in the "sdrMetadata" dictionary authored in the current EditTarget. - **ClearSource**() - Deprecated - **ClearSources**() - Clears sources for this Input in the current UsdEditTarget. - **ConnectToSource**(source, mod) - Authors a connection for this Input. - **DisconnectSource**(sourceAttr) - Disconnect source for this Input. - **Get**(value, time) - Convenience wrapper for the templated UsdAttribute::Get(). - **GetAttr**() - Explicit UsdAttribute extractor. GetBaseName() Returns the name of the input. GetConnectability() Returns the connectability of the Input. GetConnectedSource(source, sourceName, ...) Deprecated GetConnectedSources(invalidSourcePaths) Finds the valid sources of connections for the Input. GetDisplayGroup() Get the displayGroup metadata for this Input, i.e. GetDocumentation() Get documentation string for this Input. GetFullName() Get the name of the attribute associated with the Input. GetPrim() Get the prim that the input belongs to. GetRawConnectedSourcePaths(sourcePaths) Deprecated GetRenderType() Return this Input's specialized renderType, or an empty token if none was authored. GetSdrMetadata() Returns this Input's composed "sdrMetadata" dictionary as a NdrTokenMap. GetSdrMetadataByKey(key) Returns the value corresponding to key in the composed sdrMetadata dictionary. GetTypeName() Get the "scene description" value type name of the attribute associated with the Input. GetValueProducingAttribute(attrType) Deprecated GetValueProducingAttributes(shaderOutputsOnly) - Find what is connected to this Input recursively. - `HasConnectedSource()` - Returns true if and only if this Input is currently connected to a valid (defined) source. - `HasRenderType()` - Return true if a renderType has been specified for this Input. - `HasSdrMetadata()` - Returns true if the Input has a non-empty composed"sdrMetadata"dictionary value. - `HasSdrMetadataByKey(key)` - Returns true if there is a value corresponding to the given `key` in the composed"sdrMetadata"dictionary. - `IsInput(attr) -> bool` - **classmethod** - `IsInterfaceInputName(name) -> bool` - **classmethod** - `IsSourceConnectionFromBaseMaterial()` - Returns true if the connection to this Input's source, as returned by GetConnectedSource() , is authored across a specializes arc, which is used to denote a base material. - `Set(value, time)` - Set a value for the Input at `time`. - `SetConnectability(connectability)` - Set the connectability of the Input. - `SetConnectedSources(sourceInfos)` - Connects this Input to the given sources, `sourceInfos`. - `SetDisplayGroup(displayGroup)` - Set the displayGroup metadata for this Input, i.e. - `SetDocumentation(docs)` - Set documentation string for this Input. - `SetRenderType(renderType)` - Specify an alternative, renderer-specific type to use when emitting/translating this Input, rather than translating based on its GetTypeName(). - `SetSdrMetadata(sdrMetadata)` - Specify the SdrMetadata for this Input. | 方法 | 描述 | | --- | --- | | Authors the given `sdrMetadata` value on this Input at the current EditTarget. | Authors the given `sdrMetadata` value on this Input at the current EditTarget. | | Sets the value corresponding to `key` to the given string `value`, in the Input's "sdrMetadata" dictionary at the current EditTarget. | Sets the value corresponding to `key` to the given string `value`, in the Input's "sdrMetadata" dictionary at the current EditTarget. | ### CanConnect Determines whether this Input can be connected to the given source attribute, which can be an input or an output. #### Parameters - **source** (Attribute) CanConnect(sourceInput) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **sourceInput** (Input) CanConnect(sourceOutput) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **sourceOutput** (Output) ### ClearConnectability Clears any authored connectability on the Input. ### ClearSdrMetadata Clears any "sdrMetadata" value authored on the Input in the current EditTarget. ### ClearSdrMetadataByKey Clears the entry corresponding to the given `key` in the "sdrMetadata" dictionary authored in the current EditTarget. #### Parameters - **key** (str) ### ClearSource Clears any source on the Input. ### Deprecated ### ClearSources Clears sources for this Input in the current UsdEditTarget. Most of the time, what you probably want is DisconnectSource() rather than this function. UsdShadeConnectableAPI::ClearSources ### ConnectToSource Authors a connection for this Input. `source` is a struct that describes the upstream source attribute with all the information necessary to make a connection. See the documentation for UsdShadeConnectionSourceInfo. `mod` describes the operation that should be applied to the list of connections. By default the new connection will replace any existing connections, but it can add to the list of connections to represent multiple input connections. `true` if a connection was created successfully. `false` if this input or `source` is invalid. This method does not verify the connectability of the shading attribute to the source. Clients must invoke CanConnect() themselves to ensure compatibility. The source shading attribute is created if it doesn’t exist already. UsdShadeConnectableAPI::ConnectToSource Parameters: - **source** (ConnectionSourceInfo) – - **mod** (ConnectionModification) – ConnectToSource(source, sourceName, sourceType, typeName) -> bool Deprecated This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Parameters: - **source** (ConnectableAPI) – - **sourceName** (str) – - **sourceType** (AttributeType) – - **typeName** (ValueTypeName) – ConnectToSource(sourcePath) -> bool Authors a connection for this Input to the source at the given path. UsdShadeConnectableAPI::ConnectToSource Parameters: - **sourcePath** (Path) – ConnectToSource(sourceInput) -> bool Connects this Input to the given input, `sourceInput`. UsdShadeConnectableAPI::ConnectToSource Parameters: - **sourceInput** – ## 方法和参数说明 ### 输入源连接 - **sourceInput** (**Input**) – ### 连接到源 - ConnectToSource(sourceOutput) -> bool - Connects this Input to the given output, `sourceOutput`. - UsdShadeConnectableAPI::ConnectToSource - **sourceOutput** (**Output**) – ### 断开源连接 - **DisconnectSource** (`sourceAttr`) -> bool - Disconnect source for this Input. - If `sourceAttr` is valid, only a connection to the specified attribute is disconnected, otherwise all connections are removed. - UsdShadeConnectableAPI::DisconnectSource - **sourceAttr** (**Attribute**) – ### 获取属性值 - **Get** (`value`, `time`) -> bool - Convenience wrapper for the templated UsdAttribute::Get(). - **value** (**T**) – - **time** (**TimeCode**) – - Get(value, time) -> bool - Convenience wrapper for VtValue version of UsdAttribute::Get(). - **value** (**VtValue**) – - **time** (**TimeCode**) – ### 获取属性 - **GetAttr** () -> **Attribute** - Explicit UsdAttribute extractor. ### 获取基础名称 - **GetBaseName** () -> **str** - Returns the name of the input. - We call this the base name since it strips off the "inputs:" namespace prefix from the attribute name, and returns it. ### 获取连接能力 - **GetConnectability** () -> **Connectability** - Returns the connectability of the input. - This method checks if the input can be connected to other outputs. ### GetConnectability Returns the connectability of the Input. SetConnectability() ### GetConnectedSource Deprecated Parameters: - **source** (ConnectableAPI) – - **sourceName** (str) – - **sourceType** (AttributeType) – ### GetConnectedSources Finds the valid sources of connections for the Input. `invalidSourcePaths` is an optional output parameter to collect the invalid source paths that have not been reported in the returned vector. Returns a vector of `UsdShadeConnectionSourceInfo` structs with information about each upstream attribute. If the vector is empty, there have been no valid connections. A valid connection requires the existence of the source attribute and also requires that the source prim is UsdShadeConnectableAPI compatible. The python wrapping returns a tuple with the valid connections first, followed by the invalid source paths. UsdShadeConnectableAPI::GetConnectedSources Parameters: - **invalidSourcePaths** (list[SdfPath]) – ### GetDisplayGroup Get the displayGroup metadata for this Input, i.e. hint for the location and nesting of the attribute. UsdProperty::GetDisplayGroup() , UsdProperty::GetNestedDisplayGroup() ### GetDocumentation Get documentation string for this Input. UsdObject::GetDocumentation() ### GetFullName Get the full name of the Input. ## Methods ### Get the name of the attribute associated with the Input. ### GetPrim - **Description**: Get the prim that the input belongs to. ### GetRawConnectedSourcePaths - **Deprecated** - **Description**: Returns the "raw" (authored) connected source paths for this Input. - **Parameters**: - **sourcePaths** (list[SdfPath]) – ### GetRenderType - **Description**: Return this Input’s specialized renderType, or an empty token if none was authored. - **Related**: SetRenderType() ### GetSdrMetadata - **Description**: Returns this Input’s composed "sdrMetadata" dictionary as a NdrTokenMap. ### GetSdrMetadataByKey - **Description**: Returns the value corresponding to `key` in the composed **sdrMetadata** dictionary. - **Parameters**: - **key** (str) – ### GetTypeName - **Description**: Get the "scene description" value type name of the attribute associated with the Input. ### GetValueProducingAttribute - **Deprecated** - **Description**: <p> in favor of calling GetValueProducingAttributes <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> attrType ( <em> AttributeType ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.Input.GetValueProducingAttributes"> <span class="sig-name descname"> <span class="pre"> GetValueProducingAttributes <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> shaderOutputsOnly <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> list <span class="p"> <span class="pre"> [ <span class="pre"> UsdShadeAttribute <span class="p"> <span class="pre"> ] <dd> <p> Find what is connected to this Input recursively. <p> UsdShadeUtils::GetValueProducingAttributes <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> shaderOutputsOnly ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.Input.HasConnectedSource"> <span class="sig-name descname"> <span class="pre"> HasConnectedSource <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Returns true if and only if this Input is currently connected to a valid (defined) source. <p> UsdShadeConnectableAPI::HasConnectedSource <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.Input.HasRenderType"> <span class="sig-name descname"> <span class="pre"> HasRenderType <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Return true if a renderType has been specified for this Input. <p> SetRenderType() <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.Input.HasSdrMetadata"> <span class="sig-name descname"> <span class="pre"> HasSdrMetadata <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Returns true if the Input has a non-empty composed”sdrMetadata”dictionary value. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.Input.HasSdrMetadataByKey"> <span class="sig-name descname"> <span class="pre"> HasSdrMetadataByKey <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> key <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Returns true if there is a value corresponding to the given <code class="docutils literal notranslate"> <span class="pre"> key in the composed”sdrMetadata”dictionary. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> key ( <em> str ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.Input.IsInput"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> IsInput <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> <strong> classmethod IsInput(attr) -&gt; bool <p> Test whether a given UsdAttribute represents a valid Input, which implies that creating a UsdShadeInput from the attribute will succeed. <p> Success implies that <code class="docutils literal notranslate"> <span class="pre"> attr.IsDefined() is true. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> attr ( <em> Attribute ) – ### IsInterfaceInputName ```python classmethod IsInterfaceInputName(name) -> bool ``` Test if this name has a namespace that indicates it could be an input. **Parameters** - **name** (str) – ### IsSourceConnectionFromBaseMaterial ```python IsSourceConnectionFromBaseMaterial() -> bool ``` Returns true if the connection to this Input’s source, as returned by GetConnectedSource(), is authored across a specializes arc, which is used to denote a base material. UsdShadeConnectableAPI::IsSourceConnectionFromBaseMaterial ### Set ```python Set(value, time) -> bool ``` Set a value for the Input at `time`. **Parameters** - **value** (VtValue) – - **time** (TimeCode) – --- ```python Set(value, time) -> bool ``` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Set a value of the Input at `time`. **Parameters** - **value** (T) – - **time** (TimeCode) – ### SetConnectability ```python SetConnectability(connectability) -> bool ``` Set the connectability of the Input. In certain shading data models, there is a need to distinguish which inputs **can** vary over a surface from those that must be **uniform**. This is accomplished in UsdShade by limiting the connectability of the input. This is done by setting the "connectability" metadata on the associated attribute. Connectability of an Input can be set to UsdShadeTokens->full or UsdShadeTokens->interfaceOnly. - **full** implies that the Input can be connected to any other Input or Output. - **interfaceOnly** implies that the Input can only be connected to a NodeGraph Input (which represents an interface override, not a render-time dataflow connection), or another Input whose connectability is also "interfaceOnly". The default connectability of an input is UsdShadeTokens->full. **Parameters** - **connectability** (str) – ``` ### SetConnectedSources ```SetConnectedSources```(```sourceInfos```) → ```bool``` Connects this Input to the given sources, ```sourceInfos```. UsdShadeConnectableAPI::SetConnectedSources **Parameters** - **sourceInfos** (list [ConnectionSourceInfo]) – ### SetDisplayGroup ```SetDisplayGroup```(```displayGroup```) → ```bool``` Set the displayGroup metadata for this Input, i.e. hinting for the location and nesting of the attribute. Note for an input representing a nested SdrShaderProperty, its expected to have the scope delimited by a”:”. UsdProperty::SetDisplayGroup() , UsdProperty::SetNestedDisplayGroup() SdrShaderProperty::GetPage() **Parameters** - **displayGroup** (str) – ### SetDocumentation ```SetDocumentation```(```docs```) → ```bool``` Set documentation string for this Input. UsdObject::SetDocumentation() **Parameters** - **docs** (str) – ### SetRenderType ```SetRenderType```(```renderType```) → ```bool``` Specify an alternative, renderer-specific type to use when emitting/translating this Input, rather than translating based on its GetTypeName(). For example, we set the renderType to”struct”for Inputs that are of renderman custom struct types. true on success. **Parameters** - **renderType** (str) – ### SetSdrMetadata ```SetSdrMetadata```(```sdrMetadata```) → ```None``` Authors the given ```sdrMetadata``` value on this Input at the current EditTarget. **Parameters** - **sdrMetadata** (NdrTokenMap) – ### SetSdrMetadataByKey ```python SetSdrMetadataByKey(key, value) -> None ``` Sets the value corresponding to `key` to the given string `value`, in the Input’s "sdrMetadata" dictionary at the current EditTarget. #### Parameters - **key** (str) – - **value** (str) – ### Material ```python class pxr.UsdShade.Material ``` A Material provides a container into which multiple "render targets" can add data that defines a "shading material" for a renderer. Typically this consists of one or more UsdRelationship properties that target other prims of type `Shader` - though a target/client is free to add any data that is suitable. We **strongly advise** that all targets adopt the convention that all properties be prefixed with a namespace that identifies the target, e.g. "rel ri:surface = In the UsdShading model, geometry expresses a binding to a single Material or to a set of Materials partitioned by UsdGeomSubsets defined beneath the geometry; it is legal to bind a Material at the root (or other sub-prim) of a model, and then bind a different Material to individual gprims, but the meaning of inheritance and "ancestral overriding" of Material bindings is left to each render-target to determine. Since UsdGeom has no concept of shading, we provide the API for binding and unbinding geometry on the API schema UsdShadeMaterialBindingAPI. The entire power of USD VariantSets and all the other composition operators can be leveraged when encoding shading variation. UsdShadeMaterial provides facilities for a particular way of building "Material variants" in which neither the identity of the Materials themselves nor the geometry Material-bindings need to change - instead we vary the targeted networks, interface values, and even parameter values within a single variantSet. See Authoring Material Variations for more details. UsdShade requires that all of the shaders that "belong" to the Material live under the Material in namespace. This supports powerful, easy reuse of Materials, because it allows us to **reference** a Material from one asset (the asset might be a module of Materials) into another asset: USD references compose all descendant prims of the reference target into the referencer’s namespace, which means that all of the referenced Material’s shader networks will come along with the Material. When referenced in this way, Materials can also be instanced, for ease of deduplication and compactness. Finally, Material encapsulation also allows us to specialize child materials from parent materials. For any described attribute `Fallback Value` or `Allowed Values` below that are text/tokens, the actual token is published and defined in UsdShadeTokens. So to set an attribute to the value "rightHanded", use UsdShadeTokens->rightHanded as the value. **Methods:** - **ClearBaseMaterial** () - Clear the base Material of this Material. - **ComputeDisplacementSource** (renderContext, ...) - Deprecated - **ComputeSurfaceSource** (renderContext, ...) - Deprecated - **ComputeVolumeSource** (renderContext, ...) - Deprecated - **CreateDisplacementAttr** (defaultValue, ...) - (Description not provided in the HTML snippet) See GetDisplacementAttr() , and also Create vs Get Property Methods for when to use Get vs Create. CreateDisplacementOutput(renderContext) Creates and returns the "displacement" output on this material for the specified renderContext. classmethod CreateMasterMaterialVariant(masterPrim, MaterialPrims, masterVariantSetName) -> bool See GetSurfaceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. CreateSurfaceOutput(renderContext) Creates and returns the "surface" output on this material for the specified renderContext. See GetVolumeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. CreateVolumeOutput(renderContext) Creates and returns the "volume" output on this material for the specified renderContext. classmethod Define(stage, path) -> Material classmethod Get(stage, path) -> Material GetBaseMaterial() Get the path to the base Material of this Material. GetBaseMaterialPath() Get the base Material of this Material. GetDisplacementAttr() Represents the universal "displacement" output terminal of a material. GetDisplacementOutput(renderContext) Returns the "displacement" output of this material for the specified renderContext. GetDisplacementOutputs() Returns the "displacement" outputs of this material for all available renderContexts. <p> GetEditContextForVariant <p> Helper function for configuring a UsdStage 's UsdEditTarget to author Material variations. <p> GetMaterialVariant <p> Return a UsdVariantSet object for interacting with the Material variant variantSet. <p> GetSchemaAttributeNames <p> classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <p> GetSurfaceAttr <p> Represents the universal"surface"output terminal of a material. <p> GetSurfaceOutput(renderContext) <p> Returns the"surface"output of this material for the specified renderContext. <p> GetSurfaceOutputs <p> Returns the"surface"outputs of this material for all available renderContexts. <p> GetVolumeAttr <p> Represents the universal"volume"output terminal of a material. <p> GetVolumeOutput(renderContext) <p> Returns the"volume"output of this material for the specified renderContext. <p> GetVolumeOutputs <p> Returns the"volume"outputs of this material for all available renderContexts. <p> HasBaseMaterial <p> <p> SetBaseMaterial(baseMaterial) <p> Set the base Material of this Material. <p> SetBaseMaterialPath(baseMaterialPath) <p> Set the path to the base Material of this Material. <dl> <dt> ClearBaseMaterial <dd> <p> Clear the base Material of this Material. <dl> <dt> ComputeDisplacementSource( <em> <span class="n"> ### ComputeDisplacementSource **Deprecated** Use the form that takes a TfTokenVector or renderContexts. **Parameters** - **renderContext** (str) – - **sourceName** (str) – - **sourceType** (AttributeType) – ComputeDisplacementSource(contextVector, sourceName, sourceType) -> Shader Computes the resolved "displacement" output source for the given `contextVector`. Using the earliest renderContext in the contextVector that produces a valid Shader object. If a "displacement" output corresponding to each of the renderContexts does not exist or is not connected to a valid source, then this checks the universal displacement output. Returns an empty Shader object if there is no valid displacement output source for any of the renderContexts in the `contextVector`. The python version of this method returns a tuple containing three elements (the source displacement shader, sourceName, sourceType). ### ComputeSurfaceSource **Deprecated** Use the form that takes a TfTokenVector or renderContexts. **Parameters** - **renderContext** (str) – - **sourceName** (str) – - **sourceType** (AttributeType) – ComputeSurfaceSource(contextVector, sourceName, sourceType) -> Shader Computes the resolved "surface" output source for the given `contextVector`. Using the earliest renderContext in the contextVector that produces a valid Shader object. If a "surface" output corresponding to each of the renderContexts does not exist or is not connected to a valid source, then this checks the universal surface output. Returns an empty Shader object if there is no valid surface output source for any of the renderContexts in the `contextVector`. . The python version of this method returns a tuple containing three elements (the source surface shader, sourceName, sourceType). **Parameters** - **contextVector** (`list` [`TfToken`]) – - **sourceName** (`str`) – - **sourceType** (`AttributeType`) – **Deprecated** Use the form that takes a TfTokenVector or renderContexts **Parameters** - **renderContext** (`str`) – - **sourceName** (`str`) – - **sourceType** (`AttributeType`) – ComputeVolumeSource(contextVector, sourceName, sourceType) -> Shader Computes the resolved "volume" output source for the given `contextVector`. Using the earliest renderContext in the contextVector that produces a valid Shader object. If a "volume" output corresponding to each of the renderContexts does not exist **or** is not connected to a valid source, then this checks the `universal` volume output. Returns an empty Shader object if there is no valid `volume` output source for any of the renderContexts in the `contextVector`. The python version of this method returns a tuple containing three elements (the source volume shader, sourceName, sourceType). **Parameters** - **contextVector** (`list` [`TfToken`]) – - **sourceName** (`str`) – - **sourceType** (`AttributeType`) – **See GetDisplacementAttr()**, and also **Create vs Get Property Methods** for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateDisplacementOutput ```python CreateDisplacementOutput(renderContext) -> Output ``` Creates and returns the "displacement" output on this material for the specified `renderContext`. If the output already exists on the material, it is returned and no authoring is performed. The returned output will always have the requested renderContext. #### Parameters - **renderContext** (`str`) – ### CreateMasterMaterialVariant ```python classmethod CreateMasterMaterialVariant(masterPrim, MaterialPrims, masterVariantSetName) -> bool ``` Create a variantSet on `masterPrim` that will set the MaterialVariant on each of the given `MaterialPrims`. The variantSet, whose name can be specified with `masterVariantSetName` and defaults to the same MaterialVariant name created on Materials by GetEditContextForVariant(), will have the same variants as the Materials, and each Master variant will set every `MaterialPrims'` MaterialVariant selection to the same variant as the master. Thus, it allows all Materials to be switched with a single variant selection, on `masterPrim`. If `masterPrim` is an ancestor of any given member of `MaterialPrims`, then we will author variant selections directly on the MaterialPrims. However, it is often preferable to create a master MaterialVariant in a separately rooted tree from the MaterialPrims, so that it can be layered more strongly on top of the Materials. Therefore, for any MaterialPrim in a different tree than masterPrim, we will create "overs" as children of masterPrim that recreate the path to the MaterialPrim, substituting masterPrim’s full path for the MaterialPrim’s root path component. Upon successful completion, the new variantSet we created on `masterPrim` will have its variant selection authored to the "last" variant (determined lexicographically). It is up to the calling client to either UsdVariantSet::ClearVariantSelection() on `masterPrim`, or set the selection to the desired default setting. Return `true` on success. It is an error if any of `Materials` have a different set of variants for the MaterialVariant than the others. #### Parameters - **masterPrim** (`Prim`) – - **MaterialPrims** (`list[Prim]`) – - **masterVariantSetName** (`str`) – ``` ( defaultValue , writeSparsely ) → Attribute See GetSurfaceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ( renderContext ) → Output Creates and returns the”surface”output on this material for the specified `renderContext`. If the output already exists on the material, it is returned and no authoring is performed. The returned output will always have the requested renderContext. **Parameters** - **renderContext** (str) – ( defaultValue , writeSparsely ) → Attribute See GetVolumeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ( renderContext ) → Output ### pxr.UsdShade.Material.CreateVolumeOutput Creates and returns the "volume" output on this material for the specified `renderContext`. If the output already exists on the material, it is returned and no authoring is performed. The returned output will always have the requested renderContext. #### Parameters - **renderContext** (`str`) – ### pxr.UsdShade.Material.Define **classmethod** Define(stage, path) -> Material Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined()) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. #### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### pxr.UsdShade.Material.Get **classmethod** Get(stage, path) -> Material Return a UsdShadeMaterial holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdShadeMaterial(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### pxr.UsdShade.Material.GetBaseMaterial ``` ## Method Descriptions ### Get the path to the base Material of this Material. - If there is no base Material, an empty Material is returned ### Get the base Material of this Material. - If there is no base Material, an empty path is returned ### Represents the universal "displacement" output terminal of a material. - Declaration: ``` token outputs:displacement ``` - C++ Type: TfToken - Usd Type: SdfValueTypeNames->Token ### Returns the "displacement" output of this material for the specified renderContext. - The returned output will always have the requested renderContext. - An invalid output is returned if an output corresponding to the requested specific-renderContext does not exist. - Parameters: - **renderContext** (str) – ### Returns the "displacement" outputs of this material for all available renderContexts. - The returned vector will include all authored "displacement" outputs with the universal renderContext output first, if present. Outputs are returned regardless of whether they are connected to a valid source. ### Helper function for configuring a UsdStage's UsdEditTarget to author Material variations. - Takes care of creating the Material variantSet and specified variant, if necessary. Let’s assume that we are authoring Materials into the Stage’s current UsdEditTarget, and that we are iterating over the variations of a UsdShadeMaterial **clothMaterial** , and **currVariant** is the variant we are processing (e.g.”denim”). In C++, then, we would use the following pattern: ```cpp { UsdEditContext ctxt(clothMaterial.GetEditContextForVariant(currVariant)); // All USD mutation of the UsdStage on which clothMaterial sits will // now go "inside" the currVariant of the "MaterialVariant" variantSet } ``` In python, the pattern is: ```python with clothMaterial.GetEditContextForVariant(currVariant): # Now sending mutations to currVariant ``` If ``` layer ``` is specified, then we will use it, rather than the stage’s current UsdEditTarget ‘s layer as the destination layer for the edit context we are building. If ``` layer ``` does not actually contribute to the Material prim’s definition, any editing will have no effect on this Material. **Note:** As just stated, using this method involves authoring a selection for the MaterialVariant in the stage’s current EditTarget. When client is done authoring variations on this prim, they will likely want to either UsdVariantSet::SetVariantSelection() to the appropriate default selection, or possibly UsdVariantSet::ClearVariantSelection() on the UsdShadeMaterial::GetMaterialVariant() UsdVariantSet. UsdVariantSet::GetVariantEditContext() **Parameters** - **MaterialVariantName** (**str**) – - **layer** (**Layer**) – **GetMaterialVariant**() → **VariantSet** Return a UsdVariantSet object for interacting with the Material variant variantSet. **static GetSchemaAttributeNames**(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (**bool**) – **GetSurfaceAttr**() → **Attribute** Represents the universal”surface”output terminal of a material. Declaration ``` token outputs:surface ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token **GetSurfaceOutput**(renderContext) → **Output** Returns the”surface”output of this material for the specified renderContext. The returned output will always have the requested renderContext. An invalid output is returned if an output corresponding to the requested specific-renderContext does not exist. UsdShadeMaterial::ComputeSurfaceSource() Parameters ---------- - **renderContext** (`str`) – GetSurfaceOutputs ----------------- - **GetSurfaceOutputs**() - Returns: list[Output] - Returns the "surface" outputs of this material for all available renderContexts. - The returned vector will include all authored "surface" outputs with the universal renderContext output first, if present. Outputs are returned regardless of whether they are connected to a valid source. GetVolumeAttr ------------- - **GetVolumeAttr**() - Returns: Attribute - Represents the universal "volume" output terminal of a material. - Declaration: ``` token outputs:volume ``` - C++ Type: TfToken - Usd Type: SdfValueTypeNames->Token GetVolumeOutput --------------- - **GetVolumeOutput**(renderContext) - Returns: Output - Returns the "volume" output of this material for the specified renderContext. - The returned output will always have the requested renderContext. - An invalid output is returned if an output corresponding to the requested specific-renderContext does not exist. - UsdShadeMaterial::ComputeVolumeSource() - Parameters: - **renderContext** (`str`) – GetVolumeOutputs ---------------- - **GetVolumeOutputs**() - Returns: list[Output] - Returns the "volume" outputs of this material for all available renderContexts. - The returned vector will include all authored "volume" outputs with the universal renderContext output first, if present. Outputs are returned regardless of whether they are connected to a valid source. HasBaseMaterial --------------- - **HasBaseMaterial**() - Returns: bool SetBaseMaterial --------------- - **SetBaseMaterial**(baseMaterial) - Returns: ``` Set the base Material of this Material. An empty Material is equivalent to clearing the base Material. **Parameters** - **baseMaterial** (**Material**) – Set the path to the base Material of this Material. An empty path is equivalent to clearing the base Material. **Parameters** - **baseMaterialPath** (**Path**) – **class** pxr.UsdShade.MaterialBindingAPI UsdShadeMaterialBindingAPI is an API schema that provides an interface for binding materials to prims or collections of prims (represented by UsdCollectionAPI objects). In the USD shading model, each renderable gprim computes a single **resolved Material** that will be used to shade the gprim (exceptions, of course, for gprims that possess UsdGeomSubsets, as each subset can be shaded by a different Material). A gprim **and each of its ancestor prims** can possess, through the MaterialBindingAPI, both a **direct** binding to a Material, and any number of **collection-based** bindings to Materials; each binding can be generic or declared for a particular **purpose**, and given a specific **binding strength**. It is the process of”material resolution”(see UsdShadeMaterialBindingAPI_MaterialResolution) that examines all of these bindings, and selects the one Material that best matches the client’s needs. The **purpose** of a material binding is encoded in the name of the binding relationship. - **UsdShadeTokens->full**: to be used when the purpose of the render is entirely to visualize the truest representation of a scene, considering all lighting and material information, at highest fidelity. - **UsdShadeTokens->preview**: to be used when the render is in service of a goal other than a high fidelity”full”render (such as scene manipulation, modeling, or realtime playback). Latency and speed are generally of greater concern for preview renders, therefore preview materials are generally designed to be”lighterweight”compared to full materials. A binding can also have no specific purpose at all, in which case, it is considered to be the fallback or all-purpose binding (denoted by the empty-valued token **UsdShadeTokens->allPurpose**). In the case of a direct binding, the **allPurpose** binding is represented by the relationship named **“material:binding”**. Special-purpose direct bindings are represented by relationships named **“material:binding: *purpose***. A direct binding relationship must have a single target path that points to a **UsdShadeMaterial**. In the case of a collection-based binding, the **allPurpose** binding is represented by a relationship named”material:binding:collection:<i>bindingName **Note:** Both **bindingName** and **purpose** must be non-namespaced tokens. This allows us to know the role of a binding relationship simply from the number of tokens in it. > - **Two tokens**: the fallback, "all purpose", direct binding, > **material:binding** > - **Three tokens**: a purpose-restricted, direct, fallback > binding, e.g. material:binding:preview > - **Four tokens**: an all-purpose, collection-based binding, e.g. > material:binding:collection:metalBits > - **Five tokens**: a purpose-restricted, collection-based binding, > e.g. material:binding:collection:full:metalBits A **binding-strength** value is used to specify whether a binding authored on a prim should be weaker or stronger than bindings that appear lower in namespace. We encode the binding strength with as token-valued metadata **‘bindMaterialAs’** for future flexibility, even though for now, there are only two possible values: **UsdShadeTokens->weakerThanDescendants** and **UsdShadeTokens->strongerThanDescendants**. When binding-strength is not authored (i.e. empty) on a binding-relationship, the default behavior matches UsdShadeTokens->weakerThanDescendants. If a material binding relationship is a built-in property defined as part of a typed prim’s schema, a fallback value should not be provided for it. This is because the "material resolution" algorithm only considers **authored** properties. **Classes:** | Class Name | Description | |------------|-------------| | CollectionBinding | | | DirectBinding | | **Methods:** | Method Name | Description | |-------------|-------------| | AddPrimToBindingCollection(prim, ...) | Adds the specified `prim` to the collection targeted by the binding relationship corresponding to given `bindingName` and `materialPurpose`. | | Apply(prim) -> MaterialBindingAPI | **classmethod** Apply(prim) -> MaterialBindingAPI | | Bind(material, bindingStrength, materialPurpose) | Authors a direct binding to the given `material` on this prim. | | CanApply(prim, whyNot) -> bool | **classmethod** CanApply(prim, whyNot) -> bool | | CanContainPropertyName(name) -> bool | **classmethod** CanContainPropertyName(name) -> bool | | ComputeBoundMaterial(bindingsCache, ...) | Computes the resolved bound material for this prim, for the given material purpose. | | ComputeBoundMaterials(...) | | <p> <strong> classmethod ComputeBoundMaterials(prims, materialPurpose, bindingRels) -> list[Material] <p> CreateMaterialBindSubset(subsetName, ...) <p> Creates a GeomSubset named <code> subsetName with element type, <code> elementType and familyName <strong> materialBind **below this prim.** <p> <strong> classmethod Get(stage, path) -> MaterialBindingAPI <p> GetCollectionBindingRel(bindingName, ...) <p> Returns the collection-based material-binding relationship with the given <code> bindingName and <code> materialPurpose on this prim. <p> GetCollectionBindingRels(materialPurpose) <p> Returns the list of collection-based material binding relationships on this prim for the given material purpose, <code> materialPurpose . <p> GetCollectionBindings(materialPurpose) <p> Returns all the collection-based bindings on this prim for the given material purpose. <p> GetDirectBinding(materialPurpose) <p> Computes and returns the direct binding for the given material purpose on this prim. <p> GetDirectBindingRel(materialPurpose) <p> Returns the direct material-binding relationship on this prim for the given material purpose. <p> GetMaterialBindSubsets() <p> Returns all the existing GeomSubsets with familyName=UsdShadeTokens->materialBind below this prim. <p> GetMaterialBindSubsetsFamilyType() <p> Returns the familyType of the family of"materialBind"GeomSubsets on this prim. <p> <strong> classmethod GetMaterialBindingStrength(bindingRel) -> str <p> <strong> classmethod GetMaterialPurposes() -> list[TfToken] <p> GetResolvedTargetPathFromBindingRel() | Method | Description | |--------|-------------| | `classmethod GetResolvedTargetPathFromBindingRel(bindingRel) -> Path` | GetResolvedTargetPathFromBindingRel(bindingRel) -> Path | | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | `RemovePrimFromBindingCollection(prim, ...)` | Removes the specified `prim` from the collection targeted by the binding relationship corresponding to given `bindingName` and `materialPurpose`. | | `SetMaterialBindSubsetsFamilyType(familyType)` | Author the familyType of the "materialBind" family of GeomSubsets on this prim. | | `classmethod SetMaterialBindingStrength(bindingRel, bindingStrength) -> bool` | SetMaterialBindingStrength(bindingRel, bindingStrength) -> bool | | `UnbindAllBindings()` | Unbinds all direct and collection-based bindings on this prim. | | `UnbindCollectionBinding(bindingName, ...)` | Unbinds the collection-based binding with the given `bindingName`, for the given `materialPurpose` on this prim. | | `UnbindDirectBinding(materialPurpose)` | Unbinds the direct binding for the given material purpose (`materialPurpose`) on this prim. | ### CollectionBinding **Methods:** | Method | Description | |--------|-------------| | `GetBindingRel` | | | `GetCollection` | | | `GetCollectionPath` | | | `GetMaterial` | | ``` GetMaterial ``` ``` GetMaterialPath ``` ``` IsCollectionBindingRel ``` ``` IsValid ``` ``` GetBindingRel ``` ``` GetCollection ``` ``` GetCollectionPath ``` ``` GetMaterial ``` ``` GetMaterialPath ``` ``` IsCollectionBindingRel ``` ``` IsValid ``` ``` DirectBinding ``` ``` GetBindingRel ``` ``` GetMaterial ``` <p> GetMaterialPath <p> GetMaterialPurpose <dl> <dt> GetBindingRel() <dd> <dl> <dt> GetMaterial() <dd> <dl> <dt> GetMaterialPath() <dd> <dl> <dt> GetMaterialPurpose() <dd> <dl> <dt> AddPrimToBindingCollection(prim, bindingName, materialPurpose) -> bool <dd> <p> Adds the specified prim to the collection targeted by the binding relationship corresponding to given bindingName and materialPurpose. <p> If the collection-binding relationship doesn’t exist or if the targeted collection already includes the prim, then this does nothing and returns true. <p> If the targeted collection does not include prim (or excludes it explicitly), then this modifies the collection by adding the prim to it (by invoking UsdCollectionAPI::AddPrim()). <dl> <dt> Parameters <dd> <ul> <li> <strong>prim <li> <strong>bindingName <li> <strong>materialPurpose <dl> <dt> static Apply() <dd> <p> classmethod Apply(prim) -> MaterialBindingAPI <p> Applies this single-apply API schema to the given prim. valued, listOp metadata **apiSchemas** on the prim. A valid UsdShadeMaterialBindingAPI object is returned upon success. An invalid (or empty) UsdShadeMaterialBindingAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. UsdPrim::GetAppliedSchemas() UsdPrim::HasAPI() UsdPrim::CanApplyAPI() UsdPrim::ApplyAPI() UsdPrim::RemoveAPI() **Parameters** - **prim** (**Prim**) – **Bind**(material, bindingStrength, materialPurpose) -> bool Authors a direct binding to the given `material` on this prim. If `bindingStrength` is UsdShadeTokens->fallbackStrength, the value UsdShadeTokens->weakerThanDescendants is authored sparsely. To stamp out the bindingStrength value explicitly, clients can pass in UsdShadeTokens->weakerThanDescendants or UsdShadeTokens->strongerThanDescendants directly. If `materialPurpose` is specified and isn’t equal to UsdShadeTokens->allPurpose, the binding only applies to the specified material purpose. Note that UsdShadeMaterialBindingAPI is a SingleAppliedAPI schema which when applied updates the prim definition accordingly. This information on the prim definition is helpful in multiple queries and more performant. Hence its recommended to call UsdShadeMaterialBindingAPI::Apply() when Binding a material. Returns true on success, false otherwise. **Parameters** - **material** (**Material**) – - **bindingStrength** (**str**) – - **materialPurpose** (**str**) – Bind(collection, material, bindingName, bindingStrength, materialPurpose) -> bool Authors a collection-based binding, which binds the given `material` to the given `collection` on this prim. `bindingName` establishes an identity for the binding that is unique on the prim. Attempting to establish two collection bindings of the same name on the same prim will result in the first binding simply being overridden. If `bindingName` is empty, it is set to the base-name of the collection being bound (which is the collection-name with any namespaces stripped out). If there are multiple collections with the same base-name being bound at the same prim, clients should pass in a unique binding name per binding, in order to preserve all bindings. The binding name used in constructing the collection-binding relationship name shoud not contain namespaces. Hence, a coding error is issued and no binding is authored if the provided value of `bindingName` is non-empty and contains namespaces. If `bindingStrength` is **UsdShadeTokens->fallbackStrength**, the value UsdShadeTokens->weakerThanDescendants is authored sparsely, i.e. only when there is an existing binding with a different bindingStrength. To stamp out the bindingStrength value explicitly, clients can pass in UsdShadeTokens->weakerThanDescendants or UsdShadeTokens->strongerThanDescendants directly. If `materialPurpose` is specified and isn’t equal to UsdShadeTokens->allPurpose, the binding only applies to the specified material purpose. Note that UsdShadeMaterialBindingAPI is a SingleAppliedAPI schema which when applied updates the prim definition accordingly. This information on the prim definition is helpful in multiple queries and more performant. Hence its recommended to call UsdShadeMaterialBindingAPI::Apply() when Binding a material. Returns true on success, false otherwise. **Parameters** - **collection** (**CollectionAPI**) – - **material** (**Material**) – - **bindingName** (**str**) – - **bindingStrength** (**str**) – - **materialPurpose** (**str**) – **Material** (str) – **bindingName** (str) – **bindingStrength** (str) – **materialPurpose** (str) – ### CanApply ```python classmethod CanApply(prim, whyNot) -> bool ``` Returns true if this **single-apply** API schema can be applied to the given `prim`. If this schema can not be applied to the prim, this returns false and, if provided, populates `whyNot` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. **Parameters** - **prim** (Prim) – - **whyNot** (str) – ### CanContainPropertyName ```python classmethod CanContainPropertyName(name) -> bool ``` Test whether a given `name` contains the "material:binding:" prefix. **Parameters** - **name** (str) – ### ComputeBoundMaterial ```python ComputeBoundMaterial(bindingsCache, collectionQueryCache, materialPurpose, bindingRel) -> Material ``` Computes the resolved bound material for this prim, for the given material purpose. This overload of ComputeBoundMaterial makes use of the BindingsCache (`bindingsCache`) and CollectionQueryCache (`collectionQueryCache`) that are passed in, to avoid redundant binding computations and computations of MembershipQuery objects for collections. When the goal is to compute the bound material for a range (or list) of prims, it is recommended to use this version of ComputeBoundMaterial(). Here’s how you could compute the bindings of a range of prims efficiently in C++: ```cpp std::vector<std::pair<UsdPrim, UsdShadeMaterial>> primBindings; UsdShadeMaterialBindingAPI::BindingsCache bindingsCache; UsdShadeMaterialBindingAPI::CollectionQueryCache collQueryCache; for (auto prim : UsdPrimRange(rootPrim)) { UsdShadeMaterial boundMaterial = UsdShadeMaterialBindingAPI(prim).ComputeBoundMaterial( &bindingsCache, &collQueryCache); if (boundMaterial) { primBindings.emplace_back({prim, boundMaterial}); } } ``` <span class="pre"> bindingRel is not null, then it is set to the”winning”binding relationship. Note the resolved bound material is considered valid if the target path of the binding relationship is a valid non-empty prim path. This makes sure winning binding relationship and the bound material remain consistent consistent irrespective of the presence/absence of prim at material path. For ascenario where ComputeBoundMaterial returns a invalid UsdShadeMaterial with a valid winning bindingRel, clients can use the static method UsdShadeMaterialBindingAPI::GetResolvedTargetPathFromBindingRel to get the path of the resolved target identified by the winning bindingRel. See Bound Material Resolution for details on the material resolution process. The python version of this method returns a tuple containing the bound material and the”winning”binding relationship. Parameters ---------- - **bindingsCache** (`BindingsCache`) – - **collectionQueryCache** (`CollectionQueryCache`) – - **materialPurpose** (`str`) – - **bindingRel** (`Relationship`) – ComputeBoundMaterial(materialPurpose, bindingRel) -> Material ---------------------------------------------------------- This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes the resolved bound material for this prim, for the given material purpose. This overload does not utilize cached MembershipQuery object. However, it only computes the MembershipQuery of every collection that bound in the ancestor chain at most once. If <code class="docutils literal notranslate"> <span class="pre"> bindingRel is not null, then it is set to the winning binding relationship. See Bound Material Resolution for details on the material resolution process. The python version of this method returns a tuple containing the bound material and the”winning”binding relationship. Parameters ---------- - **materialPurpose** (`str`) – - **bindingRel** (`Relationship`) – classmethod ComputeBoundMaterials(prims, materialPurpose, bindingRels) -> list[Material] ------------------------------------------------------------------------------------- Static API for efficiently and concurrently computing the resolved material bindings for a vector of UsdPrims, `prim` for the given `materialPurpose`. The size of the returned vector always matches the size of the input vector, `prim`. If a prim is not bound to any material, an invalid or empty UsdShadeMaterial is returned at the index corresponding to it. If the pointer `bindingRels` points to a valid vector, then it is populated with the set of all”winning”binding relationships. The python version of this method returns a tuple containing two lists - the bound materials and the corresponding”winning”binding relationships. Parameters ---------- - **prims** (`list[Prim]`) – - **materialPurpose** (`str`) – - **bindingRels** (`list[Relationship]`) – ### CreateMaterialBindSubset Creates a GeomSubset named `subsetName` with element type, `elementType`, and familyName **materialBind below this prim.** If a GeomSubset named `subsetName` already exists, then its familyName is updated to be UsdShadeTokens->materialBind and its indices (at default timeCode) are updated with the provided `indices` value before returning. This method forces the familyType of the "materialBind" family of subsets to UsdGeomTokens->nonOverlapping if it's unset or explicitly set to UsdGeomTokens->unrestricted. The default value `elementType` is UsdGeomTokens->face, as we expect materials to be bound most often to subsets of faces on meshes. #### Parameters - **subsetName** (str) – - **indices** (IntArray) – - **elementType** (str) – ### Get **classmethod** Get(stage, path) -> MaterialBindingAPI Return a UsdShadeMaterialBindingAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdShadeMaterialBindingAPI(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (Stage) – - **path** (Path) – ### GetCollectionBindingRel Returns the collection-based material-binding relationship with the given `bindingName` and `materialPurpose` on this prim. For info on `bindingName`, see UsdShadeMaterialBindingAPI::Bind(). The material purpose of the relationship that's returned will match the specified `materialPurpose`. #### Parameters - **bindingName** (str) – - **materialPurpose** (str) – ``` ### Parameters - **bindingName** (`str`) – - **materialPurpose** (`str`) – ### GetCollectionBindingRels ```python GetCollectionBindingRels(materialPurpose) -> list[Relationship] ``` Returns the list of collection-based material binding relationships on this prim for the given material purpose. The returned list of binding relationships will be in native property order. See `UsdPrim::GetPropertyOrder()`, `UsdPrim::SetPropertyOrder()`. Bindings that appear earlier in the property order are considered to be stronger than the ones that come later. See rule #6 in `UsdShadeMaterialBindingAPI_MaterialResolution`. #### Parameters - **materialPurpose** (`str`) – ### GetCollectionBindings ```python GetCollectionBindings(materialPurpose) -> list[CollectionBinding] ``` Returns all the collection-based bindings on this prim for the given material purpose. The returned CollectionBinding objects always have the specified `materialPurpose` (i.e. the all-purpose binding is not returned if a special purpose binding is requested). If one or more collection based bindings are to prims that are not Materials, this does not generate an error, but the corresponding Material(s) will be invalid (i.e. evaluate to false). The python version of this API returns a tuple containing the vector of CollectionBinding objects and the corresponding vector of binding relationships. The returned list of collection-bindings will be in native property order of the associated binding relationships. See `UsdPrim::GetPropertyOrder()`, `UsdPrim::SetPropertyOrder()`. Binding relationships that come earlier in the list are considered to be stronger than the ones that come later. See rule #6 in `UsdShadeMaterialBindingAPI_MaterialResolution`. #### Parameters - **materialPurpose** (`str`) – ### GetDirectBinding ```python GetDirectBinding(materialPurpose) -> DirectBinding ``` Computes and returns the direct binding for the given material purpose on this prim. The returned binding always has the specified `materialPurpose` (i.e. the all-purpose binding is not returned if a special purpose binding is requested). If the direct binding is to a prim that is not a Material, this does not generate an error, but the returned Material will be invalid (i.e. evaluate to false). #### Parameters - **materialPurpose** (`str`) – ### materialPurpose Returns the direct material-binding relationship on this prim for the given material purpose. The material purpose of the relationship that’s returned will match the specified `materialPurpose`. #### Parameters - **materialPurpose** (str) – ### GetMaterialBindSubsets Returns all the existing GeomSubsets with familyName=UsdShadeTokens->materialBind below this prim. ### GetMaterialBindSubsetsFamilyType Returns the familyType of the family of "materialBind" GeomSubsets on this prim. By default, materialBind subsets have familyType="nonOverlapping", but they can also be tagged as a "partition", using SetMaterialBindFaceSubsetsFamilyType(). UsdGeomSubset::GetFamilyNameAttr ### GetMaterialBindingStrength **classmethod** GetMaterialBindingStrength(bindingRel) -> str Resolves the 'bindMaterialAs' token-valued metadata on the given binding relationship and returns it. If the resolved value is empty, this returns the fallback value UsdShadeTokens->weakerThanDescendants. UsdShadeMaterialBindingAPI::SetMaterialBindingStrength() #### Parameters - **bindingRel** (Relationship) – ### GetMaterialPurposes **classmethod** GetMaterialPurposes() -> list[TfToken] Returns a vector of the possible values for the 'material purpose'. ### GetResolvedTargetPathFromBindingRel **classmethod** GetResolvedTargetPathFromBindingRel(bindingRel) -> Path returns the path of the resolved target identified by `bindingRel`. #### Parameters - **bindingRel** (Relationship) – ### GetSchemaAttributeNames ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (`bool`) – ### RemovePrimFromBindingCollection ```python RemovePrimFromBindingCollection(prim, bindingName, materialPurpose) -> bool ``` Removes the specified `prim` from the collection targeted by the binding relationship corresponding to given `bindingName` and `materialPurpose`. If the collection-binding relationship doesn’t exist or if the targeted collection does not include the `prim`, then this does nothing and returns true. If the targeted collection includes `prim`, then this modifies the collection by removing the prim from it (by invoking UsdCollectionAPI::RemovePrim()). This method can be used in conjunction with the Unbind*() methods (if desired) to guarantee that a prim has no resolved material binding. #### Parameters - **prim** (`Prim`) – - **bindingName** (`str`) – - **materialPurpose** (`str`) – ### SetMaterialBindSubsetsFamilyType ```python SetMaterialBindSubsetsFamilyType(familyType) -> bool ``` Author the `familyType` of the "materialBind" family of GeomSubsets on this prim. The default `familyType` is `UsdGeomTokens->nonOverlapping`. It can be set to `UsdGeomTokens->partition` to indicate that the entire imageable prim is included in the union of all the "materialBind" subsets. The family type should never be set to `UsdGeomTokens->unrestricted`, since it is invalid for a single piece of geometry (in this case, a subset) to be bound to more than one material. Hence, a coding error is issued if `familyType` is `UsdGeomTokens->unrestricted`. #### Parameters - **familyType** (`str`) – ### SetMaterialBindingStrength ```python classmethod SetMaterialBindingStrength() ``` SetMaterialBindingStrength(bindingRel, bindingStrength) -> bool Sets the 'bindMaterialAs' token-valued metadata on the given binding relationship. If `bindingStrength` is *UsdShadeTokens->fallbackStrength*, the value UsdShadeTokens->weakerThanDescendants is authored sparsely, i.e., only when there is a different existing bindingStrength value. To stamp out the bindingStrength value explicitly, clients can pass in UsdShadeTokens->weakerThanDescendants or UsdShadeTokens->strongerThanDescendants directly. Returns true on success, false otherwise. UsdShadeMaterialBindingAPI::GetMaterialBindingStrength() Parameters ---------- - **bindingRel** (Relationship) – - **bindingStrength** (str) – UnbindAllBindings() -> bool ------------------------- Unbinds all direct and collection-based bindings on this prim. UnbindCollectionBinding(bindingName, materialPurpose) -> bool -------------------------------------------------------------- Unbinds the collection-based binding with the given `bindingName`, for the given `materialPurpose` on this prim. It accomplishes this by blocking the targets of the associated binding relationship in the current edit target. If a binding was created without specifying a `bindingName`, then the correct `bindingName` to use for unbinding is the instance name of the targetted collection. Parameters ---------- - **bindingName** (str) – - **materialPurpose** (str) – UnbindDirectBinding(materialPurpose) -> bool -------------------------------------------- Unbinds the direct binding for the given material purpose (`materialPurpose`) on this prim. It accomplishes this by blocking the targets of the binding relationship in the current edit target. Parameters ---------- - **materialPurpose** (str) – class pxr.UsdShade.NodeDefAPI ----------------------------- UsdShadeNodeDefAPI is an API schema that provides attributes for a prim to select a corresponding Shader Node Definition ("Sdr Node"), as well as to look up a runtime entry for that shader node in the form of an SdrShaderNode. UsdShadeNodeDefAPI is intended to be a pre-applied API schema for any prim type that wants to refer to the SdrRegistry for further implementation details about the behavior of that prim. The primary use in UsdShade itself is as UsdShadeShader, which is a basis for material shading networks (UsdShadeMaterial), but this is intended to be used in other domains that also use the Sdr node mechanism. This schema provides properties that allow a prim to identify an external node definition, either by a direct identifier key into the SdrRegistry (info:id), an asset to be parsed by a suitable NdrParserPlugin (info:sourceAsset), or an inline source code that must also be parsed (info:sourceCode); as well as a selector attribute to determine which specifier is active (info:implementationSource). For any described attribute **Fallback Value** or **Allowed Values** below that are text/tokens, the actual token is published and defined in UsdShadeTokens. So to set an attribute to the value "rightHanded", use UsdShadeTokens->rightHanded as the value. **Methods:** | Method Name | Description | |-------------|-------------| | Apply(prim) -> NodeDefAPI | classmethod Apply(prim) -> NodeDefAPI | | CanApply(prim, whyNot) -> bool | classmethod CanApply(prim, whyNot) -> bool | | CreateIdAttr(defaultValue, writeSparsely) | See GetIdAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateImplementationSourceAttr(defaultValue, ...) | See GetImplementationSourceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | Get(stage, path) -> NodeDefAPI | classmethod Get(stage, path) -> NodeDefAPI | | GetIdAttr() | The id is an identifier for the type or purpose of the shader. | | GetImplementationSource() | Reads the value of info:implementationSource attribute and returns a token identifying the attribute that must be consulted to identify the shader's source program. | | GetImplementationSourceAttr() | Specifies the attribute that should be consulted to get the shader's implementation or its source code. | | GetSchemaAttributeNames(includeInherited) -> list[TfToken] | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | GetShaderId(id) | Fetches the shader's ID value from the info:id attribute, if the shader's info:implementationSource is **id**. | | GetShaderNodeForSourceType(sourceType) | This method attempts to ensure that there is a ShaderNode in the shader registry (i.e. | - `GetSourceAsset(sourceAsset, sourceType)` Fetches the shader's source asset value for the specified `sourceType` value from the **info: *sourceType*: sourceAsset** attribute, if the shader's **info:implementationSource** is **sourceAsset**. - `GetSourceAssetSubIdentifier(subIdentifier, ...)` Fetches the shader's sub-identifier for the source asset with the specified `sourceType` value from the **info: *sourceType*: sourceAsset:subIdentifier** attribute, if the shader's **info: implementationSource** is **sourceAsset**. - `GetSourceCode(sourceCode, sourceType)` Fetches the shader's source code for the specified `sourceType` value by reading the **info: *sourceType*: sourceCode** attribute, if the shader's **info:implementationSource** is **sourceCode**. - `SetShaderId(id)` Sets the shader's ID value. - `SetSourceAsset(sourceAsset, sourceType)` Sets the shader's source-asset path value to `sourceAsset` for the given source type, `sourceType`. - `SetSourceAssetSubIdentifier(subIdentifier, ...)` Set a sub-identifier to be used with a source asset of the given source type. - `SetSourceCode(sourceCode, sourceType)` Sets the shader's source-code value to `sourceCode` for the given source type, `sourceType`. ### Apply **classmethod** Apply(prim) -> NodeDefAPI Applies this single-apply API schema to the given `prim`. This information is stored by adding "NodeDefAPI" to the token-valued, listOp metadata **apiSchemas** on the prim. A valid UsdShadeNodeDefAPI object is returned upon success. An invalid (or empty) UsdShadeNodeDefAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. - **Parameters** - **prim** (`Prim`) – <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> CanApply <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdShade.NodeDefAPI.CanApply" title="Permalink to this definition">  <dd> <p> <strong> classmethod CanApply(prim, whyNot) -&gt; bool <p> Returns true if this <strong> single-apply API schema can be applied to the given <code class="docutils literal notranslate"> <span class="pre"> prim . <p> If this schema can not be a applied to the prim, this returns false and, if provided, populates <code class="docutils literal notranslate"> <span class="pre"> whyNot with the reason it can not be applied. <p> Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> prim ( <em> Prim ) – <li> <p> <strong> whyNot ( <em> str ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.NodeDefAPI.CreateIdAttr"> <span class="sig-name descname"> <span class="pre"> CreateIdAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <a class="headerlink" href="#pxr.UsdShade.NodeDefAPI.CreateIdAttr" title="Permalink to this definition">  <dd> <p> See GetIdAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.NodeDefAPI.CreateImplementationSourceAttr"> <span class="sig-name descname"> <span class="pre"> CreateImplementationSourceAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <a class="headerlink" href="#pxr.UsdShade.NodeDefAPI.CreateImplementationSourceAttr" title="Permalink to this definition">  <dd> <p> See GetImplementationSourceAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – ## NodeDefAPI.Get ### Description **classmethod** Get(stage, path) -> NodeDefAPI Return a UsdShadeNodeDefAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdShadeNodeDefAPI(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ## NodeDefAPI.GetIdAttr ### Description The id is an identifier for the type or purpose of the shader. E.g.: Texture or FractalFloat. The use of this id will depend on the render target: some will turn it into an actual shader path, some will use it to generate shader source code dynamically. ### Declaration ``` uniform token info:id ``` ### C++ Type TfToken ### Usd Type SdfValueTypeNames->Token ### Variability SdfVariabilityUniform ## NodeDefAPI.GetImplementationSource ### Description Reads the value of `info:implementationSource` attribute and returns a token identifying the attribute that must be consulted to identify the shader’s source program. This returns: - **id**, to indicate that the "info:id" attribute must be consulted. - **sourceAsset** to indicate that the asset-valued "info:{sourceType}:sourceAsset" attribute associated with the desired `sourceType` should be consulted to locate the asset with the shader’s source. - **sourceCode** to indicate that the string-valued "info:{sourceType}:sourceCode" attribute associated with the desired `sourceType` should be read to get shader’s source. This issues a warning and returns **id** if the `info:implementationSource` attribute has an invalid value. `{sourceType}` above is a placeholder for a token that identifies the type of shader source or its implementation. For example: osl, glslfx, riCpp etc. This allows a shader to specify different sourceAsset (or sourceCode) values for different sourceTypes. The sourceType tokens usually correspond to the sourceType value of the NdrParserPlugin that’s used to parse the shader source (NdrParserPlugin::SourceType). When sourceType is empty, the corresponding sourceAsset or sourceCode is considered to be "universal" (or fallback), which is represented by the empty-valued token UsdShadeTokens->universalSourceType. When the sourceAsset (or sourceCode) corresponding to a specific, requested sourceType is unavailable, the universal sourceAsset (or sourceCode) is returned by GetSourceAsset (and GetSourceCode} API, if present. ## GetImplementationSourceAttr Specifies the attribute that should be consulted to get the shader’s implementation or its source code. > - If set to "id", the "info:id" attribute’s value is used to determine the shader source from the shader registry. > - If set to "sourceAsset", the resolved value of the "info:sourceAsset" attribute corresponding to the desired implementation (or source-type) is used to locate the shader source. A source asset file may also specify multiple shader definitions, so there is an optional attribute "info:sourceAsset:subIdentifier" whose value should be used to indicate a particular shader definition from a source asset file. > - If set to "sourceCode", the value of "info:sourceCode" attribute corresponding to the desired implementation (or source type) is used as the shader source. Declaration uniform token info:implementationSource ="id" ``` C++ Type: TfToken Usd Type: SdfValueTypeNames->Token Variability: SdfVariabilityUniform Allowed Values: id, sourceAsset, sourceCode ## GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters - **includeInherited** (bool) – ## GetShaderId Fetches the shader’s ID value from the `info:id` attribute, if the shader’s `info:implementationSource` is **id**. Returns **true** if the shader’s implementation source is **id** and the value was fetched properly into `id`. Returns false otherwise. GetImplementationSource() Parameters - **id** (str) – ## GetShaderNodeForSourceType This method attempts to ensure that there is a ShaderNode in the shader registry (i.e. SdrRegistry) representing this shader for the given `sourceType`. It may return a null pointer if none could be found or created. ### Parameters - **sourceType** (`str`) – ### GetSourceAsset ```python GetSourceAsset(sourceAsset, sourceType) -> bool ``` Fetches the shader’s source asset value for the specified `sourceType` value from the **info: *sourceType*: sourceAsset** attribute, if the shader’s **info:implementationSource** is **sourceAsset**. If the **sourceAsset** attribute corresponding to the requested **sourceType** isn’t present on the shader, then the **universal fallback** sourceAsset attribute, i.e. **info:sourceAsset** is consulted, if present, to get the source asset path. Returns **true** if the shader’s implementation source is **sourceAsset** and the source asset path value was fetched successfully into `sourceAsset`. Returns false otherwise. ### GetImplementationSource() - **sourceAsset** (`AssetPath`) – - **sourceType** (`str`) – ### GetSourceAssetSubIdentifier ```python GetSourceAssetSubIdentifier(subIdentifier, sourceType) -> bool ``` Fetches the shader’s sub-identifier for the source asset with the specified `sourceType` value from the **info: *sourceType*: sourceAsset:subIdentifier** attribute, if the shader’s **info:implementationSource** is **sourceAsset**. If the **subIdentifier** attribute corresponding to the requested **sourceType** isn’t present on the shader, then the **universal fallback** sub-identifier attribute, i.e. **info:sourceAsset:subIdentifier** is consulted, if present, to get the sub-identifier name. Returns **true** if the shader’s implementation source is **sourceAsset** and the sub-identifier for the given source type was fetched successfully into `subIdentifier`. Returns false otherwise. ### Parameters - **subIdentifier** (`str`) – - **sourceType** (`str`) – ### GetSourceCode ```python GetSourceCode(sourceCode, sourceType) -> bool ``` Fetches the shader’s source code for the specified `sourceType` value from the **info: *sourceType*: sourceAsset** attribute, if the shader’s **info:implementationSource** is **sourceAsset**. If the **sourceAsset** attribute corresponding to the requested **sourceType** isn’t present on the shader, then the **universal fallback** sourceAsset attribute, i.e. **info:sourceAsset** is consulted, if present, to get the source asset path. Returns **true** if the shader’s implementation source is **sourceAsset** and the source asset path value was fetched successfully into `sourceAsset`. Returns false otherwise. ```code sourceType ``` value by reading the **info: *sourceType*: sourceCode** attribute, if the shader’s *info:implementationSource* is **sourceCode**. If the *sourceCode* attribute corresponding to the requested *sourceType* isn’t present on the shader, then the *universal* or *fallback* sourceCode attribute (i.e. *info:sourceCode*) is consulted, if present, to get the source code. Returns **true** if the shader’s implementation source is **sourceCode** and the source code string was fetched successfully into ```code sourceCode ```. Returns false otherwise. GetImplementationSource() - **Parameters** - **sourceCode** (*str*) – - **sourceType** (*str*) – ```python SetShaderId(id) → bool ``` Sets the shader’s ID value. This also sets the *info:implementationSource* attribute on the shader to **UsdShadeTokens->id**, if the existing value is different. - **Parameters** - **id** (*str*) – ```python SetSourceAsset(sourceAsset, sourceType) → bool ``` Sets the shader’s source-asset path value to ```code sourceAsset ``` for the given source type, ```code sourceType ```. This also sets the *info:implementationSource* attribute on the shader to **UsdShadeTokens->sourceAsset**. - **Parameters** - **sourceAsset** (*AssetPath*) – - **sourceType** (*str*) – ```python SetSourceAssetSubIdentifier(subIdentifier, sourceType) → bool ``` Set a sub-identifier to be used with a source asset of the given source type. This sets the **info: *sourceType*: sourceAsset:subIdentifier**. This also sets the *info:implementationSource* attribute on the shader to **UsdShadeTokens->sourceAsset**. - **Parameters** - **subIdentifier** (*str*) – - **sourceType** (*str*) – ### NodeDefAPI Methods #### SetSourceCode ```python SetSourceCode(sourceCode, sourceType) -> bool ``` Sets the shader’s source-code value to `sourceCode` for the given source type, `sourceType`. This also sets the `info:implementationSource` attribute on the shader to `UsdShadeTokens->sourceCode`. **Parameters:** - **sourceCode** (str) – - **sourceType** (str) – ### NodeGraph Class A node-graph is a container for shading nodes, as well as other node-graphs. It has a public input interface and provides a list of public outputs. **Node Graph Interfaces** One of the most important functions of a node-graph is to host the "interface" with which clients of already-built shading networks will interact. Please see Interface Inputs for a detailed explanation of what the interface provides, and how to construct and use it, to effectively share/instance shader networks. **Node Graph Outputs** These behave like outputs on a shader and are typically connected to an output on a shader inside the node-graph. **Methods:** - **ComputeInterfaceInputConsumersMap** (...) - Walks the namespace subtree below the node-graph and computes a map containing the list of all inputs on the node-graph and the associated vector of consumers of their values. - **ComputeOutputSource** (outputName, sourceName, ...) - Deprecated - **ConnectableAPI** () - Constructs and returns a UsdShadeConnectableAPI object with this node-graph. - **CreateInput** (name, typeName) - Create an Input which can either have a value or can be connected. - **CreateOutput** (name, typeName) - Create an output which can either have a value or can be connected. - **Define** (stage, path) -> NodeGraph - **classmethod** Define(stage, path) -> NodeGraph - **Get** () - Get the NodeGraph at the given path. **classmethod** Get(stage, path) -> NodeGraph GetInput(name) - Return the requested input if it exists. GetInputs(onlyAuthored) - Returns all inputs present on the node-graph. GetInterfaceInputs() - Returns all the "Interface Inputs" of the node-graph. GetOutput(name) - Return the requested output if it exists. GetOutputs(onlyAuthored) - Outputs are represented by attributes in the "outputs:" namespace. GetSchemaAttributeNames(includeInherited) -> list[TfToken] ComputeInterfaceInputConsumersMap(computeTransitiveConsumers) -> InterfaceInputConsumersMap - Walks the namespace subtree below the node-graph and computes a map containing the list of all inputs on the node-graph and the associated vector of consumers of their values. - The consumers can be inputs on shaders within the node-graph or on nested node-graphs. - If `computeTransitiveConsumers` is true, then value consumers belonging to **node-graphs** are resolved transitively to compute the transitive mapping from inputs on the node-graph to inputs on shaders inside the material. Note that inputs on node-graphs that don’t have value consumers will continue to be included in the result. - Parameters: - **computeTransitiveConsumers** (bool) – ComputeOutputSource(outputName, sourceName, sourceType) -> Shader - Deprecated in favor of GetValueProducingAttributes on UsdShadeOutput Resolves the connection source of the requested output, identified by `outputName`, to a shader output. - `sourceName` is an output parameter that is set to the name of the resolved output, if the node-graph output is connected to a valid shader source. - `sourceType` is an output parameter that is set to the type of the resolved output, if the node-graph output is connected to a valid shader source. - Returns a valid shader object if the specified output exists and is connected to one. Return an empty shader object otherwise. version of this method returns a tuple containing three elements (the source shader, sourceName, sourceType). ### Parameters - **outputName** (`str`) – - **sourceName** (`str`) – - **sourceType** (`AttributeType`) – ### ConnectableAPI - Constructs and returns a UsdShadeConnectableAPI object with this node-graph. - Note that most tasks can be accomplished without explicitly constructing a UsdShadeConnectable API, since connection-related API such as UsdShadeConnectableAPI::ConnectToSource() are static methods, and UsdShadeNodeGraph will auto-convert to a UsdShadeConnectableAPI when passed to functions that want to act generically on a connectable UsdShadeConnectableAPI object. ### CreateInput - Create an Input which can either have a value or can be connected. - The attribute representing the input is created in the "inputs:" namespace. - **name** (`str`) – - **typeName** (`ValueTypeName`) – ### CreateOutput - Create an output which can either have a value or can be connected. - The attribute representing the output is created in the "outputs:" namespace. - **name** (`str`) – - **typeName** (`ValueTypeName`) – ### Define - **classmethod** Define(stage, path) -> NodeGraph - Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. - If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an **SdfPrimSpec** with **specifier** == **SdfSpecifierDef** and this schema’s prim type name for the prim at `path` at the current EditTarget. Author **SdfPrimSpec** s with `specifier` == **SdfSpecifierDef** and empty typeName at the current EditTarget for any nonexistent, or existing but not **Defined** ancestors. The given **path** must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case **path** cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (**Stage**) – - **path** (**Path**) – **classmethod** Get(stage, path) -> NodeGraph Return a UsdShadeNodeGraph holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdShadeNodeGraph(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (**Stage**) – - **path** (**Path**) – GetInput(name) -> Input Return the requested input if it exists. **Parameters** - **name** (**str**) – GetInputs(onlyAuthored) -> list[Input] Returns all inputs present on the node-graph. These are represented by attributes in the”inputs:”namespace. If `onlyAuthored` is true (the default), then only return authored ## GetInterfaceInputs Returns all the "Interface Inputs" of the node-graph. This is the same as GetInputs(), but is provided as a convenience, to allow clients to distinguish between inputs on shaders vs. interface-inputs on node-graphs. ## GetOutput Return the requested output if it exists. ### Parameters - **name** (str) – ## GetOutputs Outputs are represented by attributes in the "outputs:" namespace. If `onlyAuthored` is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. ### Parameters - **onlyAuthored** (bool) – ## GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - **includeInherited** (bool) – ## Output This class encapsulates a shader or node-graph output, which is a connectable attribute representing a typed, externally computed value. ### Methods: - `CanConnect` (source) - Determines whether this Output can be connected to the given source attribute, which can be an input or an output. - **ClearSdrMetadata**() - Clears any "sdrMetadata" value authored on the Output in the current EditTarget. - **ClearSdrMetadataByKey**(key) - Clears the entry corresponding to the given `key` in the "sdrMetadata" dictionary authored in the current EditTarget. - **ClearSource**() - Deprecated - **ClearSources**() - Clears sources for this Output in the current UsdEditTarget. - **ConnectToSource**(source, mod) - Authors a connection for this Output. - **DisconnectSource**(sourceAttr) - Disconnect source for this Output. - **GetAttr**() - Explicit UsdAttribute extractor. - **GetBaseName**() - Returns the name of the output. - **GetConnectedSource**(source, sourceName, ...) - Deprecated - **GetConnectedSources**(invalidSourcePaths) - Finds the valid sources of connections for the Output. - **GetFullName**() - Get the name of the attribute associated with the output. - **GetPrim**() - Get the prim that the output belongs to. - **GetRawConnectedSourcePaths**(sourcePaths) - Deprecated - **GetRenderType**() - Return this output's specialized renderType, or an empty token if none was authored. - **GetSdrMetadata**() - Returns the "sdrMetadata" dictionary authored on the Output in the current EditTarget. Returns this Output's composed "sdrMetadata" dictionary as a NdrTokenMap. ### GetSdrMetadataByKey(key) Returns the value corresponding to `key` in the composed `sdrMetadata` dictionary. ### GetTypeName() Get the "scene description" value type name of the attribute associated with the output. ### GetValueProducingAttributes(shaderOutputsOnly) Find what is connected to this Output recursively. ### HasConnectedSource() Returns true if and only if this Output is currently connected to a valid (defined) source. ### HasRenderType() Return true if a renderType has been specified for this output. ### HasSdrMetadata() Returns true if the Output has a non-empty composed "sdrMetadata" dictionary value. ### HasSdrMetadataByKey(key) Returns true if there is a value corresponding to the given `key` in the composed "sdrMetadata" dictionary. ### IsOutput **classmethod** IsOutput(attr) -> bool ### IsSourceConnectionFromBaseMaterial() Returns true if the connection to this Output's source, as returned by GetConnectedSource(), is authored across a specializes arc, which is used to denote a base material. ### Set(value, time) Set a value for the output. ### SetConnectedSources(sourceInfos) Connects this Output to the given sources, `sourceInfos`. ### SetRenderType(renderType) Specify an alternative, renderer-specific type to use when emitting/translating this output, rather than translating based on its GetTypeName(). ### SetSdrMetadata(sdrMetadata) Authors the given `sdrMetadata` value on this Output at the current EditTarget. | SetSdrMetadataByKey (key, value) | | --- | | Sets the value corresponding to `key` to the given string `value`, in the Output's "sdrMetadata" dictionary at the current EditTarget. | ### CanConnect ```python CanConnect(source) -> bool ``` Determines whether this Output can be connected to the given source attribute, which can be an input or an output. An output is considered to be connectable only if it belongs to a node-graph. Shader outputs are not connectable. #### Parameters - **source** (Attribute) – ```python CanConnect(sourceInput) -> bool ``` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **sourceInput** (Input) – ```python CanConnect(sourceOutput) -> bool ``` This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. #### Parameters - **sourceOutput** (Output) – ### ClearSdrMetadata ```python ClearSdrMetadata() -> None ``` Clears any "sdrMetadata" value authored on the Output in the current EditTarget. ### ClearSdrMetadataByKey ```python ClearSdrMetadataByKey(key) -> None ``` Clears the entry corresponding to the given `key` in the "sdrMetadata" dictionary authored in the current EditTarget. #### Parameters - **key** (str) – ### ClearSource ```python ClearSource() -> bool ``` Deprecated ### ClearSources ```python ClearSources() -> bool ``` ## DisconnectSource Disconnect source for this Output. If `sourceAttr` is valid, only a connection to the specified attribute is disconnected, otherwise all connections are removed. ### Parameters - **sourceAttr** (Attribute) – ## GetAttr Explicit UsdAttribute extractor. ## GetBaseName Returns the name of the output. We call this the base name since it strips off the "outputs:" namespace prefix from the attribute name, and returns it. ## GetConnectedSource Deprecated Please use GetConnectedSources instead ### Parameters - **source** (ConnectableAPI) – - **sourceName** (str) – - **sourceType** (AttributeType) – ## GetConnectedSources Finds the valid sources of connections for the Output. `invalidSourcePaths` is an optional output parameter to collect the invalid source paths that have not been reported in the returned vector. Returns a vector of `UsdShadeConnectionSourceInfo` structs with information about each upstream attribute. If the vector is empty, there have been no valid connections. A valid connection requires the existence of the source attribute and also requires that the source prim is UsdShadeConnectableAPI compatible. The python wrapping returns a tuple with the valid connections first, followed by the invalid source paths. UsdShadeConnectableAPI::GetConnectedSources Parameters ---------- invalidSourcePaths (list[SdfPath]) – GetFullName() → str -------------------- Get the name of the attribute associated with the output. GetPrim() → Prim ----------------- Get the prim that the output belongs to. GetRawConnectedSourcePaths(sourcePaths) → bool ------------------------------------------------ Deprecated Returns the "raw" (authored) connected source paths for this Output. Parameters ---------- sourcePaths (list[SdfPath]) – GetRenderType() → str ---------------------- Return this output’s specialized renderType, or an empty token if none was authored. SetRenderType() --------------- GetSdrMetadata() → NdrTokenMap ------------------------------- Returns this Output’s composed "sdrMetadata" dictionary as a NdrTokenMap. GetSdrMetadataByKey(key) → str ------------------------------- Returns the value corresponding to key in the composed sdrMetadata dictionary. Parameters ---------- key (str) – ### ValueTypeName ### GetValueProducingAttributes (shaderOutputsOnly) → list[UsdShadeAttribute] Find what is connected to this Output recursively. UsdShadeUtils::GetValueProducingAttributes #### Parameters - **shaderOutputsOnly** (bool) – ### HasConnectedSource () → bool Returns true if and only if this Output is currently connected to a valid (defined) source. UsdShadeConnectableAPI::HasConnectedSource ### HasRenderType () → bool Return true if a renderType has been specified for this output. SetRenderType() ### HasSdrMetadata () → bool Returns true if the Output has a non-empty composed "sdrMetadata" dictionary value. ### HasSdrMetadataByKey (key) → bool Returns true if there is a value corresponding to the given key in the composed "sdrMetadata" dictionary. #### Parameters - **key** (str) – ### IsOutput static **classmethod** IsOutput(attr) -> bool Test whether a given UsdAttribute represents a valid Output, which implies that creating a UsdShadeOutput from the attribute will succeed. Success implies that `attr.IsDefined()` is true. #### Parameters - **attr** (Attribute) – ### IsSourceConnectionFromBaseMaterial() Returns true if the connection to this Output’s source, as returned by `GetConnectedSource()`, is authored across a specializes arc, which is used to denote a base material. `UsdShadeConnectableAPI::IsSourceConnectionFromBaseMaterial` ### Set(value, time) Set a value for the output. It’s unusual to be setting a value on an output since it represents an externally computed value. The Set API is provided here just for the sake of completeness and uniformity with other property schema. **Parameters** - **value** (`VtValue`) – - **time** (`TimeCode`) – Set(value, time) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Set the attribute value of the Output at `time`. **Parameters** - **value** (`T`) – - **time** (`TimeCode`) – ### SetConnectedSources(sourceInfos) Connects this Output to the given sources, `sourceInfos`. `UsdShadeConnectableAPI::SetConnectedSources` **Parameters** - **sourceInfos** (`list[ConnectionSourceInfo]`) – ### SetRenderType(renderType) Specify an alternative, renderer-specific type to use when emitting/translating this output, rather than translating based on its `GetTypeName()`. For example, we set the renderType to "struct" for outputs that are of renderman custom struct types. true on success **Parameters** - **renderType** (`str`) – ## pxr.UsdShade.Output.SetSdrMetadata Authors the given `sdrMetadata` value on this Output at the current EditTarget. ### Parameters - **sdrMetadata** (`NdrTokenMap`) – ## pxr.UsdShade.Output.SetSdrMetadataByKey Sets the value corresponding to `key` to the given string `value`, in the Output’s “sdrMetadata” dictionary at the current EditTarget. ### Parameters - **key** (`str`) – - **value** (`str`) – ## pxr.UsdShade.Shader Base class for all USD shaders. Shaders are the building blocks of shading networks. ### Description Objects of this class generally represent a single shading object, whether it exists in the target renderer or not. For example, a texture, a fractal, or a mix node. The UsdShadeNodeDefAPI provides attributes to uniquely identify the type of this node. The id resolution into a renderable shader target is deferred to the consuming application. The purpose of representing them in Usd is two-fold: 1. To represent, via “connections” the topology of the shading network that must be reconstructed in the renderer. Facilities for authoring and manipulating connections are encapsulated in the API schema UsdShadeConnectableAPI. 2. To present a (partial or full) interface of typed input parameters whose values can be set and overridden in Usd, to be provided later at render-time as parameter values to the actual render shader objects. Shader input parameters are encapsulated in the property schema UsdShadeInput. ### Methods: - **ClearSdrMetadata** () - Clears any "sdrMetadata" value authored on the shader in the current EditTarget. - **ClearSdrMetadataByKey** (key) - Clears the entry corresponding to the given `key` in the "sdrMetadata" dictionary authored in the current EditTarget. - **ConnectableAPI** () - Constructs and returns a UsdShadeConnectableAPI object with this shader. - **CreateIdAttr** (defaultValue, writeSparsely) - Forwards to UsdShadeNodeDefAPI(prim). <p> CreateImplementationSourceAttr (defaultValue, ...) <p> Forwards to UsdShadeNodeDefAPI(prim). <p> CreateInput (name, typeName) <p> Create an input which can either have a value or can be connected. <p> CreateOutput (name, typeName) <p> Create an output which can either have a value or can be connected. <p> Define <p> classmethod Define(stage, path) -> Shader <p> Get <p> classmethod Get(stage, path) -> Shader <p> GetIdAttr () <p> Forwards to UsdShadeNodeDefAPI(prim). <p> GetImplementationSource () <p> Forwards to UsdShadeNodeDefAPI(prim). <p> GetImplementationSourceAttr () <p> Forwards to UsdShadeNodeDefAPI(prim). <p> GetInput (name) <p> Return the requested input if it exists. <p> GetInputs (onlyAuthored) <p> Inputs are represented by attributes in the"inputs:"namespace. <p> GetOutput (name) <p> Return the requested output if it exists. <p> GetOutputs (onlyAuthored) <p> Outputs are represented by attributes in the"outputs:"namespace. <p> GetSchemaAttributeNames <p> classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <p> GetSdrMetadata () <p> Returns this shader's composed"sdrMetadata"dictionary as a NdrTokenMap. <p> GetSdrMetadataByKey (key) <p> Returns the value corresponding to <code class="docutils literal notranslate"> - **key** in the composed **sdrMetadata** dictionary. - **GetShaderId** (id) - Forwards to UsdShadeNodeDefAPI(prim). - **GetShaderNodeForSourceType** (sourceType) - Forwards to UsdShadeNodeDefAPI(prim). - **GetSourceAsset** (sourceAsset, sourceType) - Forwards to UsdShadeNodeDefAPI(prim). - **GetSourceAssetSubIdentifier** (subIdentifier, ...) - Forwards to UsdShadeNodeDefAPI(prim). - **GetSourceCode** (sourceCode, sourceType) - Forwards to UsdShadeNodeDefAPI(prim). - **HasSdrMetadata** () - Returns true if the shader has a non-empty composed "sdrMetadata" dictionary value. - **HasSdrMetadataByKey** (key) - Returns true if there is a value corresponding to the given **key** in the composed "sdrMetadata" dictionary. - **SetSdrMetadata** (sdrMetadata) - Authors the given **sdrMetadata** on this shader at the current EditTarget. - **SetSdrMetadataByKey** (key, value) - Sets the value corresponding to **key** to the given string **value**, in the shader's "sdrMetadata" dictionary at the current EditTarget. - **SetShaderId** (id) - Forwards to UsdShadeNodeDefAPI(prim). - **SetSourceAsset** (sourceAsset, sourceType) - Forwards to UsdShadeNodeDefAPI(prim). - **SetSourceAssetSubIdentifier** (subIdentifier, ...) - Forwards to UsdShadeNodeDefAPI(prim). - **SetSourceCode** (sourceCode, sourceType) - Forwards to UsdShadeNodeDefAPI(prim). ### ClearSdrMetadata ``` ```markdown ### ClearSdrMetadataByKey ``` ```markdown ### ConnectableAPI ``` ```markdown ### CreateIdAttr ``` ```markdown ### CreateImplementationSourceAttr ``` ```markdown ### CreateInput ``` ```markdown Clears any "sdrMetadata" value authored on the shader in the current EditTarget. ``` ```markdown Clears the entry corresponding to the given `key` in the "sdrMetadata" dictionary authored in the current EditTarget. **Parameters** - **key** (str) – ``` ```markdown Contructs and returns a UsdShadeConnectableAPI object with this shader. Note that most tasks can be accomplished without explicitly constructing a UsdShadeConnectable API, since connection-related API such as UsdShadeConnectableAPI::ConnectToSource() are static methods, and UsdShadeShader will auto-convert to a UsdShadeConnectableAPI when passed to functions that want to act generically on a connectable UsdShadeConnectableAPI object. ``` ```markdown Forwards to UsdShadeNodeDefAPI(prim). **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ``` ```markdown Forwards to UsdShadeNodeDefAPI(prim). **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ``` ```markdown Creates an input on the shader. <dt> <em class="sig-param"> <span class="n"> <span class="pre"> typeName <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Input <dd> <p> Create an input which can either have a value or can be connected. <p> The attribute representing the input is created in the "inputs:" namespace. Inputs on both shaders and node-graphs are connectable. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> name ( <em> str ) – <li> <p> <strong> typeName ( <em> ValueTypeName ) – <dt> <span class="sig-name descname"> <span class="pre"> CreateOutput <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> name , <em class="sig-param"> <span class="n"> <span class="pre"> typeName <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Output <dd> <p> Create an output which can either have a value or can be connected. <p> The attribute representing the output is created in the "outputs:" namespace. Outputs on a shader cannot be connected, as their value is assumed to be computed externally. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> name ( <em> str ) – <li> <p> <strong> typeName ( <em> ValueTypeName ) – <dt> <em class="property"> <span class="pre"> static <span class="sig-name descname"> <span class="pre"> Define <span class="sig-paren"> ( <dd> <p> <strong> classmethod Define(stage, path) -&gt; Shader <p> Attempt to ensure a <em> UsdPrim <p> If a prim adhering to this schema at <code> path <p> The given <em> path <p> If it is impossible to author any of the necessary PrimSpecs, (for example, in case <em> path <p> Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> stage ( <em> Stage ) – <li> <p> <strong> path ( <em> Path ) – ### classmethod Get(stage, path) -> Shader Return a UsdShadeShader holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```text UsdShadeShader(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (Stage) – - **path** (Path) – ### GetIdAttr() -> Attribute Forwards to UsdShadeNodeDefAPI(prim). ### GetImplementationSource() -> str Forwards to UsdShadeNodeDefAPI(prim). ### GetImplementationSourceAttr() -> Attribute Forwards to UsdShadeNodeDefAPI(prim). ### GetInput(name) -> Input Return the requested input if it exists. #### Parameters - **name** (str) – ### GetInputs(onlyAuthored) -> list[Input] Inputs are represented by attributes in the “inputs:” namespace. If `onlyAuthored` is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. ### Parameters **onlyAuthored** (`bool`) – ### GetOutput ``` GetOutput(name) → Output ``` Return the requested output if it exists. #### Parameters **name** (`str`) – ### GetOutputs ``` GetOutputs(onlyAuthored) → list[Output] ``` Outputs are represented by attributes in the "outputs:" namespace. If `onlyAuthored` is true (the default), then only return authored attributes; otherwise, this also returns un-authored builtins. #### Parameters **onlyAuthored** (`bool`) – ### GetSchemaAttributeNames ``` classmethod GetSchemaAttributeNames(includeInherited) → list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters **includeInherited** (`bool`) – ### GetSdrMetadata ``` GetSdrMetadata() → NdrTokenMap ``` Returns this shader’s composed "sdrMetadata" dictionary as a NdrTokenMap. ### GetSdrMetadataByKey ``` GetSdrMetadataByKey(key) → str ``` Returns the value corresponding to `key` in the composed **sdrMetadata** dictionary. #### Parameters **key** (`str`) – ### GetShaderId ``` GetShaderId(id) ``` → bool ## pxr.UsdShade.Shader.GetShaderId Forwards to UsdShadeNodeDefAPI(prim). ### Parameters - **id** (`str`) – ## pxr.UsdShade.Shader.GetShaderNodeForSourceType Forwards to UsdShadeNodeDefAPI(prim). ### Parameters - **sourceType** (`str`) – ## pxr.UsdShade.Shader.GetSourceAsset Forwards to UsdShadeNodeDefAPI(prim). ### Parameters - **sourceAsset** (`AssetPath`) – - **sourceType** (`str`) – ## pxr.UsdShade.Shader.GetSourceAssetSubIdentifier Forwards to UsdShadeNodeDefAPI(prim). ### Parameters - **subIdentifier** (`str`) – - **sourceType** (`str`) – ## pxr.UsdShade.Shader.GetSourceCode Forwards to UsdShadeNodeDefAPI(prim). ### Parameters - **sourceCode** (`str`) – - **sourceType** (`str`) – ## pxr.UsdShade.Shader.HasSdrMetadata ### HasSdrMetadata ```python def HasSdrMetadata() -> bool: pass ``` Returns true if the shader has a non-empty "sdrMetadata" dictionary value. ### HasSdrMetadataByKey ```python def HasSdrMetadataByKey(key: str) -> bool: pass ``` Returns true if there is a value corresponding to the given `key` in the "sdrMetadata" dictionary. **Parameters** - **key** (str) – ### SetSdrMetadata ```python def SetSdrMetadata(sdrMetadata: NdrTokenMap) -> None: pass ``` Authors the given `sdrMetadata` on this shader at the current EditTarget. **Parameters** - **sdrMetadata** (NdrTokenMap) – ### SetSdrMetadataByKey ```python def SetSdrMetadataByKey(key: str, value: str) -> None: pass ``` Sets the value corresponding to `key` to the given string `value`, in the shader’s "sdrMetadata" dictionary at the current EditTarget. **Parameters** - **key** (str) – - **value** (str) – ### SetShaderId ```python def SetShaderId(id: str) -> bool: pass ``` Forwards to UsdShadeNodeDefAPI(prim). **Parameters** - **id** (str) – ### SetSourceAsset ```python def SetSourceAsset(sourceAsset: str, sourceType: str) -> None: pass ``` Sets the source asset and type for the shader. **Parameters** - **sourceAsset** (str) – - **sourceType** (str) – ### pxr.UsdShade.Shader.SetSourceAsset Forwards to UsdShadeNodeDefAPI(prim). #### Parameters - **sourceAsset** (`AssetPath`) – - **sourceType** (`str`) – ### pxr.UsdShade.Shader.SetSourceAssetSubIdentifier Forwards to UsdShadeNodeDefAPI(prim). #### Parameters - **subIdentifier** (`str`) – - **sourceType** (`str`) – ### pxr.UsdShade.Shader.SetSourceCode Forwards to UsdShadeNodeDefAPI(prim). #### Parameters - **sourceCode** (`str`) – - **sourceType** (`str`) – ### pxr.UsdShade.ShaderDefParserPlugin Parses shader definitions represented using USD scene description using the schemas provided by UsdShade. #### Methods: - **GetDiscoveryTypes**() - Returns the types of nodes that this plugin can parse. - **GetSourceType**() - Returns the source type that this parser operates on. - **Parse**(discoveryResult) - Takes the specified `NdrNodeDiscoveryResult` instance, which was a result of the discovery process, and generates a new `NdrNode`. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.ShaderDefParserPlugin.GetDiscoveryTypes"> <span class="sig-name descname"><span class="pre">GetDiscoveryTypes <span class="sig-paren">( <span class="sig-paren">) <span class="sig-return"> <span class="sig-return-icon">→ <span class="sig-return-typehint"><span class="pre">NdrTokenVec <dd> <p>Returns the types of nodes that this plugin can parse. <p>“Type” here is the discovery type (in the case of files, this will probably be the file extension, but in other systems will be data that can be determined during discovery). This type should only be used to match up a <code class="docutils literal notranslate"><span class="pre">NdrNodeDiscoveryResult <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.ShaderDefParserPlugin.GetSourceType"> <span class="sig-name descname"><span class="pre">GetSourceType <span class="sig-paren">( <span class="sig-paren">) <span class="sig-return"> <span class="sig-return-icon">→ <span class="sig-return-typehint"><span class="pre">str <dd> <p>Returns the source type that this parser operates on. <p>A source type is the most general type for a node. The parser plugin is responsible for parsing all discovery results that have the types declared under <code class="docutils literal notranslate"><span class="pre">GetDiscoveryTypes() <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdShade.ShaderDefParserPlugin.Parse"> <span class="sig-name descname"><span class="pre">Parse <span class="sig-paren">( <em class="sig-param"><span class="n"><span class="pre">discoveryResult <span class="sig-paren">) <span class="sig-return"> <span class="sig-return-icon">→ <span class="sig-return-typehint"><span class="pre">NdrNodeUnique <dd> <p>Takes the specified <code class="docutils literal notranslate"><span class="pre">NdrNodeDiscoveryResult <p>The node’s name, source type, and family must match. <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <p><strong>discoveryResult <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdShade.ShaderDefUtils"> <em class="property"><span class="pre">class <span class="sig-prename descclassname"><span class="pre">pxr.UsdShade. <span class="sig-name descname"><span class="pre">ShaderDefUtils <dd> <p>This class contains a set of utility functions used for populating the shader registry with shaders definitions specified using UsdShade schemas. <p><strong>Methods: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p><a class="reference internal" href="#pxr.UsdShade.ShaderDefUtils.GetNodeDiscoveryResults"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GetNodeDiscoveryResults <td> <p><strong>classmethod <tr class="row-even"> <td> <p><a class="reference internal" href="#pxr.UsdShade.ShaderDefUtils.GetPrimvarNamesMetadataString"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GetPrimvarNamesMetadataString <td> <p><strong>classmethod <tr class="row-odd"> <td> <p><a class="reference internal" href="#pxr.UsdShade.ShaderDefUtils.GetShaderProperties"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GetShaderProperties <td> <p><strong>classmethod <p> This is a shader definition, denoted as <code> <span> shaderDef , assuming it is found in a shader definition file found by an Ndr discovery plugin. <p> To enable the shaderDef parser to find and parse this shader, <code> <span> sourceUri should have the resolved path to the usd file containing this shader prim. <dl> <dt>Parameters <dd> <ul> <li> <p> <strong> shaderDef ( <em> Shader ) – <li> <p> <strong> sourceUri ( <em> str ) – <dl> <dt> <strong> classmethod GetPrimvarNamesMetadataString(metadata, shaderDef) -&gt; str <dd> <p> Collects all the names of valid primvar inputs of the given <code> <span> metadata and the given <code> <span> shaderDef and returns the string used to represent them in SdrShaderNode metadata. <dl> <dt>Parameters <dd> <ul> <li> <p> <strong> metadata ( <em> NdrTokenMap ) – <li> <p> <strong> shaderDef ( <em> ConnectableAPI ) – <dl> <dt> <strong> classmethod GetShaderProperties(shaderDef) -&gt; NdrPropertyUniquePtrVec <dd> <p> Gets all input and output properties of the given <code> <span> shaderDef and translates them into NdrProperties that can be used as the properties for an SdrShaderNode. <dl> <dt>Parameters <dd> <p> <strong> shaderDef ( <em> ConnectableAPI ) – <dl> <dt> <strong> Attributes: <dd> <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr> <td> <code> allPurpose <td> <tr> <td> <code> bindMaterialAs <td> <tr> <td> <code> coordSys <td> <tr> <td> <code> displacement <td> <tr> <td> <code> fallbackStrength <td> | Token Name | |------------| | full | | id | | infoId | | infoImplementationSource | | inputs | | interfaceOnly | | materialBind | | materialBinding | | materialBindingCollection | | materialVariant | | outputs | | outputsDisplacement | | outputsSurface | | outputsVolume | | preview | | sdrMetadata | | sourceAsset | | sourceCode | - `strongerThanDescendants` - `subIdentifier` - `surface` - `universalRenderContext` - `universalSourceType` - `volume` - `weakerThanDescendants` ### allPurpose = '' ### bindMaterialAs = 'bindMaterialAs' ### coordSys = 'coordSys:' ### displacement = 'displacement' ### fallbackStrength = 'fallbackStrength' ### full = 'full' ### id = 'id' ### infoId infoId = 'info:id' infoImplementationSource = 'info:implementationSource' inputs = 'inputs:' interfaceOnly = 'interfaceOnly' materialBind = 'materialBind' materialBinding = 'material:binding' materialBindingCollection = 'material:binding:collection' materialVariant = 'materialVariant' outputs = 'outputs:' outputsDisplacement = 'outputs:displacement' outputsSurface = 'outputs:surface' outputsVolume = 'outputs:volume' ## Attributes ### outputs:volume ### preview ### sdrMetadata ### sourceAsset ### sourceCode ### strongerThanDescendants ### subIdentifier ### surface ### universalRenderContext ### universalSourceType ### volume ### weakerThanDescendants ## Class ### Utils ## pxr.UsdShade.Utils This class contains a set of utility functions used when authoring and querying shading networks. ### Methods: - **classmethod GetBaseNameAndType(fullName) -> tuple[str, AttributeType]** - Given the full name of a shading attribute, returns its base name and shading attribute type. - Parameters: - **fullName** (str) – - **classmethod GetConnectedSourcePath(srcInfo) -> Path** - For a valid UsdShadeConnectionSourceInfo, return the complete path to the source property; otherwise the empty path. - Parameters: - **srcInfo** (ConnectionSourceInfo) – - **classmethod GetFullName(baseName, type) -> str** - Returns the full shading attribute name given the basename and the shading attribute type. - `baseName` is the name of the input or output on the shading node. - **classmethod GetPrefixForAttributeType(sourceType) -> str** - Returns the prefix for the given shading attribute type. - **classmethod GetType(fullName) -> AttributeType** - Returns the shading attribute type for the given full name. - **classmethod GetValueProducingAttributes(input, shaderOutputsOnly) -> list[UsdShadeAttribute]** - Returns a list of UsdShadeAttribute objects that produce values for the given input. type is the UsdShadeAttributeType of the shading attribute. ### Parameters - **baseName** (`str`) – - **type** (`AttributeType`) – ### classmethod GetPrefixForAttributeType(sourceType) -> str Returns the namespace prefix of the USD attribute associated with the given shading attribute type. #### Parameters - **sourceType** (`AttributeType`) – ### classmethod GetType(fullName) -> AttributeType Given the full name of a shading attribute, returns its shading attribute type. #### Parameters - **fullName** (`str`) – ### classmethod GetValueProducingAttributes(input, shaderOutputsOnly) -> list[UsdShadeAttribute] Find what is connected to an Input or Output recursively. GetValueProducingAttributes implements the UsdShade connectivity rules described in Connection Resolution Utilities. When tracing connections within networks that contain containers like UsdShadeNodeGraph nodes, the actual output(s) or value(s) at the end of an input or output might be multiple connections removed. The methods below resolves this across multiple physical connections. An UsdShadeInput is getting its value from one of these sources: - If the input is not connected the UsdAttribute for this input is returned, but only if it has an authored value. The input attribute itself carries the value for this input. - If the input is connected we follow the connection(s) until we reach a valid output of a UsdShadeShader node or if we reach a valid UsdShadeInput attribute of a UsdShadeNodeGraph or UsdShadeMaterial that has an authored value. An UsdShadeOutput on a container can get its value from the same type of sources as a UsdShadeInput on either a UsdShadeShader or UsdShadeNodeGraph. Outputs on non-containers (UsdShadeShaders) cannot be connected. This function returns a vector of UsdAttributes. The vector is empty if no valid attribute was found. The type of each attribute can be determined with the `UsdShadeUtils::GetType` function. If `shaderOutputsOnly` is true, it will only report attributes that are outputs of non-containers (UsdShadeShaders). This is a bit faster and what is need when determining the connections for Material terminals. This will return the last attribute along the connection chain that has an authored value, which might not be the last attribute in the chain itself. When the network contains multi-connections, this function can return multiple attributes for a single input or output. The list of attributes is build by a depth-first search, following the underlying connection paths in order. The list can contain both UsdShadeOutput and UsdShadeInput attributes. It is up to the caller to decide how to process such a mixture. #### Parameters - **input** (`Input`) – - **shaderOutputsOnly** (`bool`) – GetValueProducingAttributes(output, shaderOutputsOnly) -> list[UsdShadeAttribute] This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Parameters ------------ - **output** (Output) – - **shaderOutputsOnly** (bool) –
162,896
UsdSkel.md
# UsdSkel module ## UsdSkel module Summary: The UsdSkel module defines schemas and API that form a basis for interchanging skeletally-skinned meshes and joint animations. ### Classes: - **AnimMapper** - **AnimQuery** - Class providing efficient queries of primitives that provide skel animation. - **Animation** - Describes a skel animation, where joint animation is stored in a vectorized form. - **Binding** - Helper object that describes the binding of a skeleton to a set of skinnable objects. - **BindingAPI** - Provides API for authoring and extracting all the skinning-related data that lives in the "geometry hierarchy" of prims and models that want to be skeletally deformed. - **BlendShape** - Describes a target blend shape, possibly containing inbetween shapes. - **BlendShapeQuery** - Helper class used to resolve blend shape weights, including inbetweens. - **Cache** - Thread-safe cache for accessing query objects for evaluating skeletal data. - **InbetweenShape** - Schema wrapper for UsdAttribute for authoring and introspecting attributes that serve as inbetween shapes of a UsdSkelBlendShape. | PackedJointAnimation | Deprecated. | |----------------------|-------------| | Root | Boundable prim type used to identify a scope beneath which skeletally-posed primitives are defined. | | Skeleton | Describes a skeleton. | | SkeletonQuery | Primary interface to reading bound skeleton data. | | SkinningQuery | Object used for querying resolved bindings for skinning. | | Tokens | | | Topology | Object holding information describing skeleton topology. | ### AnimMapper **Methods:** - **IsIdentity()** - Returns true if this is an identity map. - **IsNull()** - Returns true if this is a null mapping. - **IsSparse()** - Returns true if this is a sparse mapping. - **Remap(source, target, elementSize, defaultValue)** - Typed remapping of data in an arbitrary, stl-like container. - **RemapTransforms(source, target, elementSize)** - Convenience method for the common task of remapping transform arrays. #### IsIdentity() - Returns true if this is an identity map. - The source and target orders of an identity map are identical. #### IsNull() - Returns true if this is a null mapping. ### IsNull Returns true if this is a null mapping. No source elements of a null map are mapped to the target. ### IsSparse Returns true if this is a sparse mapping. A sparse mapping means that not all target values will be overridden by source values, when mapped with Remap(). ### Remap Typed remapping of data in an arbitrary, stl-like container. The `source` array provides a run of `elementSize` for each path in the em sourceOrder. These elements are remapped and copied over the `target` array. Prior to remapping, the `target` array is resized to the size of the em targetOrder (as given at mapper construction time) multiplied by the `elementSize`. New element created in the array are initialized to `defaultValue`, if provided. **Parameters** - **source** (Container) – - **target** (Container) – - **elementSize** (int) – - **defaultValue** (Container.value_type) – Remap(source, target, elementSize, defaultValue) -> bool Type-erased remapping of data from `source` into `target`. The `source` array provides a run of `elementSize` elements for each path in the em sourceOrder. These elements are remapped and copied over the `target` array. Prior to remapping, the `target` array is resized to the size of the em targetOrder (as given at mapper construction time) multiplied by the `elementSize`. New elements created in the array are initialized to `defaultValue`, if provided. Remapping is supported for registered Sdf array value types only. **Parameters** - **source** (VtValue) – - **target** (VtValue) – - **elementSize** (int) – - **defaultValue** (VtValue) – RemapTransforms(source, target, elementSize) → bool Convenience method for the common task of remapping transform arrays. This performs the same operation as Remap(), but sets the matrix identity as the default value. Parameters: - source (VtArray[Matrix4]) – - target (VtArray[Matrix4]) – - elementSize (int) – class pxr.UsdSkel.AnimQuery Class providing efficient queries of primitives that provide skel animation. Methods: - BlendShapeWeightsMightBeTimeVarying() Return true if it possible, but not certain, that the blend shape weights computed through this animation query change over time, false otherwise. - ComputeBlendShapeWeights(weights, time) param weights - ComputeJointLocalTransformComponents(...) Compute translation, rotation, scale components of the joint transforms in joint-local space. - ComputeJointLocalTransforms(xforms, time) Compute joint transforms in joint-local space. - GetBlendShapeOrder() Returns an array of tokens describing the ordering of blend shape channels in the animation. - GetBlendShapeWeightTimeSamples(attrs) Get the time samples at which values contributing to blend shape weights have been set. - GetBlendShapeWeightTimeSamplesInInterval(...) Get the time samples at which values contributing to blend shape weights are set, over interval. | Method | Description | | --- | --- | | `GetJointOrder()` | Returns an array of tokens describing the ordering of joints in the animation. | | `GetJointTransformTimeSamples(times)` | Get the time samples at which values contributing to joint transforms are set. | | `GetJointTransformTimeSamplesInInterval(...)` | Get the time samples at which values contributing to joint transforms are set, over `interval`. | | `GetPrim()` | Return the primitive this anim query reads from. | | `JointTransformsMightBeTimeVarying()` | Return true if it possible, but not certain, that joint transforms computed through this animation query change over time, false otherwise. | | `BlendShapeWeightsMightBeTimeVarying()` | Return true if it possible, but not certain, that the blend shape weights computed through this animation query change over time, false otherwise. | | `ComputeBlendShapeWeights(weights, time)` | - **weights** (FloatArray) – - **time** (TimeCode) – | `ComputeJointLocalTransformComponents(translations, rotations, scales, time)` | Compute translation, rotation, scale components of the joint transforms in joint-local space. This is provided to facilitate direct streaming of animation data in a form that can efficiently be processed for animation blending. - **translations** (Vec3fArray) – - **rotations** (QuathfArray) – - **scales** (Vec3fArray) – - **time** (TimeCode) – <em> Vec3fArray ) – <li> <p> <strong> rotations ( <em> QuatfArray ) – <li> <p> <strong> scales ( <em> Vec3hArray ) – <li> <p> <strong> time ( <em> TimeCode ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.AnimQuery.ComputeJointLocalTransforms"> <span class="sig-name descname"> <span class="pre"> ComputeJointLocalTransforms <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> xforms , <em class="sig-param"> <span class="n"> <span class="pre"> time <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <a class="headerlink" href="#pxr.UsdSkel.AnimQuery.ComputeJointLocalTransforms" title="Permalink to this definition">  <dd> <p> Compute joint transforms in joint-local space. <p> Transforms are returned in the order specified by the joint ordering of the animation primitive itself. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> xforms ( <em> VtArray <em> [ <em> Matrix4 <em> ] ) – <li> <p> <strong> time ( <em> TimeCode ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.AnimQuery.GetBlendShapeOrder"> <span class="sig-name descname"> <span class="pre"> GetBlendShapeOrder <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> TokenArray <a class="headerlink" href="#pxr.UsdSkel.AnimQuery.GetBlendShapeOrder" title="Permalink to this definition">  <dd> <p> Returns an array of tokens describing the ordering of blend shape channels in the animation. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.AnimQuery.GetBlendShapeWeightTimeSamples"> <span class="sig-name descname"> <span class="pre"> GetBlendShapeWeightTimeSamples <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> attrs <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <a class="headerlink" href="#pxr.UsdSkel.AnimQuery.GetBlendShapeWeightTimeSamples" title="Permalink to this definition">  <dd> <p> Get the time samples at which values contributing to blend shape weights have been set. <p> UsdAttribute::GetTimeSamples <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> attrs ( <em> list <em> [ <em> float <em> ] ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.AnimQuery.GetBlendShapeWeightTimeSamplesInInterval"> <span class="sig-name descname"> <span class="pre"> GetBlendShapeWeightTimeSamplesInInterval <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> interval , <em class="sig-param"> <span class="n"> <span class="pre"> times <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <a class="headerlink" href="#pxr.UsdSkel.AnimQuery.GetBlendShapeWeightTimeSamplesInInterval" title="Permalink to this definition">  <dd> <p> Get the time samples at which values contributing to blend shape weights are set, over <code class="docutils literal notranslate"> <span class="pre"> interval . <p> UsdAttribute::GetTimeSamplesInInterval <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> interval ( <em> Interval ) – <li> <p> <strong> times - Returns an array of tokens describing the ordering of joints in the animation. - UsdSkelSkeleton::GetJointOrder - Get the time samples at which values contributing to joint transforms are set. - This only computes the time samples for sampling transforms in joint-local space, and does not include time samples affecting the root transformation. - UsdAttribute::GetTimeSamples - Parameters: - times (list [float]) – - Get the time samples at which values contributing to joint transforms are set, over interval. - This only computes the time samples for sampling transforms in joint-local space, and does not include time samples affecting the root transformation. - UsdAttribute::GetTimeSamplesInInterval - Parameters: - interval (Interval) – - times (list [float]) – - Return the primitive this anim query reads from. - UsdSkelAnimQuery::GetPrim - Return true if it possible, but not certain, that joint transforms computed through this animation query change over time, false otherwise. - UsdAttribute::ValueMightBeTimeVarying - class pxr.UsdSkel.Animation ## pxr.UsdSkel.Animation Describes a skel animation, where joint animation is stored in a vectorized form. See the extended Skel Animation documentation for more information. **Methods:** | Method Name | Description | |-------------|-------------| | CreateBlendShapeWeightsAttr(defaultValue, ...) | See GetBlendShapeWeightsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateBlendShapesAttr(defaultValue, ...) | See GetBlendShapesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateJointsAttr(defaultValue, writeSparsely) | See GetJointsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateRotationsAttr(defaultValue, writeSparsely) | See GetRotationsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateScalesAttr(defaultValue, writeSparsely) | See GetScalesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateTranslationsAttr(defaultValue, ...) | See GetTranslationsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | Define(stage, path) -> Animation | **classmethod** Define(stage, path) -> Animation | | Get(stage, path) -> Animation | **classmethod** Get(stage, path) -> Animation | | GetBlendShapeWeightsAttr() | Array of weight values for each blend shape. | | GetBlendShapesAttr() | Array of tokens identifying which blend shapes this animation's data applies to. | | GetJointsAttr() | Array of tokens identifying which joints this animation's data applies to. | | GetRotationsAttr() | Joint-local unit quaternion rotations of all affected joints, in 32-bit precision. | | GetScalesAttr() | Joint-local scales of all affected joints, in 16 bit precision. | | GetTranslationsAttr() | See GetTranslationsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetSchemaAttributeNames <strong> classmethod GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetTransforms (xforms, time) Convenience method for querying resolved transforms at <code class="docutils literal notranslate"> <span class="pre"> time . <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetTranslationsAttr () Joint-local translations of all affected joints. <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> SetTransforms (xforms, time) Convenience method for setting an array of transforms. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.Animation.CreateBlendShapeWeightsAttr"> <span class="sig-name descname"> <span class="pre"> CreateBlendShapeWeightsAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <dd> <p> See GetBlendShapeWeightsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.Animation.CreateBlendShapesAttr"> <span class="sig-name descname"> <span class="pre"> CreateBlendShapesAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> Attribute <dd> <p> See GetBlendShapesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> defaultValue ( <em> VtValue ) – <li> <p> <strong> writeSparsely ( <em> bool ) – ### CreateJointsAttr **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – See [GetJointsAttr()](Usd.html#pxr.Usd.Attribute), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### CreateRotationsAttr **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – See [GetRotationsAttr()](Usd.html#pxr.Usd.Attribute), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### CreateScalesAttr **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – See [GetScalesAttr()](Usd.html#pxr.Usd.Attribute), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### CreateTranslationsAttr - **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – See GetTranslationsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Define - **classmethod** Define(stage, path) -> Animation - **Parameters** - **stage** (Stage) – - **path** (Path) – Attempt to ensure a UsdPrim adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with `specifier` == SdfSpecifierDef and this schema’s prim type name for the prim at `path` at the current EditTarget. Author SdfPrimSpec s with `specifier` == SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid UsdPrim. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. ### Get - **classmethod** Get(stage, path) -> Animation - Return a UsdSkelAnimation holding the prim adhering to this schema at `path` on `stage` If no prim exists at ```cpp path ``` on ```cpp stage ``` , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```cpp UsdSkelAnimation(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetBlendShapeWeightsAttr ``` GetBlendShapeWeightsAttr() → Attribute ``` Array of weight values for each blend shape. Each weight value is associated with the corresponding blend shape identified within the `blendShapes` token array, and therefore must have the same length as *blendShapes. Declaration ```cpp float[] blendShapeWeights ``` C++ Type ```cpp VtArray<float> ``` Usd Type ``` SdfValueTypeNames->FloatArray ``` ### GetBlendShapesAttr ``` GetBlendShapesAttr() → Attribute ``` Array of tokens identifying which blend shapes this animation’s data applies to. The tokens for blendShapes correspond to the tokens set in the `skel:blendShapes` binding property of the UsdSkelBindingAPI. Declaration ```cpp uniform token[] blendShapes ``` C++ Type ```cpp VtArray<TfToken> ``` Usd Type ``` SdfValueTypeNames->TokenArray ``` Variability ``` SdfVariabilityUniform ``` ### GetJointsAttr ``` GetJointsAttr() → Attribute ``` Array of tokens identifying which joints this animation’s data applies to. The tokens for joints correspond to the tokens of Skeleton primitives. The order of the joints as listed here may vary from the order of joints on the Skeleton itself. Declaration ```cpp uniform token[] joints ``` C++ Type ```cpp VtArray<TfToken> ``` Usd Type ``` SdfValueTypeNames->TokenArray ``` Variability ``` SdfVariabilityUniform ``` ### GetRotationsAttr ``` GetRotationsAttr() → Attribute ``` Joint-local unit quaternion rotations of all affected joints, in 32-bit precision. Array length should match the size of the `joints` attribute. Declaration ```cpp float4[] rotations ``` C++ Type ```cpp VtArray<GfVec4f> ``` Usd Type ``` SdfValueTypeNames->Float4Array ``` Variability ``` SdfVariabilityUniform ``` ```code quatf[] rotations ``` C++ Type ------------ VtArray&lt;GfQuatf&gt; Usd Type --------- SdfValueTypeNames->QuatfArray --- ```code GetScalesAttr ``` Joint-local scales of all affected joints, in 16 bit precision. Array length should match the size of the *joints* attribute. Declaration ------------ ```code half3[] scales ``` C++ Type --------- VtArray&lt;GfVec3h&gt; Usd Type --------- SdfValueTypeNames->Half3Array --- ```code static GetSchemaAttributeNames ``` **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters ---------- **includeInherited** (bool) – --- ```code GetTransforms ``` Convenience method for querying resolved transforms at `time`. Note that it is more efficient to query transforms through UsdSkelAnimQuery or UsdSkelSkeletonQuery. Parameters ---------- - **xforms** (Matrix4dArray) – - **time** (TimeCode) – --- ```code GetTranslationsAttr ``` Joint-local translations of all affected joints. Array length should match the size of the *joints* attribute. Declaration ------------ ```code float3[] translations ``` C++ Type --------- VtArray&lt;GfVec3f&gt; Usd Type --------- SdfValueTypeNames->Float3Array ### pxr.UsdSkel.Animation.SetTransforms - **Type**: bool - **Description**: Convenience method for setting an array of transforms. - The given transforms must be orthogonal. - **Parameters**: - **xforms** (Matrix4dArray) – - **time** (TimeCode) – ### pxr.UsdSkel.Binding - **Description**: Helper object that describes the binding of a skeleton to a set of skinnable objects. - **Methods**: - **GetSkeleton**() - Returns the bound skeleton. - **GetSkinningTargets**() - Returns the set skinning targets. ### pxr.UsdSkel.BindingAPI - **Description**: Provides API for authoring and extracting all the skinning-related data that lives in the “geometry hierarchy” of prims and models that want to be skeletally deformed. - **Methods**: - **Apply**(prim) -> BindingAPI - **CanApply**(prim, whyNot) -> bool - `CreateAnimationSourceRel()` - See GetAnimationSourceRel() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateBlendShapeTargetsRel()` - See GetBlendShapeTargetsRel() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateBlendShapesAttr(defaultValue, ...)` - See GetBlendShapesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateGeomBindTransformAttr(defaultValue, ...)` - See GetGeomBindTransformAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateJointIndicesAttr(defaultValue, ...)` - See GetJointIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateJointIndicesPrimvar(constant, elementSize)` - Convenience function to create the jointIndices primvar, optionally specifying elementSize. - `CreateJointWeightsAttr(defaultValue, ...)` - See GetJointWeightsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateJointWeightsPrimvar(constant, elementSize)` - Convenience function to create the jointWeights primvar, optionally specifying elementSize. - `CreateJointsAttr(defaultValue, writeSparsely)` - See GetJointsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateSkeletonRel()` - See GetSkeletonRel() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateSkinningBlendWeightPrimvar()` - (No additional description provided) - `CreateSkinningBlendWeightsAttr(defaultValue, ...)` - See GetSkinningBlendWeightsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `CreateSkinningMethodAttr(defaultValue, ...)` - See GetSkinningMethodAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - `Get` - **classmethod** Get(stage, path) -> BindingAPI - **GetAnimationSource** (prim) - Convenience method to query the animation source bound on this prim. - **GetAnimationSourceRel** () - Animation source to be bound to Skeleton primitives at or beneath the location at which this property is defined. - **GetBlendShapeTargetsRel** () - Ordered list of all target blend shapes. - **GetBlendShapesAttr** () - An array of tokens defining the order onto which blend shape weights from an animation source map onto the `skel:blendShapeTargets` rel of a binding site. - **GetGeomBindTransformAttr** () - Encodes the bind-time world space transforms of the prim. - **GetInheritedAnimationSource** () - Returns the animation source bound at this prim, or one of its ancestors. - **GetInheritedSkeleton** () - Returns the skeleton bound at this prim, or one of its ancestors. - **GetJointIndicesAttr** () - Indices into the `joints` attribute of the closest (in namespace) bound Skeleton that affect each point of a PointBased gprim. - **GetJointIndicesPrimvar** () - Convenience function to get the jointIndices attribute as a primvar. - **GetJointWeightsAttr** () - Weights for the joints that affect each point of a PointBased gprim. - **GetJointWeightsPrimvar** () - Convenience function to get the jointWeights attribute as a primvar. - **GetJointsAttr** () - An (optional) array of tokens defining the list of joints to which jointIndices apply. - **GetSchemaAttributeNames** () - **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] - **GetSkeleton** (skel) - Convenience method to query the Skeleton bound on this prim. | 方法 | 描述 | | --- | --- | | `GetSkeletonRel()` | Skeleton to be bound to this prim and its descendents that possess a mapping and weighting to the joints of the identified Skeleton. | | `GetSkinningBlendWeightPrimvar` | | | `GetSkinningBlendWeightsAttr()` | Weights for weighted blend skinning method. | | `GetSkinningMethodAttr()` | Different calculation method for skinning. | | `SetRigidJointInfluence(jointIndex, weight)` | Convenience method for defining joints influences that make a primitive rigidly deformed by a single joint. | | `ValidateJointIndices` | `classmethod ValidateJointIndices(indices, numJoints, reason) -> bool` | ### Apply **classmethod** Apply(prim) -> BindingAPI Applies this **single-apply** API schema to the given `prim`. This information is stored by adding "SkelBindingAPI" to the token-valued, listOp metadata `apiSchemas` on the prim. A valid UsdSkelBindingAPI object is returned upon success. An invalid (or empty) UsdSkelBindingAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() **Parameters** - **prim** (`Prim`) – ### CanApply **classmethod** CanApply(prim, whyNot) -> bool Returns true if this **single-apply** API schema can be applied to the given `prim`. If this schema can not be applied to the prim, this returns false and, if provided, populates `whyNot` with the reason it can not be applied. Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. - UsdPrim::GetAppliedSchemas() - UsdPrim::HasAPI() - UsdPrim::CanApplyAPI() - UsdPrim::ApplyAPI() - UsdPrim::RemoveAPI() **Parameters** - **prim** (`Prim`) – - **whyNot** (`str`) – ## CreateAnimationSourceRel ``` ```markdown See GetAnimationSourceRel() , and also Create vs Get Property Methods for when to use Get vs Create. ``` ```markdown ## CreateBlendShapeTargetsRel ``` ```markdown See GetBlendShapeTargetsRel() , and also Create vs Get Property Methods for when to use Get vs Create. ``` ```markdown ## CreateBlendShapesAttr ``` ```markdown See GetBlendShapesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. ``` ```markdown If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ``` ```markdown ### Parameters ``` ```markdown - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ``` ```markdown ## CreateGeomBindTransformAttr ``` ```markdown See GetGeomBindTransformAttr() , and also Create vs Get Property Methods for when to use Get vs Create. ``` ```markdown If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ``` ```markdown ### Parameters ``` ```markdown - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ``` ```markdown ## CreateJointIndicesAttr ``` ## CreateJointIndicesAttr ```CreateJointIndicesAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See GetJointIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateJointIndicesPrimvar ```CreateJointIndicesPrimvar```(```constant```, ```elementSize```) → ```Primvar``` Convenience function to create the jointIndices primvar, optionally specifying elementSize. If ```constant``` is true, the resulting primvar is configured with 'constant' interpolation, and describes a rigid deformation. Otherwise, the primvar is configured with 'vertex' interpolation, and describes joint influences that vary per point. CreateJointIndicesAttr() , GetJointIndicesPrimvar() ### Parameters - **constant** (bool) – - **elementSize** (int) – ## CreateJointWeightsAttr ```CreateJointWeightsAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` See GetJointWeightsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateJointWeightsPrimvar ```CreateJointWeightsPrimvar```(```constant```, ```elementSize```) → ```Primvar``` Convenience function to create the jointIndices primvar, optionally specifying elementSize. If ```constant``` is true, the resulting primvar is configured with 'constant' interpolation, and describes a rigid deformation. Otherwise, the primvar is configured with 'vertex' interpolation, and describes joint influences that vary per point. CreateJointIndicesAttr() , GetJointIndicesPrimvar() ### Parameters - **constant** (bool) – - **elementSize** (int) – ### CreateJointWeightsPrimvar ```CreateJointWeightsPrimvar```(```constant```, ```elementSize```) → ```Primvar``` *Convenience function to create the jointWeights primvar, optionally specifying elementSize.* *If ```constant``` is true, the resulting primvar is configured with 'constant' interpolation, and describes a rigid deformation. Otherwise, the primvar is configured with 'vertex' interpolation, and describes joint influences that vary per point.* *CreateJointWeightsAttr() , GetJointWeightsPrimvar()* **Parameters** - **constant** (bool) – - **elementSize** (int) – ### CreateJointsAttr ```CreateJointsAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` *See GetJointsAttr() , and also Create vs Get Property Methods for when to use Get vs Create.* *If specified, author ```defaultValue``` as the attribute’s default, sparsely (when it makes sense to do so) if ```writeSparsely``` is ```true``` - the default for ```writeSparsely``` is ```false```.* **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateSkeletonRel ```CreateSkeletonRel```() → ```Relationship``` *See GetSkeletonRel() , and also Create vs Get Property Methods for when to use Get vs Create.* ### CreateSkinningBlendWeightPrimvar ```CreateSkinningBlendWeightPrimvar```() ### CreateSkinningBlendWeightsAttr ```CreateSkinningBlendWeightsAttr```(```defaultValue```, ```writeSparsely```) → ```Attribute``` *See GetSkinningBlendWeightsAttr() , and also Create vs Get Property Methods for when to use Get vs Create.* <span class="pre">defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre">writeSparsely is <code class="docutils literal notranslate"> <span class="pre">true - the default for <code class="docutils literal notranslate"> <span class="pre">writeSparsely is <code class="docutils literal notranslate"> <span class="pre">false . <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BindingAPI.CreateSkinningMethodAttr"> <span class="sig-name descname"><span class="pre">CreateSkinningMethodAttr <span class="sig-paren">( <em class="sig-param"><span class="n"><span class="pre">defaultValue , <em class="sig-param"><span class="n"><span class="pre">writeSparsely <span class="sig-paren">) <span class="sig-return"><span class="sig-return-icon">→ <a class="headerlink" href="#pxr.UsdSkel.BindingAPI.CreateSkinningMethodAttr" title="Permalink to this definition"> <dd> <p>See GetSkinningMethodAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code class="docutils literal notranslate"><span class="pre">defaultValue <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p><strong>defaultValue <li> <p><strong>writeSparsely <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BindingAPI.Get"> <em class="property"><span class="pre">static <span class="sig-name descname"><span class="pre">Get <span class="sig-paren">( <span class="sig-paren">) <a class="headerlink" href="#pxr.UsdSkel.BindingAPI.Get" title="Permalink to this definition"> <dd> <p><strong>classmethod <p>Return a UsdSkelBindingAPI holding the prim adhering to this schema at <code class="docutils literal notranslate"><span class="pre">path <p>If no prim exists at <code class="docutils literal notranslate"><span class="pre">path <div class="highlight-text notranslate"> <div class="highlight"> <pre><span> <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p><strong>stage <li> <p><strong>path <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BindingAPI.GetAnimationSource"> <span class="sig-name descname"><span class="pre">GetAnimationSource <span class="sig-paren">( <em class="sig-param"><span class="n"><span class="pre">prim <span class="sig-paren">) <span class="sig-return"><span class="sig-return-icon">→ <a class="headerlink" href="#pxr.UsdSkel.BindingAPI.GetAnimationSource" title="Permalink to this definition"> <dd> <p>Convenience method to query the animation source bound on this prim. <p>Returns true if an animation source binding is defined, and sets <code class="docutils literal notranslate"><span class="pre">prim This binds an animation source to the target prim. The resulting primitive may still be invalid, if the prim has been explicitly unbound. This does not resolve inherited animation source bindings. ### Parameters - **prim** (Prim) – ### GetAnimationSourceRel - **Returns**: Relationship - Animation source to be bound to Skeleton primitives at or beneath the location at which this property is defined. ### GetBlendShapeTargetsRel - **Returns**: Relationship - Ordered list of all target blend shapes. - This property is not inherited hierarchically, and is expected to be authored directly on the skinnable primitive to which the blend shapes apply. ### GetBlendShapesAttr - **Returns**: Attribute - An array of tokens defining the order onto which blend shape weights from an animation source map onto the skel:blendShapeTargets rel of a binding site. - If authored, the number of elements must be equal to the number of targets in the blendShapeTargets rel. This property is not inherited hierarchically, and is expected to be authored directly on the skinnable primitive to which the blend shapes apply. - Declaration: ``` uniform token[] skel:blendShapes ``` - C++ Type: VtArray&lt;TfToken&gt; - Usd Type: SdfValueTypeNames->TokenArray - Variability: SdfVariabilityUniform ### GetGeomBindTransformAttr - **Returns**: Attribute - Encodes the bind-time world space transforms of the prim. - If the transform is identical for a group of gprims that share a common ancestor, the transform may be authored on the ancestor, to”inherit”down to all the leaf gprims. If this transform is unset, an identity transform is used instead. - Declaration: ``` matrix4d primvars:skel:geomBindTransform ``` - C++ Type: GfMatrix4d - Usd Type: SdfValueTypeNames->Matrix4d ### GetInheritedAnimationSource - **Returns**: Prim - Returns the animation source bound at this prim, or one of its ancestors. ### GetInheritedSkeleton - **Returns**: Prim - Returns the inherited skeleton. → Skeleton  Returns the skeleton bound at this prim, or one of its ancestors. --- → Attribute  Indices into the `joints` attribute of the closest (in namespace) bound Skeleton that affect each point of a PointBased gprim. The primvar can have either `constant` or `vertex` interpolation. This primvar’s `elementSize` will determine how many joint influences apply to each point. Indices must point be valid. Null influences should be defined by setting values in jointWeights to zero. See UsdGeomPrimvar for more information on interpolation and elementSize. Declaration int[] primvars:skel:jointIndices ``` C++ Type ``` VtArray<int> ``` Usd Type ``` SdfValueTypeNames->IntArray ``` --- → Primvar  Convenience function to get the jointIndices attribute as a primvar. GetJointIndicesAttr, GetInheritedJointWeightsPrimvar --- → Attribute  Weights for the joints that affect each point of a PointBased gprim. The primvar can have either `constant` or `vertex` interpolation. This primvar’s `elementSize` will determine how many joints influences apply to each point. The length, interpolation, and elementSize of `jointWeights` must match that of `jointIndices`. See UsdGeomPrimvar for more information on interpolation and elementSize. Declaration float[] primvars:skel:jointWeights ``` C++ Type ``` VtArray<float> ``` Usd Type ``` SdfValueTypeNames->FloatArray ``` --- → Primvar  Convenience function to get the jointWeights attribute as a primvar. GetJointWeightsAttr, GetInheritedJointWeightsPrimvar --- → Attribute  An (optional) array of tokens defining the list of joints to which jointIndices apply. If not defined, jointIndices applies to the ordered list of joints defined in the bound Skeleton’s `joints` attribute. If undefined on a primitive, the primitive inherits the value of the nearest ancestor prim, if any. Declaration <p> <code> uniform token[] skel:joints <p> C++ Type <p> VtArray&lt;TfToken&gt; <p> Usd Type <p> SdfValueTypeNames-&gt;TokenArray <p> Variability <p> SdfVariabilityUniform <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BindingAPI.GetSchemaAttributeNames"> <em> static <span class="sig-name descname"> GetSchemaAttributeNames <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdSkel.BindingAPI.GetSchemaAttributeNames" title="Permalink to this definition">  <dd> <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -&gt; list[TfToken] <p> Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. <p> Does not include attributes that may be authored by custom/extended methods of the schemas involved. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> includeInherited ( <em> bool ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BindingAPI.GetSkeleton"> <span class="sig-name descname"> GetSkeleton <span class="sig-paren"> ( <em class="sig-param"> skel <span class="sig-paren"> ) <span class="sig-return"> → <span class="sig-return-typehint"> bool <a class="headerlink" href="#pxr.UsdSkel.BindingAPI.GetSkeleton" title="Permalink to this definition">  <dd> <p> Convenience method to query the Skeleton bound on this prim. <p> Returns true if a Skeleton binding is defined, and sets <code>skel <p> This does not resolved inherited skeleton bindings. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> skel ( <em> Skeleton ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BindingAPI.GetSkeletonRel"> <span class="sig-name descname"> GetSkeletonRel <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> → <span class="sig-return-typehint"> Relationship <a class="headerlink" href="#pxr.UsdSkel.BindingAPI.GetSkeletonRel" title="Permalink to this definition">  <dd> <p> Skeleton to be bound to this prim and its descendents that possess a mapping and weighting to the joints of the identified Skeleton. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BindingAPI.GetSkinningBlendWeightPrimvar"> <span class="sig-name descname"> GetSkinningBlendWeightPrimvar <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdSkel.BindingAPI.GetSkinningBlendWeightPrimvar" title="Permalink to this definition">  <dd> <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BindingAPI.GetSkinningBlendWeightsAttr"> <span class="sig-name descname"> GetSkinningBlendWeightsAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> → <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdSkel.BindingAPI.GetSkinningBlendWeightsAttr" title="Permalink to this definition">  <dd> <p> Weights for weighted blend skinning method. <p> The primvar can have either <em>constant <p> C++ Type: VtArray&lt;float&gt; Usd Type: SdfValueTypeNames-&gt;FloatArray Variability: SdfVariabilityUniform Fallback Value: No Fallback <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BindingAPI.GetSkinningMethodAttr"> <span class="sig-name descname"> GetSkinningMethodAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> → <span class="sig-return-typehint"> Attribute <a class="headerlink" href="#pxr.UsdSkel.BindingAPI.GetSkinningMethodAttr" title="Permalink to this definition">  <dd> <p> Different calculation method for skinning. <p> LBS, DQ, and blendWeight <p> C++ Type: TfToken Usd Type: SdfValueTypeNames-&gt;Token Variability: SdfVariabilityUniform Fallback Value: ClassicLinear Allowed Values : [ClassicLinear, DualQuaternion, WeightedBlend] ### SetRigidJointInfluence ```python SetRigidJointInfluence(jointIndex, weight) -> bool ``` Convenience method for defining joints influences that make a primitive rigidly deformed by a single joint. **Parameters** - **jointIndex** (int) – - **weight** (float) – ### ValidateJointIndices ```python classmethod ValidateJointIndices(indices, numJoints, reason) -> bool ``` Validate an array of joint indices. This ensures that all indices are the in the range [0, numJoints). Returns true if the indices are valid, or false otherwise. If invalid and reason is non-null, an error message describing the first validation error will be set. **Parameters** - **indices** (TfSpan[int]) – - **numJoints** (int) – - **reason** (str) – ### BlendShape Describes a target blend shape, possibly containing inbetween shapes. See the extended Blend Shape Schema documentation for information. **Methods:** - **CreateInbetween**(name) - Author scene description to create an attribute on this prim that will be recognized as an Inbetween (i.e. - **CreateNormalOffsetsAttr**(defaultValue, ...) - See GetNormalOffsetsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - **CreateOffsetsAttr**(defaultValue, writeSparsely) - See GetOffsetsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - **CreatePointIndicesAttr**(defaultValue, ...) - See GetPointIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. - **Define** - ``` | Method | Description | |--------|-------------| | `classmethod Define(stage, path) -> BlendShape` | Define a new BlendShape. | | `classmethod Get(stage, path) -> BlendShape` | Get an existing BlendShape. | | `GetAuthoredInbetweens()` | Like GetInbetweens(), but exclude inbetweens that have no authored scene / description. | | `GetInbetween(name)` | Return the Inbetween corresponding to the attribute named `name`, which will be valid if an Inbetween attribute definition already exists. | | `GetInbetweens()` | Return valid UsdSkelInbetweenShape objects for all defined Inbetweens on this prim. | | `GetNormalOffsetsAttr()` | **Required property**. | | `GetOffsetsAttr()` | **Required property**. | | `GetPointIndicesAttr()` | **Optional property**. | | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | Get the list of schema attribute names. | | `HasInbetween(name)` | Return true if there is a defined Inbetween named `name` on this prim. | | `classmethod ValidatePointIndices(indices, numPoints, reason) -> bool` | Validate point indices. | ### CreateInbetween ```python CreateInbetween(name) -> InbetweenShape ``` Author scene description to create an attribute on this prim that will be recognized as an Inbetween (i.e., will present as a valid UsdSkelInbetweenShape). The name of the created attribute or may or may not be the specified `attrName`, due to the possible need to apply property namespacing. Creation may fail and return an invalid Inbetwen if `attrName` contains a reserved keyword. ``` to create over an existing, compatible attribute. UsdSkelInbetweenShape::IsInbetween() Parameters ---------- name (str) – CreateNormalOffsetsAttr(defaultValue, writeSparsely) → Attribute ----------------------------------------------------------- See GetNormalOffsetsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - defaultValue (VtValue) – - writeSparsely (bool) – CreateOffsetsAttr(defaultValue, writeSparsely) → Attribute -------------------------------------------------------- See GetOffsetsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - defaultValue (VtValue) – - writeSparsely (bool) – CreatePointIndicesAttr(defaultValue, writeSparsely) → Attribute ------------------------------------------------------------- See GetPointIndicesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - defaultValue (VtValue) – - writeSparsely (bool) – <span class="pre">writeSparsely is <code class="docutils literal notranslate"> <span class="pre">false . <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong>defaultValue <em>VtValue <li> <p> <strong>writeSparsely <em>bool <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BlendShape.Define"> <em class="property"> <span class="pre">static <span class="w"> <span class="sig-name descname"> <span class="pre">Define <span class="sig-paren">( <span class="sig-paren">) <a class="headerlink" href="#pxr.UsdSkel.BlendShape.Define" title="Permalink to this definition"> <dd> <p> <strong>classmethod <p> Attempt to ensure a <em>UsdPrim adhering to this schema at <code class="docutils literal notranslate"><span class="pre">path is defined (according to UsdPrim::IsDefined() ) on this stage. <p> If a prim adhering to this schema at <code class="docutils literal notranslate"><span class="pre">path is already defined on this stage, return that prim. Otherwise author an <em>SdfPrimSpec with <em>specifier == <em>SdfSpecifierDef and this schema’s prim type name for the prim at <code class="docutils literal notranslate"><span class="pre">path at the current EditTarget. Author <em>SdfPrimSpec with <code class="docutils literal notranslate"><span class="pre">specifier == <em>SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not <em>Defined ancestors. <p> The given <em>path must be an absolute prim path that does not contain any variant selections. <p> If it is impossible to author any of the necessary PrimSpecs, (for example, in case <em>path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid <em>UsdPrim . <p> Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong>stage <em>Stage <li> <p> <strong>path <em>Path <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BlendShape.Get"> <em class="property"> <span class="pre">static <span class="w"> <span class="sig-name descname"> <span class="pre">Get <span class="sig-paren">( <span class="sig-paren">) <a class="headerlink" href="#pxr.UsdSkel.BlendShape.Get" title="Permalink to this definition"> <dd> <p> <strong>classmethod <p> Return a UsdSkelBlendShape holding the prim adhering to this schema at <code class="docutils literal notranslate"><span class="pre">path on <code class="docutils literal notranslate"><span class="pre">stage . <p> If no prim exists at <code class="docutils literal notranslate"><span class="pre">path on <code class="docutils literal notranslate"><span class="pre">stage , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: <div class="highlight-text notranslate"> <div class="highlight"> <pre><span> <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong>stage <em>Stage <li> <p> <strong>path <em>Path <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.BlendShape.GetAuthoredInbetweens"> <span class="sig-name descname"> <span class="pre">GetAuthoredInbetweens <span class="sig-paren">( <span class="sig-paren">) <span class="sig-return"> <span class="sig-return-icon">→ <span class="sig-return-typehint"> <span class="pre">list <span class="p"><span class="pre">[ <a class="reference internal" href="#pxr.UsdSkel.InbetweenShape" title="pxr.UsdSkel.InbetweenShape"> ### InbetweenShape ### GetInbetween (name) → InbetweenShape Return the Inbetween corresponding to the attribute named `name`, which will be valid if an Inbetween attribute definition already exists. Name lookup will account for Inbetween namespacing, which means that this method will succeed in some cases where `UsdSkelInbetweenShape (prim->GetAttribute(name))` will not, unless `name` has the proper namespace prefix. HasInbetween() #### Parameters - **name** (str) – ### GetInbetweens () → list[InbetweenShape] Return valid UsdSkelInbetweenShape objects for all defined Inbetweens on this prim. ### GetNormalOffsetsAttr () → Attribute **Required property**. Normal offsets which, when added to the base pose, provides the normals of the target shape. #### Declaration `uniform vector3f[] normalOffsets` #### C++ Type VtArray&lt;GfVec3f&gt; #### Usd Type SdfValueTypeNames->Vector3fArray #### Variability SdfVariabilityUniform ### GetOffsetsAttr () → Attribute **Required property**. Position offsets which, when added to the base pose, provides the target shape. #### Declaration `uniform vector3f[] offsets` #### C++ Type VtArray&lt;GfVec3f&gt; #### Usd Type SdfValueTypeNames->Vector3fArray #### Variability SdfVariabilityUniform ### Attribute **Optional property**. Indices into the original mesh that correspond to the values in `offsets` and of any inbetween shapes. If authored, the number of elements must be equal to the number of elements in the `offsets` array. **Declaration** ``` uniform int[] pointIndices ``` **C++ Type** VtArray<int> **Usd Type** SdfValueTypeNames->IntArray **Variability** SdfVariabilityUniform ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – ### HasInbetween **HasInbetween**(name) -> bool Return true if there is a defined Inbetween named `name` on this prim. Name lookup will account for Inbetween namespacing. **Parameters** - **name** (str) – ### ValidatePointIndices **classmethod** ValidatePointIndices(indices, numPoints, reason) -> bool Validates a set of point indices for a given point count. This ensures that all point indices are in the range [0, numPoints). Returns true if the indices are valid, or false otherwise. If invalid and `reason` is non-null, an error message describing the first validation error will be set. **Parameters** - **indices** (TfSpan[int]) – - **numPoints** (int) – - **reason** (str) – ### BlendShapeQuery Helper class used to resolve blend shape weights, including inbetweens. **Methods:** - ComputeBlendShapePointIndices | Method | Description | |--------|-------------| | ComputeDeformedPoints(subShapeWeights, blendShapeIndices, subShapeIndices) | Deform `points` using the resolved sub-shapes given by `subShapeWeights`, `blendShapeIndices`, and `subShapeIndices`. | | ComputeSubShapePointOffsets() | Compute an array holding the point offsets of all sub-shapes. | | ComputeSubShapeWeights(weights, ...) | Compute the resolved weights for all sub-shapes bound to this prim. | | GetBlendShape(blendShapeIndex) | Returns the blend shape corresponding to `blendShapeIndex`. | | GetBlendShapeIndex(subShapeIndex) | Returns the blend shape index corresponding to the i'th sub-shape. | | GetInbetween(subShapeIndex) | Returns the inbetween shape corresponding to sub-shape `i`, if any. | | GetNumBlendShapes() | Returns the number of blend shapes. | | GetNumSubShapes() | Returns the number of sub-shapes. | ### ComputeBlendShapePointIndices() Compute an array holding the point indices of all shapes. This is indexed by the *blendShapeIndices* returned by ComputeSubShapes(). Since the *pointIndices* property of blend shapes is optional, some of the arrays may be empty. ### ComputeDeformedPoints() ComputeDeformedPoints(subShapeWeights, blendShapeIndices, subShapeIndices) Deform `points` using the resolved sub-shapes given by `subShapeWeights`, `blendShapeIndices`, and `subShapeIndices`. ### blendShapeQuery.ComputeDeformedPoints Deform `points` using the resolved sub-shapes given by `subShapeWeights`, `blendShapeIndices`, and `subShapeIndices`. The `blendShapePointIndices` and `blendShapePointOffsets` arrays both provide the pre-computed point offsets and indices of each sub-shape, as computed by ComputeBlendShapePointIndices() and ComputeSubShapePointOffsets(). #### Parameters - **subShapeWeights** (TfSpan[float]) – - **blendShapeIndices** (TfSpan[unsigned]) – - **subShapeIndices** (TfSpan[unsigned]) – - **blendShapePointIndices** (list[IntArray]) – - **subShapePointOffsets** (list[Vec3fArray]) – - **points** (TfSpan[Vec3f]) – ### blendShapeQuery.ComputeSubShapePointOffsets Compute an array holding the point offsets of all sub-shapes. This includes offsets of both primary shapes those stored directly on a BlendShape primitive as well as those of inbetween shapes. This is indexed by the `subShapeIndices` returned by ComputeSubShapeWeights(). ### blendShapeQuery.ComputeSubShapeWeights Compute the resolved weights for all sub-shapes bound to this prim. The ```code weights ``` values are initial weight values, ordered according to the ``` skel:blendShapeTargets ``` relationship of the prim this query is associated with. If there are any inbetween shapes, a new set of weights is computed, providing weighting of the relevant inbetweens. All computed arrays shared the same size. Elements of the same index identify which sub-shape of which blend shape a given weight value is mapped to. ### Parameters - **weights** (`TfSpan[float]`) – - **subShapeWeights** (`FloatArray`) – - **blendShapeIndices** (`UIntArray`) – - **subShapeIndices** (`UIntArray`) – ```python def GetBlendShape(blendShapeIndex): → BlendShape ``` Returns the blend shape corresponding to `blendShapeIndex`. ### Parameters - **blendShapeIndex** (`int`) – ```python def GetBlendShapeIndex(subShapeIndex): → int ``` Returns the blend shape index corresponding to the `i'th` sub-shape. ### Parameters - **subShapeIndex** (`int`) – ```python def GetInbetween(subShapeIndex): → InbetweenShape ``` Returns the inbetween shape corresponding to sub-shape `i`, if any. ### Parameters - **subShapeIndex** (`int`) – ```python def GetNumBlendShapes(): → int ``` ```python def GetNumSubShapes(): → int ``` ### pxr.UsdSkel.Cache Thread-safe cache for accessing query objects for evaluating skeletal data. This provides caching of major structural components, such as skeletal topology. In a streaming context, this cache is intended to persist. **Methods:** - **Clear**() - **ComputeSkelBinding**(skelRoot, skel, binding, ...) - Compute the bindings corresponding to a single skeleton, bound beneath `skelRoot`, as discovered through a traversal using `predicate`. - **ComputeSkelBindings**(skelRoot, bindings, ...) - Compute the set of skeleton bindings beneath `skelRoot`, as discovered through a traversal using `predicate`. - **GetAnimQuery**(anim) - Get an anim query corresponding to `anim`. - **GetSkelQuery**(skel) - Get a skel query for computing properties of `skel`. - **GetSkinningQuery**(prim) - Get a skinning query at `prim`. - **Populate**(root, predicate) - Populate the cache for the skeletal data beneath prim `root`, as traversed using `predicate`. #### Clear - **Clear**() - Returns: None <em class="sig-param"> <span class="n"> <span class="pre"> binding , <em class="sig-param"> <span class="n"> <span class="pre"> predicate <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Compute the bindings corresponding to a single skeleton, bound beneath <code> skelRoot , as discovered through a traversal using <code> predicate . <p> Skinnable prims are only discoverable by this method if Populate() has already been called for <code> skelRoot , with an equivalent predicate. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> skelRoot (Root) – <li> <p> <strong> skel (Skeleton) – <li> <p> <strong> binding (Binding) – <li> <p> <strong> predicate (_PrimFlagsPredicate) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.Cache.ComputeSkelBindings"> <span class="sig-name descname"> <span class="pre"> ComputeSkelBindings <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> skelRoot , <em class="sig-param"> <span class="n"> <span class="pre"> bindings , <em class="sig-param"> <span class="n"> <span class="pre"> predicate <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Compute the set of skeleton bindings beneath <code> skelRoot , as discovered through a traversal using <code> predicate . <p> Skinnable prims are only discoverable by this method if Populate() has already been called for <code> skelRoot , with an equivalent predicate. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> skelRoot (Root) – <li> <p> <strong> bindings (list[Binding]) – <li> <p> <strong> predicate (_PrimFlagsPredicate) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.Cache.GetAnimQuery"> <span class="sig-name descname"> <span class="pre"> GetAnimQuery <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> anim <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> AnimQuery <dd> <p> Get an anim query corresponding to <code> anim . <p> This does not require Populate() to be called on the cache. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> anim (Animation) – <hr /> <p> GetAnimQuery(prim) -> AnimQuery <p> This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Deprecated Parameters ========== * **prim** (Prim) – GetSkelQuery ============ Get a skel query for computing properties of `skel`. This does not require Populate() to be called on the cache. Parameters ---------- * **skel** (Skeleton) – GetSkinningQuery ================ Get a skinning query at `prim`. Skinning queries are defined at any skinnable prims (I.e., boundable prims with fully defined joint influences). The caller must first Populate() the cache with the skel root containing `prim`, with a predicate that will visit `prim`, in order for a skinning query to be discoverable. Parameters ---------- * **prim** (Prim) – Populate ======== Populate the cache for the skeletal data beneath prim `root`, as traversed using `predicate`. Population resolves inherited skel bindings set using the UsdSkelBindingAPI, making resolved bindings available through GetSkinningQuery(), ComputeSkelBdining() and ComputeSkelBindings(). Parameters ---------- * **root** (Root) – * **predicate** (_PrimFlagsPredicate) – InbetweenShape ============== Schema wrapper for UsdAttribute for authoring and introspecting attributes that serve as inbetween shapes of a UsdSkelBlendShape. Inbetween shapes allow an explicit shape to be specified when the blendshape to which it’s bound is evaluated at a certain weight. For example, rather than performing piecewise linear interpolation between a primary shape and the rest shape at weight 0.5, an inbetween shape could be defined at the weight. For weight values greater than 0.5, a shape would then be resolved by linearly interpolating between the inbetween shape and the primary shape, while for weight values less than 0.5, the shape would be resolved by interpolating between the inbetween shape and the rest shape. than or equal to 0.5, the shape is resolved by linearly interpolating between the inbetween shape and the primary shape. **Methods:** | Method | Description | | --- | --- | | `CreateNormalOffsetsAttr(defaultValue)` | Returns the existing normal offsets attribute if the shape has normal offsets, or creates a new one. | | `GetAttr()` | Explicit UsdAttribute extractor. | | `GetNormalOffsets(offsets)` | Get the normal offsets authored for this shape. | | `GetNormalOffsetsAttr()` | Returns a valid normal offsets attribute if the shape has normal offsets. | | `GetOffsets(offsets)` | Get the point offsets corresponding to this shape. | | `GetWeight(weight)` | Return the location at which the shape is applied. | | `HasAuthoredWeight()` | Has a weight value been explicitly authored on this shape? | | `IsDefined()` | Return true if the wrapped UsdAttribute::IsDefined() , and in addition the attribute is identified as an Inbetween. | | `IsInbetween(attr) -> bool` | **classmethod** | | `SetNormalOffsets(offsets)` | Set the normal offsets authored for this shape. | | `SetOffsets(offsets)` | Set the point offsets corresponding to this shape. | | `SetWeight(weight)` | Set the location at which the shape is applied. | <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> defaultValue ( <em> VtValue ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.InbetweenShape.GetAttr"> <span class="sig-name descname"> <span class="pre"> GetAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> Explicit UsdAttribute extractor. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.InbetweenShape.GetNormalOffsets"> <span class="sig-name descname"> <span class="pre"> GetNormalOffsets <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> offsets <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> bool <dd> <p> Get the normal offsets authored for this shape. <p> Normal offsets are optional, and may be left unspecified. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> offsets ( Vec3fArray ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.InbetweenShape.GetNormalOffsetsAttr"> <span class="sig-name descname"> <span class="pre"> GetNormalOffsetsAttr <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> Attribute <dd> <p> Returns a valid normal offsets attribute if the shape has normal offsets. <p> Returns an invalid attribute otherwise. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.InbetweenShape.GetOffsets"> <span class="sig-name descname"> <span class="pre"> GetOffsets <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> offsets <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> bool <dd> <p> Get the point offsets corresponding to this shape. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> offsets ( Vec3fArray ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.InbetweenShape.GetWeight"> <span class="sig-name descname"> <span class="pre"> GetWeight <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> weight <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> bool <dd> <p> Return the location at which the shape is applied. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> weight ( float ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.InbetweenShape.HasAuthoredWeight"> <span class="sig-name descname"> <span class="pre"> HasAuthoredWeight <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> bool <dd> <p> Has a weight value been explicitly authored on this shape? <p> GetWeight() <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.InbetweenShape.IsDefined"> <span class="sig-name descname"> <span class="pre"> IsDefined <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> bool <dd> <p> Is the shape defined? ### IsDefined Return true if the wrapped UsdAttribute::IsDefined() , and in addition the attribute is identified as an Inbetween. ### IsInbetween **classmethod** IsInbetween(attr) -> bool Test whether a given UsdAttribute represents a valid Inbetween, which implies that creating a UsdSkelInbetweenShape from the attribute will succeed. Succes implies that `attr.IsDefined()` is true. Parameters: - **attr** (Attribute) – ### SetNormalOffsets Set the normal offsets authored for this shape. Parameters: - **offsets** (Vec3fArray) – ### SetOffsets Set the point offsets corresponding to this shape. Parameters: - **offsets** (Vec3fArray) – ### SetWeight Set the location at which the shape is applied. Parameters: - **weight** (float) – ### PackedJointAnimation Deprecated. Please use SkelAnimation instead. Methods: - **Define** classmethod Define(stage, path) -> PackedJointAnimation - **Get** <p> <strong> classmethod Get(stage, path) -> PackedJointAnimation <p> <strong> classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <p> <strong> classmethod Define(stage, path) -> PackedJointAnimation <p> Attempt to ensure a <em> UsdPrim adhering to this schema at <code class="docutils literal notranslate"> <span class="pre"> path is defined (according to UsdPrim::IsDefined() ) on this stage. <p> If a prim adhering to this schema at <code class="docutils literal notranslate"> <span class="pre"> path is already defined on this stage, return that prim. Otherwise author an <em> SdfPrimSpec with <em> specifier == <em> SdfSpecifierDef and this schema’s prim type name for the prim at <code class="docutils literal notranslate"> <span class="pre"> path at the current EditTarget. Author <em> SdfPrimSpec s with <code class="docutils literal notranslate"> <span class="pre"> specifier == <em> SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not <em> Defined ancestors. <p> The given <em> path must be an absolute prim path that does not contain any variant selections. <p> If it is impossible to author any of the necessary PrimSpecs, (for example, in case <em> path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid <em> UsdPrim . <p> Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> stage (<em> Stage <li> <p> <strong> path (<em> Path <p> <strong> classmethod Get(stage, path) -> PackedJointAnimation <p> Return a UsdSkelPackedJointAnimation holding the prim adhering to this schema at <code class="docutils literal notranslate"> <span class="pre"> path on <code class="docutils literal notranslate"> <span class="pre"> stage . <p> If no prim exists at <code class="docutils literal notranslate"> <span class="pre"> path on <code class="docutils literal notranslate"> <span class="pre"> stage , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: <div class="highlight-text notranslate"> <div class="highlight"> <pre><span> <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> stage (<em> Stage <li> <p> <strong> path (<em> Path <p> <strong> classmethod GetSchemaAttributeNames ## classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. ### Parameters - **includeInherited** (bool) – ## pxr.UsdSkel.Root Boundable prim type used to identify a scope beneath which skeletally-posed primitives are defined. A SkelRoot must be defined at or above a skinned primitive for any skinning behaviors in UsdSkel. See the extended Skel Root Schema documentation for more information. ### Methods: - **classmethod Define(stage, path) -> Root** - Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined() ) on this stage. - If a prim adhering to this schema at path is already defined on this stage, return that prim. Otherwise author an SdfPrimSpec with specifier == SdfSpecifierDef and this schema’s prim type name for the prim at path at the current EditTarget. Author SdfPrimSpec s with specifier == SdfSpecifierDef and empty typeName at the current EditTarget for any nonexistent, or existing but not Defined ancestors. - The given path must be an absolute prim path that does not contain any variant selections. - If it is impossible to author any of the necessary PrimSpecs, (for example, in case path cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid UsdPrim. - Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. - Parameters: - **stage** (Stage) – - **path** (Path) – - **classmethod Find(prim) -> Root** - **classmethod Get(stage, path) -> Root** - **classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]** ### Find ```python classmethod Find(prim) -> Root ``` Returns the skel root at or above `prim`, or an invalid schema object if no ancestor prim is defined as a skel root. #### Parameters - **prim** (`Prim`) – ### Get ```python classmethod Get(stage, path) -> Root ``` Return a UsdSkelRoot holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdSkelRoot(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (`Stage`) – - **path** (`Path`) – ### GetSchemaAttributeNames ```python classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ``` Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (`bool`) – ### Skeleton Describes a skeleton. See the extended Skeleton Schema documentation for more information. #### Methods: - `CreateBindTransformsAttr(defaultValue, ...)` - See GetBindTransformsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - `CreateJointNamesAttr(defaultValue, writeSparsely)` - See GetJointNamesAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - `CreateJointsAttr(defaultValue, writeSparsely)` - See GetJointsAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | | | | --- | --- | | | **CreateRestTransformsAttr** (defaultValue, ...) | | | See GetRestTransformsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | | **Define** | | | **classmethod** Define(stage, path) -> Skeleton | | | **Get** | | | **classmethod** Get(stage, path) -> Skeleton | | | **GetBindTransformsAttr** () | | | Specifies the bind-pose transforms of each joint in **world space**, in the ordering imposed by *joints*. | | | **GetJointNamesAttr** () | | | If authored, provides a unique name per joint. | | | **GetJointsAttr** () | | | An array of path tokens identifying the set of joints that make up the skeleton, and their order. | | | **GetRestTransformsAttr** () | | | Specifies the rest-pose transforms of each joint in **local space**, in the ordering imposed by *joints*. | | | **GetSchemaAttributeNames** | | | **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] | ``` ```markdown **CreateBindTransformsAttr** (defaultValue, writeSparsely) → Attribute  See GetBindTransformsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ``` ```markdown **CreateJointNamesAttr** (defaultValue)  ### CreateJointNamesAttr ```python def CreateJointNamesAttr(defaultValue, writeSparsely): → Attribute ``` See GetJointNamesAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateJointsAttr ```python def CreateJointsAttr(defaultValue, writeSparsely): → Attribute ``` See GetJointsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateRestTransformsAttr ```python def CreateRestTransformsAttr(defaultValue, writeSparsely): → Attribute ``` See GetRestTransformsAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## Define **classmethod** Define(stage, path) -> Skeleton Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ## Get **classmethod** Get(stage, path) -> Skeleton Return a UsdSkelSkeleton holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdSkelSkeleton(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ## GetBindTransformsAttr Specifies the bind-pose transforms of each joint in **world space**, in the ordering imposed by `joints`. **Declaration** ``` uniform matrix4d[] bindTransforms ``` **C++ Type** VtArray&lt;GfMatrix4d&gt; **Usd Type** ``` ### SdfValueTypeNames->Matrix4dArray ### Variability ### SdfVariabilityUniform ### GetJointNamesAttr ``` ( ) ``` → Attribute If authored, provides a unique name per joint. This may be optionally set to provide better names when translating to DCC apps that require unique joint names. #### Declaration ``` uniform token[] jointNames ``` #### C++ Type VtArray&lt;TfToken&gt; #### Usd Type SdfValueTypeNames->TokenArray #### Variability SdfVarialityUniform ### GetJointsAttr ``` ( ) ``` → Attribute An array of path tokens identifying the set of joints that make up the skeleton, and their order. Each token in the array must be valid when parsed as an SdfPath. The parent-child relationships of the corresponding paths determine the parent-child relationships of each joint. It is not required that the name at the end of each path be unique, but rather only that the paths themselves be unique. #### Declaration ``` uniform token[] joints ``` #### C++ Type VtArray&lt;TfToken&gt; #### Usd Type SdfValueTypeNames->TokenArray #### Variability SdfVarialityUniform ### GetRestTransformsAttr ``` ( ) ``` → Attribute Specifies the rest-pose transforms of each joint in **local space**, in the ordering imposed by *joints*. This provides fallback values for joint transforms when a Skeleton either has no bound animation source, or when that animation source only contains animation for a subset of a Skeleton’s joints. #### Declaration ``` uniform matrix4d[] restTransforms ``` #### C++ Type VtArray&lt;GfMatrix4d&gt; #### Usd Type SdfValueTypeNames->Matrix4dArray #### Variability SdfVarialityUniform ### GetSchemaAttributeNames ``` ( ) ``` → classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ### SkeletonQuery ``` class pxr.UsdSkel.SkeletonQuery ``` Primary interface to reading *bound* skeleton data. This is used to query properties such as resolved transforms and animation bindings, as bound through the UsdSkelBindingAPI. A UsdSkelSkeletonQuery can not be constructed directly, and instead must be constructed through a UsdSkelCache instance. This is done as follows: ```cpp // Global cache, intended to persist. UsdSkelCache skelCache; // Populate the cache for a skel root. skelCache.Populate(UsdSkelRoot(skelRootPrim)); if (UsdSkelSkeletonQuery skelQuery = skelCache.GetSkelQuery(skelPrim)) { ... } ``` **Methods:** | Method | Description | |------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------| | `ComputeJointLocalTransforms(xforms, time, atRest)` | Compute joint transforms in joint-local space, at `time`. | | `ComputeJointRestRelativeTransforms(xforms, time)` | Compute joint transforms which, when concatenated against the rest pose, produce joint transforms in joint-local space. | | `ComputeJointSkelTransforms(xforms, time, atRest)` | Compute joint transforms in skeleton space, at `time`. | | `ComputeJointWorldTransforms(xforms, xfCache, ...)` | Compute joint transforms in world space, at whatever time is configured on `xfCache`. | | `ComputeSkinningTransforms(xforms, time)` | Compute transforms representing the change in transformation of a joint from its rest pose, in skeleton space. | | `GetAnimQuery()` | Returns the animation query that provides animation for the bound skeleton instance, if any. | | `GetJointOrder()` | Returns an array of joint paths, given as tokens, describing the order and parent-child relationships of joints in the skeleton. | | `GetJointWorldBindTransforms(xforms)` | Returns the world space joint transforms at bind time. | | `GetMapper()` | Returns a mapper for remapping from the bound animation, if any, to the Skeleton. | | `GetPrim()` | Returns the underlying Skeleton primitive corresponding to the bound skeleton instance, if any. | | `GetSkeleton()` | Returns the bound skeleton instance, if any. | | `GetTopology()` | Returns the topology of the bound skeleton instance, if any. | | HasBindPose () | Returns `true` if the size of the array returned by skeleton::GetBindTransformsAttr() matches the number of joints in the skeleton. | | --- | --- | | HasRestPose () | Returns `true` if the size of the array returned by skeleton::GetRestTransformsAttr() matches the number of joints in the skeleton. | ### ComputeJointLocalTransforms ```python ComputeJointLocalTransforms(xforms, time, atRest) -> bool ``` Compute joint transforms in joint-local space, at `time`. This returns transforms in joint order of the skeleton. If `atRest` is false and an animation source is bound, local transforms defined by the animation are mapped into the skeleton’s joint order. Any transforms not defined by the animation source use the transforms from the rest pose as a fallback value. If valid transforms cannot be computed for the animation source, the `xforms` are instead set to the rest transforms. **Parameters** - **xforms** (VtArray[Matrix4]) - **time** (TimeCode) - **atRest** (bool) ### ComputeJointRestRelativeTransforms ```python ComputeJointRestRelativeTransforms(xforms, time) -> bool ``` Compute joint transforms which, when concatenated against the rest pose, produce joint transforms in joint-local space. More specifically, this computes `restRelativeTransform` in: ``` restRelativeTransform * restTransform = jointLocalTransform ``` **Parameters** - **xforms** (VtArray[Matrix4]) - **time** (TimeCode) ### ComputeJointSkelTransforms ```python ComputeJointSkelTransforms(xforms, time, atRest) -> bool ``` Compute joint transforms in joint-local space, at `time`. This returns transforms in joint order of the skeleton. If `atRest` is false and an animation source is bound, local transforms defined by the animation are mapped into the skeleton’s joint order. Any transforms not defined by the animation source use the transforms from the rest pose as a fallback value. If valid transforms cannot be computed for the animation source, the `xforms` are instead set to the rest transforms. **Parameters** - **xforms** (VtArray[Matrix4]) - **time** (TimeCode) - **atRest** (bool) ### ComputeJointSkelTransforms Compute joint transforms in skeleton space, at `time`. This concatenates joint transforms as computed from ComputeJointLocalTransforms(). If `atRest` is true, any bound animation source is ignored, and transforms are computed from the rest pose. The skeleton-space transforms of the rest pose are cached internally. #### Parameters - **xforms** (VtArray[Matrix4]) – - **time** (TimeCode) – - **atRest** (bool) – ### ComputeJointWorldTransforms Compute joint transforms in world space, at whatever time is configured on `xfCache`. This is equivalent to computing skel-space joint transforms with ComputeJointSkelTransforms(), and then concatenating all transforms by the local-to-world transform of the Skeleton prim. If `atRest` is true, any bound animation source is ignored, and transforms are computed from the rest pose. #### Parameters - **xforms** (VtArray[Matrix4]) – - **xfCache** (XformCache) – - **atRest** (bool) – ### ComputeSkinningTransforms Compute transforms representing the change in transformation of a joint from its rest pose, in skeleton space. I.e., ```text inverse(bindTransform)*jointTransform ``` These are the transforms usually required for skinning. #### Parameters - **xforms** (VtArray[Matrix4]) – - **time** (TimeCode) – ### pxr.UsdSkel.SkeletonQuery.GetAnimQuery - **Description**: Returns the animation query that provides animation for the bound skeleton instance, if any. ### pxr.UsdSkel.SkeletonQuery.GetJointOrder - **Description**: Returns an array of joint paths, given as tokens, describing the order and parent-child relationships of joints in the skeleton. - **Example**: UsdSkelSkeleton::GetJointOrder ### pxr.UsdSkel.SkeletonQuery.GetJointWorldBindTransforms - **Description**: Returns the world space joint transforms at bind time. - **Parameters**: - **xforms** (VtArray [Matrix4]) – ### pxr.UsdSkel.SkeletonQuery.GetMapper - **Description**: Returns a mapper for remapping from the bound animation, if any, to the Skeleton. ### pxr.UsdSkel.SkeletonQuery.GetPrim - **Description**: Returns the underlying Skeleton primitive corresponding to the bound skeleton instance, if any. ### pxr.UsdSkel.SkeletonQuery.GetSkeleton - **Description**: Returns the bound skeleton instance, if any. ### pxr.UsdSkel.SkeletonQuery.GetTopology - **Description**: Returns the topology of the bound skeleton instance, if any. ### pxr.UsdSkel.SkeletonQuery.HasBindPose - **Description**: Returns true if there is a bind pose. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdSkel.SkeletonQuery.HasRestPose"> <span class="sig-name descname"> <span class="pre"> HasRestPose <span class="sig-paren"> ( <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <span class="pre"> bool <dd> <p> Returns <code class="docutils literal notranslate"> <span class="pre"> true if the size of the array returned by skeleton::GetRestTransformsAttr() matches the number of joints in the skeleton. <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdSkel.SkinningQuery"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.UsdSkel. <span class="sig-name descname"> <span class="pre"> SkinningQuery <dd> <p> Object used for querying resolved bindings for skinning. <p> <strong> Methods: <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> ComputeExtentsPadding (skelRestXforms, boundable) <td> <p> Helper for computing an <em> approximate padding for use in extents computations. <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> ComputeJointInfluences (indices, weights, time) <td> <p> Convenience method for computing joint influences. <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> ComputeSkinnedPoints (xforms, points, time) <td> <p> Compute skinned points using linear blend skinning. <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> ComputeSkinnedTransform (xforms, xform, time) <td> <p> Compute a skinning transform using linear blend skinning. <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> ComputeVaryingJointInfluences (numPoints, ...) <td> <p> Convenience method for computing joint influence, where constant influences are expanded to hold values per point. <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetBlendShapeMapper () <td> <p> Return the mapper for remapping blend shapes from the order of the bound SkelAnimation to the local blend shape order of this prim. <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetBlendShapeOrder (blendShapes) <td> <p> Get the blend shapes for this skinning site, if any. <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetBlendShapeTargetsRel () <td> <p> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetBlendShapesAttr () <td> <p> <tr class="row-even"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetGeomBindTransform (time) <td> <p> <dl class="field-list simple"> <dt class="field-odd"> param time <dd class="field-odd"> <p> <tr class="row-odd"> <td> <p> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> GetGeomBindTransformAttr () <td> <p> - `GetGeomBindTransformAttr()` - `GetInterpolation()` - `GetJointIndicesPrimvar()` - `GetJointMapper()` - Return a mapper for remapping from the joint order of the skeleton to the local joint order of this prim, if any. - `GetJointOrder(jointOrder)` - Get the custom joint order for this skinning site, if any. - `GetJointWeightsPrimvar()` - `GetMapper()` - Deprecated - `GetNumInfluencesPerComponent()` - Returns the number of influences encoded for each component. - `GetPrim()` - `GetSkinningBlendWeightsPrimvar()` - `GetSkinningMethodAttr()` - `GetTimeSamples(times)` - Populate `times` with the union of time samples for all properties that affect skinning, independent of joint transforms and any other prim-specific properties (such as points). - `GetTimeSamplesInInterval(interval, times)` - Populate `times` with the union of time samples within `interval`, for all properties that affect skinning, independent of joint transforms and any other prim-specific properties (such as points). - `HasBlendShapes()` - Returns true if there are blend shapes associated with this prim. - `HasJointInfluences()` | Method Name | Description | |-------------|-------------| | IsJointInfluenceDataAssociated | Returns true if joint influence data is associated with this prim. | | IsRigidlyDeformed | Returns true if the held prim has the same joint influences across all points, or false otherwise. | ### ComputeExtentsPadding - **Parameters** - **skelRestXforms** (VtArray[Matrix4]) - **boundable** (Boundable) - **Description** Helper for computing an approximate padding for use in extents computations. The padding is computed as the difference between the pivots of the skeleton space joint transforms at rest and the extents of the skinned primitive. ### ComputeJointInfluences - **Parameters** - **indices** (IntArray) - **weights** (FloatArray) - **time** (TimeCode) - **Description** Convenience method for computing joint influences. In addition to querying influences, this will also perform validation of the basic form of the weight data. ### ComputeSkinnedPoints - **Parameters** - **xforms** - **points** - **time** - **Description** Compute skinned points using linear blend skinning. Both xforms and points are given in skeleton space, using the joint order of the bound skeleton. (which will typically be unvarying). UsdSkelSkeletonQuery::ComputeSkinningTransforms Parameters ---------- - xforms (`VtArray[Matrix4]`) – - points (`Vec3fArray`) – - time (`TimeCode`) – ComputeSkinnedTransform(xforms, xform, time) → bool ------------------------------------------------------ Compute a skinning transform using linear blend skinning. The `xforms` are given in *skeleton space*, using the joint order of the bound skeleton. Joint influences and the (optional) binding transform are computed at time `time` (which will typically be unvarying). If this skinning query holds non-constant joint influences, no transform will be computed, and the function will return false. Parameters ---------- - xforms (`VtArray[Matrix4]`) – - xform (`Matrix4`) – - time (`TimeCode`) – ComputeVaryingJointInfluences(numPoints, indices, weights, time) → bool ------------------------------------------------------------------------- Convenience method for computing joint influence, where constant influences are expanded to hold values per point. In addition to querying influences, this will also perform validation of the basic form of the weight data although the array contents is not validated. Parameters ---------- - numPoints (`int`) – - indices (`IntArray`) – - weights (`FloatArray`) – - time (`TimeCode`) – ## Functions ### GetBlendShapeMapper ```python GetBlendShapeMapper() → AnimMapper ``` Return the mapper for remapping blend shapes from the order of the bound SkelAnimation to the local blend shape order of this prim. Returns a null reference if the underlying prim has no blend shapes. The mapper maps data from the order given by the `blendShapes` order on the SkelAnimation to the order given by the `skel:blendShapes` property, as set through the UsdSkelBindingAPI. ### GetBlendShapeOrder ```python GetBlendShapeOrder(blendShapes) → bool ``` Get the blend shapes for this skinning site, if any. **Parameters** - **blendShapes** (TokenArray) – ### GetBlendShapeTargetsRel ```python GetBlendShapeTargetsRel() → Relationship ``` ### GetBlendShapesAttr ```python GetBlendShapesAttr() → Attribute ``` ### GetGeomBindTransform ```python GetGeomBindTransform(time) → Matrix4d ``` **Parameters** - **time** (TimeCode) – ### GetGeomBindTransformAttr ```python GetGeomBindTransformAttr() → Attribute ``` ### GetInterpolation ```python GetInterpolation() → str ``` ### GetJointIndicesPrimvar ```python GetJointIndicesPrimvar() → str ``` ### Primvar ### GetJointMapper ```python GetJointMapper() ``` Returns a mapper for remapping from the joint order of the skeleton to the local joint order of this prim, if any. Returns a null pointer if the prim has no custom joint order. The mapper maps data from the order given by the `joints` order on the Skeleton to the order given by the `skel:joints` property, as optionally set through the UsdSkelBindingAPI. ### GetJointOrder ```python GetJointOrder(jointOrder) ``` Get the custom joint order for this skinning site, if any. **Parameters** - **jointOrder** (TokenArray) – ### GetJointWeightsPrimvar ```python GetJointWeightsPrimvar() ``` ### GetMapper ```python GetMapper() ``` Deprecated Use GetJointMapper. ### GetNumInfluencesPerComponent ```python GetNumInfluencesPerComponent() ``` Returns the number of influences encoded for each component. If the prim defines rigid joint influences, then this returns the number of influences that map to every point. Otherwise, this provides the number of influences per point. IsRigidlyDeformed ### GetPrim ```python GetPrim() ``` ### GetSkinningBlendWeightsPrimvar ```python GetSkinningBlendWeightsPrimvar() ``` ### GetSkinningMethodAttr ### GetTimeSamples Populate `times` with the union of time samples for all properties that affect skinning, independent of joint transforms and any other prim-specific properties (such as points). #### Parameters - **times** (list [float]) – ### GetTimeSamplesInInterval Populate `times` with the union of time samples within `interval`, for all properties that affect skinning, independent of joint transforms and any other prim-specific properties (such as points). #### Parameters - **interval** (Interval) – - **times** (list [float]) – ### HasBlendShapes Returns true if there are blend shapes associated with this prim. ### HasJointInfluences Returns true if joint influence data is associated with this prim. ### IsRigidlyDeformed Returns true if the held prim has the same joint influences across all points, or false otherwise. ## Tokens ### Attributes: | Attribute | Description | |--------------------------|-------------| | bindTransforms | | | blendShapeWeights | | | blendShapes | | | classicLinear | | | dualQuaternion | | | jointNames | | | joints | | | normalOffsets | | | offsets | | | pointIndices | | | primvarsSkelGeomBindTransform | | | primvarsSkelJointIndices | | | primvarsSkelJointWeights | | | primvarsSkelSkinningBlendWeights | | | restTransforms | | | rotations | | | scales | | | skelAnimationSource | |---------------------| | skelBlendShapeTargets | |---------------------| | skelBlendShapes | |---------------------| | skelJoints | |---------------------| | skelSkeleton | |---------------------| | skelSkinningMethod | |---------------------| | translations | |---------------------| | weight | |---------------------| | weightedBlend | |---------------------| ### bindTransforms = 'bindTransforms' ### blendShapeWeights = 'blendShapeWeights' ### blendShapes = 'blendShapes' ### classicLinear = 'ClassicLinear' ### dualQuaternion = 'DualQuaternion' ### jointNames = 'jointNames' ### jointNames ### joints ### normalOffsets ### offsets ### pointIndices ### primvarsSkelGeomBindTransform ### primvarsSkelJointIndices ### primvarsSkelJointWeights ### primvarsSkelSkinningBlendWeights ### restTransforms ### rotations ### scales ### skelAnimationSource skelAnimationSource = 'skel:animationSource' skelBlendShapeTargets = 'skel:blendShapeTargets' skelBlendShapes = 'skel:blendShapes' skelJoints = 'skel:joints' skelSkeleton = 'skel:skeleton' skelSkinningMethod = 'skel:skinningMethod' translations = 'translations' weight = 'weight' weightedBlend = 'WeightedBlend' class pxr.UsdSkel.Topology Object holding information describing skeleton topology. This provides the hierarchical information needed to reason about joint relationships in a manner suitable to computations. **Methods:** - GetNumJoints() - GetParent(index) Returns the parent joint of the ```python index'th ``` joint, Returns -1 for joints with no parent (roots). ```python GetParentIndices ``` () ```python IsRoot ``` (index) Returns true if the ```python index'th ``` joint is a root joint. ```python Validate ``` (reason) Validate the topology. ```python GetNumJoints ``` () → int ```python GetParent ``` (index) → int Returns the parent joint of the ```python index'th ``` joint, Returns -1 for joints with no parent (roots). Parameters ---------- index (int) – ```python GetParentIndices ``` () → IntArray ```python IsRoot ``` (index) → bool Returns true if the ```python index'th ``` joint is a root joint. Parameters ---------- index (int) – ```python Validate ``` (reason) → bool Validate the topology. If validation is unsuccessful, a reason why will be written to ```python reason ``` , if provided. Parameters ---------- reason (str) – --- title: "文章标题" author: "作者名" date: "2023-01-01" --- ## 引言 这是一篇文章的引言部分。 ## 正文 ### 小节标题 这里是正文内容,包含一些文本和格式化信息。 ### 另一个小节标题 这里是另一个小节的内容。 ## 结论 这里是文章的结论部分。 ## 参考文献 这里是参考文献列表。 --- 这里是页脚信息。
106,805
UsdUI.md
# UsdUI module Summary: The UsdUI module provides schemas for encoding information on USD prims for client GUI tools to use in organizing/presenting prims in GUI layouts. ## Classes: | Class | Description | |-------|-------------| | `Backdrop` | Provides a 'group-box' for the purpose of node graph organization. | | `NodeGraphNodeAPI` | This api helps storing information about nodes in node graphs. | | `SceneGraphPrimAPI` | Utility schema for display properties of a prim | | `Tokens` | | ### Backdrop Provides a 'group-box' for the purpose of node graph organization. Unlike containers, backdrops do not store the Shader nodes inside of them. Backdrops are an organizational tool that allows Shader nodes to be visually grouped together in a node-graph UI, but there is no direct relationship between a Shader node and a Backdrop. The guideline for a node-graph UI is that a Shader node is considered part of a Backdrop when the Backdrop is the smallest Backdrop a Shader node’s bounding-box fits inside. Backdrop objects are contained inside a NodeGraph, similar to how Shader objects are contained inside a NodeGraph. Backdrops have no shading inputs or outputs that influence the rendered results of a NodeGraph. Therefore they can be safely ignored during import. Like Shaders and NodeGraphs, Backdrops subscribe to the NodeGraphNodeAPI to specify position and size. For any described attribute *Fallback*, *Value*, or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdUITokens. So to set an attribute to the value "rightHanded", use UsdUITokens->rightHanded as the value. **Methods:** | Method | Description | |--------|-------------| | `CreateDescriptionAttr` | | | Method | Description | | ------ | ----------- | | `Define` | `classmethod Define(stage, path) -> Backdrop` | | `Get` | `classmethod Get(stage, path) -> Backdrop` | | `GetDescriptionAttr` | The text label that is displayed on the backdrop in the node graph. | | `GetSchemaAttributeNames` | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | ### CreateDescriptionAttr See GetDescriptionAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### Define **classmethod** Define(stage, path) -> Backdrop Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not match the schema’s prim type name, if the prim was authored by another schema. not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. ### Parameters - **stage** (Stage) – - **path** (Path) – ### classmethod Get(stage, path) -> Backdrop Return a UsdUIBackdrop holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ``` UsdUIBackdrop(stage->GetPrimAtPath(path)); ``` ### Parameters - **stage** (Stage) – - **path** (Path) – ### GetDescriptionAttr The text label that is displayed on the backdrop in the node graph. This help-description explains what the nodes in a backdrop do. #### Declaration ``` uniform token ui:description ``` #### C++ Type TfToken #### Usd Type SdfValueTypeNames->Token #### Variability SdfVariabilityUniform ### classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. #### Parameters - **includeInherited** (bool) – ### class pxr.UsdUI.NodeGraphNodeAPI This api helps storing information about nodes in node graphs. For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdUITokens. So to set an attribute to the value”rightHanded”, use UsdUITokens->rightHanded as the value. #### Methods: | Column 1 | Column 2 | |----------|----------| | `Apply` | `classmethod Apply(prim) -> NodeGraphNodeAPI` | | `CanApply` | `classmethod CanApply(prim, whyNot) -> bool` | | `CreateDisplayColorAttr(defaultValue, ...)` | `See GetDisplayColorAttr() , and also Create vs Get Property Methods for when to use Get vs Create.` | | `CreateExpansionStateAttr(defaultValue, ...)` | `See GetExpansionStateAttr() , and also Create vs Get Property Methods for when to use Get vs Create.` | | `CreateIconAttr(defaultValue, writeSparsely)` | `See GetIconAttr() , and also Create vs Get Property Methods for when to use Get vs Create.` | | `CreatePosAttr(defaultValue, writeSparsely)` | `See GetPosAttr() , and also Create vs Get Property Methods for when to use Get vs Create.` | | `CreateSizeAttr(defaultValue, writeSparsely)` | `See GetSizeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.` | | `CreateStackingOrderAttr(defaultValue, ...)` | `See GetStackingOrderAttr() , and also Create vs Get Property Methods for when to use Get vs Create.` | | `Get` | `classmethod Get(stage, path) -> NodeGraphNodeAPI` | | `GetDisplayColorAttr()` | `This hint defines what tint the node should have in the node graph.` | | `GetExpansionStateAttr()` | `The current expansionState of the node in the ui.` | | `GetIconAttr()` | `This points to an image that should be displayed on the node.` | | `GetPosAttr()` | `Declared relative position to the parent in a node graph.` | | `GetSchemaAttributeNames` | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | <p> Optional size hint for a node in a node graph. <p> This optional value is a useful hint when an application cares about the visibility of a node and whether each node overlaps another. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdUI.NodeGraphNodeAPI.Apply"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> Apply <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdUI.NodeGraphNodeAPI.Apply" title="Permalink to this definition">  <dd> <p> <strong> classmethod Apply(prim) -&gt; NodeGraphNodeAPI <p> Applies this <strong> single-apply API schema to the given <code class="docutils literal notranslate"> <span class="pre"> prim . <p> This information is stored by adding”NodeGraphNodeAPI”to the token-valued, listOp metadata <em> apiSchemas on the prim. <p> A valid UsdUINodeGraphNodeAPI object is returned upon success. An invalid (or empty) UsdUINodeGraphNodeAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> prim ( <a class="reference internal" href="Usd.html#pxr.Usd.Prim" title="pxr.Usd.Prim"> <em> Prim ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdUI.NodeGraphNodeAPI.CanApply"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> CanApply <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdUI.NodeGraphNodeAPI.CanApply" title="Permalink to this definition">  <dd> <p> <strong> classmethod CanApply(prim, whyNot) -&gt; bool <p> Returns true if this <strong> single-apply API schema can be applied to the given <code class="docutils literal notranslate"> <span class="pre"> prim . <p> If this schema can not be a applied to the prim, this returns false and, if provided, populates <code class="docutils literal notranslate"> <span class="pre"> whyNot with the reason it can not be applied. <p> Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> prim ( <a class="reference internal" href="Usd.html#pxr.Usd.Prim" title="pxr.Usd.Prim"> <em> Prim ) – <li> <p> <strong> whyNot ( <em> str ) – <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdUI.NodeGraphNodeAPI.CreateDisplayColorAttr"> <span class="sig-name descname"> <span class="pre"> CreateDisplayColorAttr <span class="sig-paren"> ( <em class="sig-param"> <span class="n"> <span class="pre"> defaultValue , <em class="sig-param"> <span class="n"> <span class="pre"> writeSparsely <span class="sig-paren"> ) <span class="sig-return"> <span class="sig-return-icon"> → <span class="sig-return-typehint"> <a class="reference internal" href="Usd.html#pxr.Usd.Attribute" title="pxr.Usd.Attribute"> <span class="pre"> Attribute <a class="headerlink" href="#pxr.UsdUI.NodeGraphNodeAPI.CreateDisplayColorAttr" title="Permalink to this definition">  <dd> <p> See GetDisplayColorAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> If specified, author <code class="docutils literal notranslate"> <span class="pre"> defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> true - the default for <code class="docutils literal notranslate"> <span class="pre"> writeSparsely is <code class="docutils literal notranslate"> <span class="pre"> false . ```python false ``` Parameters ---------- - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ```python CreateExpansionStateAttr(defaultValue, writeSparsely) ``` See GetExpansionStateAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ```python CreateIconAttr(defaultValue, writeSparsely) ``` See GetIconAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ```python CreatePosAttr(defaultValue, writeSparsely) ``` See GetPosAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters ---------- - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – writeSparsely ``` is ```markdown true ``` - the default for ```markdown writeSparsely ``` is ```markdown false ``` . ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateSizeAttr ```markdown CreateSizeAttr(defaultValue, writeSparsely) ``` - Returns: `Attribute` See GetSizeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```markdown defaultValue ``` as the attribute’s default, sparsely (when it makes sense to do so) if ```markdown writeSparsely ``` is ```markdown true ``` - the default for ```markdown writeSparsely ``` is ```markdown false ``` . ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### CreateStackingOrderAttr ```markdown CreateStackingOrderAttr(defaultValue, writeSparsely) ``` - Returns: `Attribute` See GetStackingOrderAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author ```markdown defaultValue ``` as the attribute’s default, sparsely (when it makes sense to do so) if ```markdown writeSparsely ``` is ```markdown true ``` - the default for ```markdown writeSparsely ``` is ```markdown false ``` . ### Parameters - **defaultValue** (`VtValue`) – - **writeSparsely** (`bool`) – ### Get ```markdown static Get() ``` - **classmethod** Get(stage, path) -> NodeGraphNodeAPI Return a UsdUINodeGraphNodeAPI holding the prim adhering to this schema at ```markdown path ``` on ```markdown stage ``` . If no prim exists at `path` on `stage` , or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```cpp UsdUINodeGraphNodeAPI(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – **GetDisplayColorAttr** This hint defines what tint the node should have in the node graph. **Declaration** ``` uniform color3f ui:nodegraph:node:displayColor ``` **C++ Type** GfVec3f **Usd Type** SdfValueTypeNames->Color3f **Variability** SdfVariabilityUniform **GetExpansionStateAttr** The current expansionState of the node in the ui. ‘open’= fully expanded’closed’= fully collapsed’minimized’= should take the least space possible **Declaration** ``` uniform token ui:nodegraph:node:expansionState ``` **C++ Type** TfToken **Usd Type** SdfValueTypeNames->Token **Variability** SdfVariabilityUniform **Allowed Values** open, closed, minimized **GetIconAttr** This points to an image that should be displayed on the node. It is intended to be useful for summary visual classification of nodes, rather than a thumbnail preview of the computed result of the node in some computational system. **Declaration** ``` uniform asset ui:nodegraph:node:icon ``` **C++ Type** SdfAssetPath **Usd Type** SdfValueTypeNames->Asset **Variability** SdfVariabilityUniform **GetPosAttr** Declared relative position to the parent in a node graph. X is the horizontal position. Y is the vertical position. Higher numbers correspond to lower positions (coordinates are Qt style, not cartesian). These positions are not explicitly meant in pixel space, but rather assume that the size of a node is approximately 1.0x1.0. Where size-x is the node width and size-y height of the node. Depending on graph UI implementation, the size of a node may vary in each direction. Example: If a node’s width is 300 and it is position is at 1000, we store for x-position: 1000 * (1.0/300) Declaration ``` uniform float2 ui:nodegraph:node:pos ``` C++ Type GfVec2f Usd Type SdfValueTypeNames->Float2 Variability SdfVariabilityUniform classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters includeInherited (bool) – Optional size hint for a node in a node graph. X is the width. Y is the height. This value is optional, because node size is often determined based on the number of in- and outputs of a node. Declaration ``` uniform float2 ui:nodegraph:node:size ``` C++ Type GfVec2f Usd Type SdfValueTypeNames->Float2 Variability SdfVariabilityUniform This optional value is a useful hint when an application cares about the visibility of a node and whether each node overlaps another. Nodes with lower stacking order values are meant to be drawn below higher ones. Negative values are meant as background. Positive values are meant as foreground. Undefined values should be treated as 0. There are no set limits in these values. Declaration ``` uniform int ui:nodegraph:node:stackingOrder ``` C++ Type int Usd Type SdfValueTypeNames->Int Variability SdfVariabilityUniform class pxr.UsdUI.SceneGraphPrimAPI Utility schema for display properties of a prim For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdUITokens. So to set an attribute to the value”rightHanded”, use UsdUITokens->rightHanded as the value. Methods: ``` Apply ``` classmethod Apply(prim) -> SceneGraphPrimAPI <p> CanApply <p> classmethod CanApply(prim, whyNot) -> bool <p> CreateDisplayGroupAttr (defaultValue, ...) <p> See GetDisplayGroupAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> CreateDisplayNameAttr (defaultValue, ...) <p> See GetDisplayNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p> Get <p> classmethod Get(stage, path) -> SceneGraphPrimAPI <p> GetDisplayGroupAttr () <p> When publishing a nodegraph or a material, it can be useful to provide an optional display group, for organizational purposes and readability. <p> GetDisplayNameAttr () <p> When publishing a nodegraph or a material, it can be useful to provide an optional display name, for readability. <p> GetSchemaAttributeNames <p> classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] <dl> <dt> static Apply() <dd> <p> classmethod Apply(prim) -> SceneGraphPrimAPI <p> Applies this single-apply API schema to the given prim. <p> This information is stored by adding”SceneGraphPrimAPI”to the token-valued, listOp metadata apiSchemas on the prim. <p> A valid UsdUISceneGraphPrimAPI object is returned upon success. An invalid (or empty) UsdUISceneGraphPrimAPI object is returned upon failure. See UsdPrim::ApplyAPI() for conditions resulting in failure. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() <dl> <dt> Parameters <dd> <p> prim (Prim) – <dl> <dt> static CanApply() <dd> <p> classmethod CanApply(prim, whyNot) -> bool <p> Returns true if this single-apply API schema can be applied to the given prim. <p> If this schema can not be a applied to the prim, this returns false and, if provided, populates whyNot with the reason it can not be applied. <p> Note that if CanApply returns false, that does not necessarily imply that calling Apply will fail. Callers are expected to call CanApply before calling Apply if they want to ensure that it is valid to apply a schema. <p> UsdPrim::GetAppliedSchemas() <p> UsdPrim::HasAPI() <p> UsdPrim::CanApplyAPI() <p> UsdPrim::ApplyAPI() <p> UsdPrim::RemoveAPI() ## UsdPrim::ApplyAPI() ## UsdPrim::RemoveAPI() ### Parameters - **prim** (Prim) – - **whyNot** (str) – ## CreateDisplayGroupAttr ```python CreateDisplayGroupAttr(defaultValue, writeSparsely) → Attribute ``` See GetDisplayGroupAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## CreateDisplayNameAttr ```python CreateDisplayNameAttr(defaultValue, writeSparsely) → Attribute ``` See GetDisplayNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ## Get ```python classmethod Get(stage, path) -> SceneGraphPrimAPI ``` Return a UsdUISceneGraphPrimAPI holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that ``` path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```cpp UsdUISceneGraphPrimAPI(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – **GetDisplayGroupAttr** When publishing a nodegraph or a material, it can be useful to provide an optional display group, for organizational purposes and readability. This is because often the usd shading hierarchy is rather flat while we want to display it in organized groups. **Declaration** ``` uniform token ui:displayGroup ``` **C++ Type** TfToken **Usd Type** SdfValueTypeNames->Token **Variability** SdfVariabilityUniform **GetDisplayNameAttr** When publishing a nodegraph or a material, it can be useful to provide an optional display name, for readability. **Declaration** ``` uniform token ui:displayName ``` **C++ Type** TfToken **Usd Type** SdfValueTypeNames->Token **Variability** SdfVariabilityUniform **GetSchemaAttributeNames** **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters** - **includeInherited** (bool) – **pxr.UsdUI.Tokens** **Attributes:** - **closed** - **minimized** - **open** | Token Name | Description | |-----------------------------|-------------| | uiDescription | | | uiDisplayGroup | | | uiDisplayName | | | uiNodegraphNodeDisplayColor | | | uiNodegraphNodeExpansionState | | | uiNodegraphNodeIcon | | | uiNodegraphNodePos | | | uiNodegraphNodeSize | | | uiNodegraphNodeStackingOrder| | ### Attributes #### closed ``` closed = 'closed' ``` #### minimized ``` minimized = 'minimized' ``` #### open ``` open = 'open' ``` #### uiDescription ``` uiDescription = 'ui:description' ``` #### uiDisplayGroup ``` uiDisplayGroup = 'ui:displayGroup' ``` #### uiDisplayName ``` uiDisplayName = 'ui:displayName' ``` uiDisplayName = 'ui:displayName' uiNodegraphNodeDisplayColor = 'ui:nodegraph:node:displayColor' uiNodegraphNodeExpansionState = 'ui:nodegraph:node:expansionState' uiNodegraphNodeIcon = 'ui:nodegraph:node:icon' uiNodegraphNodePos = 'ui:nodegraph:node:pos' uiNodegraphNodeSize = 'ui:nodegraph:node:size' uiNodegraphNodeStackingOrder = 'ui:nodegraph:node:stackingOrder'
25,419
UsdUtils.md
# UsdUtils module Summary: The UsdUtils module contains utility classes and functions for managing, inspecting, editing, and creating USD Assets. ## Classes: | Class | Description | |-------|-------------| | `CoalescingDiagnosticDelegate` | A class which collects warnings and statuses from the Tf diagnostic manager system in a thread safe manner. | | `CoalescingDiagnosticDelegateItem` | An item used in coalesced results, containing a shared component: the file/function/line number, and a set of unshared components: the call context and commentary. | | `CoalescingDiagnosticDelegateSharedItem` | The shared component in a coalesced result This type can be thought of as the key by which we coalesce our diagnostics. | | `CoalescingDiagnosticDelegateUnsharedItem` | The unshared component in a coalesced result. | | `ConditionalAbortDiagnosticDelegate` | A class that allows client application to instantiate a diagnostic delegate that can be used to abort operations for a non fatal USD error or warning based on immutable include exclude rules defined for this instance. | | `ConditionalAbortDiagnosticDelegateErrorFilters` | A class which represents the inclusion exclusion filters on which errors will be matched stringFilters: matching and filtering will be done on explicit string of the error/warning codePathFilters: matching and filtering will be done on errors/warnings coming from a specific usd code path. | | `RegisteredVariantSet` | Info for registered variant set | | `SparseAttrValueWriter` | | <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> SparseAttrValueWriter <td> <p> A utility class for authoring time-varying attribute values with simple run-length encoding, by skipping any redundant time-samples. <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdUtils.SparseValueWriter" title="pxr.UsdUtils.SparseValueWriter"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> SparseValueWriter <td> <p> Utility class that manages sparse authoring of a set of UsdAttributes. <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdUtils.StageCache" title="pxr.UsdUtils.StageCache"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> StageCache <td> <p> The UsdUtilsStageCache class provides a simple interface for handling a singleton usd stage cache for use by all USD clients. <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdUtils.TimeCodeRange" title="pxr.UsdUtils.TimeCodeRange"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TimeCodeRange <td> <p> Represents a range of UsdTimeCode values as start and end time codes and a stride value. <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdUtils.UsdStageStatsKeys" title="pxr.UsdUtils.UsdStageStatsKeys"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> UsdStageStatsKeys <td> <p> <dl class="py class"> <dt class="sig sig-object py" id="pxr.UsdUtils.CoalescingDiagnosticDelegate"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.UsdUtils. <span class="sig-name descname"> <span class="pre"> CoalescingDiagnosticDelegate <a class="headerlink" href="#pxr.UsdUtils.CoalescingDiagnosticDelegate" title="Permalink to this definition">  <dd> <p> A class which collects warnings and statuses from the Tf diagnostic manager system in a thread safe manner. <p> This class allows clients to get both the unfiltered results, as well as a compressed view which deduplicates diagnostic events by their source line number, function and file from which they occurred. <p> <strong> Methods: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpCoalescedDiagnosticsToStderr" title="pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpCoalescedDiagnosticsToStderr"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> DumpCoalescedDiagnosticsToStderr <td> <p> <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpCoalescedDiagnosticsToStdout" title="pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpCoalescedDiagnosticsToStdout"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> DumpCoalescedDiagnosticsToStdout <td> <p> <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpUncoalescedDiagnostics" title="pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpUncoalescedDiagnostics"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> DumpUncoalescedDiagnostics (ostr) <td> <p> Print all pending diagnostics without any coalescing to <code class="docutils literal notranslate"> <span class="pre"> ostr . <tr class="row-even"> <td> <p> <a class="reference internal" href="#pxr.UsdUtils.CoalescingDiagnosticDelegate.TakeCoalescedDiagnostics" title="pxr.UsdUtils.CoalescingDiagnosticDelegate.TakeCoalescedDiagnostics"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TakeCoalescedDiagnostics () <td> <p> Get all pending diagnostics in a coalesced form. <tr class="row-odd"> <td> <p> <a class="reference internal" href="#pxr.UsdUtils.CoalescingDiagnosticDelegate.TakeUncoalescedDiagnostics" title="pxr.UsdUtils.CoalescingDiagnosticDelegate.TakeUncoalescedDiagnostics"> <code class="xref py py-obj docutils literal notranslate"> <span class="pre"> TakeUncoalescedDiagnostics () <td> <p> Get all pending diagnostics without any coalescing. <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpCoalescedDiagnosticsToStderr"> <span class="sig-name descname"> <span class="pre"> DumpCoalescedDiagnosticsToStderr <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpCoalescedDiagnosticsToStderr" title="Permalink to this definition">  <dd> <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpCoalescedDiagnosticsToStdout"> <span class="sig-name descname"> <span class="pre"> DumpCoalescedDiagnosticsToStdout <span class="sig-paren"> ( <span class="sig-paren"> ) <a class="headerlink" href="#pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpCoalescedDiagnosticsToStdout" title="Permalink to this definition">  <dd> <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpUncoalescedDiagnostics"> <span class="sig-name descname"> <span class="pre"> DumpUncoalescedDiagnostics <span class="sig-paren"> ( <em class="sig-param"> ### pxr.UsdUtils.CoalescingDiagnosticDelegate.DumpUncoalescedDiagnostics - **Parameters**: - `ostr` (ostream) – - **Description**: - Print all pending diagnostics without any coalescing to `ostr`. - This method clears the pending diagnostics. ### pxr.UsdUtils.CoalescingDiagnosticDelegate.TakeCoalescedDiagnostics - **Description**: - Get all pending diagnostics in a coalesced form. - This method clears the pending diagnostics. ### pxr.UsdUtils.CoalescingDiagnosticDelegate.TakeUncoalescedDiagnostics - **Description**: - Get all pending diagnostics without any coalescing. - This method clears the pending diagnostics. ### pxr.UsdUtils.CoalescingDiagnosticDelegateItem - **Description**: - An item used in coalesced results, containing a shared component: the file/function/line number, and a set of unshared components: the call context and commentary. - **Attributes**: - `sharedItem` - `unsharedItems` ### pxr.UsdUtils.CoalescingDiagnosticDelegateSharedItem - **Description**: - The shared component in a coalesced result. This type can be thought of as the key by which we coalesce our diagnostics. - **Attributes**: - (No specific attributes listed in the provided HTML) | sourceFileName | |----------------| | sourceFunction | | sourceLineNumber | ### sourceFileName property sourceFileName ### sourceFunction property sourceFunction ### sourceLineNumber property sourceLineNumber ### CoalescingDiagnosticDelegateUnsharedItem The unshared component in a coalesced result. **Attributes:** | commentary | |------------| | context | ### commentary property commentary ### context property context ### ConditionalAbortDiagnosticDelegate A class that allows client application to instantiate a diagnostic delegate that can be used to abort operations for a non fatal USD error or warning based on immutable include exclude rules defined for this instance. These rules are regex strings where case sensitive matching is done on error/warning text or the location of the code path where the error/warning occured. Note that these rules will be respected only during the lifetime of the delegate. Include Rules determine what errors or warnings will cause a fatal abort. Exclude Rules determine what errors or warnings matched from the Include Rules should not cause the fatal abort. Example: to abort on all errors and warnings coming from "*pxr*" codepath but not from "*ConditionalAbortDiagnosticDelegate*", a client can create the following delegate: ```python UsdUtilsConditionalAbortDiagnosticDelegateErrorFilters includeFilters; UsdUtilsConditionalAbortDiagnosticDelegateErrorFilters excludeFilters; includeFilters.SetCodePathFilters({"*pxr*"}); excludeFilters.SetCodePathFilters({"*ConditionalAbortDiagnosticDelegate*"}); UsdUtilsConditionalAbortDiagnosticDelegate delegate = UsdUtilsConditionalAbortDiagnosticDelegate(includeFilters, excludeFilters); ``` ### pxr.UsdUtils.ConditionalAbortDiagnosticDelegateErrorFilters A class which represents the inclusion exclusion filters on which errors will be matched. - stringFilters: matching and filtering will be done on explicit string of the error/warning. - codePathFilters: matching and filtering will be done on errors/warnings coming from a specific usd code path. **Methods:** | Method | Description | | --- | --- | | `GetCodePathFilters()` | | | `GetStringFilters()` | | | `SetCodePathFilters(codePathFilters)` | | | `SetStringFilters(stringFilters)` | | #### GetCodePathFilters() - Returns: list[str] #### GetStringFilters() - Returns: list[str] #### SetCodePathFilters(codePathFilters) - Parameters: - `codePathFilters` (list[str]) – #### SetStringFilters(stringFilters) - Parameters: - `stringFilters` (list[str]) – ## pxr.UsdUtils.ConditionalAbortDiagnosticDelegateErrorFilters.SetStringFilters ### SetStringFilters(stringFilters) - **Parameters**: - **stringFilters** (list[str]) – ## pxr.UsdUtils.RegisteredVariantSet ### Info for registered variant set - **Classes**: - **SelectionExportPolicy** - This specifies how the variantSet should be treated during export. - **Attributes**: - **name** - **selectionExportPolicy** ### pxr.UsdUtils.RegisteredVariantSet.SelectionExportPolicy - This specifies how the variantSet should be treated during export. - Note, in the plugInfo.json, the values for these enum’s are lowerCamelCase. - **Attributes**: - **Always** - **IfAuthored** - **Never** - **names** - **values** ### Always - **Value**: pxr.UsdUtils.SelectionExportPolicy.Always ### IfAuthored - **Value**: pxr.UsdUtils.SelectionExportPolicy.IfAuthored ### Never - **Value**: pxr.UsdUtils.SelectionExportPolicy.Never ### names - **Value**: {'Always': pxr.UsdUtils.SelectionExportPolicy.Always, 'IfAuthored': pxr.UsdUtils.SelectionExportPolicy.IfAuthored, 'Never': pxr.UsdUtils.SelectionExportPolicy.Never} ### values - **Value**: {0: pxr.UsdUtils.SelectionExportPolicy.Never, 1: pxr.UsdUtils.SelectionExportPolicy.IfAuthored, 2: pxr.UsdUtils.SelectionExportPolicy.Always} ### name - **Type**: property ### selectionExportPolicy - **Type**: property ### pxr.UsdUtils.SparseAttrValueWriter - **Description**: A utility class for authoring time-varying attribute values with simple run-length encoding, by skipping any redundant time-samples. Time-samples that are close enough to each other, with relative difference smaller than a fixed epsilon value are considered to be equivalent. This is to avoid unnecessary authoring of time-samples caused by numerical fuzz in certain computations. - **Details**: For vectors, matrices, and other composite types (like quaternions and arrays), each component is compared with the corresponding component for closeness. The chosen epsilon value for double precision floating point numbers is 1e-12. For single-precision, it is 1e-6 and for half-precision, it is 1e-2. - **Example c++ usage**: ```cpp UsdGeomSphere sphere = UsdGeomSphere::Define(stage, SdfPath("/Sphere")); UsdAttribute radius = sphere.CreateRadiusAttr(); UsdUtilsSparseAttrValueWriter attrValueWriter(radius, /*defaultValue*/ VtValue(1.0)); attrValueWriter.SetTimeSample(VtValue(10.0), UsdTimeCode(1.0)); attrValueWriter.SetTimeSample(VtValue(10.0), UsdTimeCode(2.0)); attrValueWriter.SetTimeSample(VtValue(10.0), UsdTimeCode(3.0)); attrValueWriter.SetTimeSample(VtValue(20.0), UsdTimeCode(4.0)); ``` - **Equivalent python example**: ```python sphere = UsdGeom.Sphere.Define(stage, Sdf.Path("/Sphere")) radius = sphere.CreateRadiusAttr() attrValueWriter = UsdUtils.SparseAttrValueWriter(radius, defaultValue=1.0) attrValueWriter.SetTimeSample(10.0, 1.0) ``` attrValueWriter.SetTimeSample(10.0, 2.0) attrValueWriter.SetTimeSample(10.0, 3.0) attrValueWriter.SetTimeSample(20.0, 4.0) In the above examples, the specified default value of radius (1.0) will not be authored into scene description since it matches the fallback value. Additionally, the time-sample authored at time=2.0 will be skipped since it is redundant. Also note that for correct behavior, the calls to SetTimeSample() must be made with sequentially increasing time values. If not, a coding error is issued and the authored animation may be incorrect. **Methods:** | Method Name | Description | |-------------|-------------| | `SetTimeSample(value, time)` | Sets a new time-sample on the attribute with given `value` at the given `time`. | SetTimeSample(value, time) -> bool Sets a new time-sample on the attribute with given `value` at the given `time`. The time-sample is only authored if it’s different from the previously set time-sample, in which case the previous time-sample is also authored, in order to end the previous run of contiguous identical values and start a new run. This incurs a copy of `value`. Also, the value will be held in memory at least until the next time-sample is written or until the SparseAttrValueWriter instance is destroyed. Parameters: - **value** (VtValue) – - **time** (TimeCode) – SetTimeSample(value, time) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. For efficiency, this function swaps out the given `value`, leaving it empty. The value will be held in memory at least until the next time-sample is written or until the SparseAttrValueWriter instance is destroyed. Parameters: - **value** (VtValue) – - **time** (TimeCode) – class pxr.UsdUtils.SparseValueWriter Utility class that manages sparse authoring of a set of UsdAttributes. It does this by maintaining a map of UsdAttributes to their corresponding UsdUtilsSparseAttrValueWriter objects. To use this class, simply instantiate an instance of it and invoke the SetAttribute() method with various attributes and their associated time-samples. If the attribute has a default value, SetAttribute() must be called with time=Default first (multiple times, if necessary), followed by calls to author time-samples in sequentially increasing time order. This class is not threadsafe. In general, authoring to a single USD layer from multiple threads isn’t threadsafe. Hence, there is little value in making this class threadsafe. Example c++ usage: ```cpp UsdGeomCylinder cylinder = UsdGeomCylinder::Define(stage, SdfPath("/Cylinder")); UsdAttribute radius = cylinder.CreateRadiusAttr(); UsdAttribute height = cylinder.CreateHeightAttr(); UsdUtilsSparseValueWriter valueWriter; valueWriter.SetAttribute(radius, 2.0, UsdTimeCode::Default()); valueWriter.SetAttribute(height, 2.0, UsdTimeCode::Default()); valueWriter.SetAttribute(radius, 10.0, UsdTimeCode(1.0)); valueWriter.SetAttribute(radius, 20.0, UsdTimeCode(2.0)); valueWriter.SetAttribute(radius, 20.0, UsdTimeCode(3.0)); valueWriter.SetAttribute(radius, 20.0, UsdTimeCode(4.0)); valueWriter.SetAttribute(height, 2.0, UsdTimeCode(1.0)); valueWriter.SetAttribute(height, 2.0, UsdTimeCode(2.0)); valueWriter.SetAttribute(height, 3.0, UsdTimeCode(3.0)); valueWriter.SetAttribute(height, 3.0, UsdTimeCode(4.0)); ``` Equivalent python code: ```html <div class="highlight"> <pre><span> radius = cylinder.CreateRadiusAttr() height = cylinder.CreateHeightAttr() valueWriter = UsdUtils.SparseValueWriter() valueWriter.SetAttribute(radius, 2.0, Usd.TimeCode.Default()) valueWriter.SetAttribute(height, 2.0, Usd.TimeCode.Default()) valueWriter.SetAttribute(radius, 10.0, 1.0) valueWriter.SetAttribute(radius, 20.0, 2.0) valueWriter.SetAttribute(radius, 20.0, 3.0) valueWriter.SetAttribute(radius, 20.0, 4.0) valueWriter.SetAttribute(height, 2.0, 1.0) valueWriter.SetAttribute(height, 2.0, 2.0) valueWriter.SetAttribute(height, 3.0, 3.0) valueWriter.SetAttribute(height, 3.0, 4.0) <p> In the above example, <blockquote> <div> <ul class="simple"> <li> <p> The default value of the”height”attribute is not authored into scene description since it matches the fallback value. <li> <p> Time-samples at time=3.0 and time=4.0 will be skipped for the radius attribute. <li> <p> For the”height”attribute, the first timesample at time=1.0 will be skipped since it matches the default value. <li> <p> The last time-sample at time=4.0 will also be skipped for”height”since it matches the previously written value at time=3.0. <p> <strong> Methods: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code> GetSparseAttrValueWriters () <td> <p> Returns a new vector of UsdUtilsSparseAttrValueWriter populated from the attrValueWriter map. <tr class="row-even"> <td> <p> <code> SetAttribute (attr, value, time) <td> <p> Sets the value of <code> attr to <code> value at time <code> time . <dl class="py method"> <dt> <code> GetSparseAttrValueWriters () <span class="sig-return"> → <span class="sig-return-typehint"> list [ SparseAttrValueWriter ] <a class="headerlink" href="#pxr.UsdUtils.SparseValueWriter.GetSparseAttrValueWriters" title="Permalink to this definition">  <dd> <p> Returns a new vector of UsdUtilsSparseAttrValueWriter populated from the attrValueWriter map. <dl class="py method"> <dt> <code> SetAttribute (attr, value, time) <span class="sig-return"> → <span class="sig-return-typehint"> bool <a class="headerlink" href="#pxr.UsdUtils.SparseValueWriter.SetAttribute" title="Permalink to this definition">  <dd> <p> Sets the value of <code> attr to <code> value at time <code> time . <p> The value is written sparsely, i.e., the default value is authored only if it is different from the fallback value or the existing default value, and any redundant time-samples are skipped when the attribute value does not change significantly between consecutive time-samples. <dl class="field-list simple"> <dt> Parameters <dd> <ul class="simple"> <li> <p> <strong> attr ( Attribute ) – <li> <p> <strong> value ( VtValue ) – <li> <p> <strong> time ( TimeCode ) – <hr/> <p> SetAttribute(attr, value, time) -&gt; bool <p> This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. For efficiency, this function swaps out the given <code> value ```code , leaving it empty. ``` The value will be held in memory at least until the next time-sample is written or until the SparseAttrValueWriter instance is destroyed. ```field-list Parameters : - **attr** (**Attribute**) – - **value** (**VtValue**) – - **time** (**TimeCode**) – ``` ```field-list Parameters : - **attr** (**Attribute**) – - **value** (**T**) – - **time** (**TimeCode**) – ``` SetAttribute(attr, value, time) -> bool This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. ```field-list Parameters : - **attr** (**Attribute**) – - **value** (**T**) – - **time** (**TimeCode**) – ``` ```class class pxr.UsdUtils.StageCache ``` The UsdUtilsStageCache class provides a simple interface for handling a singleton usd stage cache for use by all USD clients. This way code from any location can make use of the same cache to maximize stage reuse. **Methods:** ```table | Method | Description | | --- | --- | | `Get` | classmethod Get() -> StageCache | | `GetSessionLayerForVariantSelections` | classmethod GetSessionLayerForVariantSelections(modelName, variantSelections) -> Layer | ``` ```method static Get() -> StageCache ``` Returns the singleton stage cache. ```method static GetSessionLayerForVariantSelections(modelName, variantSelections) -> Layer ``` Given variant selections as a vector of pairs (vector in case order matters to the client), constructs a session layer with ops on the given root modelName with the variant selections, or returns a cached session layer with those opinions. ```field-list Parameters : - **modelName** (**str**) – - **variantSelections** (**list[tuple[str, str]]**) – ``` ### pxr.UsdUtils.TimeCodeRange Represents a range of UsdTimeCode values as start and end time codes and a stride value. A UsdUtilsTimeCodeRange can be iterated to retrieve all time code values in the range. The range may be empty, it may contain a single time code, or it may represent multiple time codes from start to end. The interval defined by the start and end time codes is closed on both ends. Note that when constructing a UsdUtilsTimeCodeRange, UsdTimeCode::EarliestTime() and UsdTimeCode::Default() cannot be used as the start or end time codes. Also, the end time code cannot be less than the start time code for positive stride values, and the end time code cannot be greater than the start time code for negative stride values. Finally, the stride value cannot be zero. If any of these conditions are not satisfied, then an invalid empty range will be returned. **Classes:** - Tokens **Methods:** - `CreateFromFrameSpec(frameSpec) -> TimeCodeRange` - `IsValid() -> bool` - `empty() -> bool` **Attributes:** - `endTimeCode` : TimeCode - `frameSpec` - `startTimeCode` : TimeCode - `stride` : float ### pxr.UsdUtils.TimeCodeRange.Tokens **Attributes:** - `EmptyTimeCodeRange` - `RangeSeparator` StrideSeparator ``` ```markdown EmptyTimeCodeRange = 'NONE' ``` ```markdown RangeSeparator = ':' ``` ```markdown StrideSeparator = 'x' ``` ```markdown static CreateFromFrameSpec() ``` ```markdown classmethod CreateFromFrameSpec(frameSpec) -> TimeCodeRange Create a time code range from `frameSpec`. A FrameSpec is a compact string representation of a time code range. A FrameSpec may contain up to three floating point values for the start time code, end time code, and stride values of a time code range. A FrameSpec containing just a single floating point value represents a time code range containing only that time code. A FrameSpec containing two floating point values separated by the range separator (‘:’) represents a time code range from the first value as the start time code to the second values as the end time code. A FrameSpec that specifies both a start and end time code value may also optionally specify a third floating point value as the stride, separating it from the first two values using the stride separator (‘x’). The following are examples of valid FrameSpecs: 123 101:105 105:101 101:109x2 101:110x2 101:104x0.5 An empty string corresponds to an invalid empty time code range. A coding error will be issued if the given string is malformed. Parameters ---------- frameSpec (str) – ``` ```markdown IsValid() -> bool Return true if this range contains one or more time codes, or false otherwise. ``` ```markdown empty() -> bool Return true if this range contains no time codes, or false otherwise. ``` ```markdown property endTimeCode TimeCode Return the end time code of this range. Type ---- type ``` ```markdown property frameSpec ``` frameSpec startTimeCode TimeCode Return the start time code of this range. Type type stride float Return the stride value of this range. Type type class pxr.UsdUtils.UsdStageStatsKeys **Attributes:** - activePrimCount - approxMemoryInMb - assetCount - inactivePrimCount - instanceCount - instancedModelCount - modelCount - primCounts - primCountsByType - primary - prototypeCount | Key | Description | | --- | ----------- | | `prototypes` | [prototypes](#pxr.UsdUtils.UsdStageStatsKeys.prototypes) | | `pureOverCount` | [pureOverCount](#pxr.UsdUtils.UsdStageStatsKeys.pureOverCount) | | `totalInstanceCount` | [totalInstanceCount](#pxr.UsdUtils.UsdStageStatsKeys.totalInstanceCount) | | `totalPrimCount` | [totalPrimCount](#pxr.UsdUtils.UsdStageStatsKeys.totalPrimCount) | | `untyped` | [untyped](#pxr.UsdUtils.UsdStageStatsKeys.untyped) | | `usedLayerCount` | [usedLayerCount](#pxr.UsdUtils.UsdStageStatsKeys.usedLayerCount) | ### Attributes #### activePrimCount `activePrimCount` = 'activePrimCount' #### approxMemoryInMb `approxMemoryInMb` = 'approxMemoryInMb' #### assetCount `assetCount` = 'assetCount' #### inactivePrimCount `inactivePrimCount` = 'inactivePrimCount' #### instanceCount `instanceCount` = 'instanceCount' #### instancedModelCount `instancedModelCount` = 'instancedModelCount' #### modelCount `modelCount` = 'modelCount' #### primCounts `primCounts` = 'primCounts' primCounts = 'primCounts' primCountsByType = 'primCountsByType' primary = 'primary' prototypeCount = 'prototypeCount' prototypes = 'prototypes' pureOverCount = 'pureOverCount' totalInstanceCount = 'totalInstanceCount' totalPrimCount = 'totalPrimCount' untyped = 'untyped' usedLayerCount = 'usedLayerCount'
27,291
UsdVol.md
# UsdVol module Summary: The UsdVol module provides schemas for representing volumes (smoke, fire, etc). ## Classes: | Class | Description | |-------|-------------| | `Field3DAsset` | Field3D field primitive. | | `FieldAsset` | Base class for field primitives defined by an external file. | | `FieldBase` | Base class for field primitives. | | `OpenVDBAsset` | OpenVDB field primitive. | | `Tokens` | | | `Volume` | A renderable volume primitive. | ### Field3DAsset Field3D field primitive. The FieldAsset filePath attribute must specify a file in the Field3D format on disk. For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdVolTokens. So to set an attribute to the value”rightHanded”, use UsdVolTokens->rightHanded as the value. #### Methods: | Method | Description | |--------|-------------| | `CreateFieldDataTypeAttr` | | | Method | Description | |--------|-------------| | `CreateFieldDataTypeAttr(defaultValue, ...)` | See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.` | See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `CreateFieldPurposeAttr(defaultValue, ...)` | See GetFieldPurposeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `See GetFieldPurposeAttr() , and also Create vs Get Property Methods for when to use Get vs Create.` | See GetFieldPurposeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | `Define` | `classmethod Define(stage, path) -> Field3DAsset` | | `Get` | `classmethod Get(stage, path) -> Field3DAsset` | | `GetFieldDataTypeAttr()` | Token which is used to indicate the data type of an individual field. | | `GetFieldPurposeAttr()` | Optional token which can be used to indicate the purpose or grouping of an individual field. | | `GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | `classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken]` | ### CreateFieldDataTypeAttr ```python CreateFieldDataTypeAttr(defaultValue, writeSparsely) -> Attribute ``` See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### CreateFieldPurposeAttr ```python CreateFieldPurposeAttr(defaultValue, writeSparsely) -> Attribute ``` See GetFieldPurposeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – as the attribute’s default, sparsely (when it makes sense to do so) if ```code``` writeSparsely ```code``` is ```code``` true ```code``` - the default for ```code``` writeSparsely ```code``` is ```code``` false ```code``` . - **Parameters** - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ```python classmethod Define(stage, path) -> Field3DAsset ``` Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. - **Parameters** - **stage** (Stage) – - **path** (Path) – ```python classmethod Get(stage, path) -> Field3DAsset ``` Return a UsdVolField3DAsset holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdVolField3DAsset(stage->GetPrimAtPath(path)); ``` - **Parameters** - **stage** (Stage) – - **path** (Path) – ### GetFieldDataTypeAttr - **Return Type**: Attribute - **Description**: Token which is used to indicate the data type of an individual field. Authors use this to tell consumers more about the field without opening the file on disk. The list of allowed tokens reflects the available choices for Field3d volumes. - **Declaration**: ``` token fieldDataType ``` - **C++ Type**: TfToken - **Usd Type**: SdfValueTypeNames->Token - **Allowed Values**: half, float, double, half3, float3, double3 ### GetFieldPurposeAttr - **Return Type**: Attribute - **Description**: Optional token which can be used to indicate the purpose or grouping of an individual field. Clients which consume Field3D files should treat this as the Field3D field name. - **Declaration**: ``` token fieldPurpose ``` - **C++ Type**: TfToken - **Usd Type**: SdfValueTypeNames->Token ### GetSchemaAttributeNames - **Description**: classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. - **Parameters**: - **includeInherited** (bool) ### FieldAsset - **Description**: Base class for field primitives defined by an external file. For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdVolTokens. So to set an attribute to the value”rightHanded”, use UsdVolTokens->rightHanded as the value. - **Methods**: - **CreateFieldDataTypeAttr** (defaultValue, ...) - See GetFieldDataTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateFieldIndexAttr** (defaultValue, writeSparsely) - See GetFieldIndexAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateFieldNameAttr** (defaultValue, writeSparsely) - See GetFieldNameAttr(), and also Create vs Get Property Methods for when to use Get vs Create. - **CreateFilePathAttr** (defaultValue, writeSparsely) - See GetFilePathAttr(), and also Create vs Get Property Methods for when to use Get vs Create. | td | td | | --- | --- | | See GetFilePathAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | | See GetVectorDataRoleHintAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | | classmethod Get(stage, path) -> FieldAsset | | | Token which is used to indicate the data type of an individual field. | | | A file can contain multiple fields with the same name. | | | Name of an individual field within the file specified by the filePath attribute. | | | An asset path attribute that points to a file on disk. | | | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | | | Optional token which is used to indicate the role of a vector valued field. | | <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdVol.FieldAsset.CreateFieldDataTypeAttr"> <span class="sig-name descname"><span class="pre">CreateFieldDataTypeAttr <span class="sig-paren">( <em class="sig-param"><span class="n"><span class="pre">defaultValue <em class="sig-param"><span class="n"><span class="pre">writeSparsely <span class="sig-paren">) <span class="sig-return"><span class="sig-return-icon">→ <a class="headerlink" href="#pxr.UsdVol.FieldAsset.CreateFieldDataTypeAttr" title="Permalink to this definition"> <dd> <p>See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code class="docutils literal notranslate"><span class="pre">defaultValue <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li><p><strong>defaultValue <li><p><strong>writeSparsely <dl class="py method"> <dt class="sig sig-object py" id="pxr.UsdVol.FieldAsset.CreateFieldIndexAttr"> <span class="sig-name descname"><span class="pre">CreateFieldIndexAttr <span class="sig-paren">( <em class="sig-param"><span class="n"><span class="pre">defaultValue <em class="sig-param"><span class="n"><span class="pre">writeSparsely <span class="sig-paren">) <span class="sig-return"><span class="sig-return-icon">→ <a class="headerlink" href="#pxr.UsdVol.FieldAsset.CreateFieldIndexAttr" title="Permalink to this definition"> <dd> <p>See GetFieldIndexAttr() , and also Create vs Get Property Methods for when to use Get vs Create. <p>If specified, author <code class="docutils literal notranslate"><span class="pre">defaultValue <dl class="field-list simple"> <dt class="field-odd">Parameters <dd class="field-odd"> <ul class="simple"> <li><p><strong>defaultValue <li><p><strong>writeSparsely ## pxr.UsdVol.FieldAsset.CreateFieldIndexAttr → Attribute See GetFieldIndexAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ``` ## pxr.UsdVol.FieldAsset.CreateFieldNameAttr ``` → Attribute See GetFieldNameAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ``` ## pxr.UsdVol.FieldAsset.CreateFilePathAttr ``` → Attribute See GetFilePathAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. ### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ``` ### CreateVectorDataRoleHintAttr (defaultValue, writeSparsely) → Attribute See GetVectorDataRoleHintAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. #### Parameters - **defaultValue** (VtValue) – - **writeSparsely** (bool) – ### Get static Get() classmethod Get(stage, path) -> FieldAsset Return a UsdVolFieldAsset holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdVolFieldAsset(stage->GetPrimAtPath(path)); ``` #### Parameters - **stage** (Stage) – - **path** (Path) – ### GetFieldDataTypeAttr ( ) → Attribute Token which is used to indicate the data type of an individual field. Authors use this to tell consumers more about the field without opening the file on disk. The list of allowed tokens is specified with the specific asset type. A missing value is considered an error. Declaration ``` token fieldDataType ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token ### GetFieldIndexAttr ( ) → Attribute A file can contain multiple fields with the same name. This optional attribute is an index used to disambiguate between these ``` multiple fields with the same name. Declaration ``` int fieldIndex ``` C++ Type int Usd Type SdfValueTypeNames->Int --- Name of an individual field within the file specified by the filePath attribute. Declaration ``` token fieldName ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token --- An asset path attribute that points to a file on disk. For each supported file format, a separate FieldAsset subclass is required. This attribute’s value can be animated over time, as most volume asset formats represent just a single timeSample of a volume. However, it does not, at this time, support any pattern substitutions like”$F”. Declaration ``` asset filePath ``` C++ Type SdfAssetPath Usd Type SdfValueTypeNames->Asset --- **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. Parameters **includeInherited** (bool) – --- Optional token which is used to indicate the role of a vector valued field. This can drive the data type in which fields are made available in a renderer or whether the vector values are to be transformed. Declaration ``` token vectorDataRoleHint ="None" ``` C++ Type TfToken Usd Type SdfValueTypeNames->Token Allowed Values None, Point, Normal, Vector, Color --- class pxr.UsdVol.FieldBase Base class for field primitives. **Methods:** - [Get](#pxr.UsdVol.FieldBase.Get) ``` | Method Name | Description | |----------------------------|-----------------------------------------------------------------------------| | Get | classmethod Get(stage, path) -> FieldBase | | GetSchemaAttributeNames | classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] | ### Get **classmethod** Get(stage, path) -> FieldBase Return a UsdVolFieldBase holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdVolFieldBase(stage->GetPrimAtPath(path)); ``` **Parameters:** - **stage** (Stage) – - **path** (Path) – ### GetSchemaAttributeNames **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. Does not include attributes that may be authored by custom/extended methods of the schemas involved. **Parameters:** - **includeInherited** (bool) – ### OpenVDBAsset OpenVDB field primitive. The FieldAsset filePath attribute must specify a file in the OpenVDB format on disk. For any described attribute *Fallback Value* or *Allowed Values* below that are text/tokens, the actual token is published and defined in UsdVolTokens. So to set an attribute to the value "rightHanded", use UsdVolTokens->rightHanded as the value. **Methods:** | Method Name | Description | |----------------------------|-----------------------------------------------------------------------------| | CreateFieldClassAttr | See GetFieldClassAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | CreateFieldDataTypeAttr | See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. | | Define | **classmethod** Define | ``` Define(stage, path) -> OpenVDBAsset ```python Get ``` classmethod Get(stage, path) -> OpenVDBAsset ```python GetFieldClassAttr ``` () Optional token which can be used to indicate the class of an individual grid. ```python GetFieldDataTypeAttr ``` () Token which is used to indicate the data type of an individual field. ```python GetSchemaAttributeNames ``` classmethod GetSchemaAttributeNames(includeInherited) -> list[TfToken] ```python CreateFieldClassAttr ``` (defaultValue, writeSparsely) -> Attribute See GetFieldClassAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters: - defaultValue (VtValue) – - writeSparsely (bool) – ```python CreateFieldDataTypeAttr ``` (defaultValue, writeSparsely) -> Attribute See GetFieldDataTypeAttr() , and also Create vs Get Property Methods for when to use Get vs Create. If specified, author `defaultValue` as the attribute’s default, sparsely (when it makes sense to do so) if `writeSparsely` is `true` - the default for `writeSparsely` is `false`. Parameters: - defaultValue (VtValue) – - writeSparsely (bool) – ## Define **classmethod** Define(stage, path) -> OpenVDBAsset Attempt to ensure a `UsdPrim` adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an `SdfPrimSpec` with `specifier` == `SdfSpecifierDef` and this schema’s prim type name for the prim at `path` at the current EditTarget. Author `SdfPrimSpec`s with `specifier` == `SdfSpecifierDef` and empty typeName at the current EditTarget for any nonexistent, or existing but not `Defined` ancestors. The given `path` must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case `path` cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid `UsdPrim`. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ## Get **classmethod** Get(stage, path) -> OpenVDBAsset Return a UsdVolOpenVDBAsset holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdVolOpenVDBAsset(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (`Stage`) – - **path** (`Path`) – ## GetFieldClassAttr Optional token which can be used to indicate the class of an individual grid. This is a mapping to openvdb::GridClass where the values are GRID_LEVEL_SET, GRID_FOG_VOLUME, GRID_STAGGERED, and GRID_UNKNOWN. **Declaration** ``` token fieldClass ``` **C++ Type** TfToken **Usd Type** SdfValueTypeNames->Token **Allowed Values** ## Description ### Methods #### GetFieldDataTypeAttr ``` ( ) ``` - Returns: Attribute ```markdown Token which is used to indicate the data type of an individual field. Authors use this to tell consumers more about the field without opening the file on disk. The list of allowed tokens reflects the available choices for OpenVDB volumes. - Declaration: ``` token fieldDataType ``` - C++ Type: TfToken - Usd Type: SdfValueTypeNames->Token - Allowed Values: half, float, double, int, uint, int64, half2, float2, double2, int2, half3, float3, double3, int3, matrix3d, matrix4d, quatd, bool, mask, string ``` #### GetSchemaAttributeNames ``` static GetSchemaAttributeNames() ``` - **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. - Parameters: - **includeInherited** (bool) – ``` ### Class: pxr.UsdVol.Tokens - **Attributes:** - bool_ - color - double2 - double3 - double_ - field - fieldClass - fieldDataType - fieldIndex ``` fieldName fieldPurpose filePath float2 float3 float_ fogVolume half half2 half3 int2 int3 int64 int_ levelSet mask matrix3d matrix4d none_ | normal | | ------ | | point | | quatd | | staggered | | string | | uint | | unknown | | vector | | vectorDataRoleHint | ### bool_ **= 'bool'** ### color **= 'Color'** ### double2 **= 'double2'** ### double3 **= 'double3'** ### double_ **= 'double'** ### field **= 'field'** fieldClass = 'fieldClass' fieldDataType = 'fieldDataType' fieldIndex = 'fieldIndex' fieldName = 'fieldName' fieldPurpose = 'fieldPurpose' filePath = 'filePath' float2 = 'float2' float3 = 'float3' float_ = 'float' fogVolume = 'fogVolume' half = 'half' half2 = 'half2' half3 = 'half3' int2 = 'int2' int3 = 'int3' int64 = 'int64' int_ = 'int' levelSet = 'levelSet' mask = 'mask' matrix3d = 'matrix3d' matrix4d = 'matrix4d' none_ = 'None' normal = 'Normal' point = 'Point' ### pxr.UsdVol.Tokens.quatd - **Property**: `quatd = 'quatd'` ### pxr.UsdVol.Tokens.staggered - **Property**: `staggered = 'staggered'` ### pxr.UsdVol.Tokens.string - **Property**: `string = 'string'` ### pxr.UsdVol.Tokens.uint - **Property**: `uint = 'uint'` ### pxr.UsdVol.Tokens.unknown - **Property**: `unknown = 'unknown'` ### pxr.UsdVol.Tokens.vector - **Property**: `vector = 'Vector'` ### pxr.UsdVol.Tokens.vectorDataRoleHint - **Property**: `vectorDataRoleHint = 'vectorDataRoleHint'` ### pxr.UsdVol.Volume - **Class**: `pxr.UsdVol.Volume` - **Description**: A renderable volume primitive. A volume is made up of any number of FieldBase primitives bound together in this volume. Each FieldBase primitive is specified as a relationship with a namespace prefix of "field". The relationship name is used by the renderer to associate individual fields with the named input parameters on the volume shader. Using this indirect approach to connecting fields to shader parameters (rather than using the field prim’s name) allows a single field to be reused for different shader inputs, or to be used as different shader parameters when rendering different Volumes. This means that the name of the field prim is not relevant to its contribution to the volume prims which refer to it. Nor does the field prim’s location in the scene graph have any relevance, and Volumes may refer to fields anywhere in the scene graph. However, unless Field prims need to be shared by multiple Volumes, a Volume’s Field prims should be located under the Volume in namespace, for enhanced organization. - **Methods**: - `BlockFieldRelationship(name)`: Blocks an existing field relationship on this volume, ensuring it will not be enumerated by GetFieldPaths(). - `CreateFieldRelationship(name, fieldPath)`: Creates a relationship on this volume that targets the specified field. - `Define`: [Description not provided in the HTML snippet] **classmethod** Define(stage, path) -> Volume **classmethod** Get(stage, path) -> Volume **classmethod** GetFieldPath(name) Checks if there is an existing field relationship with a given name, and if so, returns the path to the Field prim it targets, or else the empty path. **classmethod** GetFieldPaths() Return a map of field relationship names to the fields themselves, represented as prim paths. **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] **classmethod** HasFieldRelationship(name) Checks if there is an existing field relationship with a given name. **BlockFieldRelationship**(name) -> bool Blocks an existing field relationship on this volume, ensuring it will not be enumerated by GetFieldPaths(). Returns true if the relationship existed, false if it did not. In other words the return value indicates whether the volume prim was changed. The name lookup automatically applies the field relationship namespacing, if it isn’t specified in the name token. Parameters: - **name** (str) – **CreateFieldRelationship**(name, fieldPath) -> bool Creates a relationship on this volume that targets the specified field. If an existing relationship exists with the same name, it is replaced (since only one target is allowed for each named relationship). Returns true if the relationship was successfully created and set - it is legal to call this method for a field relationship that already exists, i.e. already possesses scene description, as this is the only method we provide for setting a field relationship’s value, to help enforce that field relationships can have only a single (or no) target. Parameters: - **name** (str) – - **fieldPath** (Path) – ## Define Method **classmethod** Define(stage, path) -> Volume Attempt to ensure a **UsdPrim** adhering to this schema at `path` is defined (according to UsdPrim::IsDefined() ) on this stage. If a prim adhering to this schema at `path` is already defined on this stage, return that prim. Otherwise author an **SdfPrimSpec** with **specifier** == **SdfSpecifierDef** and this schema’s prim type name for the prim at `path` at the current EditTarget. Author **SdfPrimSpec**s with `specifier` == **SdfSpecifierDef** and empty typeName at the current EditTarget for any nonexistent, or existing but not **Defined** ancestors. The given **path** must be an absolute prim path that does not contain any variant selections. If it is impossible to author any of the necessary PrimSpecs, (for example, in case **path** cannot map to the current UsdEditTarget ‘s namespace) issue an error and return an invalid **UsdPrim**. Note that this method may return a defined prim whose typeName does not specify this schema class, in case a stronger typeName opinion overrides the opinion at the current EditTarget. **Parameters** - **stage** (Stage) – - **path** (Path) – ## Get Method **classmethod** Get(stage, path) -> Volume Return a UsdVolVolume holding the prim adhering to this schema at `path` on `stage`. If no prim exists at `path` on `stage`, or if the prim at that path does not adhere to this schema, return an invalid schema object. This is shorthand for the following: ```python UsdVolVolume(stage->GetPrimAtPath(path)); ``` **Parameters** - **stage** (Stage) – - **path** (Path) – ## GetFieldPath Method GetFieldPath(name) -> Path Checks if there is an existing field relationship with a given name, and if so, returns the path to the Field prim it targets, or else the empty path. The name lookup automatically applies the field relationship namespacing, if it isn’t specified in the name token. **Parameters** - **name** (str) – ## GetFieldPaths Method GetFieldPaths() -> FieldMap ## Description ### pxr.UsdVol.Volume.GetFieldPaths - Return a map of field relationship names to the fields themselves, represented as prim paths. - This map provides all the information that should be needed to tie fields to shader parameters and render this volume. - The field relationship names that serve as the map keys will have the field namespace stripped from them. ### pxr.UsdVol.Volume.GetSchemaAttributeNames - **classmethod** GetSchemaAttributeNames(includeInherited) -> list[TfToken] - Return a vector of names of all pre-declared attributes for this schema class and all its ancestor classes. - Does not include attributes that may be authored by custom/extended methods of the schemas involved. - **Parameters** - **includeInherited** (bool) – ### pxr.UsdVol.Volume.HasFieldRelationship - Checks if there is an existing field relationship with a given name. - This query will return `true` even for a field relationship that has been blocked and therefore will not contribute to the map returned by GetFieldRelationships() - The name lookup automatically applies the field relationship namespacing, if it isn’t specified in the name token. - **Parameters** - **name** (str) –
28,562
usd_fabric_usdrt.md
# USD, Fabric, and USDRT ## Overview **USD** is Pixar’s library that allows large-scale scenes to be composed from hundreds or thousands of component layers and modified using non-destructive operations. Layers are backed by files on disk or a web service like Nucleus or AWS. The USD library enables authoring and editing of individual layers and inspection of the composed state of those layers, the USD stage. **Fabric** is the Omniverse library that enables high-performance creation, modification, and access of scene data, as well as communication of scene data between CPU and GPU and other Fabric clients on a network. Data in Fabric can be populated from the local composed USD stage, but may also be generated procedurally or populated over the network. Fabric also provides a ringbuffer between simulation and one or more renderers to allow them to run at different rates. Fabric indexes data and provides a query API to allow systems such as physics and rendering to get only the data they need, without having to traverse the scene each frame. **USDRT Scenegraph API** is an Omniverse API that mirrors the USD API (and is pin-compatible in most cases), but reads and writes data to and from Fabric instead of USD. It is designed to enable low-cost transitions for developers and technical artists to use Fabric in their code by starting with existing USD code or writing new code with USD APIs they already know, in either C++ or Python. ## Features at a Glance | | USD | Fabric | USDRT | |----------|--------------|--------------|--------------| | Developer| Pixar | NVIDIA | NVIDIA | | Data view| Pre- and post-composition | Post-composition only | Post-composition only | | API Languages | C++, Python | C++ | C++, Python | | Python bindings | boost::python | N/A | pybind11 | | ABI versioning | No guarantees, ABI may change with each release | Versioned Carbonite interfaces | ONI, periodic stable forward-compatible releases | | Vectorized APIs | No | Yes | Not yet | | Cost to locate (e.g. all prims of a type, ## Comparison of APIs | Feature | USD | Fabric | USDRT | |-----------------------------------|-----|--------|-------| | **Data access (properties by name)** | O(n) - traversal of entire stage | O(1) - query | O(1) / O(n) - query by type or applied API / traversal of entire stage for others | | **GPU data synchronization** | No | Yes | Partial | | **Data persistence** | File-based storage | Transient, in-memory only | Transient, in-memory only | | **Data write speed** | Slow | Fastest | Fast | ## Which API to use USD, Fabric, and USDRT each provide different capabilities for interacting with scene data in Omniverse. Here’s some guidelines about which API is most appropriate for your project or extension. ### USD The USD API can be used for both pre- and post- composition operations. That is, reading and authoring data directly from/to individual layers (pre-composition) and inspecting the result of composing those layers into a stage (post-composition). As a general rule, it is fast to read data from USD, but can be slow to write data to USD. Use the USD API when you are: - authoring persistent data (new assets and scenes) to be saved to one or more layers - inspecting the composition of a stage (ex: checking a property value across all that layers where it is authored, querying composition arcs on a prim, discovering all the instances of a scenegraph prototype) - modifying the composition of a stage (ex: changing a variantSet selection, enabling or disabling instancing for a prim, adding a new reference to a prim) ### Fabric The Fabric API operates on a post-composition view of the USD stage. Fabric cannot modify the composition of a stage (ex: change a variantSet selection) or inspect pre-composition data from individual USD layers. Data may be authored to Fabric that does not exist in USD (both prims and properties), and Fabric may not contain all prims and properties that exist on the USD stage. Fabric manages synchronization of data to and from the GPU for GPU-accelerated operations and rendering. Use the Fabric API when you: - are inspecting the composed state of the USD stage - are authoring transient data like simulation results, procedurally generated geometry, and interactive transform updates - want to author data rapidly, to be stored back to USD at a later time or not at all - want the option to use vectorized APIs for reading or writing data - want to read or modify data on the GPU - want to quickly query the data to process it every frame, for example to get all the physics prims, all the renderable prims, or all the prims that have a particular set of attributes - are using C++ ### USDRT The USDRT API provides a USD-like API on top of Fabric. If you are already familiar with the USD API, you can apply your existing knowledge to immediately begin working with Fabric. Use the USDRT API when you: - want to work with Fabric (see above - transient data, fast data writes) - want a USD-like API - don’t need access to vectorized APIs - want fast queries by prim type or applied API, or are ok with traversing the stage to find the prims you want to process or know their paths without searching - are using C++ or Python ## Code examples A few code examples are provided here to demonstrate how to accomplish a task with the USD, Fabric, and USDRT APIs. USD and USDRT samples are compared side-by-side, as the intention of the USDRT Scenegraph API is to be as compatible with the USD API as possible. Fabric does not provide a Python API, so there are no Python samples for Fabric code. USDRT is the designated API for interacting with Fabric through Python. These samples are part of the usdrt repository unit test suites, so validation asserts are mixed in throughout. For C++ the tests use doctest, so the tests use the `CHECK()` macro. For Python the tests use unittest, so you will see checks like `self.assertTrue()` and `self.assertEqual()`. ### Get and modify the displayColor property on one prim For this example, we look at modifying an attribute on a prim with a known path. In all cases, this data can be accessed and modified directly. #### C++ ## USD and USDRT The code for the USD sample and the USDRT sample is the same, with the exception of the namespace using directive. However, the USDRT sample is reading data from Fabric, while the USD sample is reading data from the USD stage. | USD | USDRT | | --- | --- | | ```c++ PXR_NAMESPACE_USING_DIRECTIVE; SdfPath path("/Cornell_Box/Root/Cornell_Box1_LP/White_Wall_Back"); UsdPrim prim = stage->GetPrimAtPath(path); TfToken attrName = UsdGeomTokens->primvarsDisplayColor; UsdAttribute attr = prim.GetAttribute(attrName); // Get the value of displayColor on White_Wall_Back, // which is mid-gray on this stage VtArray<GfVec3f> result; attr.Get(&result); CHECK(result.size() == 1); CHECK(result[0] == GfVec3f(0.5, 0.5, 0.5)); // Set the value of displayColor to red, // and verify the change by getting the value VtArray<GfVec3f> red = { GfVec3f(1, 0, 0) }; attr.Set(red); attr.Get(&result); CHECK(result[0] == GfVec3f(1, 0, 0)); ``` | ```c++ using namespace usdrt; SdfPath path("/Cornell_Box/Root/Cornell_Box1_LP/White_Wall_Back"); UsdPrim prim = stage->GetPrimAtPath(path); TfToken attrName = UsdGeomTokens->primvarsDisplayColor; UsdAttribute attr = prim.GetAttribute(attrName); // Get the value of displayColor on White_Wall_Back, // which is mid-gray on this stage VtArray<GfVec3f> result; attr.Get(&result); CHECK(result.size() == 1); CHECK(result[0] == GfVec3f(0.5, 0.5, 0.5)); // Set the value of displayColor to red, // and verify the change by getting the value VtArray<GfVec3f> red = { GfVec3f(1, 0, 0) }; attr.Set(red); attr.Get(&result); CHECK(result[0] == GfVec3f(1, 0, 0)); ``` | ``` ## Fabric Fabric’s `StageReaderWriter` class provides separate APIs for accessing non-array-typed attributes and array-typed attributes. As noted in the code comments, there are also separate APIs for accessing data as a read-only (const) pointer, a writable (non-const) pointer, or a read/write (non-const) pointer - using the write or read/write APIs will mark the attribute as potentially modified in Fabric’s change tracking system. Fabric change tracking subscribers may then take appropriate action based on potentially modified attribute values. | Attribute type | Read-only API | Write API | Read/Write API | |----------------|---------------|-----------|----------------| | Non-array | `getAttributeRd()` | `getAttributeWr()` | `getAttribute()` | | Array | `getArrayAttributeRd()` | `getArrayAttributeWr()` | `getArrayAttribute()` | Because primvars are always represented by an array (even when the array only contains a single item, i.e. `constant` interpolation), the `getArrayAttributeRd()` and `getArrayAttributeWr()` APIs are used in this example. ```c++ using namespace omni::fabric; using namespace usdrt; const Path primPath("/Cornell_Box/Root/Cornell_Box1_LP/White_Wall_Back"); const Token attrName("primvars:displayColor"); // Get the value of displayColor on White_Wall_Back, // which is mid-gray on this stage // Note - the "Rd" API (getArrayAttributeRd) returns a span // of const items, which is therefor read-only // and Fabric does not track that a change was potentially made here gsl::span<const GfVec3f> displayColor = stageReaderWriter.getArrayAttributeRd<GfVec3f>(primPath, attrName); CHECK(displayColor.size() == 1); CHECK(displayColor[0] == GfVec3f(0.5, 0.5, 0.5)); // Set the value of displayColor to red // Note - the "Wr" API (getArrayAttributeWr) returns a span // with non-const items, and this can be used to write // new values directly to Fabric. Using the "Wr" APIs // indicates to Fabric that a change may have been made to this // attribute, which Fabric will track gsl::span<GfVec3f> displayColorWr = stageReaderWriter.getArrayAttributeWr<GfVec3f>(primPath, attrName); displayColorWr[0] = GfVec3f(1, 0, 0); // Validate that displayColor was updated to red // using the previous read-only query CHECK(displayColor[0] == GfVec3f(1, 0, 0)); ``` # Python ## USD and USDRT Like the C++ example, the code for the USD sample and the USDRT sample is the same, with the exception of the packages import namespace. And also like the C++ example, the USDRT sample is reading data from Fabric, while the USD sample is reading data from the USD stage. | USD | USDRT | | --- | --- | | ```python from pxr import Gf, Sdf, Usd, Vt path = "/Cornell_Box/Root/Cornell_Box1_LP/White_Wall_Back" prim = stage.GetPrimAtPath(path) attr = prim.GetAttribute("primvars:displayColor") # Get the value of displayColor on White_Wall_Back, # which is mid-gray on this stage result = attr.Get() self.assertEqual(len(result), 1) self.assertEqual(result[0], Gf.Vec3f(0.5, 0.5, 0.5)) # Set the value of displayColor to red, # and verify the change by getting the value attr.Set(Vt.Vec3fArray([Gf.Vec3f(1, 0, 0)])) result = attr.Get() self.assertEqual(len(result), 1) self.assertEqual(result[0], Gf.Vec3f(1, 0, 0)) ``` | ```python from usdrt import Gf, Sdf, Usd, UsdGeom, Vt path = "/Cornell_Box/Root/Cornell_Box1_LP/White_Wall_Back" prim = stage.GetPrimAtPath(path) attr = prim.GetAttribute(UsdGeom.Tokens.primvarsDisplayColor) # Get the value of displayColor on White_Wall_Back, # which is mid-gray on this stage result = attr.Get() self.assertEqual(len(result), 1) self.assertEqual(result[0], Gf.Vec3f(0.5, 0.5, 0.5)) # Set the value of displayColor to red, # and verify the change by getting the value attr.Set(Vt.Vec3fArray([Gf.Vec3f(1, 0, 0)])) result = attr.Get() self.assertEqual(len(result), 1) self.assertEqual(result[0], Gf.Vec3f(1, 0, 0)) ``` | # Find all Mesh prims and change the displayColor property In this example, we want to modify the displayColor property on every Mesh prim on the stage. This demonstrates a key performance feature of Fabric. Prim discovery with Fabric is very fast (O(1)) because Fabric’s internal storage organizes prims by shared sets of properties and metadata. Prim discovery with USD can be quite expensive (O(n)) because it requires traversing the entire stage to discover all prims with a specific type or specific attributes. USDRT also supports fast queries ( ```cpp O(1) ``` ) with Fabric by prim type or applied API schema. ## C++ ### USD and USDRT In this example, we see a key performance advantage in USDRT over USD. With USDRT, querying the stage for prims by type or applied API schema has a constant cost. With USD, this requires a traversal of the entire stage. | USD | USDRT | | --- | --- | | ```cpp PXR_NAMESPACE_USING_DIRECTIVE; const TfToken mesh("Mesh"); const TfToken attrName = UsdGeomTokens->primvarsDisplayColor; const VtArray<GfVec3f> red = { GfVec3f(1, 0, 0) }; for (UsdPrim prim : stage->Traverse()) { if (prim.GetTypeName() == mesh) { prim.GetAttribute(attrName).Set(red); } } ``` | ```cpp using namespace usdrt; const TfToken mesh("Mesh"); const TfToken attrName = UsdGeomTokens->primvarsDisplayColor; const VtArray<GfVec3f> red = { GfVec3f(1, 0, 0) }; const SdfPathVector meshPaths = stage->GetPrimsWithTypeName(mesh); for (SdfPath meshPath : meshPaths) { UsdPrim prim = stage->GetPrimAtPath(meshPath); if (prim.HasAttribute(attrName)) { prim.GetAttribute(attrName).Set(red); } } ``` | ### Fabric Efficient discovery of prims in Fabric is accomplished using the `StageReaderWriter::find()` API, takes a set of property names and types (represented by `AttrNameAndType` objects) and returns a `PrimBucketList` containing all Fabric buckets (data groupings) that match those requirements. Note that in Fabric, prim type is also represented by a property of the type `tag`. Fabric’s `StageReaderWriter::find()` is utilized in USDRT by a few APIs: - `UsdStage::GetPrimsWithTypeName()` - `UsdStage::GetPrimsWithAppliedAPIName()` - `UsdStage::GetPrimsWithTypeAndAppliedAPIName()` Fabric queries are currently more general than USDRT queries because they support querying by attribute name and type in addition to prim type and applied API schema. Fabric also allows you to categorize your query inputs by prim types and attribute names that should be present in **all**, **any**, or **none** of the results. This first example demonstrates a non-vectorized approach, where each property is accessed individually using the `getArrayAttributeWr` method. ```c++ using namespace omni::fabric; using namespace usdrt; // Get every Mesh prim with a displayColor attribute in Fabric const Token displayColorName("primvars:displayColor"); const GfVec3f red(1, 0, 0); AttrNameAndType displayColor(Type(BaseDataType::eBool), displayColorName); AttrNameAndType mesh(Type(BaseDataType::eTag, 1, 0, AttributeRole::ePrimTypeName), Token("Mesh")); PrimBucketList buckets = stageReaderWriter.findPrims({ displayColor, mesh }); // Iterate over the buckets that match the query for (size_t bucketId = 0; bucketId < buckets.bucketCount(); bucketId++) { auto primPaths = stageReaderWriter.getPathArray(buckets, bucketId); for (Path primPath : primPaths) { gsl::span<GfVec3f> displayColorWr = stageReaderWriter.getArrayAttributeWr<GfVec3f>(primPath, displayColorName); displayColorWr[0] = red; } } ``` Efficient access and modification of properties with Fabric can be accomplished using its **vectorized** APIs. Internally, Fabric stores data so that all properties of the same name and type are stored adjacent to each-other in memory as an array, for each group of prims with matching sets of properties (aka bucket). This allows access to **all** properties in a bucket with a single lookup and simple pointer arithmetic, which is fast, GPU-friendly, and straightforward to parallelize at scale. The example below demonstrates vectorized attribute access with Fabric: ```c++ using namespace omni::fabric; using namespace usdrt; // Get every Mesh prim with a displayColor attribute in Fabric const Token displayColorName("primvars:displayColor"); const GfVec3f red(1, 0, 0); AttrNameAndType displayColor(Type(BaseDataType::eBool), displayColorName); AttrNameAndType mesh(Type(BaseDataType::eTag, 1, 0, AttributeRole::ePrimTypeName), Token("Mesh")); ``` meshPaths = stage.GetPrimsWithTypeName("Mesh") for meshPath in meshPaths: prim = stage.GetPrimAtPath(meshPath) if prim.HasAttribute(UsdGeom.Tokens.primvarsDisplayColor): prim.GetAttribute(UsdGeom.Tokens.primvarsDisplayColor).Set(red) ``` ## Get and modify a material binding relationship USDRT and Fabric also support relationship-type properties. ### C++ USD and USDRT | USD | USDRT | | --- | --- | | ```c++ PXR_NAMESPACE_USING_DIRECTIVE; SdfPath path("/Cornell_Box/Root/Cornell_Box1_LP/Green_Wall/Green1SG"); UsdPrim prim = stage->GetPrimAtPath(path); TfToken relName = UsdShadeTokens->materialBinding; UsdRelationship rel = prim.GetRelationship(relName); // The currently bound Material prim, and a new // Material prim to bind const SdfPath oldMtl("/Cornell_Box/Root/Looks/Green1SG"); const SdfPath newMtl("/Cornell_Box/Root/Looks/Red1SG"); // Get the first target CHECK(rel.HasAuthoredTargets()); SdfPathVector targets; rel.GetTargets(&targets); CHECK(targets[0] == oldMtl); // Update the relationship to target // a different material SdfPathVector newTargets = { newMtl }; rel.SetTargets(newTargets); SdfPathVector updatedTargets; rel.GetTargets(&updatedTargets); CHECK(updatedTargets[0] == newMtl); ``` | ```c++ using namespace usdrt; SdfPath path("/Cornell_Box/Root/Cornell_Box1_LP/Green_Wall/Green1SG"); UsdPrim prim = stage->GetPrimAtPath(path); TfToken relName = UsdShadeTokens->materialBinding; UsdRelationship rel = prim.GetRelationship(relName); // The currently bound Material prim, and a new // Material prim to bind const SdfPath oldMtl("/Cornell_Box/Root/Looks/Green1SG"); const SdfPath newMtl("/Cornell_Box/Root/Looks/Red1SG"); // Get the first target CHECK(rel.HasAuthoredTargets()); SdfPathVector targets; rel.GetTargets(&targets); CHECK(targets[0] == oldMtl); // Update the relationship to target // a different material SdfPathVector newTargets = { newMtl }; rel.SetTargets(newTargets); SdfPathVector updatedTargets; rel.GetTargets(&updatedTargets); CHECK(updatedTargets[0] == newMtl); ``` | ```c++ using namespace omni::fabric; using namespace usdrt; const Path primPath("/Cornell_Box/Root/Cornell_Box1_LP/Green_Wall/Green1SG"); const Token relName("material:binding"); const Path oldMtl("/Cornell_Box/Root/Looks/Green1SG"); const Path newMtl("/Cornell_Box/Root/Looks/Red1SG"); // Get the first target of material:binding // Note: getAttribute methods have a specialization for relationships // that will return the first target directly const Path* target = stageReaderWriter.getAttributeRd<Path>(primPath, relName); CHECK(*target == oldMtl); // Update the relationship to target // a different material Path* newTarget = stageReaderWriter.getAttributeWr<Path>(primPath, relName); *newTarget = newMtl; // Validate that target was updated CHECK(*target == newMtl); ``` ## Fabric Fabric uses the same APIs to work with both attributes and relationships, with `omni::fabric::Path` as the template type: `StageReaderWriter::getAttribute<Path>()`. An important note is that Fabric and USDRT only support a single relationship target in Kit 104 - this is updated in Kit 105 to support any number of targets on a relationship (like USD). The example below contains an example of a Fabric API that bridges both Kit releases, which will return the only relationship target in Kit 104, and the first relationship target in Kit 105. To get all relationship targets in Kit 105, you would use `StageReaderWriter::getArrayAttribute<Path>()` or the equivalent read-only or write APIs. ## Python ### USD and USDRT | USD | USDRT | | --- | --- | | from pxr import Gf, Sdf, Usd<br>path = "/Cornell_Box/Root/Cornell_Box1_LP/Green_Wall/Green1SG"<br>prim = stage.GetPrimAtPath(path)<br>rel = prim.GetRelationship("material:binding")<br># The currently bound Material prim, and a new<br># Material prim to bind<br>old_mtl = "/Cornell_Box/Root/Looks/Green1SG"<br>new_mtl = "/Cornell_Box/Root/Looks/Red1SG"<br># Get the first target<br>self.assertTrue(rel.HasAuthoredTargets()) | | ```python from usdrt import Gf, Sdf, Usd, UsdGeom path = "/Cornell_Box/Root/Cornell_Box1_LP/Green_Wall/Green1SG" prim = stage.GetPrimAtPath(path) rel = prim.GetRelationship(UsdShade.Tokens.materialBinding) # The currently bound Material prim, and a new # Material prim to bind old_mtl = "/Cornell_Box/Root/Looks/Green1SG" new_mtl = "/Cornell_Box/Root/Looks/Red1SG" # Get the first target self.assertTrue(rel.HasAuthoredTargets()) mtl_path = rel.GetTargets()[0] self.assertEqual(mtl_path, old_mtl) # Update the relationship to target a different material rel.SetTargets([new_mtl]) updated_path = rel.GetTargets()[0] self.assertEqual(updated_path, new_mtl) ``` # Working with data on the GPU Fabric has the capability of synchronizing data between CPU memory and GPU memory. This can be useful for staging data on the GPU for running CUDA kernels to process it in a highly parallelized manner. USDRT has some initial support for Fabric’s GPU data through its VtArray implementation - Fabric GPU data array-typed attributes may be accessed though VtArray. Additionally, GPU data from Python objects that implement the CUDA Array interface (such as warp) can be used to populate a VtArray and copy the data to Fabric with a direct copy on the GPU. ## C++ ```c++ using namespace omni::fabric; using namespace usdrt; UsdStageRefPtr stage = UsdStage::Open("./data/usd/tests/cornell.usda"); const Path primPath("/Cornell_Box/Root/Cornell_Box1_LP/White_Wall_Back"); const Token attrName("points"); // Get the points attribute value from USDRT VtArray<GfVec3f> usdrtPoints; UsdPrim mesh = stage->GetPrimAtPath(SdfPath(primPath)); UsdAttribute attr = mesh.GetAttribute(TfToken(attrName)); attr.Get(&usdrtPoints); // Nobody has accessed the GPU mirror for the points // attribute yet, so VtArray reports that there is no // Fabric GPU data available CHECK(!usdrtPoints.HasFabricGpuData()); std::vector<GfVec3f> newPoints = {{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}}; ``` # First create a warp array from numpy points = np.zeros(shape=(1024, 3), dtype=np.float32) for i in range(1024): for j in range(3): points[i][j] = i * 3 + j warp_points = wp.array(points, device="cpu") with wp.ScopedCudaGuard(): gpu_warp_points = warp_points.to("cuda") warp_ref = weakref.ref(gpu_warp_points) # Create a VtArray from a warp array vt_points = Vt.Vec3fArray(gpu_warp_points) # Set the Fabric attribute which will make a CUDA copy # from warp to Fabric attr.Set(vt_points) wp.synchronize() # Retrieve a new Fabric VtArray from USDRT new_vt_points = attr.Get() self.assertTrue(new_vt_points.HasFabricGpuData()) # Create a warp array from the VtArray new_warp_points = warp_array_from_cuda_array_interface(new_vt_points) # Delete the fabric VtArray to ensure the data was # really copied into warp del new_vt_points # Convert warp points back to numpy new_points = new_warp_points.numpy() # Now compare the round-trip through USDRT and GPU was a success self.assertEqual(points.shape, new_points.shape) for i in range(1024): for j in range(3): self.assertEqual(points[i][j], new_points[i][j]) # Interoperability between USD and USDRT ## C++ ```cpp PXR_NS::UsdStageRefPtr usdStage = PXR_NS::UsdStage::Open("./data/usd/tests/cornell.usda"); // Get USD stage Id from global stage cache in UsdUtils PXR_NS::UsdStageCache::Id usdStageId = PXR_NS::UsdUtilsStageCache::Get().Insert(usdStage); // Get Fabric stage Id from USD stage Id omni::fabric::UsdStageId stageId(usdStageId.ToLongInt()); // Create USDRT stage pointer using Attach w/ Fabric stage Id usdrt::UsdStageRefPtr stage = usdrt::UsdStage::Attach(stageId); usdrt::SdfPathVector meshPaths = stage->GetPrimsWithTypeName(usdrt::TfToken("Mesh")); for (const usdrt::SdfPath& meshPath : meshPaths) ``` ```cpp // Convert usdrt SdfPath to USD SdfPath const PXR_NS::SdfPath& usdMeshPath = omni::fabric::toSdfPath(omni::fabric::PathC(meshPath)); // Now you can query the USD stage PXR_NS::UsdPrim usdPrim = usdStage->GetPrimAtPath(usdMeshPath); // ...and use APIs that are not represented in USDRT if (usdPrim.HasVariantSets()) { std::cout << "Found Mesh with variantSet: " << usdMeshPath.GetString() << std::endl; } ``` ```python from pxr import Sdf, Usd, UsdUtils from usdrt import Usd as RtUsd usd_stage = Usd.Stage.Open(TEST_DIR + "/data/usd/tests/cornell.usda") usd_stage_id = UsdUtils.StageCache().Insert(usd_stage) stage = RtUsd.Stage.Attach(usd_stage_id.ToLongInt()) mesh_paths = stage.GetPrimsWithTypeName("Mesh") for mesh_path in mesh_paths: # strings can be implicitly converted to SdfPath in Python usd_prim = usd_stage.GetPrimAtPath(str(mesh_path)) if usd_prim.HasVariantSets(): print(f"Found Mesh with variantSet: {mesh_path}") ``` ## Availability ### USD, Fabric, and USDRT Availability | | USD | Fabric | USDRT | |----------|-----|--------|-------| | Open-source repo | [https://github.com/PixarAnimationStudios/USD](https://github.com/PixarAnimationStudios/USD) | N/A | N/A | | Published Binaries | [https://developer.nvidia.com/usd](https://developer.nvidia.com/usd) | N/A | N/A | | PyPi Package | [usd_core](https://pypi.org/project/usd-core/) | N/A | N/A | | NVIDIA internal repo | omniverse/USD | omniverse/kit | omniverse/usdrt | | packman package | nv_usd | kit_sdk | usdrt | | Kit-103 | USD-20.08 | carb.flatcache.plugin | N/A | |---------|-----------|-----------------------|-----| | Kit-104 | USD-20.08 | carb.flatcache.plugin | USDRT Scenegraph API extension | | Kit-105 | USD-22.11 | omni.fabric.plugin | USDRT Scenegraph API extension |
26,030
usd_resolver_api.md
# Omniverse USD Resolver API ## Directory hierarchy - **dir live** - **dir live/include** - **dir live/include/omni_spectree** - file live/include/omni_spectree/Defines.h - file live/include/omni_spectree/Interfaces.h - file live/include/omni_spectree/Utils.h ## Namespace hierarchy ### dir - resolver #### dir - resolver/include ##### file - resolver/include/Defines.h - resolver/include/OmniUsdResolver.h ### namespace - omni #### namespace - omni::spectree ##### namespace - omni::spectree::utils - omni::spectree::v1 ###### class - omni::spectree::v1::IAsyncBatch - omni::spectree::v1::IChangeListConsigner - omni::spectree::v1::IChangeListDelegate - omni::spectree::v1::IChangeListDelegateFactory - omni::spectree::v1::IInboundChangeDelegate <details> <summary> <span class="headerlink"> <div class="section" id="inbound-change-delegates"> <h2> Inbound Change Delegates <div class="section" id="inbound-change-delegates-1"> <h3> Inbound Change Delegates <ul class="simple"> <li> <p class="sd-card-text"> class <span class="std std-ref"> omni::spectree::v1::IInboundChangeDelegate <li> <p class="sd-card-text"> class <span class="std std-ref"> omni::spectree::v1::IOutboundChangeDelegate <li> <p class="sd-card-text"> class <span class="std std-ref"> omni::spectree::v1::ISpecChangeList <li> <p class="sd-card-text"> class <span class="std std-ref"> omni::spectree::v1::ISpecField <li> <p class="sd-card-text"> class <span class="std std-ref"> omni::spectree::v1::ISpecNode <li> <p class="sd-card-text"> class <span class="std std-ref"> omni::spectree::v1::ISpecTreeClient <section id="api-contents"> <h2> API contents <div class="toctree-wrapper compound"> <ul> <li class="toctree-l1"> Classes <li class="toctree-l1"> Macros <li class="toctree-l1"> Directories <li class="toctree-l1"> Enumerations <li class="toctree-l1"> Files <li class="toctree-l1"> Functions <li class="toctree-l1"> Namespaces <li class="toctree-l1"> Structs <li class="toctree-l1"> Typedefs
2,038
user-manual.md
# Using The Scene Optimizer ## Finding The Extension > Note: This extension is enabled by default in USD Composer 2022.3.0 and above. The Scene Optimizer panel can be opened via the **Window -> Utilities -> Scene Optimizer** menu item. The extension can be enabled/disabled via the **Window -> Extensions** window. Search for **Scene Optimizer**. There are three extensions available. You will see: - `omni.scene.optimizer.core` - `omni.scene.optimizer.ui` - `omni.scene.optimizer.bundle` In most cases enabling the `bundle` extension is all that is needed. This will load both `core` and `ui` extensions automatically. ## Scene Optimizer UI When the Scene Optimizer is enabled, the following UI is displayed: (Image removed as per instructions) - **Load Preset** - Load a previously saved JSON configuration file describing a series of processes or choose an included preset: - Modify Instances - Clean Prototypes - Modify Instances - Merge Meshes - Modify Stage - Deduplicate Materials and Meshes - Modify Stage - Move Materials to /Looks - Modify Stage - Merge Meshes - Modify Stage - Spatial Merge Meshes - **Save Preset** - Save the current process stack to a JSON file for later use. - **Execute All** - Executes all of the processes that are configured from top to bottom. - **Clear All Processes** - Clear all processes configured in the stack. - Removes all processes from the UI. - **Add Scene Optimizer Process** - Add processes that will be performed on the stage. - **Configuration Menu** The configuration menu will show contextual information about the current stage contents such as stats and process logs. This can be helpful for understanding how stage components will be processed by specified Scene Optimizer operations. The results are displayed in a new **Report** tab. - **Verbose** - Logs extended information for a generated report. - **Generate Report** - Creates a report for each time a user runs a process stack. This includes timing and information about what the various operations processed. - **Capture Before/After Stats** - Captures the before and after stats of the contents of the stage to show any changes of the stage when scene optimizer operations have been run. - **Note** A report will be generated by default from core version **105.1.8** and newer. This can be turned off in the **Configure Menu** by disabling **Generate Report** option. - **Reordering Processes** As processes are added they will be appended to the list. Processes can be reordered (click and drag the `drag handle` in the top-left corner of a process) or removed (click the `delete` button in the top-right corner of a process). You can also expand/collapse a process by clicking on the top header section of it. - **Editing Prim Paths** Some processes can have a list of prim paths or regular expressions specified in order to restrict what they operate on: Those processes will have an argument that looks like the screenshot above. You can freely type a `prim path` or `regular expression` in the text field. Clicking `Add` will add any selected prims in the stage to the list. Clicking the `pencil` icon will open a new window, shown below, that lets you more easily manipulate what is included. - **Presets** A few presets are included in `Load Preset` button to help load common operation stacks and their configurations to help organize common output USD data structures to be more performant for user workflows. There are two primary categories of presets within Scene Optimizer: - **Instance Optimization** These presets aim to find the **prototypes** of the instances in the stage and optimize each one. The presets can be executed in succession to achieve higher levels of optimization, mainly by reducing prim count, this is equally beneficial for performance and useability (i.e., less clutter in the Stage Window). | Name | Description | Workflow / Applications | | --- | --- | --- | | Modify Instances - Clean Prototypes | This preset does not change the prim hierarchy. It performs the following operations: | - Components in Process and Equipment data. <br> - Instances (families) in architecture data. <br> - Products with important hierarchies that need to be preserved up to the instance level. <br> - Simulation / Process Data with many timesamples. <br> - CAD data with low quality materials. | | Modify Instances - Merge Meshes | This preset merges the meshes within each component (in the prototype library) and removes leaf level xforms. | - Stages with many meshes in each prototype. <br> - Stages with important hierarchies that need to be preserved up to the instance level. | | Name | Description | Workflow / Applications | | --- | --- | --- | | Modify Stage - Deduplicate Materials and Meshes | Detects duplicate meshes and turns them into instances. This should result in faster stage load times, faster translation to the renderer and lower memory requirements. | Stages with many duplicate meshes across the hierarchy, which are not already instanced. | | Modify Stage - Move Materials to /Looks | Prototypes may often contain duplicate materials in each prototype. This can make it difficult to modify materials easily as they exist multiple times in the hierarchy. | Stages with many instances and prototypes containing duplicated materials. | | Modify Stage - Merge Meshes | Simplify and flatten the hierarchical complexity of the stage drastically, at the cost of addressability and memory. | | # Scene Optimizer ## Presets ### Simplify Scene - Prune leaves - Set pivots Architecture and Process Data with complex scene Hierarchies that can be simplified. ### Modify Stage - Spatial Merge Meshes Similar to the Merge Meshes preset, but merges all meshes regardless of materials based on a defined bounding volume. Users may want to change the size of the controls to yield different results of the merge operator. This is a very effective preset which can drastically reduce the scene complexity. Architecture and process data with complex scene hierarchies that can be simplified. ## Integrations The scene optimizer is also available in the following integrations: - Standalone Application - A command line tool that offers faster load times and is convenient for scripting to process multiple files. - Revit Connector - A direct Revit integration that utilizes the core optimization libraries found across scene optimizer operations. - Creo Connector - A direct Creo integration that utilizes the core optimization libraries found across scene optimizer operations. - Archicad Connector - A direct Archicad integration that utilizes the core optimization libraries found across scene optimizer operations.
6,765
user-settings_configuration.md
# Configuration Kit comes with a very rich and flexible configuration system based on Carbonite settings. Settings is a runtime representation of typical configuration formats (like json, toml, xml), and is basically a nested dictionary of values. ## Quick Start When you run a kit app it doesn’t load any kit file: ``` > kit.exe ``` That will start kit and exit, without enabling any extensions or applying any configuration, except for built-in config: `kit-core.json`. > To see all flags call `> kit.exe -h` To see default kit settings pass `--/app/printConfig=true`: ``` > kit.exe --/app/printConfig=true ``` That will print all settings. This syntax `--/` is used to apply settings from the command line. Any setting can be modified in this way. You may notice that the config it printed includes `app/printConfig`. You can try adding your own settings to the command line and observing them in the printed config to prove yourself that it works as expected. Another useful flag to learn early is `-v` to enable info logging or `-vv` to enable verbose logging. There are settings to control logging more precisely, but this is an easy way to get more logging in console and debug startup routine. ``` > kit.exe -v ``` To make kit do something let’s enable some extensions: ``` > kit.exe --enable omni.kit.window.script_editor ``` That enables a script editor extension. You may also notice that it enabled a few extensions it depends on. You can stack multiple `--enable` keywords to enable more extensions. You can also add more folders to search for extensions in with `--ext-folder`: ``` > kit.exe --enable omni.kit.window.script_editor --ext-folder ./exts --enable foo.bar ``` That enables you to create e.g `exts/foo.bar/extension.toml` and start hacking your own extension right away. ``` /app/exts/enabled ``` and ``` /app/exts/folders ``` arrays respectively. ## Application Config Settings can also be applied by passing a configuration file as a positional argument to Kit: ``` > kit.exe my.toml ``` This kind of config file becomes the “Application config”. It receives special treatment from Kit: 1. Config name becomes application name. 2. Separate data, documents and cache folders are created for applications. 3. The Folder where this config is located becomes the application path. This allows you to build separate applications with their own data. ## Kit File A Kit file is the recommended way to configure applications. ``` > kit.exe my.kit ``` Kit files are single file extensions (basically renamed `extension.toml` files). Only the `[settings]` part of them is applied to settings (as with any extension). Here is an example: ```toml [package] title = "My Script Editor App" version = "0.1.0" keywords = ["app"] [dependencies] "omni.kit.window.script_editor" = {} [settings] foo.bar = "123" exts."omni.kit.window.script_editor".windowOpenByDefault = true ``` As with any extension, it can be named, versioned and even published to the registry. It defines dependencies in the same format to pull in additional extensions. Notice that the setting `windowOpenByDefault` of the script editor extension is being overriden. Any extension can define its own settings and a guideline is to put them in the `extension.toml` file of the extension. Check `extension.toml` file for `omni.kit.window.script_editor`. Another guideline is to use root `exts` namespace and the name of extension next. The goal of the .kit file is to bridge the gap between settings and extensions and have one file that user can click and run Kit-based application (associate `.kit` file with `kit.exe` in OS). ## User Settings You can create system wide configuration files to override any setting. There are 2 places to put them: 1. To override settings of any kit application in the shared documents folder, typically in (on Windows): ``` C:\Users\[username]\Documents\Kit\shared\user.toml ``` 2. To override settings of particular application in the application documents folder, typically in: ``` C:\Users\[username]\Documents\Kit\apps\[app_name]\user.toml ``` 3. To override settings of any kit application locally (near the application .kit file), typically in (on Windows): ``` <app .kit file>\<0 or more levels above>\deps\user.toml ``` 4. To override settings of particular application locally (near the application .kit file), typically in: ``` <app .kit file>\<0 or more levels above>\deps\[app_name]\user.toml ``` To find those folders you can run Kit with info logging enabled and look for `[omni.kit.app.plugin] Tokens:` message at the beginning. Look for `documents` and `shared_documents` tokens. For more info: ``` # Tokens ## Special Keys ### Appending Arrays When configs are merged one value can override another. Sometimes we want instead to append values for array. You can use the special `++` key for that. For example to add additional extension folder to `/app/folders` settings you can do: ```toml [app.exts] folders."++" = ["c:/temp"] ``` You can put that for instance in `user.toml` described above to add more extension folder search paths. ### Importing Other Configs You can use the `@import@` key to import other config files in that location: ```toml [foo] "@import@": ["./some.toml"], ``` That will import config `some.toml` under the key `foo`. The `./` syntax implies that the config file is in the same folder. ## Portable Mode Regular kit-based app installation sets and uses system wide data, cache, logs folders. It also reads global Omniverse config in a known system-specific location. To know which folders where set you can look at tokens, like `${data}`, `${cache}`, `${logs}`. They can be found in the beginning of each log file. Kit based app can also run in portable mode, to use specified folder as a root for all those folders. First of all that is useful for developers, local builds by default run in portable mode. There are few different ways to run kit in portable mode: ### Cmd Args Pass `--portable` to run kit in portable mode and optionally pass `--portable-root [path]` to specify location of portable root. ### Portable Configs (Markers) Kit looks for following configs that force it to run in portable mode. It reads content of a file if it finds one and treats it as a path. If path is relative - it is relative to this config folder. Priority of search is: 1. App portable config, e.g. `foo.portable` near `foo.kit` when run with: `kit.exe foo.kit` 2. Kit portable config near experience, e.g. `kit.portable` near `foo.kit` when run with: `kit.exe foo.kit` 3. Kit portable config near `kit.exe`, e.g. `kit.portable` near `kit.exe` ## Changing Configuration With Command line Sometimes it is convenient to change some of the settings via command line, as was mentioned at the start you can do it by providing the full path to the parameter separated by the `/` and prefixed by the `--/`. For example, if the required option is `ignoreUnsavedOnExit` as shown in the printed JSON configuration: ```json <ISettings root>: { "app": { "hangDetector": { "enabled": false, "timeout": 120 }, "file": { "ignoreUnsavedOnExit": false, } } } ``` Then to change its value to `true` you need to add `--/app/file/ignoreUnsavedOnExit=true` to the command line: ``` > kit.exe --/app/file/ignoreUnsavedOnExit=true ``` To specify a boolean value `true` and `false` strings must be used. ```admonition Note ``` 1. The values are case-insensitive and using `--/some/path/to/parameter=false` or `--/some/path/to/parameter=FaLsE` produces the same result 2. If you need to set the string value `"true"` or `"false"` escape it with double quotes: `--/some/path/to/text_parameter=\"false\"` 3. It is also possible to use `--/some/path/to/parameter=0` or `--/some/path/to/parameter=1` to set a setting to `true` or `false` correspondingly. In this case the actual value in the settings will be an integer but functions working with settings will correctly convert it to a boolean. Setting a numeric or string value is straightforward: ``` > kit.exe --/some/number=7 --/another/number=1.5 --/some/string=test ``` If you need to set a string value that can be parsed as a number or a boolean or if the string value contains whitespaces use double quotes to escape it: ``` > kit.exe --/sets/string/value=\"7\" --/sets/string/with/whitespaces=\"string with spaces\" ``` ```admonition Note ``` Do not forget to escape the quotes so the OS doesn’t remove them To set an array value you can: ``` > kit.exe --/some/array/1=17 ``` will change ```json { "some": { "array" : [1, 2, 3], }, } ``` into ```json { "some": { "array" : [1, 17, 3], }, } ``` ``` > kit.exe --/some/array=[8,11] ``` replaces ```json { "some": { "array" : [1, 2, 3], }, } ``` with ```json { "some": { "array" : [8, 11], }, } ``` ```admonition Note ``` You can use whitespaces in the square brackets (`[val0, val1, val2]`) if you escape the whole expression with double quotes to prevent the OS from separating it into several command line arguments: ``` > kit.exe --/some/array="[ 8, 11]" ``` It is also possible to assign a proper JSON as a parameter value: ``` > kit.exe --/my/json/param={\"num\":1,\"str\":\"test\",\"arr\":[1,2,3],\"obj\":{\"info\":42}} "my": { "json" : { "param" : { "num": 1, "str": "test", "arr": [ 1, 2, 3 ], "obj": { "info": 42 } } } }, ... ``` ## Passing Command Line arguments to extensions Kit ignores all command line arguments after `--`. It also writes those in `/app/cmdLineUnprocessedArgs` setting. Extensions can use this setting to access them and process as they wish.
9,858
using-a-local-build-of-another-extension_index.md
# kit-rtp-texture: Omniverse Kit Extension & App Template ## Kit Extensions & Apps Example :package: This repo is a gold standard for building Kit extensions and applications. The idea is that you fork it, trim down parts you don’t need and use it to develop your extensions and applications. Which then can be packaged, shared, reused. This README file provides a quick overview. In-depth documentation can be found at: 📖 omniverse-docs.s3-website-us-east-1.amazonaws.com/kit-rtp-texture Teamcity Project ## Extension Types ```mermaid graph TD subgraph "python" A3(__init__.py + python code) end subgraph cpp A1(omni.ext-example_cpp_ext.plugin.dll) end subgraph "mixed" A2(__init__.py + python code) A2 --import _mixed_ext--&gt; B2(example.mixed_ext.python) B2 -- carb::Framework --&gt; C2(example.mixed_ext.plugin.dll) end Kit[Kit] --&gt; A1 Kit[Kit] --&gt; A2 Kit[Kit] --&gt; A3 ``` ## Getting Started 1. build: ``` build.bat -r ``` 2. run: ``` _build\windows-x86_64\release\omni.app.new_exts_demo_mini.bat ``` 3. notice enabled extensions in “Extension Manager Window” of Kit. One of them brought its own test in “Test Runner” window. To run tests: ``` repo.bat test ``` To run from python: ``` _build\windows-x86_64\release\example.pythonapp.bat ``` ## Using a Local Build of Kit SDK By default packman downloads Kit SDK (from `deps/kit-sdk.packman.xml`). For developing purposes local build of Kit SDK can be used. To use your local build of Kit SDK, assuming it is located say at `C:/projects/kit`. Use `repo_source` tool to link: ``` repo source ``` > You can use the following command to link the kit SDK: > ``` > link c:/projects/kit/kit > ``` Or you can also do it manually: create a file: ``` deps/kit-sdk.packman.xml.user ``` containing the following lines: ```xml <project toolsVersion="5.6"> <dependency name="kit_sdk_${config}" linkPath="../_build/${platform}/${config}/kit"> <source path="c:/projects/kit/kit/_build/$platform/$config" /> ``` To see current source links: ``` repo source list ``` To remove source link: ``` repo source unlink kit-sdk ``` To remove all source links: ``` repo source clear ``` ## Using a Local Build of another Extension Other extensions can often come from the registry to be downloaded by kit at run-time or build-time (e.g. ``` omni.app.my_app.kit ``` example). Developers often want to use a local clone of their repo to develop across multiple repos simultaneously. To do that additional extension search path needs to be passed into kit pointing to the local repo. There are many ways to do it. Recommended is using ``` deps/user.toml ``` . You can use that file to override any setting. Create ``` deps/user.toml ``` file in this repo with the search to path to your repo added to ``` app/exts/folders ``` setting, e.g.: ```toml [app.exts] folders."++" = ["c:/projects/extensions/kit-converters/_build/windows-x86_64/release/exts"] ``` ``` repo source tool can also be used to create and edit user.toml. Provide a path to a repo or a direct path to an extension(s): ``` - If repo produces kit extensions add them to ``` deps/user.toml ``` file. - If the path is a kit extension or folder with kit extensions add to ``` deps/user.toml ``` file. Other options: - Pass CLI arg to any app like this: ``` --ext-folder c:/projects/extensions/kit-converters/_build/windows-x86_64/release/exts ``` . - Use *Extension Manager UI (Gear button)* - Use other ``` user.toml ``` (or other) configuration files, refer to [Kit Documentation: Configuration](https://docs.omniverse.nvidia.com/kit/docs/kit-sdk/104.0/docs/guide/configuration.html#user-settings). You can always find out where an extension is coming from in *Extension Manager* by selecting an extension and hovering over the open button. You can also find it in the log, by looking either for ``` registered ``` message for each extension or ``` About to startup: ``` when it starts. ## Other Useful Links - See [Kit Manual](https://docs.omniverse.nvidia.com/kit/docs/kit-manual) # Kit Developer Documentation Index - **Introduction** - Welcome to the Kit Developer Documentation Index. This documentation provides an overview of the various components and systems used in the development of the Kit. - **Build Systems** - See Anton’s Video Tutorials for Anton’s videos about the build systems.
4,385
using_pip_packages.md
# Using Python pip Packages There are 2 ways to use python pip packages in extensions: 1. Install them at runtime and use them right away. 2. Install them at build-time and pre-package into another extension. ## Runtime installation using `omni.kit.pipapi` Installing at runtime is probably the most convenient way to quickly prototype and play around with tools. The `omni.kit.pipapi` extension conveniently wraps pip (which is already included into python by default) and provides an API to install pip packages. You just have to declare a dependency on this extension, and call the `omni.kit.pipapi.install("package_name")()` function. Right after this line, you can import and start using the installed package. ```python # Package name and module can be different (although rarely is in practice): import omni.kit.pipapi omni.kit.pipapi.install("Pillow", module="PIL") import PIL ``` However installing at runtime has a couple of downsides: - Can be slow. Usually it ends up blocking the process, waiting for the download and installation upon first startup. - Requires internet access and pip index availability. - Has security and licensing implications. Even if the version is locked, which should always be the case, the package can still become unavailable at some point, or the content could change. It opens up the opportunity for certain types of attacks, and from a legal perspective we can’t ship any extensions/apps that perform a pip installation at runtime. The end-user can decide to write, test, and execute such code, but it shouldn’t come from NVIDIA. ## Build-time installation using `repo_build` The recommended way to install pip packages is at build time, and to embed it into an extension. For most packages, it is as simple as installing it into a folder inside an extension. As long it is added to the `sys.path`, python can import it. Sometimes, packages require certain shared libraries or other system software, which goes out of the scope of this guide and had to be dealt on case by case basis. We also provide tooling to simplify the process of build time package installation. The `repo_build` tool, when run, can process special config file(s). By default: `deps/pip.toml`. Here you can specify a list of packages to install and a target folder: ```toml [[dependency]] packages = [ "watchdog==0.10.4", # SWIPAT filed under: http://nvbugs/123456 ] target = "../_build/target-deps/pip_prebundle" ``` The version must be specified (locked). The `repo_build` tool performs an installation only once. It then hashes the whole config file and uploads the installed packages into packman. On the next launch, it will download the uploaded package from packman, instead of using the pip index. This is much faster and removes the necessity of vendoring dependencies. The build also won’t depend on the availability of the pip index. Then, this folder where packages were installed into is linked (or copied) into an extension. The only reason we don’t install it directly into the extension target folder is because `debug` and `release` configurations can share the same pip packages. It is convenient to install it once and link the folder into both build flavors. Linking the folder is done in the `premake5.lua` file of an extension. ```lua -- Include pip packages installed at build time repo_build.prebuild_link { {"%{root}/_build/target-deps/pip_prebundle", ext.target_dir.."/pip_prebundle"}, } ``` Also, after installation, `repo_build` gathers up pip package license information (including N-order dependencies) into the `gather_licenses_path`. They must be included into an extension too, for legal reasons. After the build, you can make sure that everything looks correct by looking into the extension target folder, e.g.: `_build/$platform/$config/exts/example.mixed_ext/pip_prebundle`. Finally, in the `extension.toml`, we need to make sure that this folder is added to `sys.path`. ```toml # Demonstrate how to add another folder to sys.path. Here we add pip packages installed at build time. [[python.module]] path = "pip_prebundle" ``` When the extension starts, it adds all `[[python.module]]` entries with their `path` relative to extension root to the `sys.path`. The order of those entries can be important if you have other code in the extension that for instance performs an `import watchdog`. All the extensions that are loaded as dependees can also make use of those packages as well. This way one extension can bring several pip packages for other extensions to use. They just need to add a dependency on the package providing them. ## pip packages included in Kit: `omni.kit.pip_archive` Exactly as described above, `Kit` comes with the `omni.kit.pip_archive` extension that includes many commonly used packages, like `numpy` or `PIL`. To use them just add dependency: ```toml [dependecies] "omni.kit.pip_archive" = {} ``` The Kit repo serves as another great example of this setup. ## Code Examples ### Install pip package at runtime ```python # PIP/Install pip package # omni.kit.pipapi extension is required import omni.kit.pipapi # It wraps `pip install` calls and reroutes package installation into user specified environment folder. # That folder is added to sys.path. # Note: This call is blocking and slow. It is meant to be used for debugging, development. For final product packages # should be installed at build-time and packaged inside extensions. omni.kit.pipapi.install( package="semver", version="2.13.0", module="semver", # sometimes module is different from package name, module is used for import check ignore_import_check=False, ignore_cache=False, use_online_index=True, surpress_output=False, extra_args=[] ) # use import semver ver = semver.VersionInfo.parse('1.2.3-pre.2+build.4') ``` # 标题1 ## 标题2 ### 标题3 这是一个段落,包含一些文本信息。 ```python print(ver) ``` 这里是另一个段落,包含更多的文本信息。 --- 这里是脚注区域。
5,949
valgrind.md
# Tips for debugging with Valgrind ## Tips for debugging with Valgrind - Some earlier Valgrind versions did not support AVX properly and will crash in some Carbonite code. This issue doesn’t occur in newer Valgrind versions, such as 3.16.0. - It is recommended to increase the backtrace size using ` --num-callers=<number> `. Valgrind’s default backtrace depth is 12, which is often not sufficient for Carbonite code. - When checking for memory leaks with `--leak-check=full`, you may notice a large number of ‘possibly lost’ leaks (particularly from libasound). Use `--show-leak-kinds=definite` to only see detections that are guaranteed to be memory leaks. - When Carbonite plugins are unloaded, Valgrind will not be able to find the symbol names for functions in its backtraces that were part of the unloaded code. This can be a problem when trying to detect memory leaks in tests. Putting `exit(0)` at the end of a test case is generally sufficient as a workaround. - Valgrind executes programs serially and uses an unfair thread scheduling algorithm, which can cause threads to appear to hang. The `--fair-sched=yes` parameter can be used to switch to a fair scheduler which will avoid these hangs. This parameter must be specified when using any code that interacts with IAudioPlayback. - If you build Valgrind from source and install to a non-system directory (such as your home folder), the environment variable `VALGRIND_LIB` needs to point to the `lib/valgrind` directory in the install directory.
1,509
variables.md
# Variables - **Nv::Blast::kMaterialInteriorId**: Default material id assigned to interior faces (faces which created between 2 fractured chunks) - **Nv::Blast::kNotValidVertexIndex**: `Vertex` index which considered by NvBlast as not valid. - **Nv::Blast::kSmoothingGroupInteriorId**: Default smoothing group id assigned to interior faces. - **Nv::Blast::kUnbreakableLimit**
376
VectorizedCompute.md
# Writing a `computeVectorized` function Instead of writing a `compute` function in your node, you can choose to write a `computeVectorized` function. When using instancing, this function will receive a batch of instances to compute instead of a single one. ## Indexing The data associated to a given instance can be retrieved by providing an `omni::graph::core::InstanceIndex`. The data of the following instances can be either retrieved by providing an incremented `omni::graph::core::InstanceIndex`, but also by directly indexing the returned pointer. Indeed, the data of subsequent instances for the provided batch is guaranteed to be contiguous. This indexing is always relative to the "current active instance": when the framework calls a node `compute` function, or its `computeVectorized` function with a batch of (or a unique) instance(s), it keeps track in the context of the "current active instance", the first (or unique) one of the provided batch. In that context, calling any ABI function that takes an `omni::graph::core::InstanceIndex` will always apply the provided index as an offset to the "current active instance". For example, proving `omni::graph::core::InstanceIndex{0}` to such an ABI will return the data for the first instance in the batch. Outside of the context of a `compute` function (like during authoring actions), the "current active instance" is actually not an instance, but rather refers to the "authoring graph", the template used to create all instances. The authoring graph can be seen as a shared data structure, that can be used by all instances, in the same way than the `static` members of a C++ class. Inside `compute`, indexing is relative to the current active instance, but outside of `compute`, the current active instance will be the authoring graph, and indexing will be absolute. Some pre-defined constants can be used to precisely access what you want depending on the context in which the ABI is called: - `omni::graph::core::kAccordingToContextIndex`: this constant will target the current active instance. In the context of `compute`, it will target the current active instance in the batch. - `computeVectorized`, this is equivalent to `omni::graph::core::InstanceIndex{0}` - `omni::graph::core::kAuthoringGraphIndex`: This will target the “authoring graph”, the template shared by all instances. Outside of compute, this is equivalent to `omni::graph::core::kAccordingToContextIndex` When using OGN, there is another layer of indexing on top of the context indexing: the entire OGN database can be shifted to the next instance in a batch by simply calling `db.moveToNextInstance()`. The current instance it is pointing to can be retrieved by calling `db.getCurrentInstanceIndex()`. All attributes accessed through the database will be the ones that belong to the instance pointed by the database. ## Writing an ABI ### computeVectorized If not using the OGN, you can implement the following static method in your node, in place of the regular `compute`: ```cpp size_t computeVectorized(GraphContextObj const& contextObj, NodeObj const& nodeObj, size_t count) ``` When used in an instantiated graph, the framework may call this function with a full batch of instances, in which case the `count` parameter will tell how many instances are expected to be computed. In all other situations, `count` will be equal to `1`. There are 3 ways to access and iterates the attributes data of all the provided instances. Each one provides a different access pattern that returns the same data, and can freely be mixed to your liking. It really depends on the operation your node tries to perform and what is the best way to express it. For this example, let’s consider a passthrough node, which only purpose is to pass some data as-is. While such a node is useless, it allows us to focus on the subject at hand: accessing the instantiated data. Here is how its regular compute function could be implemented: ```cpp static bool compute(GraphContextObj const& contextObj, NodeObj const& nodeObj) { NodeContextHandle nodeHandle = nodeObj.nodeContextHandle; auto inputValueAttr = getAttributeR(contextObj, nodeHandle, Token("inputs:value"), kAccordingToContextIndex); const float* inputValue = getDataR<float>(contextObj, inputValueAttr); auto outputValueAttr = getAttributeW(contextObj, nodeHandle, Token("outputs:value"), kAccordingToContextIndex); float* outputValue = getDataW<float>(contextObj, outputValueAttr); if (inputValue && outputValue) { *outputValue = *inputValue; return true; } return false; } ``` Now let’s look at the vectorized versions. **Method #1** : Access individual attribute data with an instance offset ```cpp static size_t computeVectorized(GraphContextObj const& contextObj, NodeObj const& nodeObj, size_t count) { GraphContextObj const* contexts = nullptr; NodeObj const* nodes = nullptr; // When using auto instancing, similar graphs can get merged together, and computed vectorized // In such case, each instance represent a different node in a different graph // Accessing the data either through the provided node, or through the actual auto-instance node would work // properly But any other ABI call requiring the node would need to provide the proper node. While not necessary // in this context, do the work of using the proper auto-instance node in order to demonstrate how to use it. size_t handleCount = nodeObj.iNode->getAutoInstances(nodeObj, contexts, nodes); auto nodeHandle = [&](InstanceIndex index) -> NodeContextHandle { return nodes[handleCount == 1 ? 0 : index.index].nodeContextHandle; }; auto context = [&](InstanceIndex index) -> GraphContextObj { return contexts[handleCount == 1 ? 0 : index.index]; }; size_t ret = 0; const float* inputValue{ nullptr }; float* outputValue{ nullptr }; auto inToken = Token("inputs:value"); auto outToken = Token("outputs:value"); for (InstanceIndex idx{ 0 }; idx < InstanceIndex{ count }; ++idx) { auto inputValueAttr = getAttributeR(context(idx), nodeHandle(idx), inToken, idx); inputValue = getDataR<float>(context(idx), inputValueAttr); } } ``` 29 30 auto outputValueAttr = getAttributeW(context(idx), nodeHandle(idx), outToken, idx); 31 outputValue = getDataW<float>(context(idx), outputValueAttr); 32 33 if (inputValue && outputValue) 34 { 35 *outputValue = *inputValue; 36 ++ret; 37 } 38 } 39 40 return ret; 41 } As you notice here, we can access each instance attribute data by providing an additional offset (compared to the current active instance) in the attribute data accessor. **Method #2**: Mutate the attribute data handles 1 static size_t computeVectorized(GraphContextObj const& contextObj, NodeObj const& nodeObj, size_t count) 2 { 3 NodeContextHandle nodeHandle = nodeObj.nodeContextHandle; 4 5 size_t ret = 0; 6 const float* inputValue{ nullptr }; 7 float* outputValue{ nullptr }; 8 auto inputValueAttr = getAttributeR(contextObj, nodeHandle, Token("inputs:value"), kAccordingToContextIndex); 9 auto outputValueAttr = getAttributeW(contextObj, nodeHandle, Token("outputs:value"), kAccordingToContextIndex); 10 11 while (count--) 12 { 13 inputValue = getDataR<float>(contextObj, inputValueAttr); 14 outputValue = getDataW<float>(contextObj, outputValueAttr); 15 16 if (inputValue && outputValue) 17 { 18 *outputValue = *inputValue; 19 ++ret; 20 } 21 inputValueAttr = contextObj.iAttributeData->moveToAnotherInstanceR(contextObj, inputValueAttr, 1); 22 outputValueAttr = contextObj.iAttributeData->moveToAnotherInstanceW(contextObj, outputValueAttr, 1); ``` 23 ``` ``` 24 ``` ``` 25 return ret; ``` ``` 26 } ``` In that example, we are retrieving the attribute data handles just once, and then make them move to the next instance in the loop. **Method #3**: Retrieve the raw data ```cpp static size_t computeVectorized(GraphContextObj const& contextObj, NodeObj const& nodeObj, size_t count) { NodeContextHandle nodeHandle = nodeObj.nodeContextHandle; auto inputValueAttr = getAttributeR(contextObj, nodeHandle, Token("inputs:value"), kAccordingToContextIndex); const float* inputValue = getDataR<float>(contextObj, inputValueAttr); auto outputValueAttr = getAttributeW(contextObj, nodeHandle, Token("outputs:value"), kAccordingToContextIndex); float* outputValue = getDataW<float>(contextObj, outputValueAttr); if (inputValue && outputValue) { memcpy(outputValue, inputValue, count * sizeof(float)); return count; } return 0; } ``` In this example, we are working and indexing directly the raw data, as we are guaranteed that all the data for the provided instances is arranged in a contiguous way. This is the fastest and preferred method. # Writing an OGN `computeVectorized` When using the OGN framework, you can implement the following static method instead of a regular `compute`: ```cpp size_t computeVectorized(OgnMyNodeDatabase& db, size_t count) ``` In the same way than the ABI version, this function will receive the number of instances expected to be computed. There are also 3 ways to access and iterates the attributes data of all the provided instances when using OGN. Like for the ABI version, each one provides a different access pattern that returns the same data, and can freely be mixed to your liking. If for any reason you need to use an ABI function that requires the instance index, be sure to pass `db.getCurrentInstanceIndex()` for this argument. Let’s consider the same passthrough node, but let’s look at how it could be implemented using the OGN wrappers. Here what its OGN could look like: ```json { "TutorialVectorizedPassThrough": { "version": 1, "description": "Simple passthrough node that copy its input to its output in a vectorized way", "categories": "tutorials" } } ```cpp OgnNode::compute(db); db.moveToNextInstance(); ``` **Method #2**: Access individual attribute data with an instance offset ```cpp static size_t computeVectorized(OgnTutorialVectorizedPassthroughDatabase& db, size_t count) { for (size_t idx = 0; idx < count; ++idx) db.outputs.value(idx) = db.inputs.value(idx); return count; } ``` You can notice in that case that we keep the database pointing to the current active index, and then access each instance attribute data by providing an additional offset (compared to the database) in the attribute data accessor `operator()`. **Method #3**: Retrieve the full range in a single call ```cpp static size_t computeVectorized(OgnTutorialVectorizedPassthroughDatabase& db, size_t count) { auto spanIn = db.inputs.value.vectorized(count); auto spanOut = db.outputs.value.vectorized(count); memcpy(spanOut.data(), spanIn.data(), std::min(spanIn.size_bytes(), spanOut.size_bytes())); return count; } ``` In this example, we are using the `vectorized()` accessor on the attribute that returns the full range of data for all instances. This is the preferred method to use advanced instructions (such as SIMD) or low level functions (such as `memcpy`), as you can access directly the raw data.
11,485
Versioning.md
# OmniGraph Versioning There are many facets to OmniGraph that can and will change over time as OmniGraph is still very much a work in progress. In order to minimize disruption to our users all of these types of changes have been enumerated and incremental deprecation plans have been created. ## Semantic Versioning All of the OmniGraph extensions adhere to Semantic Versioning. See the changelogs from each extension for details on what is included in each of the versions. Given a version number MAJOR.MINOR.PATCH, expect an increment to the: **MAJOR** version for incompatible API changes, **MINOR** version for functionality added or modified in a backwards compatible manner **PATCH** version for mostly invisible backwards compatible bug fixes. What this means to the C++ programmer is: **MAJOR** change: You must recompile and potentially refactor your code for compatibility **MINOR** change: You can use your code as-is in binary form, and optionally recompile for compatibility **PATCH** change: Your code works as-is in binary form, no need for recompiling What this means to the Python programmer is: **MAJOR** change: Your code may not work. You should refactor to restore correct execution. **MINOR** change: Your code will continue to work, however you may receive deprecation warnings and should refactor your code to use the latest interfaces. **PATCH** change: Your code will be mostly unaware of the change, other than corrections to previously incorrect behaviors. (You may need to refactor if your code relied on incorrect behavior.) ## The Public Python API We are using the PEP8 Standard for defining the actual public API we are supporting. Note especially how the presence of a leading underscore in any named module, class, function, or constant, indicates that it is internal and has no guarantee of backward compatibility. > **Warning** > Although the nature of Python allows you to inspect and access pretty much anything if it doesn’t appear as part of our “published” API then it is subject to change at any time without warning. If there is something that is not part of the interface you might find particular useful then request that it be surfaced. The model of import we use is similar to what is used by popular packages like `numpy`, `pandas`, and `scikit-learn`. You import the top level module as a simple prefix and use the API directly from there. ```python # The core OmniGraph functionality import omni.graph.core as og og.get_all_graphs() # The code generator framework - for utilities, key/value constants, and typing import omni.graph.tools.ogn as ogn ``` > **Hint** > The Python bindings to our ABI are considered part of the published API and are available in the same way as all of the other Python functions. They are available as part of the `omni.graph.core`. ## Other Types Of Versions ### OmniGraph Extension Versions As with other parts of Kit the OmniGraph extensions have their own version number, and the interface definitions each have their own version number. These version numbers follow the general guidelines used by Kit. ### OmniGraph Carbonite Interface Versions A good portion of the OmniGraph interfaces are Carbonite style for historic reasons, so they will follow the Carbonite upgrade procedures. The primary rules are: - Existing functions in an interface always work as described - Functions are never removed from an interface - Add all new functions to the end of the interface - Increment the minor version of the interface whenever a new function is added > **Hint** > Most Carbonite version changes will result in a corresponding minor version bump of the extension in which they live as it involves new functionality being added. ### OmniGraph ONI Versions Some of the OmniGraph interfaces, and those developed in the future, will be ONI style, so they will follow the ONI upgrade procedures. The primary rules are: - Once an interface is published it can never be changed - New functionality in an interface is created by adding a new version that is a derived class (e.g. `IBundle2` and `IBundle3`) > **Hint** > Most ONI version changes will result in a corresponding minor version bump of the extension in which they live as it involves new functionality being added. ### OmniGraph File Format Versions The OmniGraph nodes also have a USD backing which itself contains a file format version number. For the most part this version number is strictly used to automatically migrate a USD scene to the latest version as it would be problematic to maintain multiple versions within the same code base. It appears as an attribute on the `OmniGraph` prim type. ```cpp def OmniGraph "TestGraph" { token evaluator:type = "push" int2 fileFormatVersion = (1, 4) token flatCacheBacking = "Shared" token pipelineStage = "pipelineStageSimulation" token evaluationMode = "Automatic" } ``` ### OGN Code Generator Versions There is also a version number for the .ogn node generator. It is equal to the version number of the extension containing it (`omni.graph.tools`) and is embedded into the generated code for version management. You should not need to worry about this version number unless you want to file a bug report, where it would be valuable information. ### Node Type Versions Every node type definition has a version number with it. The number should be incremented every time there is a change in behavior of the node, such as adding or removing attributes or changing the computation algorithm. This applies to nodes you write as well as nodes you consume. A mismatch in version number between a node being created and the current node implementation will trigger a callback to the `omni::graph::core::INodeType::updateNodeVersion` function, which your node can override if there is some cleanup you can do that will help maintain expected operation of the node. ## Protecting Yourself With Tests OmniGraph uses something called the Extension Testing Matrix to validate any dangerous changes. The more tests you have written that typify your pattern of OmniGraph use the safer it will be for you when changes are made. We can’t run tests we don’t have so please help us help you; write more tests! ## Deprecation # Deprecation Communication The first thing we will do when some functionality is to be deprecated is to communicate our intent through any channel that we have available to us at the time, which may include Discord, user forums, and release notes. The intent of this initial communication is to coordinate with stakeholders to come to an agreement on a timeline for the deprecation. Once a date has been determined we will proceed with up to three phases of deprecation. The combination of phases will depend on the exact nature of the change and the timeline that has been decided. ## Soft Deprecation The soft deprecation phase is where a setting will be introduced to toggle between the old and new behaviors. The difference between the two could be as trivial as the availability of a deprecated function or as complex as a complete replacement of a commonly used data structure or algorithm. The setting will be a Carbonite setting under the tree `/persistent/omnigraph/deprecation/...`. At this phase the default value of the setting will be to take the original code paths, which will remain untouched. Communication of the change will take place in two ways: - An announcement will be posted indicating the new behavior is available - A deprecation message is added to the original code paths as a one-time warning ## Default Deprecation Once you have had a chance to migrate to the new behavior the default behavior will switch: - An announcement will be posted indicating the new behavior is to be the default - The setting default will change to take the new code path - The settings manager will emit a deprecation warning whenever the setting is changed to specify the old code path ## Hard Deprecation In the rare case when old behavior must be completely removed, after the agreed on time has passed the old code path will be removed: - An announcement will be posted indicating the old behavior is being removed - The setting and all of the old code paths will be physically deleted - The settings manager will emit an error whenever the now-deleted setting is attempted to be accessed
8,364
viewer-only-mode_Overview.md
# Overview — Omniverse Kit 1.2.20 documentation ## Overview Extension `omni.kit.widget.live_session_management-1.2.20` provides API and utilities to implement workflow for Live Session. It includes the following extensions: - Simple and easy to use API to enter into Live Session join/leave/create/merge/share process. See `omni.kit.widget.live_session_management.stop_or_show_live_session_widget()` for more details. - Single line widget to track camera followers. See `omni.kit.widget.live_session_management.LiveSessionCameraFollowerList` for more details. - Single line widget to track user list inside a Live Session. See `omni.kit.widget.live_session_management.LiveSessionUserList` for more details. - Encapsulated value model for omni.ui.ComboBox to easily implement dropdown list for Live Session listening or selection. See `omni.kit.widget.live_session_management.LiveSessionModel` for more details. - Utils to build user icons. See `omni.kit.widget.live_session_management.build_live_session_user_layout()`. All of those are built on top of the API support from `omni.kit.usd.layers`. ## Viewer Only Mode This extension also supports a viewer only mode, which means: - When joining a live session, if the user has unsaved changes, skip the dialog and automatically reload the stage, then join the session. - When creating a live session, if the user has unsaved changes, skip the dialog and automatically reload the stage, then create the session. - When leaving a live session, do not offer to merge changes. instead reload the stage to its original state. * This mode can be controlled by setting ``` omni.kit.widget.live_session_management.VIEWER_ONLY_MODE_SETTING ``` . And you can use ``` omni.kit.widget.live_session_management.is_viewer_only_mode() ``` to query if it’s enabled.
1,821
viewport_api.md
# Viewport API The ViewportAPI object is used to access and control aspects of the render, who will then push images into the backing texture. It is accessed via the `ViewportWidget.viewport_api` property which returns a Python `weakref.proxy` object. The use of a weakref is done in order to make sure that a Renderer and Texture aren’t kept alive because client code is keeping a reference to one of these objects. That is: the lifetime of a Viewport is controlled by the creator of the Viewport and cannot be extended beyond the usage they expect. With our simple `omni.kit.viewport.stage_preview` example, we’ll now run through some cases of directly controlling the render, similar to what the Content context-menu does. ```python from omni.kit.viewport.stage_preview.window import StagePreviewWindow # Viewport widget can be setup to fill the frame with 'fill_frame', or to a constant resolution (x, y). resolution = 'fill_frame' or (640, 480) # Will use 'fill_frame' # Give the Window a unique name, the window-size, and forward the resolution to the Viewport itself preview_window = StagePreviewWindow('My Stage Preview', usd_context_name='MyStagePreviewWindowContext', window_width=640, window_height=480, resolution=resolution) # Open a USD file in the UsdContext that the preview_window is using preview_window.open_stage('http://omniverse-content-production.s3-us-west-2.amazonaws.com/Samples/Astronaut/Astronaut.usd') # Save an easy-to-use reference to the ViewportAPI object viewport_api = preview_window.preview_viewport.viewport_api ``` ## Camera The camera being used to render the image is controlled with the `camera_path` property. It will return and is settable with a an `Sdf.Path`. The property will also accept a string, but it is slightly more efficient to set with an `Sdf.Path` if you have one available. ```python print(viewport_api.camera_path) # => '/Root/LongView' # Change the camera to view through the implicit Top camera viewport_api.camera_path = '/OmniverseKit_Front' # Change the camera to view through the implicit Perspective camera viewport_api.camera_path = '/OmniverseKit_Persp' ``` ## Filling the canvas Control whether the texture-resolution should be adjusted based on the parent objects ui-size with the `fill_frame` property. It will return and is settable with a bool. ```python print('viewport_api.fill_frame) ``` # => True # Disable the automatic resolution viewport_api.fill_frame = False # And give it an explicit resolution viewport_api.resolution = (640, 480) ## Resolution Resolution of the underlying `ViewportTexture` can be queried and set via the `resolution` property. It will return and is settable with a tuple representing the (x, y) resolution of the rendered image. ```python print(viewport_api.resolution) # => (640, 480) # Change the render output resolution to a 512 x 512 texture viewport_api.resolution = (512, 512) ``` ## SceneView For simplicity, the ViewportAPI can push both view and projection matrices into an `omni.ui.scene.SceneView.model`. The use of these methods are not required, rather provided a convenient way to auto-manage their relationship (particularly for stage independent camera, resolution, and widget size changes), while also providing room for future expansion where a `SceneView` may be locked to last delivered rendered frame versus the current implementation that pushes changes into the Renderer and the `SceneView` simultaneously. ### add_scene_view Add an `omni.ui.scene.SceneView` to the list of models that the Viewport will notify with changes to view and projection matrices. The Viewport will only retain a weak-reference to the provided `SceneView` to avoid extending the lifetime of the `SceneView` itself. A `remove_scene_view` is available if the need to dynamically change the list of models to be notified is necessary. ```python scene_view = omni.ui.scene.SceneView() # Pass the real object, as a weak-reference will be retained viewport_api.add_scene_view(scene_view) ``` ### remove_scene_view Remove the `omni.ui.scene.SceneView` from the list of models that the Viewport will notify from changes to view and projection matrices. Because the Viewport only retains a weak-reference to the `SceneView`, calling this explicitly isn’t mandatory, but can be used to dynamically change the list of `SceneView` objects whose model should be updated. ```python viewport_api.remove_scene_view(scene_view) ``` ## Additional Accessors The `ViewportAPI` provides a few additional read-only accessors for convenience: ### usd_context_name Returns the name of the UsdContext the Viewport is bound to. ```python viewport_api.usd_context_name => str ``` ### usd_context Returns the actual UsdContext the Viewport is bound to, essentially `omni.usd.get_context(self.usd_context_name)`. ```python viewport_api.usd_context => omni.usd.UsdContext ``` ### stage Returns the `Usd.Stage` the ViewportAPI is bound to, essentially: `omni.usd.get_context(self.usd_context_name).get_stage()`. ```python viewport_api.stage => Usd.Stage ``` ### projection Returns the Gf.Matrix4d of the projection. This may differ than the projection of the `Usd.Camera` based on how the Viewport is placed in the parent widget. ```python viewport_api.projection => Gf.Matrix4d ``` ## transform ```python viewport_api.transform => Gf.Matrix4d # Return the Gf.Matrix4d of the transform for the `Usd.Camera` in world-space. ``` ## view ```python viewport_api.view => Gf.Matrix4d # Return the Gf.Matrix4d of the inverse-transform for the `Usd.Camera` in world-space. ``` ## time ```python viewport_api.time => Usd.TimeCode # Return the Usd.TimeCode that the Viewport is using. ``` ## Space Mapping The `ViewportAPI` natively uses NDC coordinates to interop with the payloads from `omni.ui.scene` gestures. To understand where these coordinates are in 3D-space for the `ViewportTexture`, two properties will can be used to get a `Gf.Matrix4d` to convert to and from NDC-space to World-space. ```python origin = (0, 0, 0) origin_screen = viewport_api.world_to_ndc.Transform(origin) print('Origin is at {}, in screen-space'.format(origin_screen)) origin = viewport_api.ndc_to_world.Transform(origin_screen) print('Converted back to world-space, origin is {}'.format(origin)) ``` ## world_to_ndc ```python viewport_api.world_to_ndc => Gf.Matrix4d # Returns a Gf.Matrix4d to move from World/Scene space into NDC space ``` ## ndc_to_world ```python viewport_api.ndc_to_world => Gf.Matrix4d # Returns a Gf.Matrix4d to move from NDC space into World/Scene space ``` ## World queries While it is useful being able to move through these spaces is useful, for the most part what we’ll be more interested in using this to inspect the scene that is being rendered. What that means is that we’ll need to move from an NDC coordinate into pixel-space of our rendered image. A quick breakdown of the three spaces in use: The native NDC space that works with `omni.ui.scene` gestures can be thought of as a cartesian space centered on the rendered image. We can easily move to a 0.0 - 1.0 uv space on the rendered image. And finally expand that 0.0 - 1.0 uv space into pixel space. Now that we know how to map between the ui and texture space, we can use it to convert between screen and 3D-space. More importantly, we can use it to actually query the backing `ViewportTexture` about objects and locations in the scene. ## request_query ```python viewport_api.request_query(pixel_coordinate: (x, y), query_completed: callable) => None # Query a pixel co-ordinate with a callback to be executed when the query completes # Get the mouse position from within an omni.ui.scene gesture mouse_ndc = self.sender.gesture_payload.mouse # Convert the ndc-mouse to pixel-space in our ViewportTexture mouse, in_viewport = viewport_api.map_ndc_to_texture_pixel(mouse_ndc) # We know immediately if the mapping is outside the ViewportTexture if not in_viewport: return # Inside the ViewportTexture, create a callback and query the 3D world def query_completed(path, pos, *args): ``` ```python if not path: print('No object') else: print(f"Object '{path}' hit at {pos}") ``` ```python viewport_api.request_query(mouse, query_completed) ``` ## Asynchronous waiting Some properties and API calls of the Viewport won’t take effect immediately after control-flow has returned to the caller. For example, setting the camera-path or resolution won’t immediately deliver frames from that Camera at the new resolution. There are two methods available to asynchrnously wait for the changes to make their way through the pipeline. ### wait_for_render_settings_change Asynchronously wait until a render-settings change has been ansorbed by the backend. This can be useful after changing the camera, resolution, or render-product. ```python my_custom_product = '/Render/CutomRenderProduct' viewport_api.render_product_path = my_custom_product settings_changed = await viewport_api.wait_for_render_settings_change() print('settings_changed', settings_changed) ``` ### wait_for_rendered_frames Asynchronously wait until a number of frames have been delivered. Default behavior is to wait for deivery of 1 frame, but the function accepts an optional argument for an additional number of frames to wait on. ```python await viewport_api.wait_for_rendered_frames(10) print('Waited for 10 frames') ``` ## Capturing Viewport frames To access the state of the Viewport’s next frame and any AOVs it may be rendering, you can schedule a capture with the `schedule_capture` method. There are a variety of default Capturing delegates in the `omni.kit.widget.viewport.capture` that can handle writing to disk or accesing the AOV’s buffer. Because capture is asynchronous, it will likely not have occured when control-flow has returned to the caller of `schedule_capture`. To wait until it has completed, the returned object has a `wait_for_result` method that can be used. ### schedule_capture ```python viewport_api.schedule_capture(capture_delegate: Capture): -> Capture ``` ```python from omni.kit.widget.viewport.capture import FileCapture capture = viewport_api.schedule_capture(FileCapture(image_path)) captured_aovs = await capture.wait_for_result() if captured_aovs: print(f'AOV "{captured_aovs[0]}" was written to "{image_path}"') else: print(f'No image was written to "{image_path}"') ```
10,429
Vt.md
# Vt module Summary: The Vt (Value Types) module defines classes that provide for type abstraction, enhanced array types, and value type manipulation. ## Vt Value Types library This package defines classes for creating objects that behave like value types. It contains facilities for creating simple copy-on-write implicitly shared types. ### Classes: | Class | Description | |-------|-------------| | BoolArray | An array of type bool. | | CharArray | An array of type char. | | DoubleArray | An array of type double. | | DualQuatdArray | An array of type GfDualQuatd. | | DualQuatfArray | An array of type GfDualQuatf. | | DualQuathArray | An array of type GfDualQuath. | | FloatArray | An array of type float. | | HalfArray | An array of type pxr_half::half. | | Int64Array | An array of type __int64. | | IntArray | An array of type int. | | Type | Description | | ---- | ----------- | | IntArray | An array of type int. | | IntervalArray | An array of type GfInterval. | | Matrix2dArray | An array of type GfMatrix2d. | | Matrix2fArray | An array of type GfMatrix2f. | | Matrix3dArray | An array of type GfMatrix3d. | | Matrix3fArray | An array of type GfMatrix3f. | | Matrix4dArray | An array of type GfMatrix4d. | | Matrix4fArray | An array of type GfMatrix4f. | | QuatdArray | An array of type GfQuatd. | | QuaternionArray | An array of type GfQuaternion. | | QuatfArray | An array of type GfQuatf. | | QuathArray | An array of type GfQuath. | | Range1dArray | An array of type GfRange1d. | | Range1fArray | An array of type GfRange1f. | | Range2dArray | An array of type GfRange2d. | | Range2fArray | An array of type GfRange2f. | | Range3dArray | An array of type GfRange3d. | | Range3fArray | An array of type GfRange3f. | | Rect2iArray | An array of type GfRect2i. | ShortArray An array of type short. StringArray An array of type string. TokenArray An array of type TfToken. UCharArray An array of type unsigned char. UInt64Array An array of type unsigned __int64. UIntArray An array of type unsigned int. UShortArray An array of type unsigned short. Vec2dArray An array of type GfVec2d. Vec2fArray An array of type GfVec2f. Vec2hArray An array of type GfVec2h. Vec2iArray An array of type GfVec2i. Vec3dArray An array of type GfVec3d. Vec3fArray An array of type GfVec3f. Vec3hArray An array of type GfVec3h. Vec3iArray An array of type GfVec3i. Vec4dArray An array of type GfVec4d. Vec4fArray An array of type GfVec4f. Vec4hArray An array of type GfVec4h. Vec4iArray An array of type GfVec4i. ## pxr.Vt.BoolArray An array of type bool. **Methods:** - **FromBuffer** - **FromNumpy** ## pxr.Vt.CharArray An array of type char. **Methods:** - **FromBuffer** - **FromNumpy** ## pxr.Vt.DoubleArray An array of type double. **Methods:** - **FromBuffer** - **FromNumpy** ### pxr.Vt.DoubleArray #### FromBuffer - **static** #### FromNumpy - **static** ### pxr.Vt.DualQuatdArray #### Class - **class** pxr.Vt.DualQuatdArray #### Description - An array of type GfDualQuatd. #### Methods - **FromBuffer** - **FromNumpy** ### pxr.Vt.DualQuatfArray #### Class - **class** pxr.Vt.DualQuatfArray #### Description - An array of type GfDualQuatf. #### Methods - **FromBuffer** - **FromNumpy** ### pxr.Vt.DualQuathArray #### Class - **class** pxr.Vt.DualQuathArray ## GfDualQuathArray ### Description An array of type GfDualQuath. ### Methods - **FromBuffer** - **FromNumpy** ## FloatArray ### Description An array of type float. ### Methods - **FromBuffer** - **FromNumpy** ## HalfArray ### Description An array of type pxr_half::half. ### Methods - **FromBuffer** - **FromNumpy** ### pxr.Vt.HalfArray #### Methods: - **FromNumpy** ### pxr.Vt.Int64Array #### Description: An array of type __int64. #### Methods: - **FromBuffer** - **FromNumpy** ### pxr.Vt.IntArray #### Description: An array of type int. #### Methods: - **FromBuffer** - **FromNumpy** ### pxr.Vt.IntervalArray #### Description: An array of type GfInterval. ### pxr.Vt.Matrix2dArray #### Description: An array of type Matrix2d. ## GfMatrix2dArray ### Description An array of type GfMatrix2d. ### Methods - FromBuffer - FromNumpy ## GfMatrix2fArray ### Description An array of type GfMatrix2f. ### Methods - FromBuffer - FromNumpy ## GfMatrix3dArray ### Description An array of type GfMatrix3d. ### Methods - FromBuffer - FromNumpy ## pxr.Vt.Matrix3fArray An array of type GfMatrix3f. **Methods:** | Method | Description | |--------|-------------| | `FromBuffer` | | | `FromNumpy` | | ## pxr.Vt.Matrix4dArray An array of type GfMatrix4d. **Methods:** | Method | Description | |--------|-------------| | `FromBuffer` | | | `FromNumpy` | | ## pxr.Vt.Matrix4fArray An array of type GfMatrix4f. **Methods:** | Method | Description | |--------|-------------| | `FromBuffer` | | | `FromNumpy` | | ### pxr.Vt.Matrix4fArray #### Methods: - **FromBuffer** - **FromNumpy** ### pxr.Vt.QuatdArray An array of type GfQuatd. #### Methods: - **FromBuffer** - **FromNumpy** ### pxr.Vt.QuaternionArray An array of type GfQuaternion. ### pxr.Vt.QuatfArray An array of type GfQuatf. #### Methods: - **FromBuffer** - **FromNumpy** )  static FromNumpy ( )  class pxr.Vt. QuathArray  An array of type GfQuath. **Methods:** | | | | ---- | --------------------------------------------------------------- | | | [FromBuffer](#pxr.Vt.QuathArray.FromBuffer) | | | | | | [FromNumpy](#pxr.Vt.QuathArray.FromNumpy) | | | | static FromBuffer ( )  static FromNumpy ( )  class pxr.Vt. Range1dArray  An array of type GfRange1d. **Methods:** | | | | ---- | --------------------------------------------------------------- | | | [FromBuffer](#pxr.Vt.Range1dArray.FromBuffer) | | | | | | [FromNumpy](#pxr.Vt.Range1dArray.FromNumpy) | | | | static FromBuffer ( )  static FromNumpy ( )  class pxr.Vt. Range1fArray  An array of type GfRange1f. **Methods:** | | | | ---- | --------------------------------------------------------------- | | | [FromBuffer](#pxr.Vt.Range1fArray.FromBuffer) | | | | | | [FromNumpy](#pxr.Vt.Range1fArray.FromNumpy) | | | | <p> FromBuffer <p> <p> FromNumpy <p> <dl class="py method"> <dt class="sig sig-object py" id="pxr.Vt.Range1fArray.FromBuffer"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> FromBuffer <span class="sig-paren"> () <dd> <dl class="py method"> <dt class="sig sig-object py" id="pxr.Vt.Range1fArray.FromNumpy"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> FromNumpy <span class="sig-paren"> () <dd> <dl class="py class"> <dt class="sig sig-object py" id="pxr.Vt.Range2dArray"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.Vt. <span class="sig-name descname"> <span class="pre"> Range2dArray <dd> <p> An array of type GfRange2d. <p> <strong> Methods: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> FromBuffer <td> <p> <tr class="row-even"> <td> <p> FromNumpy <td> <p> <dl class="py method"> <dt class="sig sig-object py" id="pxr.Vt.Range2dArray.FromBuffer"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> FromBuffer <span class="sig-paren"> () <dd> <dl class="py method"> <dt class="sig sig-object py" id="pxr.Vt.Range2dArray.FromNumpy"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> FromNumpy <span class="sig-paren"> () <dd> <dl class="py class"> <dt class="sig sig-object py" id="pxr.Vt.Range2fArray"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.Vt. <span class="sig-name descname"> <span class="pre"> Range2fArray <dd> <p> An array of type GfRange2f. <p> <strong> Methods: <table class="autosummary longtable docutils align-default"> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> FromBuffer <td> <p> <tr class="row-even"> <td> <p> FromNumpy <td> <p> <dl class="py method"> <dt class="sig sig-object py" id="pxr.Vt.Range2fArray.FromBuffer"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> FromBuffer <span class="sig-paren"> () <dd> <dl class="py method"> <dt class="sig sig-object py" id="pxr.Vt.Range2fArray.FromNumpy"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> FromNumpy <span class="sig-paren"> () <dd> ### pxr.Vt.Range3dArray An array of type GfRange3d. **Methods:** - `FromBuffer` - `FromNumpy` ### pxr.Vt.Range3fArray An array of type GfRange3f. **Methods:** - `FromBuffer` - `FromNumpy` ### pxr.Vt.Rect2iArray An array of type GfRect2i. **Methods:** - `FromBuffer` - `FromNumpy` ### pxr.Vt.Rect2iArray #### Methods - **FromBuffer** - **FromNumpy** ### pxr.Vt.ShortArray #### Description An array of type short. #### Methods - **FromBuffer** - **FromNumpy** ### pxr.Vt.StringArray #### Description An array of type string. ### pxr.Vt.TokenArray #### Description An array of type TfToken. ### pxr.Vt.UCharArray #### Description An array of type unsigned char. #### Methods - **FromBuffer** - **FromNumpy** <span class="sig-name descname"> <span class="pre"> FromBuffer <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <dl class="py method"> <dt class="sig sig-object py" id="pxr.Vt.UCharArray.FromNumpy"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> FromNumpy <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <dl class="py class"> <dt class="sig sig-object py" id="pxr.Vt.UInt64Array"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.Vt. <span class="sig-name descname"> <span class="pre"> UInt64Array <dd> <p> An array of type unsigned __int64. <p> <strong> Methods: <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code> FromBuffer <td> <p> <tr class="row-even"> <td> <p> <code> FromNumpy <td> <p> <dl class="py method"> <dt class="sig sig-object py" id="pxr.Vt.UInt64Array.FromBuffer"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> FromBuffer <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <dl class="py method"> <dt class="sig sig-object py" id="pxr.Vt.UInt64Array.FromNumpy"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> FromNumpy <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <dl class="py class"> <dt class="sig sig-object py" id="pxr.Vt.UIntArray"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.Vt. <span class="sig-name descname"> <span class="pre"> UIntArray <dd> <p> An array of type unsigned int. <p> <strong> Methods: <table> <colgroup> <col style="width: 10%"/> <col style="width: 90%"/> <tbody> <tr class="row-odd"> <td> <p> <code> FromBuffer <td> <p> <tr class="row-even"> <td> <p> <code> FromNumpy <td> <p> <dl class="py method"> <dt class="sig sig-object py" id="pxr.Vt.UIntArray.FromBuffer"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> FromBuffer <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <dl class="py method"> <dt class="sig sig-object py" id="pxr.Vt.UIntArray.FromNumpy"> <em class="property"> <span class="pre"> static <span class="w"> <span class="sig-name descname"> <span class="pre"> FromNumpy <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <dl class="py class"> <dt class="sig sig-object py" id="pxr.Vt.UShortArray"> <em class="property"> <span class="pre"> class <span class="w"> <span class="sig-prename descclassname"> <span class="pre"> pxr.Vt. <span class="sig-name descname"> <span class="pre"> UShortArray <dd> <p> An array of type unsigned short. <p> <strong> Methods: <table> | FromBuffer | |------------| | FromNumpy | | FromBuffer | |------------| | FromNumpy | ### pxr.Vt.UShortArray.FromBuffer **static** **FromBuffer**() ### pxr.Vt.UShortArray.FromNumpy **static** **FromNumpy**() ### pxr.Vt.Vec2dArray An array of type GfVec2d. **Methods:** | FromBuffer | |------------| | FromNumpy | ### pxr.Vt.Vec2dArray.FromBuffer **static** **FromBuffer**() ### pxr.Vt.Vec2dArray.FromNumpy **static** **FromNumpy**() ### pxr.Vt.Vec2fArray An array of type GfVec2f. **Methods:** | FromBuffer | |------------| | FromNumpy | ### pxr.Vt.Vec2fArray.FromBuffer **static** **FromBuffer**() ### pxr.Vt.Vec2fArray.FromNumpy **static** **FromNumpy**() ## pxr.Vt.Vec2hArray An array of type GfVec2h. **Methods:** | Method | Description | |--------|-------------| | `FromBuffer` | | | `FromNumpy` | | ## pxr.Vt.Vec2hArray.FromBuffer static `FromBuffer`() ## pxr.Vt.Vec2hArray.FromNumpy static `FromNumpy`() ## pxr.Vt.Vec2iArray An array of type GfVec2i. **Methods:** | Method | Description | |--------|-------------| | `FromBuffer` | | | `FromNumpy` | | ## pxr.Vt.Vec2iArray.FromBuffer static `FromBuffer`() ## pxr.Vt.Vec2iArray.FromNumpy static `FromNumpy`() ## pxr.Vt.Vec3dArray An array of type GfVec3d. **Methods:** | Method | Description | |--------|-------------| | `FromBuffer` | | | `FromNumpy` | | FromNumpy ``` ```markdown static ``` ```markdown FromBuffer ``` ```markdown An array of type GfVec3f. **Methods:** ```markdown FromBuffer ``` ```markdown FromNumpy ``` ```markdown An array of type GfVec3h. **Methods:** ```markdown FromBuffer ``` ```markdown FromNumpy ``` ```markdown class ``` ```markdown pxr.Vt. ``` ```markdown Vec3iArray ## pxr.Vt.Vec3iArray An array of type GfVec3i. **Methods:** | Method | Description | | ------ | ----------- | | `FromBuffer` | | | `FromNumpy` | | ## pxr.Vt.Vec4dArray An array of type GfVec4d. **Methods:** | Method | Description | | ------ | ----------- | | `FromBuffer` | | | `FromNumpy` | | ## pxr.Vt.Vec4fArray An array of type GfVec4f. **Methods:** | Method | Description | | ------ | ----------- | | `FromBuffer` | | | `FromNumpy` | | ## pxr.Vt.Vec4hArray An array of type GfVec4h. **Methods:** | Method | Description | |--------|-------------| | `FromBuffer` | | | `FromNumpy` | | ## pxr.Vt.Vec4iArray An array of type GfVec4i. **Methods:** | Method | Description | |--------|-------------| | `FromBuffer` | | | `FromNumpy` | |
15,841
walkthrough-editors.md
# Walkthrough - Script and Graph Editor This file contains an example walkthrough for creating a node type definition using an AutoNode definition in the **Script Editor** and then constructing a graph containing a node of that type using the visual scripting **Graph Editor**. For other walkthrough tutorials see Walkthroughs. This walkthrough will assume that the following extensions have been installed and are enabled in your application: - **omni.graph** for the core AutoNode functionality - **omni.graph.ui** for the visual scripting **Graph Editor** - **omni.kit.window.script_editor** for the Python **Script Editor** ## Step 1: Open The Script Editor Even though you will be creating nodes through the GUI you still need to program your node type definition. The easiest way to do this is directly through the script editor, which you can access through the Window menu. ![Menu option to open the script editor](../../_images/OpenScriptEditor.png) ## Step 2: Write The Script To start with you’ll need these basic imports to access the key AutoNode functionality, as well as `numpy` for the computation function. ```python import numpy as np import omni.graph.core as og import omni.graph.core.types as ot ``` Then you can create your AutoNode definition, in this case to compute the dot product of two vectors: ```python """ @og.create_node_type def autonode_dot(vector1: ot.vector3d, vector2: ot.vector3d) -> ot.double: """ ``` You can type directly or copy-paste into the script editor. When you’re done it should look like this: ![AutoNode definition in the script editor](../../_images/AutoNodeInEditor.png) Hitting **CTL-ENTER** will execute the code and define your node type. ## Step 3: Create A Graph ## Step 4: Instantiate New Node Type Now that you have a graph you can use the search bar for node types on the left to look for your newly created type. Use the search text “autonode” to zero in on the node type of interest. Now you can drag the node type definition onto the graph pane to instantiate a node of your new type. Notice that the names of the inputs correspond to the function arguments and the outputs are numbered, as per the description of the [AutoNode function definition](#autonode-examples-multiple-output). ## Step 5: Set Input Values When you click on the node the property panel will open up to that node’s information. In particular you will have access to the **inputs:vector1** and **inputs:vector2** inputs, where you can type in some numbers. Enter the values **1.0, 2.0, 3.0** into **inputs:vector1** and the values **4.0, 5.0, 6.0** into **inputs:vector2**. ## Step 6: Check The Output Below the inputs in the property panel you can see the output, where you’ll notice now contains the result of the dot product calculation. Everything works as with standard node type definitions and you are free to continue using this node type in your scene! ### Warning Although you can instantiate this node type any number of times in your scene you should be aware that saving a file with such node types will not work across sessions. In a normal workflow the extension will automatically register the node types it contains but that is not true with [AutoNode](#omnigraph-autonode-runtime) definitions. To use them in a scene you have loaded you must import and execute the script that defines the node type.
3,372
walkthrough-scripts.md
# Walkthrough - External Python Scripting This file contains an example walkthrough for creating a node type definition using an AutoNode definition found in an extension script file and then constructing a graph containing a node of that type using the OmniGraph Python API. For other walkthrough tutorials see Walkthroughs. This example will create an AutoNode node type definition that takes two vectors as inputs and returns a single output that is the dot product. The script we will produce here contains the steps necessary to define that node type, construct a graph that contains it, and run a simple test to confirm that it operates as expected. This walkthrough will assume that the following extensions have been installed and are enabled in your application: - `omni.graph` for the core AutoNode functionality - `omni.kit.window.script_editor` for the Python Script Editor ## Step 1: Create The Definition The first part of the script will contain the AutoNode definition of the node type. The definition is enclosed in a function so that it does not activate immediately on import. Instead, creation of the node type will happen when the function is called. ```python import numpy as np import omni.graph.core as og import omni.graph.core.types as ot def define_dot_product() -> str: """Calling this function creates a node type definition for the dot product. As the import is happening from a file a special prefix "og.RUNTIME_MODULE_NAME" is added to ensure the node type name is unique. This will be important to know when a node of this type is created later. Returns the fully qualified name of the new node type for easier use. """ @og.create_node_type def autonode_dot(vector1: ot.vector3d, vector2: ot.vector3d) -> ot.double: ```python """Computes the dot product of two vectors""" return np.dot(vector1, vector2) ``` ```python return f"{og.RUNTIME_MODULE_NAME}.autonode_dot" ``` ## Step 2: Construct The Graph The OmniGraph Controller class is the standard method for OmniGraph creation so we will use that. As mentioned above, the node type name was made unique by including a special prefix so that must be included when creating nodes of that type. For the test we will write some constant input nodes are required to those are created here as well. ```python def create_graph(node_type_name: str) -> og.Node: """Create the sample graph with a node of the AutoNode type for use in the test""" (_ , (test_node,), _ , _) = og.Controller.edit( "/AutoNodeTestGraph", {og.Controller.Keys.CREATE_NODES: ("TestNode", node_type_name)} ) return test_node ``` ## Step 3: Add A Simple Test The test will just set some input values, evaluate the graph, and then confirm that the result is what we would expect from the computation. ```python def run_test() -> bool: """Tests the AutoNode node type we have defined above. Returns True if the test succeeded, False if not""" # Call the function that defines the node type node_type_name = define_dot_product() # Create a graph with a node of the new node type test_node = create_graph(node_type_name) # Set some input vectors whose dot product we know input1 = test_node.get_attribute("inputs:vector1") input2 = test_node.get_attribute("inputs:vector2") og.Controller(input1).set([1.0, 2.0, 3.0]) og.Controller(input2).set([4.0, 5.0, 6.0]) # Evaluate the graph so that the compute runs og.Controller.evaluate_sync() # Note the naming of the output attribute, with index starting at 0 result = test_node.get_attribute("outputs:out_0") actual_result = og.Controller(result).get() # See if the computation produced the expected result success = np.allclose(actual_result, 32.0) # Deregister the node type so that it does not continue to exist after the test completes og.deregister_node_type(node_type_name) return success ``` # Note Once the test completes the deregister_node_type() call will ensure that the definition does not persist beyond the test. In normal operation you would leave it active for as long as you need it, or simply rely on the application exit to remove them all for you. ## Step 4: Import The File Through The Script Editor Now that the file contains everything you need in order to create your node type and run a test you can run it by importing it through the script editor. The script editor **File** menu has an option to open a script file so use that and navigate to the file you have saved your script in. Once the file has been read its contents are pasted into the script editor in a new tab but not yet executed. Hit **CTL-ENTER** in that new tab to run the script. At this point all of the functions are defined but the node type definition has not yet been created. Now switch to an empty tab to run the **run_test()** function. It returns a boolean to indicate test success so report that for confirmation. That’s all there is to it for scripting with AutoNode! ### Warning Although you can instantiate this node type any number of times in your scene you should be aware that saving a file with such node types will not work across sessions. In a normal workflow the extension will automatically register the node types it contains but that is not true with AutoNode definitions. To use them in a scene you have loaded you must import and execute the script that defines the node type.
5,449
walkthrough-tutorial-nodes_Overview.md
# Overview ## Extension : omni.graph.tutorials-1.27.1 ## Documentation Generated : Apr 25, 2024 ## Changelog # Overview This extension provides a series of nodes that walk through OmniGraph node functionality, from the simple to the complex. # Walkthrough Tutorial Nodes In the source tree are several tutorials. Enclosed in these tutorial files are curated nodes that implement a representative portion of the available features in an OmniGraph Node interface. By working through these tutorials you can gradually build up a knowledge of the concepts used to effectively write OmniGraph Nodes. > Note > In the tutorial files irrelevant details such as the copyright notice are omitted for clarity ## .ogn Tutorials - Tutorial 1 - Trivial Node - Tutorial 2 - Simple Data Node - Tutorial 3 - ABI Override Node - Tutorial 4 - Tuple Data Node - Tutorial 5 - Array Data Node - Tutorial 6 - Array of Tuples - Tutorial 7 - Role-Based Data Node - Tutorial 8 - GPU Data Node - Tutorial 9 - Runtime CPU/GPU Decision - Tutorial 10 - Simple Data Node in Python - Tutorial 11 - Complex Data Node in Python - Tutorial 12 - Python ABI Override Node - Tutorial 13 - Python State Node - Tutorial 14 - Defaults - Tutorial 15 - Bundle Manipulation - Tutorial 16 - Bundle Data - Tutorial 17 - Python State Attributes Node - Tutorial 18 - Node With Internal State - Tutorial 19 - Extended Attribute Types - Tutorial 20 - Tokens - Tutorial 21 - Adding Bundled Attributes - Tutorial 22 - Adding Bundled Attributes ### OmniGraph Nodes In This Extension - Tutorial Node: ABI Overrides - Tutorial Python Node: ABI Overrides - Tutorial Node: Array Attributes - Tutorial Node: Bundle Add Attributes - Tutorial Python Node: Bundle Add Attributes - Tutorial Node: Bundle Data - Tutorial Python Node: Bundle Data - Tutorial Node: Bundle Manipulation - Tutorial Python Node: Bundle Manipulation - Tutorial Python Node: Attributes With Arrays of Tuples - Tutorial Node: CPU/GPU Bundles - Tutorial Python Node: CPU/GPU Bundles - Tutorial Node: Attributes With CPU/GPU Data - Tutorial Node: CPU/GPU Extended Attributes - Tutorial Python Node: CPU/GPU Extended Attributes - Tutorial Node: Attributes With CUDA Data - Tutorial Node: Attributes With CUDA Array Pointers In Cpu Memory - Tutorial Python Node: Attributes With CUDA Array Pointers In Cpu Memory - Tutorial Node: Defaults - Tutorial Node: Dynamic Attributes - Tutorial Python Node: Dynamic Attributes - Tutorial Node: No Attributes - Tutorial Node: Extended Attribute Types - Tutorial Python Node: Extended Attribute Types - Tutorial Python Node: Generic Math Node - Tutorial Node: Overriding C++ Data Types - Tutorial Node: Role-Based Attributes - Tutorial Node: SIMD Add - Tutorial Node: Attributes With Simple Data - Tutorial Python Node: Attributes With Simple Data - Tutorial Node: Internal States - Tutorial Python Node: State Attributes - Tutorial Python Node: Internal States - Tutorial Node: Tokens - Tutorial Python Node: Tokens - Tutorial Node: Attributes With Arrays of Tuples - Tutorial Node: Tuple Attributes - Tutorial Node: Vectorized Passthrough via ABI - Tutorial Node: Vectorized Passthrough
3,143
walkthroughs.md
# Walkthroughs These walkthrough tutorials will help you get your feet wet with node type definition through AutoNode. Once you follow through in creation of a single node type definition you can see all of the options available by looking through the set of comprehensive examples. - [Walkthrough - Script and Graph Editor](walkthrough-editors.html) - [Walkthrough - External Python Scripting](walkthrough-scripts.html)
422
What%27s_new.md
# Welcome screen: WHAT’S NEW Show release note of current release. <img alt="" src="_images/What%27s_new.png"/> - **VIEW ON THE WEB** to launch default web browser and look at the documentation there. ``` 请注意,由于Markdown不支持直接显示图片,我保留了图片的HTML标签,但根据要求,图片实际上应该被删除。因此,最终的Markdown应该是: ```markdown # Welcome screen: WHAT’S NEW Show release note of current release. - **VIEW ON THE WEB** to launch default web browser and look at the documentation there.
453
what-s-in-fabric-usdrt-scenegraph-api-example-omni-example-cpp-usdrt_Overview.md
# Overview ## Overview ## What’s in Fabric? USDRT Scenegraph API example [omni.example.cpp.usdrt] This is an example Kit extension using the USDRT Scenegraph API. This C++ extension demonstrates the following: - Inspecting Fabric data using the USDRT Scenegraph API - Manipulating prim transforms in Fabric using the RtXformable schema - Deforming Mesh geometry
365
what-s-in-fabric-usdrt-scenegraph-api-example-omni-example-python-usdrt_Overview.md
# What’s in Fabric? USDRT Scenegraph API example [omni.example.python.usdrt] This is an example Kit extension using the USDRT Scenegraph API. This Python extension demonstrates the following: - Inspecting Fabric data using the USDRT Scenegraph API - Manipulating prim transforms in Fabric using the RtXformable schema - Deforming Mesh geometry on the GPU with USDRT and Warp
376
whatsinfabric.md
# Example Kit Extension: What’s in Fabric? ## About The Kit Extension Template Cpp public github repository has 2 example extensions that can be installed named omni.example.cpp.usdrt and omni.example.python.usdrt. These are small Python &amp; C++ extensions that demonstrate a few concepts of working with the USDRT Scenegraph API: - Inspecting Fabric data using the USDRT Scenegraph API - Manipulating prim transforms in Fabric using the RtXformable schema - Deforming Mesh geometry (In the python case: on the GPU with USDRT and Warp) ## Enabling the extension You can find the extensions in the Kit Extension Template Cpp repository on github. - omni.example.cpp.usdrt - omni.example.python.usdrt To enable in kit, clone and build the Kit Extension Template Cpp repository. In Kit, select Window -&gt; Extensions -&gt; Settings add a new search path to you build: `kit-extension-template-cpp/_build/windows-x86_64/release/exts`. Refrsh the extension registry, and you will find the examples under the Third Party tab. The extension will launch as a free-floating window, which can be docked anywhere you find convenient (or not at all). ## Inspecting Fabric data You can inspect data in Fabric by selecting any prim in the viewport or stage window, and then clicking the button labeled “What’s in Fabric?”. Note that in the current implementation of the USDRT Scenegraph API, any creation of a usdrt UsdPrim (ex: `stage.GetPrimAtPath()`) will populate data for that prim into Fabric if has not yet been populated. If you create a Torus Mesh in an empty scene… and click “What’s in Fabric?”, you should see something like this in the UI: The code to get all of the prim attribute values from Fabric is straightforward and familiar to those with USD experience. The `get_fabric_data_for_prim` function does all the work using the USDRT Scenegraph API. ### Python For python, we also have `is_vtarray` and `condensed_vtarray_str` to encapsulate some work around discovering VtArray instances and generating a printed representation for them. ```python import omni.usd from usdrt import Usd, Sdf, Gf, Vt, Rt ``` ```python def get_fabric_data_for_prim(stage_id, path): """Get the Fabric data for a path as a string""" if path is None: return "Nothing selected" stage = Usd.Stage.Attach(stage_id) # If a prim does not already exist in Fabric, # it will be fetched from USD by simply creating the # Usd.Prim object. At this time, only the attributes that have # authored opinions will be fetch into Fabric. prim = stage.GetPrimAtPath(Sdf.Path(path)) if not prim: return f"Prim at path {path} is not in Fabric" # This diverges a bit from USD - only attributes # that exist in Fabric are returned by this API attrs = prim.GetAttributes() result = f"Fabric data for prim at path {path}\n\n\n" for attr in attrs: try: data = attr.Get() datastr = str(data) if data is None: datastr = "<no value>" elif is_vtarray(data): datastr = condensed_vtarray_str(data) except TypeError: # Some data types not yet supported in Python datastr = "<no Python conversion>" result += "{0} ({1}): {2}\n".format(attr.GetName(), str(attr.GetTypeName().GetAsToken()), datastr) return result def is_vtarray(obj): """Check if this is a VtArray type In Python, each data type gets its own VtArray class i.e. Vt.Float3Array etc. so this helper identifies any of them.""" return hasattr(obj, "IsFabricData") def condensed_vtarray_str(data): """Return a string representing VtArray data Include at most 6 values, and the total items in the array""" size = len(data) if size > 6: datastr = "[{0}, {1}, {2}, .. {3}, {4}, {5}] (size: {6})".format( data[0], data[1], data[2], data[-3], data[-2], data[-1], size ) else: datastr = "[" for i in range(size-1): datastr += str(data[i]) + ", " datastr += str(data[-1]) + "]" return datastr ``` The stage ID for the active stage in Kit can be retrieved using ```python omni.usd.get_context().get_stage_id() ``` - this is the ID of the USD stage in the global UsdUtilsStageCache, where Kit automatically adds all loaded stages. ### C++ In the C++ example, the entry point for the extension is python, and use of the USDRT Scenegraph API is behind an example C++ interface `IExampleUsdrtInterface`. The interface provides access to similar functions as in the python example. The code to get all of the prim attribute values from Fabric is in `ExampleUsdrtExtension::get_attributes_for_prim`. ```cpp inline std::string ExampleCppUsdrtExtension::get_attributes_for_prim(long int stageId, usdrt::SdfPath* path, std::vector<usdrt::UsdAttribute>* data) ``` { if (!path || path->IsEmpty()) { return "Nothing selected"; } if (data == nullptr) { return "Invalid data"; } usdrt::UsdStageRefPtr stage = usdrt::UsdStage::Attach(omni::fabric::UsdStageId(stageId)); // If a prim does not already exist in Fabric, // it will be fetched from USD by simply creating the // Usd.Prim object. At this time, only the attributes that have // authored opinions will be fetch into Fabric. usdrt::UsdPrim prim = stage->GetPrimAtPath(*path); if (!prim) { return "Prim at path " + path->GetString() + " is not in Fabric"; } // This diverges a bit from USD - only attributes // that exist in Fabric are returned by this API std::vector<usdrt::UsdAttribute> attrs = prim.GetAttributes(); *data = attrs; return ""; } ``` ## Applying OmniHydra transforms using Rt.Xformable The OmniHydra scene delegate that ships with Omniverse includes a fast path for prim transform manipulation with Fabric. The USDRT Scenegraph API provides the `Rt.Xformable` schema to facilitate those transform manipulations in Fabric. You can learn more about this in [Working with OmniHydra Transforms](omnihydra_xforms.html). In this example, the **Rotate it in Fabric!** button will use the `Rt.Xformable` schema to apply a random world-space orientation to the selected prim. You can push the button multiple times to make the prim dance in place! The code to apply the OmniHydra transform in Fabric is simple enough: ### Python ```python from usdrt import Usd, Sdf, Gf, Vt, Rt def apply_random_rotation(stage_id, path): """Apply a random world space rotation to a prim in Fabric""" if path is None: return "Nothing selected" stage = Usd.Stage.Attach(stage_id) prim = stage.GetPrimAtPath(Sdf.Path(path)) if not prim: return f"Prim at path {path} is not in Fabric" rtxformable = Rt.Xformable(prim) # If this is the first time setting OmniHydra xform, # start by setting the initial xform from the USD stage if not rtxformable.HasWorldXform(): rtxformable.SetWorldXformFromUsd() # Generate a random orientation quaternion angle = random.random()*math.pi*2 axis = Gf.Vec3f(random.random(), random.random(), random.random()).GetNormalized() halfangle = angle/2.0 shalfangle = math.sin(halfangle) rotation = Gf.Quatf(math.cos(halfangle), axis[0]*shalfangle, axis[1]*shalfangle, axis[2]*shalfangle) rtxformable.GetWorldOrientationAttr().Set(rotation) return f"Set new world orientation on {path} to {rotation}" ``` ```markdown ## C++ ```cpp inline std::string ExampleCppUsdrtExtension::apply_random_rotation(long int stageId, usdrt::SdfPath* path, usdrt::GfQuatf* rot) { //Apply a random world space rotation to a prim in Fabric if (!path || path->IsEmpty()) { return "Nothing selected"; } if (rot == nullptr) { return "Invalid data"; } usdrt::UsdStageRefPtr stage = usdrt::UsdStage::Attach(omni::fabric::UsdStageId(stageId)); usdrt::UsdPrim prim = stage->GetPrimAtPath(*path); if (!prim) { return "Prim at path " + path->GetString() + " is not in Fabric"; } usdrt::RtXformable rtxformable = usdrt::RtXformable(prim); if (!rtxformable.HasWorldXform()) { rtxformable.SetWorldXformFromUsd(); } std::random_device rd; // Will be used to obtain a seed for the random number engine std::mt19937 gen(rd()); // Standard mersenne_twister_engine seeded with rd() std::uniform_real_distribution<float> dist(0.0f, 1.0f); float angle = dist(gen) * M_PI * 2; usdrt::GfVec3f axis = usdrt::GfVec3f(dist(gen), dist(gen), dist(gen)).GetNormalized(); float halfangle = angle / 2.0; ``` ```csharp float shalfangle = sin(halfangle); usdrt::GfQuatf rotation = usdrt::GfQuatf(cos(halfangle), axis[0] * shalfangle, axis[1] * shalfangle, axis[2] * shalfangle); rtxformable.GetWorldOrientationAttr().Set(rotation); *rot = rotation; return ""; ``` ```csharp Deforming a Mesh =============== Python (on the GPU with Warp) ----------------------------- The USDRT Scenegraph API can leverage Fabric’s support for mirroring data to the GPU for array-type attributes with its implementation of VtArray. This is especially handy for integration with warp, NVIDIA’s open-source Python library for running Python code on the GPU with CUDA. In addition to a fast path for transforms, OmniHydra also provides a fast rendering path for Mesh point data with Fabric. Any Mesh prim in Fabric with the `Deformable` tag will have its point data pulled from Fabric for rendering by OmniHydra, rather than the USD stage. If you push the **Deform it with Warp!** button, the extension will apply a Warp kernel to the point data of any selected prim - this data modification will happen entirely on the GPU with CUDA, which makes it possible to do operations on substantial Mesh data in very little time. If you push the button repeatedly, you will see the geometry oscillate as the deformation kernel is repeatedly applied. The warp kernel used here is very simple, but it is possible to achieve beautiful and complex results with Warp. Warp is amazing! ```python from usdrt import Usd, Sdf, Gf, Vt, Rt import warp as wp wp.init() @wp.kernel def deform(positions: wp.array(dtype=wp.vec3), t: float): tid = wp.tid() x = positions[tid] offset = -wp.sin(x[0]) scale = wp.sin(t)*10.0 x = x + wp.vec3(0.0, offset*scale, 0.0) positions[tid] = x def deform_mesh_with_warp(stage_id, path, time): """Use Warp to deform a Mesh prim""" if path is None: return "Nothing selected" stage = Usd.Stage.Attach(stage_id) prim = stage.GetPrimAtPath(Sdf.Path(path)) if not prim: return f"Prim at path {path} is not in Fabric" if not prim.HasAttribute("points"): return f"Prim at path {path} does not have points attribute" # Tell OmniHydra to render points from Fabric if not prim.HasAttribute("Deformable"): prim.CreateAttribute("Deformable", Sdf.ValueTypeNames.PrimTypeTag, True) points = prim.GetAttribute("points") ``` pointsarray = points.Get() warparray = wp.array(pointsarray, dtype=wp.vec3, device="cuda") wp.launch( kernel=deform, dim=len(pointsarray), inputs=[warparray, time], device="cuda" ) points.Set(Vt.Vec3fArray(warparray.numpy())) return f"Deformed points on prim {path}" ``` ### C++ (No GPU for simplicity of example) In the python example, this uses warp to run the deformation on GPU. The more correct C++ equivalent would be to write a CUDA kernel for this, but for simplicity of this example, do the deformation here on CPU. ```cpp inline std::string ExampleCppUsdrtExtension::deform_mesh(long int stageId, usdrt::SdfPath* path, int time) { // Deform a Mesh prim if (!path || path->IsEmpty()) { return "Nothing selected"; } usdrt::UsdStageRefPtr stage = usdrt::UsdStage::Attach(omni::fabric::UsdStageId(stageId)); usdrt::UsdPrim prim = stage->GetPrimAtPath(*path); if (!prim) { return "Prim at path " + path->GetString() + " is not in Fabric"; } if (!prim.HasAttribute("points")) { return "Prim at path " + path->GetString() + " does not have points attribute"; } // Tell OmniHydra to render points from Fabric if (!prim.HasAttribute("Deformable")) { prim.CreateAttribute("Deformable", usdrt::SdfValueTypeNames->PrimTypeTag, true); } usdrt::UsdAttribute points = prim.GetAttribute("points"); usdrt::VtArray<usdrt::GfVec3f> pointsarray; points.Get(&pointsarray); // Deform points // In the python example, this uses warp to run the deformation on GPU // The more correct C++ equivalent would be to write a CUDA kernel for this // but for simplicity of this example, do the deformation here on CPU. for (usdrt::GfVec3f& point : pointsarray) { float offset = -sin(point[0]); } ```cpp float scale = sin(time) * 10.0; point = point + usdrt::GfVec3f(0.0, offset * scale, 0.0); } points.Set(pointsarray); return "Deformed points on prim " + path->GetString(); }
13,051
widget.md
# Stage Preview Widget The `StagePreviewWidget` is comprised of a few `omni.ui` objects which are stacked on top of one-another. So first an `omni.ui.ZStack` container is instantiated and using the `omni.ui` with syntax, the remaining objects are created in its scope: ```python self.__ui_container = ui.ZStack() with self.__ui_container: ``` ## Background First we create an `omni.ui.Rectangle` that will fill the entire frame with a constant color, using black as the default. We add a few additional style arguments so that the background color can be controlled easily from calling code. ```python # Add a background Rectangle that is black by default, but can change with a set_style ui.Rectangle(style_type_name_override='ViewportBackgroundColor', style={'ViewportBackgroundColor': {'background_color': 0xff000000}}) ``` ## ViewportWidget Next the `omni.kit.widget.viewport.ViewportWidget` is created, directly above the background Rectangle. In the `stage_preview` example, the `ViewportWidget` is actually created to always fill the parent frame by passing `resolution='fill_frame'`, which will essentially make it so the black background never seen. If a constant resolution was requested by passing a tuple `resolution=(640, 480)`; however, the rendered image would be locked to that resolution and causing the background rect to be seen if the Widget was wider or taller than the texture’s resolution. ```python self.__vp_widget = ViewportWidget(usd_context_name=usd_context_name, camera_path=camera_path, resolution=resolution, *ui_args, **ui_kw_args) ``` ## SceneView The final `omni.ui` element we are going to create is an `omni.ui.scene.SceneView`. We are creating it primarily to host our camera-manipulators which are written for the ```python # Add the omni.ui.scene.SceneView that is going to host the camera-manipulator self.__scene_view = sc.SceneView(aspect_ratio_policy=sc.AspectRatioPolicy.STRETCH) # And finally add the camera-manipulator into that view with self.__scene_view.scene: ``` ```python class StagePreviewWidget: def __init__(self, usd_context_name: str = '', camera_path: str = None, resolution: Union[tuple, str] = None, *ui_args, **ui_kw_args): """StagePreviewWidget contructor Args: usd_context_name (str): The name of a UsdContext the Viewport will be viewing. camera_path (str): The path of the initial camera to render to. resolution (x, y): The resolution of the backing texture, or 'fill_frame' to match the widget's ui-size *ui_args, **ui_kw_args: Additional arguments to pass to the ViewportWidget's parent frame """ # Put the Viewport in a ZStack so that a background rectangle can be added underneath self.__ui_container = ui.ZStack() with self.__ui_container: # Add a background Rectangle that is black by default, but can change with a set_style ui.Rectangle(style_type_name_override='ViewportBackgroundColor', style={'ViewportBackgroundColor': {'background_color': 0xff000000}}) # Create the ViewportWidget, forwarding all of the arguments to this constructor self.__vp_widget = ViewportWidget(usd_context_name=usd_context_name, camera_path=camera_path, resolution=resolution, *ui_args, **ui_kw_args) # Add the omni.ui.scene.SceneView that is going to host the camera-manipulator self.__scene_view = sc.SceneView(aspect_ratio_policy=sc.AspectRatioPolicy.STRETCH) # And finally add the camera-manipulator into that view with self.__scene_view.scene: self.__camera_manip = ViewportCameraManipulator(self.viewport_api) model = self.__camera_manip.model # Let's disable any undo for these movements as we're a preview-window model.set_ints('disable_undo', [1]) # We'll also let the Viewport automatically push view and projection changes into our scene-view self.viewport_api.add_scene_view(self.__scene_view) def __del__(self): self.destroy() def destroy(self): self.__view_change_sub = None if self.__camera_manip: self.__camera_manip.destroy() self.__camera_manip = None if self.__scene_view: self.__scene_view.destroy() self.__scene_view = None if self.__vp_widget: self.__vp_widget.destroy() self.__vp_widget = None if self.__ui_container: self.__ui_container.destroy() self.__ui_container = None ``` ```python @property def viewport_api(self): # Access to the underying ViewportAPI object to control renderer, resolution return self.__vp_widget.viewport_api @property def scene_view(self): # Access to the omni.ui.scene.SceneView return self.__scene_view def set_style(self, *args, **kwargs): # Give some styling access self.__ui_container.set_style(*args, **kwargs) ```
5,016
widgets.md
# Widgets ## Label Labels are used everywhere in omni.ui. They are text only objects. Here is a list of styles you can customize on Label: > color (color): the color of the text > font_size (float): the size of the text > margin (float): the distance between the label and the parent widget defined boundary > margin_width (float): the width distance between the label and the parent widget defined boundary > margin_height (float): the height distance between the label and the parent widget defined boundary > alignment (enum): defines how the label is positioned in the parent defined space. There are 9 alignments supported which are quite self-explanatory. - ui.Alignment.LEFT_CENTER - ui.Alignment.LEFT_TOP - ui.Alignment.LEFT_BOTTOM - ui.Alignment.RIGHT_CENTER - ui.Alignment.RIGHT_TOP - ui.Alignment.RIGHT_BOTTOM - ui.Alignment.CENTER - ui.Alignment.CENTER_TOP - ui.Alignment.CENTER_BOTTOM Here are a few examples of labels: ```python from omni.ui import color as cl ui.Label("this is a simple label", style={"color":cl.red, "margin": 5}) ``` ```python from omni.ui import color as cl ui.Label("label with alignment", style={"color":cl.green, "margin": 5}, alignment=ui.Alignment.CENTER) ``` Notice that alignment could be either a property or a style. ```python from omni.ui import color as cl label_style = { "Label": {"font_size": 20, "color": cl.blue, "alignment":ui.Alignment.RIGHT, "margin_height": 20} } { ui.Label("Label with style", style=label_style) } ``` When the text of the Label is too long, it can be elided by ``` ... ``` : Here is a list of styles you can customize on Line: > color (color): the color of the tick > background_color (color): the background color of the check box > font_size: the size of the tick > border_radius (float): the radius of the corner angle if the user wants to round the check box. > border_width (float): the size of the check box border > secondary_background_color (color): the color of the check box border Default checkbox Disabled checkbox: In the following example, the models of two checkboxes are connected, and if one checkbox is changed, it makes another checkbox change as well. ```python from omni.ui import color as cl with ui.HStack(width=0, spacing=5): # Create two checkboxes style = {"CheckBox":{ "color": cl.white, "border_radius": 0, "background_color": cl("#ff5555"), "font_size": 30}} first = ui.CheckBox(style=style) second = ui.CheckBox(style=style) # Connect one to another first.model.add_value_changed_fn(lambda a, b=second: b.model.set_value(not a.get_value_as_bool())) ``` # Set the first one to True first.model.set_value(True) ui.Label("One of two") In the following example, that is a bit more complicated, only one checkbox can be enabled. ```python from omni.ui import color as cl style = {"CheckBox":{"color": cl("#ff5555"), "border_radius": 5, "background_color": cl(0.35), "font_size": 20}} with ui.HStack(width=0, spacing=5): # Create two checkboxes first = ui.CheckBox(style=style) second = ui.CheckBox(style=style) third = ui.CheckBox(style=style) def like_radio(model, first, second): """Turn on the model and turn off two checkboxes""" if model.get_value_as_bool(): model.set_value(True) first.model.set_value(False) second.model.set_value(False) # Connect one to another first.model.add_value_changed_fn(lambda a, b=second, c=third: like_radio(a, b, c)) second.model.add_value_changed_fn(lambda a, b=first, c=third: like_radio(a, b, c)) third.model.add_value_changed_fn(lambda a, b=first, c=second: like_radio(a, b, c)) # Set the first one to True first.model.set_value(True) ui.Label("Almost like radio box") ``` ## ComboBox The ComboBox widget is a combination of a button and a drop-down list. A ComboBox is a selection widget that displays the current item and can pop up a list of selectable items. Here is a list of styles you can customize on ComboBox: - color (color): the color of the combo box text and the arrow of the drop-down button - background_color (color): the background color of the combo box - secondary_color (color): the color of the drop-down button’s background - selected_color (color): the selected highlight color of option items - secondary_selected_color (color): the color of the option item text - font_size (float): the size of the text - border_radius (float): the border radius if the user wants to round the ComboBox - padding (float): the overall padding of the ComboBox. If padding is defined, padding_height and padding_width will have no effects. - padding_height (float): the width padding of the drop-down list - padding_width (float): the height padding of the drop-down list - secondary_padding (float): the height padding between the ComboBox and options Default ComboBox: <p> Code Result <div class="highlight-python notranslate"> <div class="highlight"> <pre><span> <p> ComboBox with style <div class="highlight-python notranslate"> <div class="highlight"> <pre><span> <span class="n">style <span class="s2">"color" <span class="s2">"background_color" <span class="s2">"secondary_color" <span class="s2">"selected_color" <span class="s2">"secondary_selected_color" <span class="s2">"font_size" <span class="s2">"border_radius" <span class="s2">"padding_height" <span class="s2">"padding_width" <span class="s2">"secondary_padding" <span class="p">}} <span class="k">with <span class="n">ui <span class="n">ui <p> The following example demonstrates how to add items to the ComboBox. <div class="highlight-python notranslate"> <div class="highlight"> <pre><span> <span class="n">ui <span class="s2">"Add item to combo" <span class="n">clicked_fn <span class="kc">None <span class="p">) <p> The minimal model implementation to have more flexibility of the data. It requires holding the value models and reimplementing two methods: <code> get_item_children and <code> get_item_value_model . <div class="highlight-python notranslate"> <div class="highlight"> <pre><span> <span class="k">def <span class="nb">super <span class="bp">self <span class="k">class <span class="k">def <span class="nb">super <span class="bp">self <span class="bp">self <span class="k">lambda <span class="bp">self <span class="n">MinimalItem <span class="k">for <span class="p">] <span class="k">def <span class="k">return <span class="k">def <span class="k">if <span class="k">return <span class="k">return <span class="bp">self <span class="k">with <span class="n">ui <span class="n">ui The example of communication between widgets. Type anything in the field and it will appear in the combo box. ```python editable_combo = None class StringModel(ui.SimpleStringModel): ''' String Model activated when editing is finished. Adds item to combo box. ''' def __init__(self): super().__init__("") def end_edit(self): combo_model = editable_combo.model # Get all the options ad list of strings all_options = [ combo_model.get_item_value_model(child).as_string for child in combo_model.get_item_children() ] # Get the current string of this model fieldString = self.as_string if fieldString: if fieldString in all_options: index = all_options.index(fieldString) else: # It's a new string in the combo box combo_model.append_child_item( None, ui.SimpleStringModel(fieldString) ) index = len(all_options) combo_model.get_item_value_model().set_value(index) self._field_model = StringModel() def combo_changed(combo_model, item): all_options = [ combo_model.get_item_value_model(child).as_string for child in combo_model.get_item_children() ] current_index = combo_model.get_item_value_model().as_int self._field_model.as_string = all_options[current_index] with ui.HStack(): ui.StringField(self._field_model) editable_combo = ui.ComboBox(width=0, arrow_only=True) editable_combo.model.add_item_changed_fn(combo_changed) ``` ## TreeView TreeView is a widget that presents a hierarchical view of information. Each item can have a number of subitems. An indentation often visualizes this in a list. An item can be expanded to reveal subitems, if any exist, and collapsed to hide subitems. TreeView can be used in file manager applications, where it allows the user to navigate the file system directories. They are also used to present hierarchical data, such as the scene object hierarchy. TreeView uses a model-delegate-view pattern to manage the relationship between data and the way it is presented. The separation of functionality gives developers greater flexibility to customize the presentation of items and provides a standard interface to allow a wide range of data sources to be used with other widgets. Here is a list of styles you can customize on TreeView: > background_color (color): specifically used when Treeview item is selected. It indicates the background color of the TreeView item when selected. > background_selected_color (color): the hover color of the TreeView selected item. The actual selected color of the TreeView selected item should be defined by the “background_color” of “:selected”. > secondary_color (color): if the TreeView has more than one column, this is the color of the line which divides the columns. > secondary_selected_color (color): if the TreeView has more than one column and if the column is resizable, this is the color of the line which divides the columns when hovered over the divider. > border_color (color): the border color of the TreeView item when hovered. During drag and drop of the Treeview item, it is also the border color of the Treeview item border which indicates where the dragged item targets to drop. > border_width (float): specifically used when Treeview item drag and dropped. Thickness of the Treeview item border which indicates where the dragged item targets to drop. Here is a list of styles you can customize on TreeView.Item: > margin (float): the margin between TreeView items. This will be overridden by the value of margin_width or margin_height > margin_width (float): the margin width between TreeView items margin_height (float): the margin height between TreeView items color (color): the text color of the TreeView items font_size (float): the text size of the TreeView items The following example demonstrates how to make a single level tree appear like a simple list. ```python import omni.ui as ui from omni.ui import color as cl style = { "TreeView": { "background_selected_color": cl("#55FF9033"), "secondary_color": cl.green, "secondary_selected_color": cl.purple, "border_color": cl.red, }, "TreeView:selected": {"background_color": cl("#888888")}, "TreeView.Item": { "margin": 4, "margin_width": 10, "color": cl("#AAAAAA"), "font_size": 13, }, "TreeView.Item:selected": {"color": cl.pink}, } class CommandItem(ui.AbstractItem): """Single item of the model""" def __init__(self, text): super().__init__() self.name_model = ui.SimpleStringModel(text) class CommandModel(ui.AbstractItemModel): """ Represents the list of commands registered in Kit. It is used to make a single level tree appear like a simple list. """ def __init__(self): super().__init__() self._commands = [] try: import omni.kit.commands except ModuleNotFoundError: return omni.kit.commands.subscribe_on_change(self._commands_changed) self._commands_changed() def _commands_changed(self): """Called by subscribe_on_change""" self._commands = [] import omni.kit.commands for cmd_list in omni.kit.commands.get_commands().values(): for k in cmd_list.values(): self._commands.append(CommandItem(k.__name__)) self._item_changed(None) def get_item_children(self, item): """Returns all the children when the widget asks it.""" if item is not None: # Since we are doing a flat list, we return the children of root only. # If it's not root we return. return [] return self._commands def get_item_value_model_count(self, item): """The number of columns""" return 2 def get_item_value_model(self, item, column_id): """ Return value model. It's the object that tracks the specific value. In our case we use ui.SimpleStringModel. """ if item and isinstance(item, CommandItem): return item.name_model ): self._command_model = CommandModel() tree_view = ui.TreeView( self._command_model, root_visible=False, header_visible=False, columns_resizable=True, column_widths=[350, 350], style_type_name_override="TreeView", style=style, ) The following example demonstrates reordering with drag and drop. You can drag one item of the TreeView and move it to the position where you want to insert the item. Code Result ```python from omni.ui import color as cl style = { "TreeView": { "border_color": cl.red, "border_width": 2, }, "TreeView.Item": {"margin": 4}, } class ListItem(ui.AbstractItem): """Single item of the model""" def __init__(self, text): super().__init__() self.name_model = ui.SimpleStringModel(text) def __repr__(self): return f'"{self.name_model.as_string}"' class ListModel(ui.AbstractItemModel): """ Represents the model for lists. It's very easy to initialize it with any string list: string_list = ["Hello", "World"] model = ListModel(*string_list) ui.TreeView(model) """ def __init__(self, *args): super().__init__() self._children = [ListItem(t) for t in args] def get_item_children(self, item): """Returns all the children when the widget asks it.""" if item is not None: # Since we are doing a flat list, we return the children of root only. # If it's not root we return. return [] return self._children def get_item_value_model_count(self, item): """The number of columns""" return 1 def get_item_value_model(self, item, column_id): """ Return value model. It's the object that tracks the specific value. In our case we use ui.SimpleStringModel. """ return item.name_model class ListModelWithReordering(ListModel): """ Represents the model for the list with the ability to reorder the list with drag and drop. """ def __init__(self, *args): super().__init__(*args) def get_drag_mime_data(self, item): """Returns Multipurpose Internet Mail Extensions (MIME) data for be able to drop this item somewhere""" # As we don't do Drag and Drop to the operating system, we return the string. return item.name_model.as_string def drop_accepted(self, target_item, source, drop_location=-1): """Reimplemented from AbstractItemModel. Called to highlight target when drag and drop.""" # If target_item is None, it's the drop to root. Since it's # list model, we support reorganization of root only and we # don't want to create a tree. return not target_item and drop_location >= 0 def drop(self, target_item, source, drop_location=-1): """Reimplemented from AbstractItemModel. Called when dropping something to the item.""" ```python try: source_id = self._children.index(source) except ValueError: # Not in the list. This is the source from another model. return if source_id == drop_location: # Nothing to do return self._children.remove(source) if drop_location > len(self._children): # Drop it to the end self._children.append(source) else: if source_id < drop_location: # Because when we removed source, the array became shorter drop_location = drop_location - 1 self._children.insert(drop_location, source) self._item_changed(None) ``` ```python with ui.ScrollingFrame( height=150, horizontal_scrollbar_policy=ui.ScrollBarPolicy.SCROLLBAR_ALWAYS_OFF, vertical_scrollbar_policy=ui.ScrollBarPolicy.SCROLLBAR_ALWAYS_ON, ): self._list_model = ListModelWithReordering("Simplest", "List", "Model", "With", "Reordering") tree_view = ui.TreeView( self._list_model, root_visible=False, header_visible=False, style_type_name_override="TreeView", style=style, drop_between_items=True, ) ``` The following example demonstrates the ability to edit TreeView items. Code Result ```python from omni.ui import color as cl class FloatModel(ui.AbstractValueModel): """An example of custom float model that can be used for formatted string output""" def __init__(self, value: float): super().__init__() self._value = value def get_value_as_float(self): """Reimplemented get float""" return self._value or 0.0 def get_value_as_string(self): """Reimplemented get string""" # This string goes to the field. if self._value is None: return "" # General format. This prints the number as a fixed-point # number, unless the number is too large, in which case it # switches to 'e' exponent notation. return "{0:g}".format(self._value) def set_value(self, value): """Reimplemented set""" try: value = float(value) except ValueError: value = None if value != self._value: # Tell the widget that the model is changed self._value = value self._value_changed() class NameValueItem(ui.AbstractItem): """Single item of the model""" def __init__(self, text, value): super().__init__() self.name_model = ui.SimpleStringModel(text) self.value_model = FloatModel(value) ``` ```python def __repr__(self): return f'"{self.name_model.as_string} {self.value_model.as_string}"' class NameValueModel(ui.AbstractItemModel): """ Represents the model for name-value tables. It's very easy to initialize it with any string-float list: my_list = ["Hello", 1.0, "World", 2.0] model = NameValueModel(*my_list) ui.TreeView(model) """ def __init__(self, *args): super().__init__() # ["Hello", 1.0, "World", 2.0"] -> [("Hello", 1.0), ("World", 2.0)] regrouped = zip(*(iter(args),) * 2) self._children = [NameValueItem(*t) for t in regrouped] def get_item_children(self, item): """Returns all the children when the widget asks it.""" if item is not None: # Since we are doing a flat list, we return the children of root only. # If it's not root we return. return [] return self._children def get_item_value_model_count(self, item): """The number of columns""" return 2 def get_item_value_model(self, item, column_id): """ Return value model. It's the object that tracks the specific value. In our case we use ui.SimpleStringModel for the first column and SimpleFloatModel for the second column. """ return item.value_model if column_id == 1 else item.name_model class EditableDelegate(ui.AbstractItemDelegate): """ Delegate is the representation layer. TreeView calls the methods of the delegate to create custom widgets for each item. """ def __init__(self): super().__init__() self.subscription = None def build_branch(self, model, item, column_id, level, expanded): """Create a branch widget that opens or closes subtree""" pass def build_widget(self, model, item, column_id, level, expanded): """Create a widget per column per item""" stack = ui.ZStack(height=20) with stack: value_model = model.get_item_value_model(item, column_id) label = ui.Label(value_model.as_string) if column_id == 1: field = ui.FloatField(value_model, visible=False) else: field = ui.StringField(value_model, visible=False) # Start editing when double clicked stack.set_mouse_double_clicked_fn(lambda x, y, b, m, f=field, l=label: self.on_double_click(b, f, l)) def on_double_click(self, button, field, label): """Called when the user double-clicked the item in TreeView""" if button != 0: return # Make Field visible when double clicked field.visible = True ``` ```python field.focus_keyboard() # When editing is finished (enter pressed of mouse clicked outside of the viewport) self.subscription = field.model.subscribe_end_edit_fn( lambda m, f=field, l=label: self.on_end_edit(m, f, l) ) def on_end_edit(self, model, field, label): """Called when the user is editing the item and pressed Enter or clicked outside of the item""" field.visible = False label.text = model.as_string self.subscription = None ``` ```python with ui.ScrollingFrame( height=100, horizontal_scrollbar_policy=ui.ScrollBarPolicy.SCROLLBAR_ALWAYS_OFF, vertical_scrollbar_policy=ui.ScrollBarPolicy.SCROLLBAR_ALWAYS_ON, ): self._name_value_model = NameValueModel("First", 0.2, "Second", 0.3, "Last", 0.4) self._name_value_delegate = EditableDelegate() tree_view = ui.TreeView( self._name_value_model, delegate=self._name_value_delegate, root_visible=False, header_visible=False, style_type_name_override="TreeView", style={"TreeView.Item": {"margin": 4}}, ) ``` This is an example of async filling the TreeView model. It’s collecting only as many as it’s possible of USD prims for 0.016s and waits for the next frame, so the UI is not locked even if the USD Stage is extremely big. To play with it, create several materials in the stage or open a stage which contains materials, click “Traverse All” or “Stop Traversing”. ```python import asyncio import time from omni.ui import color as cl class ListItem(ui.AbstractItem): """Single item of the model""" def __init__(self, text): super().__init__() self.name_model = ui.SimpleStringModel(text) def __repr__(self): return f'"{self.name_model.as_string}"' class ListModel(ui.AbstractItemModel): """ Represents the model for lists. It's very easy to initialize it with any string list: string_list = ["Hello", "World"] model = ListModel(*string_list) ui.TreeView(model) """ def __init__(self, *args): super().__init__() self._children = [ListItem(t) for t in args] def get_item_children(self, item): """Returns all the children when the widget asks it.""" if item is not None: # Since we are doing a flat list, we return the children of root only. # If it's not root we return. return [] return self._children def get_item_value_model_count(self, item): """The number of columns""" return 1 def get_item_value_model(self, item, column_id): """ Return value model. It's the object that tracks the specific value. In our case we use ui.SimpleStringModel. """ return item.name_model ``` ```python class AsyncQueryModel(ListModel): """ This is an example of async filling the TreeView model. It's collecting only as many as it's possible of USD prims for 0.016s and waits for the next frame, so the UI is not locked even if the USD Stage is extremely big. """ def __init__(self): super().__init__() self._stop_event = None def destroy(self): self.stop() def stop(self): """Stop traversing the stage""" if self._stop_event: self._stop_event.set() def reset(self): """Traverse the stage and keep materials""" self.stop() self._stop_event = asyncio.Event() self._children.clear() self._item_changed(None) asyncio.ensure_future(self.__get_all(self._stop_event)) def __push_collected(self, collected): """Add given array to the model""" for c in collected: self._children.append(c) self._item_changed(None) async def __get_all(self, stop_event): """Traverse the stage portion at time, so it doesn't freeze""" stop_event.clear() start_time = time.time() # The widget will be updated not faster than 60 times a second update_every = 1.0 / 60.0 import omni.usd from pxr import Usd from pxr import UsdShade context = omni.usd.get_context() stage = context.get_stage() if not stage: return # Buffer to keep the portion of the items before sending to the # widget collected = [] for p in stage.Traverse( Usd.TraverseInstanceProxies(Usd.PrimIsActive and Usd.PrimIsDefined and Usd.PrimIsLoaded) ): if stop_event.is_set(): break if p.IsA(UsdShade.Material): # Collect materials only collected.append(ListItem(str(p.GetPath()))) elapsed_time = time.time() # Loop some amount of time so fps will be about 60FPS if elapsed_time - start_time > update_every: start_time = elapsed_time # Append the portion and update the widget if collected: self.__push_collected(collected) collected = [] # Wait one frame to let other tasks go await omni.kit.app.get_app().next_update_async() self.__push_collected(collected) try: import omni.usd from pxr import Usd usd_available = True except ModuleNotFoundError: usd_available = False if usd_available: with ui.ScrollingFrame( height=200, horizontal_scrollbar_policy=ui.ScrollBarPolicy.SCROLLBAR_ALWAYS_OFF, ``` vertical_scrollbar_policy=ui.ScrollBarPolicy.SCROLLBAR_ALWAYS_ON, ): self._async_query_model = AsyncQueryModel() ui.TreeView( self._async_query_model, root_visible=False, header_visible=False, style_type_name_override="TreeView", style={"TreeView.Item": {"margin": 4}}, ) _loaded_label = ui.Label("Press Button to Load Materials", name="text") with ui.HStack(): ui.Button("Traverse All", clicked_fn=self._async_query_model.reset) ui.Button("Stop Traversing", clicked_fn=self._async_query_model.stop) def _item_changed(model, item): if item is None: count = len(model._children) _loaded_label.text = f"{count} Materials Traversed" self._async_query_sub = self._async_query_model.subscribe_item_changed_fn(_item_changed)
27,717
widget_overview.md
# Overview Omni.kit.widget.graph provides the base for the delegate of graph nodes. It also defines the standard interface for graph models. With the layout algorithm, GraphView gives a visualization layer of how graph nodes display and how they connect/disconnect with each to form a graph. ## Delegate The graph node’s delegate defines how the graph node looks like. It has two types of layout: List and Column. It defines the appearance of the ports, header, footer and connection. The delegate keeps multiple delegates and pick them depending on the routing conditions. The conditions could be a type or a lambda expression. We use type routing to make the specific kind of nodes unique (e.g. backdrop delegate or compound delegate), and also we can use the lambda function to make the particular state of nodes unique (e.g. full expanded or collapsed delegate). ## Model GraphModel defines the base class for the Graph model. It defines the standard interface to be able to interoperate with the components of the model-view architecture. The model manages two kinds of data elements. Node and port are the atomic data elements of the model. ## Widget GraphNode Represents the Widget for the single node. Uses the model and the delegate to fill up its layout. The overall graph layout follows the method developed by Sugiyama which computes the coordinates for drawing the entire directed graphs. GraphView plays as the visualization layer of omni.kit.widget.graph. It behaves like a regular widget and displays nodes and their connections. ## Batch Position Helper This extension also adds support for batch position updates for graphs. It makes moving a collection of nodes together super easy by inheriting from GraphModelBatchPositionHelper, such as multi-selection, backdrops etc. ## Relationship with omni.kit.graph.editor.core For users to easily set up a graph framework, we provide another extension `omni.kit.graph.editor.core` which is based on this extension. omni.kit.graph.editor.core is more on the application level which defines the graph to have a catalog view to show all the available graph nodes and the graph editor view to construct the actual graph by dragging nodes from the catalog view, while `omni.kit.widget.graph` is the core definition of how graphs work. There is the documentation extension of `omni.kit.graph.docs` which explains how `omni.kit.graph.editor.core` is built up. Also we provide a real graph example extension called `omni.kit.graph.editor.example` which is based on `omni.kit.graph.editor.core`. It showcases how you can easily build a graph extension by feeding in your customized graph model and how to control the graph look by switching among different graph delegates. Here is an example graph built from `omni.kit.graph.editor.example`: --- title: "Example Document" author: "John Doe" date: "2023-01-01" --- # Introduction This is an example document. ## Section 1 Some content here. ### Subsection 1.1 More detailed information. ## Section 2 Another section with different content. ### Subsection 2.1 Additional details. ## Conclusion Summarizing the document. --- ## Footer ---
3,163
window.md
# Stage Preview Window In order to display the Renderer’s output, we’ll need to have an `omni.ui.window` that will host our widget. We’re interested in this level primarily to demonstrate the ability to create a `ViewportWidget` that isn’t tied to the application’s main `UsdContext`; rather you can provide a usd_context_name string argument and the `StagePreviewWindow` will either reuse an existing `UsdContext` with that name, or create a new one. Keep in mind a `ViewportWidget` is currently tied to exactly one `UsdContext` for its lifetime. If you wanted to change the `UsdContext` you are viewing, you would need to hide and show a new `ViewportWidget` based on which context you want to be displayed. ## Context creation The first step we take is to check whether the named `UsdContext` exists, and if not, create it. ```python # We may be given an already valid context, or we'll be creating and managing it ourselves usd_context = omni.usd.get_context(usd_context_name) if not usd_context: self.__usd_context_name = usd_context_name self.__usd_context = omni.usd.create_context(usd_context_name) else: self.__usd_context_name = None self.__usd_context = None ``` ## Viewport creation Once we know a valid context with usd_context_name exists, we create the `omni.ui.Window` passing along the window size and window flags. The `omni.ui` documentation has more in depth description of what an `omni.ui.Window` is and the arguments for it’s creation. After the `omni.ui.Window` has been created, we’ll finally be able to create the `StagePreviewWidget`, passing along the `usd_context_name`. We do this within the context of the `omni.ui.Window.frame` property, and forward any additional arguments to the # StagePreviewWidget constructor. ```python super().__init__(title, width=window_width, height=window_height, flags=flags) with self.frame: self.__preview_viewport = StagePreviewWidget(usd_context_name, *vp_args, **vp_kw_args) ``` ## Full code ```python class StagePreviewWindow(ui.Window): def __init__(self, title: str, usd_context_name: str = '', window_width: int = 1280, window_height: int = 720 + 20, flags: int = ui.WINDOW_FLAGS_NO_SCROLLBAR, *vp_args, **vp_kw_args): """StagePreviewWindow contructor Args: title (str): The name of the Window. usd_context_name (str): The name of a UsdContext this Viewport will be viewing. window_width(int): The width of the Window. window_height(int): The height of the Window. flags(int): ui.WINDOW flags to use for the Window. *vp_args, **vp_kw_args: Additional arguments to pass to the StagePreviewWidget """ # We may be given an already valid context, or we'll be creating and managing it ourselves usd_context = omni.usd.get_context(usd_context_name) if not usd_context: self.__usd_context_name = usd_context_name self.__usd_context = omni.usd.create_context(usd_context_name) else: self.__usd_context_name = None self.__usd_context = None super().__init__(title, width=window_width, height=window_height, flags=flags) with self.frame: self.__preview_viewport = StagePreviewWidget(usd_context_name, *vp_args, **vp_kw_args) def __del__(self): self.destroy() @property def preview_viewport(self): return self.__preview_viewport def open_stage(self, file_path: str): # Reach into the StagePreviewWidget and get the viewport where we can retrieve the usd_context or usd_context_name self.__preview_viewport.viewport_api.usd_context.open_stage(file_path) # the Viewport doesn't have any idea of omni.ui.scene so give the models a sync after open (camera may have changed) self.__preview_viewport.sync_models() def destroy(self): if self.__preview_viewport: self.__preview_viewport.destroy() self.__preview_viewport = None if self.__usd_context: # We can't fully tear down everything yet, so just clear out any active stage self.__usd_context.remove_all_hydra_engines() # self.__usd_context = None # omni.usd.destroy_context(self.__usd_context_name) super().destroy() ```
4,335
Work.md
# Work module Summary: The Work library is intended to simplify the use of multithreading in the context of our software ecosystem. ## Functions: | Function Name | Description | |---------------|-------------| | `GetConcurrencyLimit` | | | `GetPhysicalConcurrencyLimit` | | | `HasConcurrency` | | | `SetConcurrencyLimit` | | | `SetConcurrencyLimitArgument` | | | `SetMaximumConcurrencyLimit` | | ### GetConcurrencyLimit ```python pxr.Work.GetConcurrencyLimit() ``` ### GetPhysicalConcurrencyLimit ```python pxr.Work.GetPhysicalConcurrencyLimit() ``` ### HasConcurrency ```python pxr.Work.HasConcurrency() ``` <dl class="py function"> <dt class="sig sig-object py" id="pxr.Work.SetConcurrencyLimit"> <span class="sig-prename descclassname"> <span class="pre"> pxr.Work. <span class="sig-name descname"> <span class="pre"> SetConcurrencyLimit <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <dl class="py function"> <dt class="sig sig-object py" id="pxr.Work.SetConcurrencyLimitArgument"> <span class="sig-prename descclassname"> <span class="pre"> pxr.Work. <span class="sig-name descname"> <span class="pre"> SetConcurrencyLimitArgument <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <dl class="py function"> <dt class="sig sig-object py" id="pxr.Work.SetMaximumConcurrencyLimit"> <span class="sig-prename descclassname"> <span class="pre"> pxr.Work. <span class="sig-name descname"> <span class="pre"> SetMaximumConcurrencyLimit <span class="sig-paren"> ( <span class="sig-paren"> ) <dd>
1,808
Workflow.md
# Workflow ## Workflow This extension adds support for workflow on demand. A workflow includes a extension to enable necessary extensions and a layout file for windows layout Workflows can be specified in `[[settings.exts."omni.app.setup".workflow]]` sections: ```toml [[settings.exts."omni.app.setup".workflow]] name = "startup" layout = "${omni.app.setup}/layouts/startup.json" workflow = "omni.app.workflow.startup" ``` `omni.app.setup` finds all workflows with `[[settings.exts."omni.app.setup".workflow]]` section and adds a menu item name defined with “name” to the menu “Layout” for each workflow. When the menu is clicked both the workflow extension defined width “workflow” and the layout file defined with “layout” will be loaded. Here “layout” is optional. Default using the one comes from workflow extension `[settings.exts."${workflow}".default_layout]` ```
877
workstation-install.md
# Workstation Install Guide ## Workstation Setup Workstation is ideal for individuals and small teams. It’s deployment and configuration is simple thanks to the Omniverse Launcher application. ### Warning Workstation runs on a network interface and it’s IP Address or hostname must be accessible by all intended Clients (e.g., USD Composer), including Nucleus itself. Running Workstation behind a firewall or using a Cloud Service Provider (CSP) and port forwarding traffic inbound is **not** supported. ## Setup Instructions 1. Download Omniverse Launcher. 2. Install the Omniverse Launcher and refer to the [Installing Launcher](../../launcher/latest/installing_launcher.html#launcher-setup) instructions for additional help. 3. Install Nucleus Workstation. See [Nucleus Tab](../../launcher/latest/workstation-launcher.html#collaboration-tab) for additional configuration details. 4. Install Omniverse Applications &amp; Connectors as needed. See [Install Apps](../../launcher/latest/workstation-launcher.html#install-apps) for information and help. ### Note To ensure Workstation has access to and is accessible by all required services in a non-airgapped environment, refer to the [Networking and TCP/IP Ports documentation](https://docs.omniverse.nvidia.com/nucleus/latest/ports_connectivity.html) for a comprehensive list of connectivity ports and endpoints.
1,372
workstation-launcher.md
# User Guide This document describes the components and workflow of the **Omniverse Launcher**. Making it easy for users to manage their Omniverse Apps, Connectors, and provides Nucleus Collaboration Services; the Omniverse Launcher acts as your personal launchpad for the Omniverse. The Omniverse Launcher is available for download from the Omniverse Getting Started page or from NVIDIA’s licensing and software portal for Enterprise customers. ## News Tab The Omniverse news Tab allows users to review and learn about things related to Omniverse. ## Exchange Tab The Omniverse Exchange is the place where Omniverse Apps, Connectors, File Tools and more can be found and installed. Simply navigate through the list of available apps and connectors, select the version, and install. Once installed, this area can also be used to launch apps. ## Library Tab The Omniverse Library makes it easy to see, launch, update, and/or learn about Omniverse Apps installed on your computer. > Note > If this list is empty this is because you currently have no applications installed. This can easily be remedied by clicking over to the Exchange and installing the apps/connectors of your choice. ### Library Panel The Omniverse Library Panel is located on the left side of the screen and lists all installed Apps, Connectors and more. Selecting one of the items on the list will reveal useful data in the main window about the tool as well as provides functionality based on the item type selected. > Note > The Omniverse Library Panel will be unpopulated until apps are installed. If your list is empty, please navigate to the Exchange Tab to install apps, connectors, and other Omniverse tools. ### Apps On the top of the Library panel, apps are listed. Upon selecting an App, a series of options will be provided for managing the App in the main display. | Option | Description | |--------|-------------| | Launch Button | The launch button allows users to easily launch a selected App. | | Install Settings | Found in the **Hamburger Menu** to the right of the Launch Button, The Settings Pane allows you to review the install path, update, or uninstall the Selected App | | Release Notes | Launches the Documentation Portal for the selected App and takes you to the Latest Release Notes. | # Documentation Launches the Documentation Portal for the Selected App. # Tutorials Launches the Video Learning content for the selected App. # Forums Launches the Forum Pages for in-depth discussion on the selected App. ## Development Tools Development Tools Upon installing Kit, a development tools Tab will appear below Apps. Development tools are typically handled and managed in the same way as Apps and offers similar tools for managing these tools. | Option | Description | | --- | --- | | Launch Button | The launch button allows users to easily launch a selected App. | | Install Settings | Found in the triple Bars to the right of the Launch Button, The Settings Pane allows you to review the install path, update, or uninstall the Selected App. | | Release Notes | Launches the Documentation Portal for the selected App and Takes you to the Latest Release Notes. | | Documentation | Launches the Documentation Portal for the Selected App. | | Tutorials | Launches the Video Learning content for the selected App. | | Forums | Launches the Forum Pages for in depth discussion on the selected App. | ## File Management File management tools provide utilities for managing file operations on the Omniverse. These tools by their nature are less cohesive in their tooling and have variation on their UI controls. Please see the documentation of the tool in question should you need explanation of how to manage. ## Connectors All connectors appear under the connectors icon and are displayed in a list allowing management. For each connector installed, an entry will appear in the list with the ability to add additional connectors easily should you need them. | Option | Description | | --- | --- | | Add | Allows adding additional connectors and brings you to the Connectors Exchange. | | Update | If a connector is out of date, a green Update Button will be displayed allowing you to update to the most current release of that connector. | | Up To Date | When a connector on the list is up to date, a greyed out “up to date” notification will be presented. | ## Updating an App Any app previously installed that has an update available will display with the following green highlight. Selecting (left-click) the highlight will allow you to locate the update (green). Upon selecting, the launcher update status will show the progress. Once the update is complete - The Launch Button will auto-select the updated version. - An Alert confirming the success or failure + reason will be generated. - The highlight will be removed. ## Library Tab In the Library Tab, only the latest version of an application is listed for quick install. Versions released after the installed version and before the latest version are available for installation in the Exchange Tab. ## Exchange Tab The Omniverse Exchange is the place where Omniverse Apps, Connectors, File Tools and more can be found and installed. Simply navigate through the list of available apps and connectors, select the version, and install. Once installed, this area can also be used to launch apps. ## Updating a Connector Connectors have a unified interface. Simply select Connectors under the **Exchange Tab** and any installed connectors will have an green notification bell shown. ### Option - **Filters** - Allows refinement of list based on selection - **Search** - Contextual Search allows locating a specific App or Connector easily. - **Apps List** - Shows all available Apps or Connectors based on Filters and Search. ## Product Overview When selected, details about the app/connector/tool are presented including overall description, version information, supported platforms, and system requirements. This information can be useful to decide if the app/connector/tool is right for you before downloading and installing. ## Install Apps Apps are installed and launched by selecting items in the Exchange Tab: Available releases are categorized by release channel. A release is classified as Alpha, Beta, Release, or Enterprise, depending on its maturity and stability. If an Alpha or Beta release is selected, a banner will appear on the main image to emphasize the relative stability and completeness of that release. Alpha or Beta releases may not be feature complete or fully stable. Versions classified as Release (also known as GA or General Availability) are feature complete and stable. Release versions that are supported for Enterprise customers appear in the Enterprise list. After selecting the desired version, clicking the **Install Button** will initialize installation. ## Nucleus Tab The Omniverse Launcher Nucleus Tab offers the experience of the Omniverse Nucleus Navigator app directly in the Launcher, enabling users to quickly and easily navigate and manage content in their Omniverse Nucleus servers. ### Important If you are looking to host a large, company wide installation of Nucleus and expect large amounts of traffic, other more robust Nucleus packages are available and should be used in lieu or addition to local Server(s). ### Note A network can have multiple Nucleus Installations and there is no harm in having both Linux Docker Installations and Local Servers on the same network. They will exist independently of each other and do not conflict. ### Create your administration Account As this process installs a set of services and effectively turns your workstation into a server, an administration account will be needed. This account allows full and complete control over your Nucleus and is unrelated to any other NVIDIA Accounts. This is your servers primary account and specifically allows you access to the server you are currently installing. Press the Create to finalize the user admin account and log in. ### Connecting to Collaboration Once the above steps have been followed, Users can now connect to your Omniverse Nucleus collaboration service. This is also true for Local Applications. In order to connect to the collaboration service connect with the network address of the host that is also accessible to the user you wish to share with. For details on connecting, please see the documentation for the omniverse app, connector or utility you are using. #### Connecting Locally If the collaboration service resides on your workstation, you can also use **localhost** to connect with local apps and connectors. #### Additional Collaboration Information For more information on the Nucleus Collaboration Services, please review Nucleus Documentation. ## Alerts The alert icon in the top right of the notifies your of important Omniverse Messages. ## User Settings The User Settings panel allows users to choose the default install path for the Omniverse Library Apps & Connectors. ### Settings | Option | Description | | --- | --- | | Library Path | This location specifies where apps, connectors and tools are installed when installed from Launcher. | | Data Path | Displays and allows selection of the Data Path. The data path is where all content on the local Nucleus is stored. | ### About Gives version information about Launcher. ### Log out Logs out of the Launcher. ## Accessibility Omniverse Launcher Text and Layout accommodates text/image scale adjustment to help users with readability and/or high resolution monitors. | Key Command | Action | | --- | --- | | Ctrl + - | Scale Text/Images Smaller | | Ctrl + Shift + + | Scale Text/Images Larger | | Ctrl + 0 | Reset Scale to Default |
9,756
wrapper-file-format.md
# OmniUsdWrapperFileFormat Overview When `GetExtension` is called on the Omniverse USD resolver, and the path is a non-local USD layer (ie: a layer which exists either on an Omniverse server, or an HTTP/S3 server), the resolver returns the file extension “.omni”. This triggers USD to load (or save) the file using the `OmniUsdWrapperFileFormat`. The wrapper file format delegates almost all behavior to the underlying file format, with 2 major exceptions: 1. Read will first download the file to a temporary location, then direct the underlying format to read from that. 2. Write will direct the underlying file format to write to a temporary location, then uses `omniClientMove` to “move” it to the remote server (essentially just a copy + delete) ## Hacks There are a lot of hacks to get this to work correctly in all cases. ### This entire concept This entire class only exists because USD can only read/write to real files on disk. This changes with Ar 2.0 (which abstracts file reading/writing), at which point all this code can be deleted. ### Stashing Info Inside Args We need to know the original extension, path, version, asset name, and repo path. We stash all of this information in the file format args during InitData. ### Creating an anonymous “wrapped layer” In order to instantiate the correct SdfAbstractData, and be able to call Read/Write on the underlying file format, we must provide a layer. We cannot provide the real layer, because the file format will most likely call layer->SetData (which would override our own “OmniUsdWrapperData”), so we must create an anonymous layer. ### InstantiateNewLayer USD versions prior to 21.08 had the `InstantiateNewLayer` function marked as private. We have an extremely dangerous hack to extract that function from the vtable, cast it to the correct type, and call it. ### OpenAsAnonymous When using “OpenAsAnonymous” the wrapper format doesn’t know the underyling format (because the path is empty), so we use a “dummy file format” and defer determining the real format until `Read` is called for the first time (at which point we know the extension of the underlying file, and therefore the file format).
2,182
WritingNodes.md
# OmniGraph Nodes The OmniGraph node provides an encapsulated piece of functionality that is used in a connected graph structure to form larger more complex calculations. One of the core strengths of the way the nodes are defined is that individual node writers do not have to deal with the complexity of the entire system, while still reaping the benefits of it. Support code is generated for the node type definitions that simplify the code necessary for implementing the algorithm, while also providing support for efficient manipulation of data through the use of Fabric both on the CPU and on the GPU. The user writes the description and code that define the operation of the node type and OmniGraph provides the interfaces that incorporate it into the Omniverse runtime. ## Node Type Implementations The node type definition implements the functionality that will be used by the node using two key pieces: 1. The *authoring* definition, which comes in the form of a JSON format file with the suffix *.ogn*. 2. The *runtime* algorithm, which can be implemented in one of several languages. The actual language of implementation is not important to OmniGraph and can be chosen based on the needs and abilities of the node writer. A common component of all node type implementations is the presence of a generated structure known as the node type database. The database provides a simplified wrapper around the underlying OmniGraph functionality that hides all of the required boilerplate code that makes the nodes operate so efficiently. You’ll see how its used in the examples below. ### OGN Definition This *.ogn* file is required for all of the pregenerated implementations - Python, C++, CUDA, and Warp, as they are all build-time definitions. The Script node, Slang node, and AutoNode by contrast are defined at runtime and use other mechanisms to determine the node and attribute configuration. This file describes the node configuration for our samples here. The first highlighted line is only present in the Python and Warp implementations as they are both Python-based. The remaining highlighted lines are used only for Warp and CUDA implementations, being used to indicate that the memory for the attributes should be retrieved from the GPU rather than the CPU. ```json { "AddWeightedPoints": { "version": 1, "language": "python", "description": [ "Add two sets of points together, using an alpha value to determine how much of each point set to" ] } } ``` ```python db.log_error(f"Alpha blend must be in the range [0.0, 1.0], not computing with {db.inputs.alpha}) return False db.outputs.result_size = len(first_set) db.outputs.result = first_set * db.inputs.alpha + second_set * (1.0 - db.inputs.alpha) return True ``` To see further examples of the Python implementation code you can peruse the samples used by the user guide or the user guide itself. ### Script Node Implementation For simple nodes you do not intend to share you may not want the added effort of creating an extension and a `.ogn` file describing your node. Instead you can customize a script node and only write the compute function. See the Script Node documentation for details on how to define the node configuration without the `.ogn` file. Once you have configured the node the code you write inside the script is pretty much identical to what you would write for a full Python node ```python def compute(db: og.Database) -> bool: first_set = db.inputs.firstSet second_set = db.inputs.secondSet if len(first_set) != len(second_set): db.log_error(f"Cannot blend two unequally sized point sets - {len(first_set)} and {len(second_set)}") return False if not (0.0 <= db.inputs.alpha <= 1.0): db.log_error(f"Alpha blend must be in the range [0.0, 1.0], not computing with {db.inputs.alpha}) return False db.outputs.result_size = len(first_set) db.outputs.result = first_set * db.inputs.alpha + second_set * (1.0 - db.inputs.alpha) return True ``` The difference is that this is a freestanding function rather than a class-static method and the database type is a locally defined object, not a pregenerated one. ### AutoNode Implementation An even easier method of implementing a simple node is to use the AutoNode decorators in Python. AutoNode is a variation of the Python implementation that makes use of the Python AST to combine both the authoring description and the runtime implementation into a single Python class or function. While not yet fully functional, it provides a rapid method of implementing simple node types with minimal overhead. For this version, as with the Slang version, there is no `.ogn` file required as the type information is gleaned from the node type definition. For this example only a single point will be used for inputs and outputs as the arrays are not yet fully supported. You just execute this code in the script editor or through a file and it will define a node type `my.local.extension.blend_point` for you to use as you would any other node. ```python @og.AutoFunc(pure=True, module_name="my.local.extension") def blend_point(firstSet: og.Double3, secondSet: og.Double3, alpha: og.Double) -> og.Double3: return ( firstSet[0] * alpha + secondSet[0] * (1.0 - alpha), ) ``` firstSet[1] * alpha + secondSet[1] * (1.0 - alpha), firstSet[2] * alpha + secondSet[2] * (1.0 - alpha), ``` To see further examples of how AutoNode can be used see the AutoNode documentation. ## Warp Implementation If you don’t know how to write CUDA code but are familiar with Python then you can use the Warp package to accelerate your computations on the GPU as well. NVIDIA Warp is a Python framework for writing high-performance simulation and graphics code in Omniverse, and in particular OmniGraph. A Warp node is written in exactly the same way as a Python node, except for its `compute()` it will make use of the Warp cross-compiler to convert the Python into highly performant CUDA code. You’ll notice that there is more boilerplate code to write but it is pretty straightforward, mostly wrapping arrays into common types, and the performance is the result. ```python import numpy as np import warp as wp @wp.kernel def deform(first_set: wp.array(dtype=wp.vec3), second_set: wp.array(dtype=wp.vec3), points_out: wp.array(dtype=wp.vec3), alpha: float): tid = wp.tid() points_out[tid] = first_set[tid] * alpha + second_set[tid] * (1.0 - alpha) class OgnAddWeightedPoints: @staticmethod def compute(db) -> bool: if not db.inputs.points: return True # ensure that the warp kernel will execute on the same CUDA device as the rest of OmniGraph with wp.ScopedDevice(f"cuda:{og.get_compute_cuda_device()}"): # Get the inputs first_set = wp.array(db.inputs.points, dtype=wp.vec3) second_set = wp.array(db.inputs.points, dtype=wp.vec3) points_out = wp.zeros_like(first_set) # Do the work wp.launch(kernel=deform, dim=len(first_set), inputs=[first_set, second_set, points_out, db.inputs.alpha]) # Set the result db.outputs.points = points_out.numpy() ``` Although the code looks very similar the approach to designing the algorithm should vary a lot when you are using Warp as it makes heavy use of the GPU and it is better at different types of algorithms than the CPU. To see further examples of how Warp can be used see the Warp extension documentation. ## Slang Implementation Moving on to a new language, you can also build nodes using Slang. Slang is a language developed for efficient implementation of shaders, based on years of collaboration between researchers at NVIDIA, Carnegie Mellon University, and Stanford. To bring the benefits of Slang into Omnigraph an extension was written that allows you to create OmniGraph node implementations in the Slang language. To gain access to it you must enable the **omni.slangnode** extension, either through the extension window or via the extension manager API The Slang node type is slightly different from the others in that you do not define the authoring definition through a `.ogn` file. There is a single `.ogn` file shared by all Slang node types and you write the implementation of the node type’s algorithm in the `inputs:code` attribute of an instantiation of that node type. You dynamically add attributes to the node to define the authoring interface and then you can access the attribute data using some generated Slang conventions. Moreover, the Slang language has the capability of targeting either CPU or GPU when compiled, so once the graph supports it the node will be able to run on either CPU or GPU, depending on which is more efficient on the available resources. Like the Script Node, Slang implementations are done directly within the application. Once you create a blank Slang node you open up the property panel and use the **Add+** button to add the attributes. This is what the attribute definition window will look like for one of the inputs. Add the three inputs and one input in this way. In the end the property panel should reflect the addition of the attributes the node will use. > **Note** > For now the array index is passed through to the Slang compute function as the `instanceId` as the function will be called in parallel for each element in the array. The number of elements is reflected in the attribute `inputs:instanceCount` as seen in the property panel. In an OmniGraph you can connect either of the input point arrays through an ArrayGetSize node to that attribute to correctly size the output array. ```cpp void compute(uint instanceId) { double alpha = inputs_alpha_get(); double[3] v1 = inputs_firstSet_get(instanceId); double[3] v2 = inputs_secondSet_get(instanceId); double[3] result = { v1[0] * alpha + v2[0] * (1.0 - alpha), v1[1] * alpha + v2[1] * (1.0 - alpha), v1[2] * alpha + v2[2] * (1.0 - alpha) }; outputs_result_set(instanceId, result); } ``` To see further examples of how Slang can be used see the Slang extension documentation ## C++ Implementation While the Python nodes are easier to write they are not particularly efficient, and for some types of nodes performance is critical. These node types can be implemented in C++. There is slightly more code to write, but you gain the performance benefits of compiled code. ```cpp #include &lt;OgnAddWeightedPointsDatabase.h&gt; #include &lt;algorithm&gt; class OgnAddWeightedPoints { public: static bool compute(OgnAddWeightedPointsDatabase& db) { auto const& firstSet = db.inputs.firstSet(); auto const& secondSet = db.inputs.secondSet(); } } ``` ```cpp auto const& alpha = db.inputs.alpha(); auto & result = db.outputs.result(); // Output arrays always have their size set before use, for efficiency result.resize(firstSet.size()); std::transform(firstSet.begin(), firstSet.end(), secondSet.begin(), result.begin(), [alpha](GfVec3d const& firstValue, GfVec3d const& secondValue) -> GfVec3d { return firstValue * alpha + (1.0 - alpha) * secondValue; }); return true; } }; REGISTER_OGN_NODE() ``` ```markdown // Output arrays always have their size set before use, for efficiency size_t numberOfPoints = db.inputs.firstSet.size(); db.outputs.result().resize(numberOfPoints); if (numberOfPoints > 0) { auto const& alpha = db.inputs.alpha(); applyBlendGPU(db.inputs.firstSet(), db.inputs.secondSet(), alpha, db.outputs.result(), numberOfPoints); } ``` # Learning By Example We have a number of tutorials to help you write nodes in OmniGraph. This set of tutorials will walk you through the node writing process by using examples that build on each other, from the simplest to the most complex nodes. Work your way through each of them or find one that addresses your particular need in the Walkthrough Tutorial Nodes. In addition, you can look at the global node library reference for a list of all nodes available, both built-in and available through external extensions.
12,144
_CPPv4IDpEN4omni5graph4exec8unstable5NodeTE_classomni_1_1graph_1_1exec_1_1unstable_1_1NodeT.md
# omni::graph::exec::unstable::NodeT Defined in omni/graph/exec/unstable/Node.h ## Class Definition ```cpp template<typename ...Bases> class NodeT : public omni::graph::exec::unstable::Implements<Bases...> ``` Concrete implementation of omni::graph::exec::unstable::INode. This template is a concrete implementation of omni::graph::exec::unstable::INode. In most cases, instantiating ``` (which is instance of this template) will suffice. See omni::graph::exec::unstable::INode for documentation on the purpose of nodes in the Execution Framework. This class can be seen as a way to provide a reasonable, default implementation of both omni::graph::exec::unstable::INode and omni::graph::exec::unstable::IGraphBuilderNode. The template arguments allow the developer to further customize the interfaces this class implements. A common pattern seen in the Execution Framework is to define a private interface to attach authoring data to a node. See Private Interfaces for details. During graph construction, authoring data can be stored in omni::graph::exec::unstable::NodeT. When storing data in omni::graph::exec::unstable::NodeT, the user must be mindful that a node may be a part of a definition that is shared. Storing authoring data in omni::graph::exec::unstable::NodeGraphDefT during graph construction is another way to link authoring data and the Execution Framework. Again, the user must be mindful that definitions can be shared across multiple nodes in the execution graph. omni::graph::exec::unstable::IExecutionContext is another place to store data. Rather than storing authoring data, omni::graph::exec::unstable::IExecutionContext is designed to store execution/evaluation data keyed on each node’s unique omni::graph::exec::unstable::ExecutionPath. Since definitions can be shared between nodes, each node’s omni::graph::exec::unstable::ExecutionPath is necessary to uniquely identify the “instance” of any given node. ### Public Functions - **~NodeT()** - Destructor. - **bool hasChild(omni::core::ObjectParam&lt;INode&gt; child) noexcept** - Check if a given node is a child of this node. - The given node may be `nullptr`. - **Thread Safety**: This method makes no guarantees on thread safety. However, in practice, accessing the children during execution is safe as the list of children is not expected to change during execution. Accessing the children during graph construction requires coordination with the passes building the graph. - **void acquire()** - (Function description not provided in the HTML snippet) acquire() noexcept Increments the object’s reference count. Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire(). Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you. **Thread Safety** This method is thread safe. release() noexcept Decrements the objects reference count. Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement). Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire(). Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you. **Thread Safety** This method is thread safe. uint32_t getUseCount() noexcept Returns the number of different instances (this included) referencing the current object. **Thread Safety** This method is thread safe. void* cast(omni::core::TypeId id) noexcept **Thread Safety** This method is thread safe. See omni::core::IObject::cast. See omni::graph::exec::unstable::IBase_abi::castWithoutAcquire_abi. ### Public Static Functions template &lt;typename T&gt; static inline omni::core::ObjectPtr&lt;NodeT&gt; create(T &amp;&amp; graphOrTopology, const carb::cpp::string_view &amp; name) noexcept string_view & idName ) Constructor of a node with an empty definition. The given graph or topology must not be `nullptr`. The given name must not be `nullptr`. A valid pointer is always returned. template<typename T, typename D> static inline omni::core::ObjectPtr<NodeT> create(T &graphOrTopology, D &def, const carb::cpp::string_view &idName) Constructor of a node with a definition (can be a base definition IDef, an opaque node definition ```cpp <span class="pre">INodeDef ```cpp , or a node graph definition ```cpp <span class="pre">INodeGraphDef ```cpp ). The given graph or topology must not be `nullptr`. The given name must not be `nullptr`. A valid pointer is always returned. ## Protected Functions ### getTopology_abi() Access topology owning this node. The returned pointer will not be `nullptr`. The returned omni::graph::exec::unstable::ITopology will not have omni::core::IObject::acquire() called before being returned. **Thread Safety**: This method is thread safe. ### getName_abi() Access node’s unique identifier name. The lifetime of the returned object is tied to this node. **Thread Safety**: This method is thread safe. ### getIndexInTopology_abi() Access the index of the node in the topology. **Thread Safety**: This method is thread safe. <dl> <dt> <p> Access nodes unique index withing owning topology. Index will be always smaller than topology size. <p> <dl class="simple"> <dt> <strong> Thread Safety <dd> <p> This method is thread safe. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni5graph4exec8unstable5NodeT14getParents_abiEv"> <p> Access parents. <p> The returned omni::graph::exec::unstable::INode objects will <em> not have omni::core::IObject::acquire() called before being returned. <p> <dl class="simple"> <dt> <strong> Thread Safety <dd> <p> This method makes no guarantees on thread safety. However, in practice, accessing the parents during execution is safe as the list of parents is not expected to change during execution. Accessing the parents during graph construction requires coordination with the passes building the graph. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni5graph4exec8unstable5NodeT15getChildren_abiEv"> <p> Access children. <p> The returned omni::graph::exec::unstable::INode objects will <em> not have omni::core::IObject::acquire() called before being returned. <p> <dl class="simple"> <dt> <strong> Thread Safety <dd> <p> This method makes no guarantees on thread safety. However, in practice, accessing the children during execution is safe as the list of children is not expected to change during execution. Accessing the children during graph construction requires coordination with the passes building the graph. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni5graph4exec8unstable5NodeT23getCycleParentCount_abiEv"> <p> Access cycle parent count. <p> The returned uint32_t value represents the count of cycle parents. <p> <dl class="simple"> <dt> <strong> Thread Safety <dd> <p> This method makes no guarantees on thread safety. However, in practice, accessing the cycle parent count during execution is safe as the count is not expected to change during execution. Accessing the cycle parent count during graph construction requires coordination with the passes building the graph. ( ) noexcept override Return number of parents that cause cycles within the graph during traversal over this node. This method makes no guarantees on thread safety. However, in practice, accessing this count during execution is safe as the cycle count is expected to be computed during graph construction. Accessing the count during graph construction requires coordination with the passes building the graph. Check if topology/connectivity of nodes is valid within current topology version. See Graph Invalidation for details on invalidation. This method is not thread safe. > Note > This method is called in the destructor and therefore must be marked as final Check if this node is valid in the topology, dropping all connections if it is not. This method checks if the node is valid in the topology (i.e. checks the node’s topology stamp with the topology). If it is not valid, all parent and child connections are removed and the cycle count is set back to zero. If the node is valid in the topology, this method does nothing. See Graph Invalidation to better understand stamps, topologies, and invalidation. This method is not thread safe. inline IDef* getDef_abi() noexcept ### Access the node’s definition (can be empty). When you wish to determine if the attached definition is either opaque or a graph, consider calling omni::graph::exec::unstable::INode::getNodeDef() or omni::graph::exec::unstable::INode::getNodeGraphDef() rather than this method. The returned omni::graph::exec::unstable::IDef will **not** have omni::core::IObject::acquire() called before being returned. #### Thread Safety This method is thread safe during execution since the definition is not expected to change during execution. During construction, access to this method must be coordinated between the passes building the graph. ### Access node definition (can be empty). If the returned pointer is `nullptr`, either the definition does not implement omni::graph::exec::unstable::INodeDef or there is no definition attached to the node. The returned omni::graph::exec::unstable::INodeDef will **not** have omni::core::IObject::acquire() called before being returned. Also see omni::graph::exec::unstable::INode::getDef() and omni::graph::exec::unstable::INode::getNodeGraphDef(). #### Thread Safety This method is thread safe during execution since the definition is not expected to change during execution. During construction, access to this method must be coordinated between the passes building the graph. ### Access node’s graph definition (can be empty) The returned graph definition pointer is the graph definition which defines the work this node represents. The returned pointer **is not** the graph definition that contains this node. If the returned pointer is `nullptr`, either the definition does not implement omni::graph::exec::unstable::INodeGraphDef or there is no definition attached to the node. The returned omni::graph::exec::unstable::INodeGraphDef will **not** have omni::core::IObject::acquire() called before being returned. Also see omni::graph::exec::unstable::INode::getDef() and omni::graph::exec::unstable::INode::getNodeDef(). #### Thread Safety This method is thread safe during execution since the definition is not expected to change during execution. During construction, access to this method must be coordinated between the passes building the graph. ### _addParent_abi Method ```cpp inline void _addParent_abi(IGraphBuilderNode* parent) noexcept override ``` Adds the given node as a parent (i.e. upstream) of this node. - **Note**: omni::core::IObject::acquire() is not called on the given node. It is up to the calling code to ensure the node persists while in use by this interface. - **Requirement**: `parent` must not be `nullptr`. - **Behavior**: It is undefined behavior to add a parent multiple times to a node. - **Usage**: Do not directly call this method. Instead, call omni::graph::exec::unstable::IGraphBuilder::connect(). - **Thread Safety**: This method is not thread safe. ### _removeParent_abi Method ```cpp inline void _removeParent_abi(IGraphBuilderNode* parent) noexcept override ``` Removes the given node as a parent. - **Note**: It is not an error if the given node is not a parent. - **Condition**: The given node may be `nullptr`. - **Usage**: Do not directly call this method. Instead, call omni::graph::exec::unstable::IGraphBuilder::disconnect(). - **Thread Safety**: This method is not thread safe. ### _addChild_abi Method ```cpp inline void _addChild_abi(IGraphBuilderNode* child) noexcept override ``` Adds a child node to the current node. - **Usage**: Do not directly call this method. Instead, call omni::graph::exec::unstable::IGraphBuilder::addChild(). - **Thread Safety**: This method is not thread safe. ### Adds the given node as a child (i.e. downstream) of this node. Adds the given node as a child (i.e. downstream) of this node. omni::core::IObject::acquire() is not called on the given node. It is up to the calling code to ensure the node persists while in use by this interface. `child` must not be `nullptr`. It is undefined behavior to add a child multiple times to a node. Do not directly call this method. Instead, call omni::graph::exec::unstable::IGraphBuilder::connect(). #### Thread Safety This method is not thread safe. ### Removes the given node as a child. Removes the given node as a child. It is not an error if the given node is not a parent. The given node may not be `nullptr`. Do not directly call this method. Instead, call omni::graph::exec::unstable::IGraphBuilder::disconnect(). #### Thread Safety This method is not thread safe. ### Remove from this node’s parent list any nodes that no longer exist in current topology, i.e are invalid. Remove from this node’s parent list any nodes that no longer exist in current topology, i.e are invalid. omni::core::IObject::release() is not called on the invalid nodes. Do not directly call this method. It is used internally by omni::graph::exec::unstable::IGraphBuilder. #### Thread Safety This method is not thread safe. ### Remove from this node’s child list any nodes that no longer exist in current topology, i.e are invalid. Remove from this node’s child list any nodes that no longer exist in current topology, i.e are invalid. omni::core::IObject::release() is not called on the invalid nodes. Do not directly call this method. It is used internally by omni::graph::exec::unstable::IGraphBuilder. #### Thread Safety This method is not thread safe. ### _removeInvalidChildren_abi() Remove from this node’s children list any nodes that no longer exist in current topology, i.e are invalid. omni::core::IObject::release() is not called on the invalid nodes. Do not directly call this method. It is used internally by omni::graph::exec::unstable::IGraphBuilder. **Thread Safety** This method is not thread safe. ### _invalidateConnections_abi() Invalidate all children and parents connections by invalidating the topology stamp this node is synchronized with. Do not directly call this method. It is used internally by omni::graph::exec::unstable::IGraphBuilder. **Thread Safety** This method is thread safe. **Warning** This only removes connections on a single node. The topology has bi-directional connections for every node with the exception of the connection with the root node. ### setCycleParentCount_abi(uint32_t count) Sets the number of parents who are a part of cycle. **Thread Safety** This method is not thread safe. ### _setNodeDef_abi(INodeDef *nodeDef) Sets the definition for this node. If a definition is already set, it will be replaced by the given definition. The given definition may be `nullptr`. omni::core::IObject::acquire() is called on the given pointer. See also omni::graph::exec::unstable::IGraphBuilderNode::_setNodeGraphDef(). Do not directly call this method. Instead, call omni::graph::exec::unstable::IGraphBuilder::setNodeDef(). **Thread Safety** This method is not thread safe. Sets the definition for this node. If a definition is already set, it will be replaced by the given definition. The given definition may be `nullptr`. omni::core::IObject::acquire() is called on the given pointer. See also omni::graph::exec::unstable::IGraphBuilderNode::_setNodeDef(). Do not directly call this method. Instead, call omni::graph::exec::unstable::IGraphBuilder::setNodeGraphDef(). **Thread Safety** This method is not thread safe. Unsets this node’s definition. If the definition is already `nullptr`, this method does nothing. Do not directly call this method. Instead, call omni::graph::exec::unstable::IGraphBuilder::clearDef(). **Thread Safety** This method is not thread safe. ### Access the parent at the given index. It is an error if the the given index is greater than the parent count. See omni::graph::exec::unstable::IGraphBuilderNode::getParentCount(). Consider using omni::graph::exec::unstable::IGraphBuilderNode::getParents() for a modern C++ wrapper to this method. The returned omni::graph::exec::unstable::IGraphBuilderNode will **not** have omni::core::IObject::acquire() called before being returned. The returned pointer will not be `nullptr`. **Thread Safety** This method is not thread safe. ### Returns the number of parents. **Thread Safety** This method is not thread safe. ### Access the child at the given index. It is an error if the the given index is greater than the child count. See omni::graph::exec::unstable::IGraphBuilderNode::getChildCount(). Consider using omni::graph::exec::unstable::IGraphBuilderNode::getChildren() for a modern C++ wrapper to this method. The returned omni::graph::exec::unstable::IGraphBuilderNode will **not** have omni::core::IObject::acquire() called before being returned. The returned pointer will not be `nullptr`. **Thread Safety** This method is not thread safe. ```c uint64_t ``` ```c getChildCount_abi() noexcept override ``` Returns the number of children. **Thread Safety** This method is not thread safe. ```c inline bool hasChild_abi(IGraphBuilderNode* node) noexcept override ``` Returns `true` if the given node is an immediate child of this node. `node` may be `nullptr`. **Thread Safety** This method is not thread safe. ```c inline bool isRoot_abi() noexcept override ``` Returns `true` if this node is the root of the topology. **Thread Safety** This method is not thread safe. ```c inline IGraphBuilderNode* getRoot_abi() noexcept ``` Returns the root node of the topology of which this node is a part. The returned omni::graph::exec::unstable::IGraphBuilderNode will *not* have omni::core::IObject::acquire() called before being returned. The returned pointer will not be `nullptr`. **Thread Safety** This method is not thread safe. Constructor. ### NodeT(ITopology*, INodeDef*, const carb::cpp::string_view&) noexcept Constructor. ### NodeT(ITopology*, INodeDef*, const carb::cpp::string_view&) noexcept Constructor. ### void acquire_abi() noexcept override Increments the object’s reference count. Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire(). Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you. **Thread Safety** This method is thread safe. ### void release_abi() noexcept ### Release ABI `noexcept override` - **Decrements the objects reference count.** - Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement). - Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call `omni::core::IObject::release()` on the same pointer from which you called `omni::core::IObject::acquire()`. - Do not directly use this method, rather use `omni::core::ObjectPtr`, which will manage calling `omni::core::IObject::acquire()` and `omni::core::IObject::release()` for you. - **Thread Safety** - This method is thread safe. ### Get Use Count ABI `inline noexcept override uint32_t getUseCount_abi()` - Returns the number of different instances (this included) referencing the current object. ### Cast ABI `inline noexcept override void* cast_abi(omni::core::TypeId id)` - Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface. - Objects can support multiple interfaces, even interfaces that are in different inheritance chains. - The returned object will have `omni::core::IObject::acquire()` called on it before it is returned, meaning it is up to the caller to call `omni::core::IObject::release()` on the returned pointer. - The returned pointer can be safely `reinterpret_cast<>` to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to `omni::windowing::IWindow`. - Do not directly use this method, rather use a wrapper function like `omni::core::cast()` or `omni::core::ObjectPtr::as()`. - **Thread Safety** - This method is thread safe. ### Cast Without Acquire ABI `inline noexcept override void* castWithoutAcquire_abi(omni::core::TypeId id)` - Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface, without calling `omni::core::IObject::acquire()`. - Objects can support multiple interfaces, even interfaces that are in different inheritance chains. - The returned pointer can be safely `reinterpret_cast<>` to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to `omni::windowing::IWindow`. - Do not directly use this method, rather use a wrapper function like `omni::core::cast()` or `omni::core::ObjectPtr::as()`. - **Thread Safety** - This method is thread safe. Casts this object to the type described the the given id. Returns `nullptr` if the cast was not successful. Unlike omni::core::IObject::cast(), this casting method does not call omni::core::IObject::acquire(). **Thread Safety** This method is thread safe. ## Protected Attributes ### m_refCount Reference count.
22,187
_CPPv4IDpEN4omni5graph4exec8unstable8NodeDefTE_classomni_1_1graph_1_1exec_1_1unstable_1_1NodeDefT.md
# omni::graph::exec::unstable::NodeDefT Defined in `omni/graph/exec/unstable/NodeDef.h` ## Class Definition ```cpp template<typename ...Bases> class NodeDefT : public omni::graph::exec::unstable::Implements<Bases...> ``` ### Description Opaque node definition. Nodes are opaque because the Execution Framework has no knowledge of what the execution method will do and does not orchestrate generation and dispatch of the tasks. ``` Node definitions can be shared across multiple nodes and graphs. The implementation should leverage execution task to operate within proper task state. See [Execution Concepts](../ExecutionConcepts.html#ef-execution-concepts) for an in-depth guide on how this object is used during execution. See also omni::graph::exec::unstable::ExecutionTask, omni::graph::exec::unstable::ExecutionPath. Subclassed by omni::graph::exec::unstable::NodeDefLambda ### Public Functions - **acquire()** - Increments the object’s reference count. - Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire(). - Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you. - **Thread Safety**: This method is thread safe. - **release()** - Decrements the objects reference count. - Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement). - Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire(). - Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you. - **Thread Safety**: This method is thread safe. - **getUseCount()** - Returns the number of different instances (this included) referencing the current object. - **Thread Safety**: This method is thread safe. - **cast(omni::core::TypeId)** - This method is used to cast the object to a different type. <span class="sig-name descname"> <span class="n"> <span class="pre"> cast ( <span class="n"> <span class="pre"> omni :: <span class="n"> <span class="pre"> core :: <span class="n"> <span class="pre"> TypeId <span class="n sig-param"> <span class="pre"> id ) <span class="k"> <span class="pre"> noexcept <p> See omni::core::IObject::cast. <span class="sig-name descname"> <span class="n"> <span class="pre"> castWithoutAcquire ( <span class="n"> <span class="pre"> omni :: <span class="n"> <span class="pre"> core :: <span class="n"> <span class="pre"> TypeId <span class="n sig-param"> <span class="pre"> id ) <span class="k"> <span class="pre"> noexcept <p> See omni::graph::exec::unstable::IBase_abi::castWithoutAcquire_abi. <p class="breathe-sectiondef-title rubric-h3 rubric" id="breathe-section-title-public-static-functions"> Public Static Functions <span class="sig-name descname"> <span class="n"> <span class="pre"> create ( <span class="k"> <span class="pre"> const <span class="n"> <span class="pre"> carb :: <span class="pre"> string_view ) Construct node definition. This function always returns a valid pointer. Parameters ---------- * **definitionName** – Definition name is considered as a token that transformation passes can register against. This name must not be `nullptr`. Protected Functions ------------------- ### Protected Functions Execute the node definition. The given task must not be `nullptr`. Prefer calling omni::graph::exec::unstable::ExecutionTask::execute() rather than this method as omni::graph::exec::unstable::ExecutionTask::execute() populates information such as `omni::graph::exec::unstable::getCurrentTask()`. See [Error Handling](../ErrorHandling.html#ef-error-handling) to understand the error handling/reporting responsibilities of implementors of this method. Unless overriden by a subclass, returns `Status::eSuccess`. Thread Safety -------------- See thread safety information in interface description. Get scheduling info for the node definition. The given task must not be `nullptr`. Prefer calling omni::graph::exec::unstable::ExecutionTask::execute() rather than this method as omni::graph::exec::unstable::ExecutionTask::execute() populates information such as `omni::graph::exec::unstable::getCurrentTask()`. See [Error Handling](../ErrorHandling.html#ef-error-handling) to understand the error handling/reporting responsibilities of implementors of this method. Unless overriden by a subclass, returns `Status::eSuccess`. Thread Safety -------------- See thread safety information in interface description. ### ExecutionTask * info ) noexcept override Provides runtime information about scheduling constraints for a given task/node. The provided omni::graph::exec::unstable::ExecutionTask can be used to determine the path of the current definition. The given task must not be `nullptr`. Unless overriden by a subclass, returns SchedulingInfo::eSerial. #### Thread Safety See thread safety information in interface description. ### ConstName *getName_abi() Return unique definition identifier. The returned pointer is never `nullptr`. The lifetime of the data returned is tied to the lifetime of this object. #### Thread Safety See thread safety information in interface description. ### NodeDefT(const carb::cpp::string_view& definitionName) Constructor. ### acquire_abi() ## acquire_abi() - **Description**: Increments the object’s reference count. - **Usage**: Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire(). - **Recommendation**: Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you. - **Thread Safety**: This method is thread safe. ## release_abi() - **Description**: Decrements the objects reference count. - **Behavior**: Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement). - **Usage**: Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire(). - **Recommendation**: Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you. - **Thread Safety**: This method is thread safe. ## getUseCount_abi() - **Description**: Returns the number of different instances (this included) referencing the current object. ## cast_abi(omni::core::TypeId) - **Description**: Casts the object to a different type without acquiring it. TypeId id ) noexcept override Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface. Objects can support multiple interfaces, even interfaces that are in different inheritance chains. The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer. The returned pointer can be safely ```cpp reinterpret_cast<>() ``` to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to ```cpp omni::windowing::IWindow ``` . Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as(). #### Thread Safety This method is thread safe. ```cpp inline void *castWithoutAcquire_abi(omni::core::TypeId id) noexcept override ``` Casts this object to the type described the the given id. Returns ```cpp nullptr ``` if the cast was not successful. Unlike omni::core::IObject::cast(), this casting method does not call omni::core::IObject::acquire(). #### Thread Safety This method is thread safe. ```cpp std::atomic<uint32_t> m_refCount ``` Protected Attributes ``` Reference count.
8,440
_CPPv4N4omni3usd10UsdContextE_classomni_1_1usd_1_1UsdContext.md
# omni::usd::UsdContext Defined in omni/usd/UsdContext.h ## Public Types ### EngineWarmupConfig Extract the engine warmup config from the settings. ## Public Functions ### void runRenderRunLoop(const hydra::FrameIdentifier&) ```cpp const hydra::FrameIdentifier &frameIdentifier ``` ```cpp void checkHydraRenderFinished() ``` ```cpp void releaseRenderResult(size_t frameNumber, omni::usd::PathH renderProductPath) ``` ```cpp bool addHydraEngine(const char *name, omni::usd::hydra::IHydraEngine *hydraEngine, omni::usd::hydra::OpaqueSharedHydraEngineContextPtr hydraEngineContext) ``` ### Function: addHydraEngine ```cpp OpaqueSharedHydraEngineContextPtr ctx, const omni::usd::hydra::HydraEngineContextConfig &config, bool defer ``` - **Description**: - Adds a hydra engine with associated renderer to context. - The syncScopes determines which rendering thread the hydra engine should run on. It should correspond to the syncScope that was passed into the IHydraEngine during creation. - **Returns**: - true if hydra engines are created, false otherwise. ### Function: removeAllHydraEngines ```cpp void removeAllHydraEngines() ``` - **Description**: - Destroys all hydra engines. ### Function: setActiveHydraEngine ```cpp void setActiveHydraEngine(const char *name) ``` - **Description**: - Controls two things: - Specifies the default hydra engine to use with hydraEngine = null in CreateViewport. - [TODO] Controls the hydra engine used for selection and picking, this feels wrong and instead the picking api should include a hydra engine, and if non specified use the default. This API should instead be setDefaultHydraEngine. ### Function: getActiveHydraEngineName ```cpp const char *getActiveHydraEngineName() ``` - **Description**: - Return the name of active hydra engine. ## Function: addHydraSceneDelegate ```cpp bool addHydraSceneDelegate(const char *name, const char *hydraEngine, const omni::usd::hydra::IHydraSceneDelegate &sceneDelegate, const char *delegateCreateParam); ``` Adds a hydra scene delegate with associated input data to the context. ### Parameters - **name** – should be unique, and will be used for identifying the scene delegate in future calls. If the name is not unique, the add call will fail. - **hydraEngine** – a string representing which hydra engine this delegate should be added for. For instance, “rtx” - **sceneDelegate** – the new scene delegate interface to add - **delegateCreateParam** – a parameter to pass to the sceneDelegate’s Create function ### Returns true if successfully added, false otherwise ## Function: removeHydraSceneDelegate ```cpp bool removeHydraSceneDelegate(const char *name); ``` Removes a hydra scene delegate. ### Parameters - **name** – should match the name passed to addHydraSceneDelegate ### Returns true if successfully removed, false otherwise ## Function: setHydraSceneDelegateRootTransform ```cpp bool setHydraSceneDelegateRootTransform(const char *name, const PXR_NS::GfMatrix4d &rootTransform); ``` Sets the root transform for a hydra scene delegate. ### Parameters - **name** – should match the name passed to addHydraSceneDelegate - **rootTransform** – the new root transform to apply ### Returns true if successfully set, false otherwise ```cpp setHydraSceneDelegateRootTransform(const char *name, const PXR_NS::GfMatrix4d &xform) ``` Sets a global transform for all content in a named hydra scene delegate. **Parameters** - **name** – should match the name passed to addHydraSceneDelegate - **xform** – a transform to apply to everything in the delegate **Returns** - true if successfully removed, false otherwise ```cpp getHydraSceneDelegateAttribute(const char *name, const PXR_NS::SdfPath &primPath, const PXR_NS::TfToken &attribueName, PXR_NS::VtValue &attributeValue) ``` Gets a named attribute of a prim from a named hydra scene delegate. **Parameters** - **name** – should match the name passed to addHydraSceneDelegate - **primPath** – is the path to the prim containing the attribute - **attributeName** – name of the attribute - **attributeValue** – a VtValue to populate with the value of the attribute **Returns** - true if successfully accessed the scene delegate, false otherwise ``` ## computeHydraSceneDelegateWorldBoundingBox ```cpp void computeHydraSceneDelegateWorldBoundingBox(const char *name, double *bbox); ``` Computs a world bounding box for all content in a named hydra scene delegate. ### Parameters - **name** – should match the name passed to addHydraSceneDelegate - **bbox** – is an array of 12 elements (4 x vector3, min/max bounds, center, size) ## useFabricSceneDelegate ```cpp bool useFabricSceneDelegate() const; ``` Returns true if the Fabric scene delegate is in use. This changes behavior in Fabric population, StageReaderWriter copies to the ring buffer, and Fabric USD notice handling. This is the value of the “/app/useFabricSceneDelegate” carb setting when the stage is first loaded, and remains constant until the next stage load to avoid bad behavior with already allocated scene delegates and hydra engines. ## hasMDLHydraRenderer ```cpp bool hasMDLHydraRenderer() const; ``` Checks if any Hydra Renderer supports MDL. ### Returns true if a Hydra renderer supports MDL, false otherwise. ## getSceneRenderer ```cpp carb::scenerenderer::SceneRenderer *getSceneRenderer() const; ``` Returns the RTX SceneRenderer if a “rtx” hydra engine exists, otherwise nullptr. Note, tightly coupled with getScene(). [TODO] Remove this API Used for PrimitiveListDrawing Trigger “compile shaders” for F9 MaterialWatcher for getNeurayDbScopeName() Kit.Legacy Editor python bindings for get_current_renderer_status Returns the RTX SceneRenderer Context if a “rtx” hydra engine exists, otherwise nullptr. Update function to be called once every frame. Parameters ---------- - **elapsedTime** – Elapsed time in seconds since last update call. Returns ------- true if omniverse has new update during this frame. Creates a new USD stage. This is an asynchronous call. Parameters ---------- - **fn** – the callback function when stage is created or fails to create. Synchronous version of. See also -------- - [newStage(const OnStageResultFn&amp; resultFn)](classomni_1_1usd_1_1UsdContext_1a474ea106bb268e1c153ab9c658634dd4); ## Functions ### attachStage ```cpp bool attachStage(long stageId, const OnStageResultFn &resultFn); ``` Attaches an opened USD stage. This is an asynchronous call. #### Parameters - **stageId** – The stage id saved into UsdUtilsStageCache. - **resultFn** – The callback function when stage is attached successfully or fails to attach. ### openStage ```cpp bool openStage(const char *fileUrl, const OnStageResultFn &resultFn, UsdContextInitialLoadSet loadSet = UsdContextInitialLoadSet::eLoadAll); ``` Opens a existing USD stage. This is an asynchronous call. #### Parameters - **url** – The file path. For Omniverse file, you must connect to Omniverse first and pass the url with prefix “omniverse:”. - **fn** – The callback function when stage is opened or fails to open. - **loadSet** – Specifies the initial set of prims to load when opening a UsdStage. bool openStage(const char *fileUrl, UsdContextInitialLoadSet loadSet = UsdContextInitialLoadSet::eLoadAll) Synchronous version of. See also -------- openStage(const char* fileUrl, const OnStageResultFn& resultFn); bool reopenStage(const OnStageResultFn& resultFn, UsdContextInitialLoadSet loadSet = UsdContextInitialLoadSet::eLoadAll) Reopens current USD stage. This is an asynchronous call. Parameters ---------- fn – The callback function when stage is reopened or fails to reopen. bool reopenStage(UsdContextInitialLoadSet loadSet = UsdContextInitialLoadSet::eLoadAll) ### UsdContextInitialLoadSet - **UsdContextInitialLoadSet** :: **eLoadAll** - Synchronous version of. - **See also** - reopenStage(const OnStageResultFn& resultFn); ### closeStage(const OnStageResultFn& resultFn) - Close current USD stage. - This is an asynchronous call. - **Parameters** - **fn** – The callback function when stage is closed for fails to close. ### closeStage() - Synchronous version of. - **See also** - closeStage(const OnStageResultFn& resultFn); ### saveLayer(const std::string& layerIdentifier, const OnLayersSavedResultFn& resultFn) - Saves specific layer only. - This is an asynchronous call. ### Parameters - **layerIdentifier** – The layer to save. - **fn** – The callback function when stage is saved or fails to save. ### Returns - true if it’s saved successfully. ### Function: saveLayer - **saveLayer**(const std::string& layerIdentifier) - Synchronous version of. - See also: saveLayer(const std::string& layerIdentifier, const OnStageResultFn& resultFn); ### Function: saveLayers - **saveLayers**(const std::string& newRootLayerPath, const std::vector<std::string>& layerIdentifiers, const OnLayersSavedResultFn& resultFn) - Saves specific layers only. - This is an asynchronous call. - Parameters: - **newRootLayerPath** – If it’s not empty, it means to do save root layer to new place. This will trigger stage reload to open new root layer. - **layerIdentifiers** – The layers to save. It will save all dirty changes of them. - **fn** – The callback function when stage is saved or fails to save. - Returns: - true if it’s saved successfully. <dd class="field-even"> <p> true if it’s saved successfully. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni3usd10UsdContext10saveLayersERKNSt6stringERKNSt6vectorINSt6stringEEE"> <span class="kt"> <span class="pre"> bool <span class="sig-name descname"> <span class="n"> <span class="pre"> saveLayers <span class="sig-paren"> ( <span class="k"> <span class="pre"> const <span class="n"> <span class="pre"> std <span class="p"> <span class="pre"> :: <span class="n"> <span class="pre"> string <span class="p"> <span class="pre"> &amp; <span class="n sig-param"> <span class="pre"> newRootLayerPath , <span class="k"> <span class="pre"> const <span class="n"> <span class="pre"> std <span class="p"> <span class="pre"> :: <span class="n"> <span class="pre"> vector <span class="p"> <span class="pre"> &lt; <span class="n"> <span class="pre"> std <span class="p"> <span class="pre"> :: <span class="n"> <span class="pre"> string <span class="p"> <span class="pre"> &gt; <span class="p"> <span class="pre"> &amp; <span class="n sig-param"> <span class="pre"> layerIdentifiers <span class="sig-paren"> ) <dd> <p> Synchronous version of. <p> See also <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni3usd10UsdContext9saveStageERK21OnLayersSavedResultFn"> <span class="kt"> <span class="pre"> bool <span class="sig-name descname"> <span class="n"> <span class="pre"> saveStage <span class="sig-paren"> ( <span class="k"> <span class="pre"> const <span class="n"> <span class="pre"> OnLayersSavedResultFn <span class="p"> <span class="pre"> &amp; <span class="n sig-param"> <span class="pre"> resultFn <span class="sig-paren"> ) <dd> <p> Saves current USD stage. <p> This is an asynchronous call. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> fn – The callback function when stage is saved or fails to save. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni3usd10UsdContext9saveStageEv"> <span class="kt"> <span class="pre"> bool <span class="sig-name descname"> <span class="n"> <span class="pre"> saveStage <span class="sig-paren"> ( <span class="sig-paren"> ) <dd> <p> Synchronous version of. <p> See also bool saveAsStage(const char* url, const OnLayersSavedResultFn& resultFn) Saves current USD stage to a different location. This is an asynchronous call. Parameters: - url – The new location to save the USD stage. - fn – The callback function when stage is saved or fails to save. bool saveAsStage(const char* url) Synchronous version of. See also: saveAsStage(const char* url, const OnStageResultFn& resultFn); bool exportAsStage(const char* url, const OnStageResultFn& resultFn) Exports current USD stage to a different location. This is an asynchronous call. It will composite current stage into a single flattened layer. Parameters: - url – The new location to save the USD stage. - fn – The callback function when stage is saved or fails to save. ## Functions ### exportAsStage ```cpp bool exportAsStage(const char* url) const; ``` Synchronous version of. See also : [exportAsStage(const char* url, const OnStageResultFn& resultFn) const](#classomni_1_1usd_1_1UsdContext_1adbce8da809d7446417ad4afcb0eff62a); ### isNewStage ```cpp bool isNewStage() const; ``` Checks if currently opened stage is created by calling [newStage](#classomni_1_1usd_1_1UsdContext_1a474ea106bb268e1c153ab9c658634dd4). Returns : true if current stage is a new stage. ### canCloseStage ```cpp bool canCloseStage() const; ``` Checks if it’s safe to close stage at calling time. Returns : true if it is safe to close the stage (when current stage is fully opened). false if it’s unsafe to close current stage (when current stage is still being opened or closed). ### canSaveStage ```cpp bool canSaveStage() const; ``` Checks if a USD stage is opened and in a savable stage (not opening/closing in progress). Returns : true if the stage is opened and savable, false is no stage is opened or opened stage is not savable. ### canOpenStage ```cpp bool canOpenStage() const; ``` Checks if a USD stage is opened and in a savable stage (not opening/closing in progress). Returns : true if the stage is opened and savable, false is no stage is opened or opened stage is not savable. Checks if it’s safe to open a different stage at calling time. Returns : true if it is safe to open a different stage (when current stage is fully opened or closed). false if it’s unsafe to open different stage (when current stage is still being opened or closed). Checks if there is enough permissions to save the stage at calling time. Returns : true if it is possible to save the stage. false if it’s not possible to save current stage. Gets the state of current stage. Returns : state of current stage. Gets UsdStage. Returns : UsdStageWeakPtr of current stage. Gets UsdStage id. Returns : id of current stage. ## Functions ### getStageUrl ```cpp const std::string & getStageUrl() const; ``` Gets the url of current stage. **Returns:** url of current stage. ### hasPendingEdit ```cpp bool hasPendingEdit() const; ``` Checks if current stage is dirty. **Returns:** true if current stage is dirty. ### setPendingEdit ```cpp void setPendingEdit(bool edit); ``` Marks the edits state of current opened stage. It means changes are pending to be saved if you set it to true, or false otherwise. This will disgard the real state of opened stage. For example, if the opened stage has real changes to be saved, `hasPendingEdit()` will still return false if you set it to false. **Parameters:** - **edit** – true to set pending edits state, false to unset pending edits state ### getStageEventStream ```cpp carb::events::IEventStreamPtr getStageEventStream(); ``` Gets the carb::events::IEventStreamPtr for StageEvent. **Returns:** the carb::events::IEventStream for StageEvent. ### getRenderingEventStream ```cpp carb::events::IEventStreamPtr getRenderingEventStream(); ``` Gets the carb::events::IEventStreamPtr for RenderingEvent. **Returns:** the carb::events::IEventStream for RenderingEvent. :: events :: IEventStreamPtr getRenderingEventStream() Gets the carb::events::IEventStreamPtr for RenderingEvent. Returns the carb::events::IEventStream for RenderingEvent. void sendEvent(carb::events::IEventPtr &event, bool blockingAsync = false) Sends a StageEvent to UsdStageEvent stream. It chooses to send event sync/async based on syncUsdLoads option. Parameters event – The event to be sent. blockingAsync – If the event is sent as async, true to wait on the event until it has been processed by all subscribers. false to return immediately. bool isOmniStage() const Gets if the current stage is opened from Omniverse. Returns true if the stage is opened from Omniverse. void saveRenderSettingsToCurrentStage() Saves render settings to current opened USD stage. void loadRenderSettingsFromStage(l-i) Loads render settings from the specified USD stage. ### loadRenderSettingsFromStage(long int stageId) Loads render settings from stage. **Parameters** - **stageId** – The stage id saved into UsdUtilsStageCache. ### getPickedWorldPos(ViewportHandle handle, carb::Double3 &outWorldPos) Gets the picked position in world space since last picking request. **Parameters** - **outWorldPos** – The picked world space position. **Returns** - true if the result is valid, false if result is not valid. ### getPickedGeometryHit(ViewportHandle handle, carb::Double3 &outWorldPos, carb::Float3 &outNormal) Gets the picked geometry hit data - position in world space and normal since last picking request. **Parameters** - **outWorldPos** – The picked world space position. - **outNormal** – The picked normal. **Returns** - true if the result is valid, false if result is not valid. ### computePrimWorldBoundingBox Gets the AABB of a prim. **Parameters** - **prim** – The prim to get AABB from. **Returns** - The AABB of the prim. ### computePathWorldBoundingBox Gets the AABB of a path as carb::Doubles3 (primarily for Python). **Parameters** - **path** – The path to get AABB from. - **aabbMin** – Where to store the min-extents. - **aabbMax** – Where to store the max-extents. ### computePrimWorldTransform <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni3usd10UsdContext25computePrimWorldTransformERKN3pxr7UsdPrimE"> <span class="kt"> <span class="pre"> void <span class="w"> <span class="sig-name descname"> <span class="n"> <span class="pre"> computePrimWorldTransform <span class="sig-paren"> ( <span class="k"> <span class="pre"> const <span class="w"> <span class="n"> <span class="pre"> pxr <span class="p"> <span class="pre"> :: <span class="n"> <span class="pre"> UsdPrim <span class="w"> <span class="p"> <span class="pre"> &amp; <span class="n sig-param"> <span class="pre"> prim <span class="sig-paren"> ) <br/> <dd> <p> Gets the GfMatrix4 of a prim as stored in the current bbox cache. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> prim – The prim to get the transform of. <dt class="field-even"> Returns <dd class="field-even"> <p> The world-space GfMatrix4 of the prim. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni3usd10UsdContext25computePrimWorldTransformERKNSt6stringERNSt5arrayIdXL16EEEE"> <span class="kt"> <span class="pre"> void <span class="w"> <span class="sig-name descname"> <span class="n"> <span class="pre"> computePrimWorldTransform <span class="sig-paren"> ( <span class="k"> <span class="pre"> const <span class="w"> <span class="n"> <span class="pre"> std <span class="p"> <span class="pre"> :: <span class="n"> <span class="pre"> string <span class="w"> <span class="p"> <span class="pre"> &amp; <span class="n sig-param"> <span class="pre"> path , <span class="n"> <span class="pre"> std <span class="p"> <span class="pre"> :: <span class="n"> <span class="pre"> array <span class="p"> <span class="pre"> &lt; <span class="kt"> <span class="pre"> double <span class="p"> <span class="pre"> , <span class="w"> <span class="m"> <span class="pre"> 16 <span class="p"> <span class="pre"> &gt; <span class="w"> <span class="p"> <span class="pre"> &amp; <span class="n sig-param"> <span class="pre"> flattened <span class="sig-paren"> ) <br/> <dd> <p> Gets the GfMatrix4 of a path as stored in the current bbox cache. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <p> <strong> path – The path to a prim to get the transform of. <dt class="field-even"> Returns <dd class="field-even"> <p> The world-space GfMatrix4 of the prim at the path. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni3usd10UsdContext21getStageLoadingStatusERNSt6stringER7int32_tR7int32_t"> <span class="kt"> <span class="pre"> void <span class="w"> <span class="sig-name descname"> <span class="n"> <span class="pre"> getStageLoadingStatus <span class="sig-paren"> ( <span class="n"> <span class="pre"> std <span class="p"> <span class="pre"> :: <span class="n"> <span class="pre"> string <span class="w"> <span class="p"> <span class="pre"> &amp; <span class="n sig-param"> <span class="pre"> message , <span class="n"> <span class="pre"> int32_t <span class="w"> <span class="p"> <span class="pre"> &amp; <span class="n sig-param"> <span class="pre"> filesLoaded , <span class="n"> <span class="pre"> int32_t <span class="w"> <span class="p"> <span class="pre"> &amp; <span class="n sig-param"> <span class="pre"> totalFiles <span class="sig-paren"> ) <br/> <dd> <p> Gets the stage loading status. <dl class="field-list simple"> <dt class="field-odd"> Parameters <dd class="field-odd"> <ul class="simple"> <li> <p> <strong> The – message of current stage loading. <li> <p> <strong> filesLoaded – Number of files already loaded. <dt class="field-even"> Returns <dd class="field-even"> <p> The world-space GfMatrix4 of the prim at the path. ### Function Details #### Function: getRenderablePaths - **Description**: Returns all renderable paths for given prim path and its descendatns. - Renderable paths are prims of type instancer or geometry. - **Parameters**: - **primPath** – Prim path - **unOrderedRenderablePathSet** – An unordered output path set. #### Function: getRenderablePaths (Template) - **Description**: Returns all renderable paths for given prim path and its descendatns. - Renderable paths are prims of type instancer or geometry. - **Parameters**: - **primPath** – Prim path - **renderablePathSet** – An ordered output path set. #### Function: setPickable - **Description**: Sets the pickable state of a prim. - **Parameters**: - **primName** – Name of the prim - **pickable** – Boolean indicating whether the prim is pickable ### omni::usd::UsdContext::setPickable ```cpp void setPickable( primPath, bool isPickable ) ``` Sets the mouse pickable state of a prim. #### Parameters - **primPath** – The path of the prim to set pickable state. - **isPickable** – true if to set the prim to be pickable, false to set to unpickable. ### omni::usd::UsdContext::getRendererScene ```cpp carb::scenerenderer::SceneId getRendererScene() ``` Returns the SceneId from the RTX SceneRenderer if a “rtx” hydra engine exists. Note, usage coupled with `getSceneRenderer()`. #### Returns - carb::scenerenderer::SceneId of current scene. ### omni::usd::UsdContext::stopAsyncRendering ```cpp void stopAsyncRendering() ``` Stops all async hydra rendering. Waits for completion of in-flight tasks then requests RunLoops for rendering to exit ### omni::usd::UsdContext::enableUsdWrites ```cpp void enableUsdWrites(bool enabled) ``` Currently writing to usd during async rendering can cause a data race. This necessitates the prescence of certain mutex to protect usd data access. This call controls the usage of this mutex and will block until it is safe to begin writes. If a usd write occurs while this is disabled, undefined behavior is likely. Can only be called from the main thread for safety reasons. #### Note This function is deprecated. #### Parameters - **enabled** – if true enables the usage of a mutex to protect usd write operations. ### omni::usd::UsdContext::enableUsdLocking ```cpp void enableUsdLocking() ``` USD is a global shared resource. Invoking `enableUsdLocking()` lets `UsdContext` manage the locking of this resource. enableUsdLocking will lock() the resource and manage locking/unlocking going forward disableUsdLocking() will unlock() the resource and make no subsequent lock/unlock calls WARNING: enableUsdLocking and disableUsdLocking will only work when called from the main thread. Returns the status of usd write back. If not true, writing to usd may cause undefined behavior. > **Note** > This function is deprecated. **Returns** true if write back is enabled and false otherwise. ### Function: createViewport ```cpp void createViewport(deviceMask) ``` Creates a new ViewportHandle for the hydraEngine at the specified tick rate. A tickrate of -1 means “render as fast as possible”. Will not create a new HydraEngine, a HydraEngine must be available. HydraEngines are added by `addHydraEngine()`. **Returns** - ViewportHandle that’s used in `addRender()`, `getRenderResults()`, `destroyViewport()`. ### Function: destroyViewport ```cpp void destroyViewport(viewportHandle) ``` Destroys the ViewportHandle that was created in createViewport then requests RunLoops for rendering to exit. ### Function: getRenderResults ```cpp const omni::usd::hydra::ViewportHydraRenderResults* getRenderResults(viewportHandle, bool bBlock = false) ``` Returns the latest available rendering result. It is assumed main/simulation thread runs at the same rate or faster than hydra engine tick rate. If you query the FPS of the returned value, it will match the hydra engine render rate. bBlock == true will trigger hydraRendering() + checkForHydraResults() outside of defined update order in omni::kit::update::UpdateOrderings if necessary. **Returns** - ViewportHydraRenderResults the latest available hydra render result ### Function: addRender ```cpp void addRender(ViewportHandle, omni::usd::PathH, PickingCP) ``` Adds a render request for the specified ViewportHandle. ### omni::usd::UsdContext::addRender ```cpp void addRender( handle, omni::usd::PathH renderProductPrimPath, const Picking* picking = nullptr ) ``` The ViewportHandle and the RenderProduct USD Prim Path to render. ### omni::usd::UsdContext::getSelection ```cpp Selection* getSelection() ``` Gets [Selection](classomni_1_1usd_1_1Selection.html#classomni_1_1usd_1_1Selection) instance. ### omni::usd::UsdContext::getSelectionC ```cpp const Selection* getSelection() const ``` Gets const [Selection](classomni_1_1usd_1_1Selection.html#classomni_1_1usd_1_1Selection) instance. ### omni::usd::UsdContext::getAudioManagerC ```cpp const audio::AudioManager* getAudioManager() const ``` Retrieves the stage audio manager for use in the IStageAudio interface. - Returns: The USD context’s stage audio manager instance. This is valid until the USD context is destroyed. - Returns: nullptr if the stage audio manager was not loaded or failed to load. ### omni::usd::UsdContext::enableSaveToRecentFiles ```cpp void enableSaveToRecentFiles() ``` ### Functions #### enableSaveToRecentFiles() - **Description**: void enableSaveToRecentFiles() #### disableSaveToRecentFiles() - **Description**: void disableSaveToRecentFiles() #### toggleAutoUpdate(bool enabled) - **Description**: - By default `UsdContext` subscribes to IApp for updates. - That can be disabled. Temp function until we refactor Editor.cpp #### GetGeometryInstanceId(const PXR_NS::SdfPath &path, uint32_t *instanceList) - **Description**: Query for instance IDs that are returned to synthetic data. #### GetGeometryId(const PXR_NS::SdfPath &path, uint32_t *geometryList) - **Description**: void GetGeometryId(const PXR_NS::SdfPath &path, uint32_t *geometryList) ### Query for geometry IDs that are returned to synthetic data. ### Query for mesh instance path that is returned to synthetic data. ### Query for mesh geometry path that is returned to synthetic data. ### Adds path to material/shader loading queue. - **Parameters** - **path** – the path of UsdShadeShader to create MDL materials. - **recreate** – If to force recreating the inputs if it’s already populated ### loadInputs - If to create MDL inputs as UsdAttribute on the UsdShadeShader prim. ### Returns - true if scheduled successfully, false if inputs are already created and recreate is false. ### getGizmoUID - Get unique gizmo id. - When it not needed freeGizmoUID should be called so that it can be reused. If it is not called this method return the same uid on next call with given path. - Parameters - **path** – Prim path that will be used for prim selection when gizmo uid is picked. ### freeGizmoUID - Allows to notify that gizmo uid is no longer used. - Parameters - **uid** – Gizmo unique id. ### getPathForGizmoUID - Returns prim path for given gizmo uid. - Parameters - **uid** – Gizmo unique id. - Returns - A pointer to path for given uid or nullptr for invalid uid. ### registerSelectionGroup - Register a selection group. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni3usd10UsdContext22registerSelectionGroupEv"> <dd> <p>Register selection group. <p>Note: Supposed that this function called once at app initialization. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni3usd10UsdContext29setSelectionGroupOutlineColorE7uint8_tRKN4carb6Float4E"> <dd> <p>Setup selection group outline color. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni3usd10UsdContext27setSelectionGroupShadeColorE7uint8_tRKN4carb6Float4E"> <dd> <p>Setup selection group shade color. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni3usd10UsdContext17setSelectionGroupE7uint8_tRKNSt6stringE"> <dd> <p>Set selection group for specified primitives path. <dl class="cpp function"> <dt class="sig sig-object cpp" id="_CPPv4N4omni3usd10UsdContext17getCameraSettingsERKN6PXR_NS7SdfPathEd"> <dd> <p>Get camera settings. Query for camera settings for the camera prim. Set the aperture fit policy. Get frame data for the specified data type, device index, and optionally engine index. Returns the current frame data based on the requested feature, such as profiler data. If frame is not finished processing the data, the result of the previous frame is returned. For multi-GPU, query the device count and then set deviceIndex to the desired device index. ### Parameters - **dataType** – Specified the requested data type to return. - **deviceIndex** – The index of GPU device to get the frame data from. Set to zero in Single-GPU mode. You may query the number of devices with FrameDataType::eGpuProfilerDeviceCount. deviceIndex is ignored when the type is set to eGpuProfilerDeviceCount. - **data** – A pointer to the returned data. Returns nullptr for failures or eGpuProfilerDeviceCount. You may pass nullptr if you only need dataSize. - **dataSize** – The size of the returned data in bytes, the number of structures, or device count based on the dataType. For strings, it includes the null-termination. - **engineIndex** – The index of an attached HydraEngine or -1 for the -active- HydraEngine. ### omni::usd::UsdContext::getAttachedHydraEngineCount() const - Returns the count of attached HydraEngines. ### omni::usd::UsdContext::getAttachedHydraEngineName(size_t hydraEngineIdx) const - Returns the name of the HydraEngine at the specified index. ### omni::usd::UsdContext::getHydraEngineDesc(ViewportHandle handle) const - Returns the description of the HydraEngine associated with the given ViewportHandle. ### omni::usd::UsdContext::registerViewOverrideToHydraEngines(omni::usd::hydra::IViewOverrideBase* viewOverride) - Registers a view override to all HydraEngines. ### omni::usd::UsdContext::registerViewOverrideToHydraEngines(omni::usd::hydra::IViewOverrideBase*) Allow for viewoverrides to be added through the usd context. ### omni::usd::UsdContext::unregisterViewOverrideToHydraEngines(omni::usd::hydra::IViewOverrideBase*) Allow for viewoverrides to be removed through the usd context. ### omni::usd::UsdContext::setUsdContextSchedulingOverride(IUsdContextSchedulingOverride*) Allow scheduling override to be set for usd context. ### omni::usd::UsdContext::resetUsdContextSchedulingOverride() Reset scheduling override. ### omni::usd::UsdContext::getMutex() -> IUsdMutex& Retrieves the mutex for `*this`. ### omni::usd::UsdContext::stopAllPickingForView(ViewPickingId) ```cpp void stopAllPickingForView(ViewPickingId pickingId); ``` Stop any picking in flight for a specific View. ```cpp void setTimeline(const std::string &amp;name = ""); ``` Sets the timeline. This must be called before the context is used, right after its creation. ```cpp std::string getTimelineName() const; ``` Retrieves the name of the timeline. ```cpp timeline::TimelinePtr getTimeline() const; ``` Retrieves the timeline. ```cpp std::string getName() const; ``` Retrieves the name of the context. ### omni::usd::UsdContext::getName() Retrieves the name of the context. ### omni::usd::UsdContext::getOrCreateRunloopThread(const char *name, const hydra::EngineCreationConfig &engineConfig, bool setWarmup) Trigger creation of the runloop associated with the given hydra engine configuration (otherwise it will only be created the first time an associated viewport is renderer) ### omni::usd::UsdContext::openStageWithSessionLayer(const char *fileUrl, const char *sessionLayerUrl, const OnStageResultFn &resultFn, UsdContextInitialLoadSet loadSet = UsdContextInitialLoadSet::eLoadAll) ### Public Static Functions #### void tryCancelSave() #### FabricRenderingView* getFabricRenderingView() #### void popChangesForGlobalFabricRenderingView() #### void populationApplyPendingUpdates() #### bool removeHydraEngine(omni::usd::hydra::OpaqueSharedHydraEngineContextPtr hydraEngineContext) - Removes a hydra engine and releases IHydraEngine references in the context. - Don’t call this API directly, call UsdManager::releaseHydraEngine() instead to destroy the engine and its context, which also makes a call to `removeHydraEngine()`. ```cpp static UsdContext* getContext(const std::string& name = "") ``` Gets a `UsdContext`. #### Parameters - **name** – of the `UsdContext` to get. The default context is named with empty string “”. ```cpp static bool getEngineWarmupConfig(const carb::settings::ISettings& settings, const char* hydraEngineName, EngineWarmupConfig& config) ``` ```cpp static hydra::EngineCreationConfig getDefaultEngineCreationConfig(const carb::settings::ISettings& settings, const char* hydraEngineName, uint32_t& config) ``` ```cpp const carb::settings::ISettings &amp;settings, const char *engineName, uint32_t engineIndex ) ``` Return the default config for hydraengine creation for this engine type, and index. ```
35,761
_CPPv4N4omni5graph4exec8unstable13INodeGraphDefE_classomni_1_1graph_1_1exec_1_1unstable_1_1INodeGraphDef.md
# omni::graph::exec::unstable::INodeGraphDef Defined in `omni/graph/exec/unstable/INodeGraphDef.h` ## Class Definition ```cpp class omni::graph::exec::unstable::INodeGraphDef : public omni::core::Generated<omni::graph::exec::unstable::INodeGraphDef_abi> ``` Graph definition. Defines work to be done as a graph. ``` Nodes within a graph represent work to be done. The actual work to be performed is described in a definition. Each node wanting to perform work points to a defintion. This interface is a subclass of the work definition interface (i.e. omni::graph::exec::unstable::IDef) and extends omni::graph::exec::unstable::IDef with methods to describe work as a graph. Visually: Above, you can see the two types of definitions: opaque definitions (described by omni::graph::exec::unstable::INodeDef) and graph definitions (described by this interface). Nodes within a graph definition can point to other graph definitions. This composibility is where EF gets its graph of graphs moniker. Multiple node’s in the execution graph can point to the same instance of a graph definition. This saves both space and graph construction time. However, since each graph definition can be shared, its pointer value cannot be used to uniquely identify its location in the graph. To solve this, when traversing/executing a graph definition, an omni::graph::exec::unstable::ExecutionPath is passed (usually via omni::graph::exec::unstable::ExecutionTask::getUpstreamPath()). When defining new graph types, it is common to create a new implementation of this interface. See omni::graph::exec:unstable::NodeGraphDef for an implementation of this interface that can be easily inherited from. See Definition Creation for a guide on creating your own graph definition. How a graph definition’s nodes are traversed during execution is defined by the definition’s omni::graph::exec::unstable::IExecutor. See Execution Concepts for an in-depth guide on how executors and graph definitions work together during execution. See also omni::graph::exec::unstable::INode, omni::graph::exec::unstable::IExecutor, and omni::graph::exec::unstable::ExecutionTask. **Thread Safety** Since definitions can be shared by multiple nodes, and nodes can be executed in parallel, implementations of this interface should expect its methods to be called in parallel. **Public Functions** - **getRoot**() noexcept Access graph’s root node. The returned INode. will not have omni::core::IObject::acquire() called before being returned. This method will never return nullptr. **Thread Safety**: This method is thread safe. - **getTopology**() noexcept Access graph’s topology. This method will never return nullptr. **Thread Safety**: This method is thread safe. ## getTopology() Return this graph’s topology object. Each omni::graph::exec::unstable::INodeGraphDef owns a omni::graph::exec::unstable::ITopology. The returned omni::graph::exec::unstable::ITopology will not have omni::core::IObject::acquire() called before being returned. This method will never return `nullptr`. ### Thread Safety This method is thread safe. ## initializeState(omni::graph::exec::unstable::ExecutionTask &rootTask) Initialize the state of the graph. It is up to the implementation of the graph type to decide whether this call needs to be propagated over all nodes within the graph or a single shared state is owned by the graph. ### Thread Safety See thread safety information in interface description. #### Parameters - **rootTask** – State will be initialized for every instance of this graph. Root task will provide a path to allow discovery of the state. Must not be `nullptr`. ## preExecute(omni::graph::exec::unstable::ExecutionTask &rootTask) This method is used to perform any necessary pre-execution tasks for the graph. ### Thread Safety See thread safety information in interface description. #### Parameters - **rootTask** – This parameter is used to specify the root task for which pre-execution tasks are being performed. It must not be `nullptr`. ### preExecute ```cpp exec::unstable::Status preExecute(omni::graph::exec::unstable::ExecutionTask &info) noexcept ``` - **Description**: Pre-execution call that can be used to setup the graph state prior to execution or entirely skip the execution. - **Note**: The given task must not be `nullptr`. - **Error Handling**: See [Error Handling](../ErrorHandling.html#ef-error-handling) to understand the error handling/reporting responsibilities of implementors of this method. - **Thread Safety**: See thread safety information in interface description. ### postExecute ```cpp inline omni::graph::exec::unstable::Status postExecute(omni::graph::exec::unstable::ExecutionTask &info) noexcept ``` - **Description**: Post-execution call that can be used to finalize the graph state after execution. - **Note**: The given task must not be `nullptr`. - **Error Handling**: See [Error Handling](../ErrorHandling.html#ef-error-handling) to understand the error handling/reporting responsibilities of implementors of this method. - **Thread Safety**: See thread safety information in interface description. ``` ::: exec ::: unstable ::: ExecutionTask ::: ::: info ) ::: noexcept  Post-execution call can be used to finalize the execution, e.g. transfer computation results to consumers. The given task must not be `nullptr`. See Error Handling to understand the error handling/reporting responsibilities of implementors of this method. **Thread Safety** See thread safety information in interface description. ::: inline ::: omni::core::ObjectPtr<omni::graph::exec::unstable::INodeFactory> ::: getNodeFactory () ::: noexcept  Acquire factory object allowing for allocating new node instances for this graph definition. The returned factory may be `nullptr` when the graph definition does not allow allocating new nodes outside of pass that constructed the definition in the first place. The returned omni::graph::exec::unstable::INodeFactory will have omni::core::IObject::acquire() called before being returned. **Thread Safety** Accessing node factory is thread-safe but mutating graphs topology is not. This includes node creation. ## Protected Functions ::: omni::graph::exec::unstable::INodeGraphDef::getTopology_abi ## omni::graph::exec::unstable::INodeGraphDef::getTopology_abi ### Description Return this graph’s topology object. Each omni::graph::exec::unstable::INodeGraphDef owns a omni::graph::exec::unstable::ITopology. The returned omni::graph::exec::unstable::ITopology will not have omni::core::IObject::acquire() called before being returned. This method will never return `nullptr`. #### Thread Safety This method is thread safe. ## omni::graph::exec::unstable::INodeGraphDef::initializeState_abi ### Description Initialize the state of the graph. It is up to the implementation of the graph type to decide whether this call needs to be propagated over all nodes within the graph or a single shared state is owned by the graph. #### Thread Safety See thread safety information in interface description. #### Parameters - **rootTask** – State will be initialized for every instance of this graph. Root task will provide a path to allow discovery of the state. Must not be `nullptr`. ## omni::graph::exec::unstable::INodeGraphDef::preExecute_abi ### Description (Description not provided in the HTML snippet) <dt> <p> Pre-execution call that can be used to setup the graph state prior to execution or entirely skip the execution. <p> The given task must not be <code> nullptr . <p> See Error Handling to understand the error handling/reporting responsibilities of implementors of this method. <p> <dl> <dt> <strong> Thread Safety <dd> <p> See thread safety information in interface description. <dl> <dt> <p> Post-execution call can be used to finalize the execution, e.g. transfer computation results to consumers. <p> The given task must not be <code> nullptr . <p> See Error Handling to understand the error handling/reporting responsibilities of implementors of this method. <p> <dl> <dt> <strong> Thread Safety <dd> <p> See thread safety information in interface description. <dl> <dt> <p> Acquire factory object allowing for allocating new node instances for this graph definition. <p> The returned factory may be <code> nullptr when the graph definition does not allow allocating new nodes outside of pass that constructed the definition in the first place. <p> The returned omni::graph::exec::unstable::INodeFactory will have omni::core::IObject::acquire() called before being returned. ## Thread Safety Accessing node factory is thread-safe but mutating graphs topology is not. This includes node creation.
8,726
_CPPv4N4omni9avreality4rain11PuddleBakerE_classomni_1_1avreality_1_1rain_1_1_puddle_baker.md
# omni::avreality::rain::PuddleBaker Defined in [omni/avreality/rain/PuddleBaker.h](#puddle-baker-8h) ## Functions - [PuddleBaker()=delete](#classomni_1_1avreality_1_1rain_1_1_puddle_baker_1a5471be17f6dcaa1d8b80fd9e419cf5cb): Creates a new PuddleBaker. - [assignShadersAccumulationMapTextureNames(gsl::span&lt; std::tuple&lt; const pxr::SdfPath, const std::string &gt; &gt; shaderPathsAndTextureNames, omni::usd::UsdContext *usdContext=nullptr)](#classomni_1_1avreality_1_1rain_1_1_puddle_baker_1a6d928e2c37ef74e4bd5feeec453432cb) - [bake(std::string textureName, carb::Uint2 textureDims, carb::Float2 regionMin, carb::Float2 regionMax, gsl::span&lt; const carb::Float2 &gt; puddlesPositions, gsl::span&lt; const float &gt; puddlesRadii, gsl::span&lt; const float &gt; puddlesDepths)](#classomni_1_1avreality_1_1rain_1_1_puddle_baker_1a9b667a91c8f838194bb16760530c6fd6) - [bake(std::string textureName, carb::Float2 regionMin, carb::Float2 regionMax, gsl::span&lt; carb::Float2 &gt; puddlesPositions, gsl::span&lt; float &gt; puddlesRadii, gsl::span&lt; float &gt; puddlesDepths)](#classomni_1_1avreality_1_1rain_1_1_puddle_baker_1ad2f231448a08e002e2b83a7c34981a38) ## Class Description Bake puddles into dynamic textures. ### Public Functions - **PuddleBaker()=delete** - Creates a new PuddleBaker. - **assignShadersAccumulationMapTextureNames** - Assigns shader paths and texture names. - **bake** - Bakes puddles into a specified texture. - **bake** - Bakes puddles into a specified texture with different parameters. Creates a new PuddleBaker. ## Public Static Functions ### `static inline void bake(std::string textureName, carb::Uint2 textureDims, carb::Float2 regionMin, carb::Float2 regionMax, gsl::span<const carb::Float2> puddlesPositions, gsl::span<const float> puddlesRadii, gsl::span<const float> puddlesDepths)` Bake puddles to the dynamic texture `textureName`. > **Warning** > The size of puddlesPositions, puddlesRadii and puddlesDepths must be the same. **Parameters** - `textureName`: The name of the texture. - `textureDims`: The dimensions of the texture. - `regionMin`: The minimum region coordinates. - `regionMax`: The maximum region coordinates. - `puddlesPositions`: A span of positions for the puddles. - `puddlesRadii`: A span of radii for the puddles. - `puddlesDepths`: A span of depths for the puddles. - **textureName** – The name of the dynamic texture to bake into. - **textureDims** – The dimensions of the generated texture. - **regionMin** – The 2D world space minimum of the region the texture maps onto. - **regionMax** – The 2D world space maximum of the region the texture maps onto. - **puddlesPositions** – A pointer to the 2D positions of the puddles. - **puddlesRadii** – A pointer to the radii of the puddles. - **puddlesDepths** – A pointer to the depths of the puddles. ```cpp static inline void bake( std::string textureName, carb::Float2 regionMin, carb::Float2 regionMax, gsl::span<carb::Float2> puddlesPositions, gsl::span<float> puddlesRadii, gsl::span<float> puddlesDepths ) ``` Bake puddles to the dynamic texture `textureName`. > **Note** > Generated texture size defaults to 1024x1024. > **Warning** > The size of puddlesPositions, puddlesRadii and puddlesDepths must be the same. ## Parameters - **textureName** – The name of the dynamic texture to bake into. - **regionMin** – The 2D world space minimum of the region the texture maps onto. - **regionMax** – The 2D world space maximum of the region the texture maps onto. - **puddlesPositions** – A pointer to the 2D positions of the puddles. - **puddlesRadii** – A pointer to the radii of the puddles. - **puddlesDepths** – A pointer to the depths of the puddles. ## Function: assignShadersAccumulationMapTextureNames ```cpp static inline void assignShadersAccumulationMapTextureNames(gsl::span<std::tuple<const pxr::SdfPath, const std::string>> shaderPathsAndTextureNames, omni::usd::UsdContext* usdContext = nullptr) ``` Assign dynamic textures to the water accumulation entry in the provided shader list. ### Parameters - **usdContext** – The Usd context holding the prims to update. - **shaderPathsAndTextureNames** – The shaders to assign the dynamic textures to, provided as a list of tuple of shader path and associated texture name. ```
4,306
_CPPv4N4omni9avreality4rain17WetnessControllerE_classomni_1_1avreality_1_1rain_1_1_wetness_controller.md
# omni::avreality::rain::WetnessController Defined in [omni/avreality/rain/WetnessController.h](file_omni_avreality_rain_WetnessController.h.html#wetness-controller-8h) ## Functions - **WetnessController(omni::usd::UsdContext *usdContext=nullptr)** : Create a new scene wetness controller. - **applyGlobalPorosity(float porosity)** : Apply porosity value `porosity` to all SimPBR primitives supporting porosity. - **applyGlobalPorosityScale(float porosityScale)** : Apply porosityScale value `porosityScale` to all SimPBR primitives supporting porosity. - **applyGlobalWaterAccumulation(float waterAccumulation)** : Apply water accumulation value `waterAccumulation` to all SimPBR primitives supporting accumulation. - **applyGlobalWaterAccumulationScale(float accumulationScale)** : Apply accumulationScale value `accumulationScale` to all SimPBR primitives supporting accumulation. - **applyGlobalWaterAlbedo(carb::ColorRgb waterAlbedo)** : Apply albedo value `waterAlbedo` to all SimPBR primitives supporting accumulation. - **applyGlobalWaterTransparency(float waterTransparency)** : Apply water transparency value `waterTransoarency` to all SimPBR primitives supporting accumulation. - **applyGlobalWetness(float wetness)** : Apply wetness value `wetness` to all SimPBR primitives supporting wetness. - applyGlobalWetnessState(bool state) : Set wetness state to `state` to all SimPBR primitives supporting wetness. - loadShadersParameters(omni::usd::UsdContext *usdContext=nullptr) : Load shader parameters default values for USD shader when those values are not authored. - ~WetnessController() : Destroys this WetnessController. class WetnessController : Controller for scene level wetness parameters. ### Public Functions - WetnessController(omni::usd::UsdContext *usdContext=nullptr) : Create a new scene wetness controller. - ~WetnessController() : Destroys this WetnessController. - void applyGlobalWetnessState(bool state) : Set wetness state to `state` to all SimPBR primitives supporting wetness. ### omni::avreality::rain::WetnessController::applyGlobalWetness(float wetness) - **Description**: Apply wetness value `wetness` to all SimPBR primitives supporting wetness. ### omni::avreality::rain::WetnessController::applyGlobalPorosity(float porosity) - **Description**: Apply porosity value `porosity` to all SimPBR primitives supporting porosity. ### omni::avreality::rain::WetnessController::applyGlobalPorosityScale(float porosityScale) - **Description**: Apply porosityScale value `porosityScale` to all SimPBR primitives supporting porosity. ### omni::avreality::rain::WetnessController::applyGlobalWaterAlbedo(carb::ColorRgb waterAlbedo) - **Description**: Apply albedo value `waterAlbedo` to all SimPBR primitives supporting accumulation. ### Public Static Functions #### loadShadersParameters(omni::usd::UsdContext* usdContext) - **Description**: Load shader parameters. - **Parameters**: - `usdContext`: Pointer to an `UsdContext` object. #### applyGlobalWaterTransparency(float waterTransparency) - **Description**: Apply water transparency value `waterTransparency` to all SimPBR primitives supporting accumulation. #### applyGlobalWaterAccumulation(float waterAccumulation) - **Description**: Apply water accumulation value `waterAccumulation` to all SimPBR primitives supporting accumulation. #### applyGlobalWaterAccumulationScale(float accumulationScale) - **Description**: Apply accumulationScale value `accumulationScale` to all SimPBR primitives supporting accumulation. = nullptr ) Load shader parameters default values for USD shader when those values are not authored. ::: warning **Warning** Unstable API, subject to change. :::
3,683