HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pipeline.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_USD_UTILS_PIPELINE_H
8 #define PXR_USD_USD_UTILS_PIPELINE_H
9 
10 /// \file usdUtils/pipeline.h
11 ///
12 /// Collection of module-scoped utilities for establishing pipeline
13 /// conventions for things not currently suitable or possible to canonize in
14 /// USD's schema modules.
15 
16 #include "pxr/pxr.h"
17 #include "pxr/usd/usdUtils/api.h"
19 
20 #include "pxr/base/tf/envSetting.h"
21 #include "pxr/base/tf/token.h"
23 #include "pxr/usd/sdf/path.h"
24 #include "pxr/usd/usd/common.h"
25 
27 
29 
32 
33 /// Define the shading pipeline's convention for naming a companion
34 /// alpha/opacity attribute and primvarnames given the full name of a
35 /// color-valued attribute
38 
39 /// Returns the model name associated with a given root layer. In order,
40 /// it looks for defaultPrim metadata, a prim matching the filename,
41 /// and then the first concrete root prim.
43 TfToken UsdUtilsGetModelNameFromRootLayer(const SdfLayerHandle& rootLayer);
44 
45 /// Certain variant sets can be registered with the system.
46 ///
47 /// Returns the set of UsdUtilsRegisteredVariantSet objects that are registered
48 /// with the pipeline.
49 ///
50 /// Variant sets can be registered through direct enumeration inside a
51 /// `plugInfo.json`, or via a plugin for situations that require dynamic
52 /// configuration at runtime.
53 ///
54 /// This list will be empty until one or more `plugInfo.json` files
55 /// discoverable by your USD installation contain an entry in the
56 /// UsdUtilsPipeline group like the following:
57 /// \code{json}
58 /// "UsdUtilsPipeline": {
59 /// "RegisteredVariantSets": {
60 /// "modelingVariant": {
61 /// "selectionExportPolicy": "always"
62 /// },
63 /// "standin": {
64 /// "selectionExportPolicy": "never"
65 /// }
66 /// }
67 /// }
68 /// \endcode
69 ///
70 /// After the above variantSets are registered, this will then load any plugin
71 /// that has a `plugInfo.json` with:
72 ///
73 /// \code{json}
74 /// "UsdUtilsPipeline": {
75 /// "RegistersVariantSets": true
76 /// }
77 /// \endcode
78 ///
79 /// This plugin should then have code that registers code to run for
80 /// `UsdUtilsRegisteredVariantSet`:
81 /// \code{cpp}
82 /// TF_REGISTRY_FUNCTION(UsdUtilsRegisteredVariantSet) {
83 /// std::string variantSetName = ...;
84 /// UsdUtilsRegisteredVariantSet::SelectionExportPolicy exportPolicy = ...;
85 /// UsdUtilsRegisterVariantSet(variantSetName, exportPolicy);
86 /// }
87 /// \endcode
88 ///
89 /// \sa UsdUtilsRegisterVariantSet
91 const std::set<UsdUtilsRegisteredVariantSet>& UsdUtilsGetRegisteredVariantSets();
92 
93 /// Registers \p variantSetName with \p selectionExportPolicy.
94 ///
95 /// \sa UsdUtilsGetRegisteredVariantSets
98  const std::string& variantSetName,
100  selectionExportPolicy);
101 
102 /// If a valid UsdPrim already exists at \p path on the USD stage \p stage,
103 /// returns it. It not, it checks to see if the path belongs to a prim
104 /// underneath an instance and returns the corresponding prototype prim.
105 ///
106 /// This returns an invalid UsdPrim if no corresponding prototype prim can be
107 /// found and if no prim exists at the path.
108 ///
109 /// This method is similar to UsdStage::GetPrimAtPath(), in that it will never
110 /// author scene description, and therefore is safe to use as a "reader" in the
111 /// Usd multi-threading model.
113 UsdPrim UsdUtilsGetPrimAtPathWithForwarding(const UsdStagePtr &stage,
114  const SdfPath &path);
115 
116 /// Given a path, uninstances all the instanced prims in the namespace chain and
117 /// returns the resulting prim at the requested path. Returns a NULL prim if the
118 /// given path doesn't exist and does not correspond to a valid prim inside a
119 /// prototype.
121 UsdPrim UsdUtilsUninstancePrimAtPath(const UsdStagePtr &stage,
122  const SdfPath &path);
123 
124 /// Returns the name of the primary UV set used on meshes and nurbs.
125 /// By default the name is "st".
128 
129 /// Returns the name of the reference position used on meshes and nurbs.
130 /// By default the name is "pref".
133 
134 /// Get the name of the USD prim under which materials are expected to be
135 /// authored.
136 ///
137 /// The scope name can be configured in the metadata of a plugInfo.json file
138 /// like so:
139 /// \code{json}
140 /// "UsdUtilsPipeline": {
141 /// "MaterialsScopeName": "SomeScopeName"
142 /// }
143 /// \endcode
144 ///
145 /// If \p forceDefault is true, any value specified in a plugInfo.json will be
146 /// ignored and the built-in default will be returned. This is primarily used
147 /// for unit testing purposes as a way to ignore any site-based configuration.
149 TfToken UsdUtilsGetMaterialsScopeName(const bool forceDefault = false);
150 
151 /// Get the name of the USD prim representing the primary camera.
152 /// By default the name is "main_cam".
153 ///
154 /// The camera name can be configured in the metadata of a plugInfo.json file
155 /// like so:
156 /// \code{json}
157 /// "UsdUtilsPipeline": {
158 /// "PrimaryCameraName": "SomeCameraName"
159 /// }
160 /// \endcode
161 ///
162 /// If \p forceDefault is true, any value specified in a plugInfo.json will be
163 /// ignored and the built-in default will be returned. This is primarily used
164 /// for unit testing purposes as a way to ignore any site-based configuration.
166 TfToken UsdUtilsGetPrimaryCameraName(const bool forceDefault = false);
167 
169 
170 #endif
Definition: layer.h:81
USDUTILS_API const TfToken & UsdUtilsGetPrimaryUVSetName()
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
USDUTILS_API TfToken UsdUtilsGetModelNameFromRootLayer(const SdfLayerHandle &rootLayer)
USDUTILS_API void UsdUtilsRegisterVariantSet(const std::string &variantSetName, const UsdUtilsRegisteredVariantSet::SelectionExportPolicy &selectionExportPolicy)
USDUTILS_API UsdPrim UsdUtilsGetPrimAtPathWithForwarding(const UsdStagePtr &stage, const SdfPath &path)
USDUTILS_API TfEnvSetting< bool > USD_FORCE_DEFAULT_MATERIALS_SCOPE_NAME
Definition: token.h:70
PXR_NAMESPACE_OPEN_SCOPE SDF_DECLARE_HANDLES(SdfLayer)
USDUTILS_API TfToken UsdUtilsGetPrimaryCameraName(const bool forceDefault=false)
USDUTILS_API const TfToken & UsdUtilsGetPrefName()
Definition: prim.h:116
Definition: path.h:273
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
USDUTILS_API TfToken UsdUtilsGetMaterialsScopeName(const bool forceDefault=false)
USDUTILS_API const std::set< UsdUtilsRegisteredVariantSet > & UsdUtilsGetRegisteredVariantSets()
USDUTILS_API UsdPrim UsdUtilsUninstancePrimAtPath(const UsdStagePtr &stage, const SdfPath &path)
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
#define USDUTILS_API
Definition: api.h:23
USDUTILS_API TfToken UsdUtilsGetAlphaAttributeNameForColor(TfToken const &colorAttrName)