1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 //    names, trademarks, service marks, or product names of the Licensor
11 //    and its affiliates, except as required to comply with Section 4(c) of
12 //    the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 //     http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_USD_USD_COMMON_H
25 #define PXR_USD_USD_COMMON_H
26 
27 /// \file usd/common.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usd/api.h"
31 #include "pxr/base/tf/declarePtrs.h"
32 #include "pxr/base/tf/stringUtils.h"
33 #include "pxr/usd/sdf/layerOffset.h"
34 
35 #include "pxr/usd/usd/primDataHandle.h"
36 #include "pxr/usd/usd/timeCode.h"
37 
38 #include <string>
39 #include <map>
40 
41 PXR_NAMESPACE_OPEN_SCOPE
42 
43 // Forward declare Usd classes.
44 class UsdStage;
45 class UsdObject;
46 class UsdPrim;
47 class UsdProperty;
48 class UsdAttribute;
49 class UsdRelationship;
50 class UsdStageCache;
51 
52 class VtValue;
53 
54 TF_DECLARE_WEAK_AND_REF_PTRS(UsdStage);
55 typedef UsdStagePtr UsdStageWeakPtr;
56 
57 /// Return a human-readable description.
58 USD_API
59 std::string UsdDescribe(const UsdObject &);
60 /// \overload
61 USD_API
62 std::string UsdDescribe(const UsdStageRefPtr &);
63 /// \overload
64 USD_API
65 std::string UsdDescribe(const UsdStageWeakPtr &);
66 /// \overload
67 USD_API
68 std::string UsdDescribe(const UsdStage *);
69 /// \overload
70 USD_API
71 std::string UsdDescribe(const UsdStage &);
72 /// \overload
73 USD_API
74 std::string UsdDescribe(const UsdStageCache &);
75 
76 // XXX:
77 // Currently used for querying composed values from ascii layers, so VtValue is
78 // the optimal value-store, but this may not always be the case.
79 typedef std::map<class TfToken, VtValue,
80                  TfDictionaryLessThan
81                  > UsdMetadataValueMap;
82 
83 /// \enum UsdListPosition
84 ///
85 /// Specifies a position to add items to lists.  Used by some Add()
86 /// methods in the USD API that manipulate lists, such as AddReference().
87 ///
88 enum UsdListPosition {
89     /// The position at the front of the prepend list.
90     /// An item added at this position will, after composition is applied,
91     /// be stronger than other items prepended in this layer, and stronger
92     /// than items added by weaker layers.
93     UsdListPositionFrontOfPrependList,
94     /// The position at the back of the prepend list.
95     /// An item added at this position will, after composition is applied,
96     /// be weaker than other items prepended in this layer, but stronger
97     /// than items added by weaker layers.
98     UsdListPositionBackOfPrependList,
99     /// The position at the front of the append list.
100     /// An item added at this position will, after composition is applied,
101     /// be stronger than other items appended in this layer, and stronger
102     /// than items added by weaker layers.
103     UsdListPositionFrontOfAppendList,
104     /// The position at the back of the append list.
105     /// An item added at this position will, after composition is applied,
106     /// be weaker than other items appended in this layer, but stronger
107     /// than items added by weaker layers.
108     UsdListPositionBackOfAppendList,
109 };
110 
111 /// \enum UsdLoadPolicy
112 ///
113 /// Controls UsdStage::Load() and UsdPrim::Load() behavior regarding whether or
114 /// not descendant prims are loaded.
115 ///
116 enum UsdLoadPolicy {
117     /// Load a prim plus all its descendants.
118     UsdLoadWithDescendants,
119     /// Load a prim by itself with no descendants.
120     UsdLoadWithoutDescendants
121 };
122 
123 /// \enum UsdSchemaKind
124 ///
125 /// An enum representing which kind of schema a given schema class belongs to
126 ///
127 enum class UsdSchemaKind {
128     /// Invalid or unknown schema kind.
129     Invalid,
130     /// Represents abstract or base schema types that are interface-only
131     /// and cannot be instantiated. These are reserved for core base classes
132     /// known to the usdGenSchema system, so this should never be assigned to
133     /// generated schema classes.
134     AbstractBase,
135     /// Represents a non-concrete typed schema
136     AbstractTyped,
137     /// Represents a concrete typed schema
138     ConcreteTyped,
139     /// Non-applied API schema
140     NonAppliedAPI,
141     /// Single Apply API schema
142     SingleApplyAPI,
143     /// Multiple Apply API Schema
144     MultipleApplyAPI
145 };
146 
147 PXR_NAMESPACE_CLOSE_SCOPE
148 
149 #endif
150