HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
prim.h
Go to the documentation of this file.
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 USD_PRIM_H
25 #define USD_PRIM_H
26 
27 /// \file usd/prim.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/usd/api.h"
31 #include "pxr/usd/usd/common.h"
32 #include "pxr/usd/usd/object.h"
33 #include "pxr/usd/usd/primFlags.h"
34 
35 #include "pxr/usd/sdf/schema.h"
36 #include "pxr/base/trace/trace.h"
37 
39 #include "pxr/base/tf/refBase.h"
40 #include "pxr/base/tf/token.h"
41 #include "pxr/base/tf/weakBase.h"
42 
43 #include "pxr/usd/sdf/path.h"
44 
45 #include <hboost/iterator/iterator_adaptor.hpp>
46 #include <hboost/range/iterator_range.hpp>
47 
48 #include <string>
49 #include <type_traits>
50 #include <vector>
51 
53 
54 class UsdPrim;
55 class UsdPrimRange;
56 class Usd_PrimData;
57 
58 class UsdAttribute;
59 class UsdRelationship;
60 class UsdPayloads;
61 class UsdReferences;
62 class UsdSchemaBase;
63 class UsdAPISchemaBase;
64 class UsdInherits;
65 class UsdSpecializes;
66 class UsdVariantSets;
67 class UsdVariantSet;
68 
69 class SdfPayload;
70 
72 typedef hboost::iterator_range<UsdPrimSiblingIterator> UsdPrimSiblingRange;
73 
75 typedef hboost::iterator_range<UsdPrimSubtreeIterator> UsdPrimSubtreeRange;
76 
77 /// \class UsdPrim
78 ///
79 /// UsdPrim is the sole persistent scenegraph object on a UsdStage, and
80 /// is the embodiment of a "Prim" as described in the <em>Universal Scene
81 /// Description Composition Compendium</em>
82 ///
83 /// A UsdPrim is the principal container of other types of scene description.
84 /// It provides API for accessing and creating all of the contained kinds
85 /// of scene description, which include:
86 /// \li UsdVariantSets - all VariantSets on the prim (GetVariantSets(), GetVariantSet())
87 /// \li UsdReferences - all references on the prim (GetReferences())
88 /// \li UsdInherits - all inherits on the prim (GetInherits())
89 /// \li UsdSpecializes - all specializes on the prim (GetSpecializes())
90 ///
91 /// As well as access to the API objects for properties contained within the
92 /// prim - UsdPrim as well as all of the following classes are subclasses
93 /// of UsdObject:
94 /// \li UsdProperty - generic access to all attributes and relationships.
95 /// A UsdProperty can be queried and cast to a UsdAttribute or UsdRelationship
96 /// using UsdObject::Is<>() and UsdObject::As<>(). (GetPropertyNames(),
97 /// GetProperties(), GetPropertiesInNamespace(), GetPropertyOrder(),
98 /// SetPropertyOrder())
99 /// \li UsdAttribute - access to default and timesampled attribute values, as
100 /// well as value resolution information, and attribute-specific metadata
101 /// (CreateAttribute(), GetAttribute(), GetAttributes(), HasAttribute())
102 /// \li UsdRelationship - access to authoring and resolving relationships
103 /// to other prims and properties (CreateRelationship(), GetRelationship(),
104 /// GetRelationships(), HasRelationship())
105 ///
106 /// UsdPrim also provides access to iteration through its prim children,
107 /// optionally making use of the \ref primFlags.h "prim predicates facility"
108 /// (GetChildren(), GetAllChildren(), GetFilteredChildren()).
109 ///
110 /// \section Lifetime Management
111 ///
112 /// Clients acquire UsdPrim objects, which act like weak/guarded pointers
113 /// to persistent objects owned and managed by their originating UsdStage.
114 /// We provide the following guarantees for a UsdPrim acquired via
115 /// UsdStage::GetPrimAtPath() or UsdStage::OverridePrim() or
116 /// UsdStage::DefinePrim():
117 /// \li As long as no further mutations to the structure of the UsdStage
118 /// are made, the UsdPrim will still be valid. Loading and
119 /// Unloading are considered structural mutations.
120 /// \li When the UsdStage's structure \em is mutated, the thread performing
121 /// the mutation will receive a UsdNotice::ObjectsChanged notice
122 /// after the stage has been reconfigured, which provides details as to
123 /// what prims may have been created or destroyed, and what prims
124 /// may simply have changed in some structural way.
125 ///
126 /// Prim access in "reader" threads should be limited to GetPrimAtPath(), which
127 /// will never cause a mutation to the Stage or its layers.
128 ///
129 /// Please refer to \ref UsdNotice for a listing of
130 /// the events that could cause UsdNotice::ObjectsChanged to be emitted.
131 class UsdPrim : public UsdObject
132 {
133 public:
134  /// Convenience typedefs.
137 
138  /// Convenience typedefs.
141 
142  /// Construct an invalid prim.
144 
145  /// Return this prim's definition from the UsdSchemaRegistry based on the
146  /// prim's type if one exists, otherwise return null.
147  USD_API
148  SdfPrimSpecHandle GetPrimDefinition() const;
149 
150  /// Return this prim's composed specifier.
151  SdfSpecifier GetSpecifier() const { return _Prim()->GetSpecifier(); };
152 
153  /// Return a list of PrimSpecs that provide opinions for this prim
154  /// (i.e. the prim's metadata fields, including composition
155  /// metadata). These specs are ordered from strongest to weakest opinion.
156  ///
157  /// \note The results returned by this method are meant for debugging
158  /// and diagnostic purposes. It is **not** advisable to retain a
159  /// PrimStack for the purposes of expedited value resolution for prim
160  /// metadata, since not all metadata resolves with simple "strongest
161  /// opinion wins" semantics.
162  USD_API
163  SdfPrimSpecHandleVector GetPrimStack() const;
164 
165  /// Author an opinion for this Prim's specifier at the current edit
166  /// target.
167  bool SetSpecifier(SdfSpecifier specifier) const {
168  return SetMetadata(SdfFieldKeys->Specifier, specifier);
169  }
170 
171  /// Return this prim's composed type name. Note that this value is
172  /// cached and is efficient to query.
173  const TfToken &GetTypeName() const { return _Prim()->GetTypeName(); };
174 
175  /// Author this Prim's typeName at the current EditTarget.
176  bool SetTypeName(const TfToken & typeName) const {
177  return SetMetadata(SdfFieldKeys->TypeName, typeName);
178  }
179 
180  /// Clear the opinion for this Prim's typeName at the current edit
181  /// target.
182  bool ClearTypeName() const {
183  return ClearMetadata(SdfFieldKeys->TypeName);
184  }
185 
186  /// Return true if a typeName has been authored.
187  bool HasAuthoredTypeName() const {
188  return HasAuthoredMetadata(SdfFieldKeys->TypeName);
189  }
190 
191  /// Return true if this prim is active, meaning neither it nor any of its
192  /// ancestors have active=false. Return false otherwise.
193  ///
194  /// See \ref Usd_ActiveInactive for what it means for a prim to be active.
195  bool IsActive() const { return _Prim()->IsActive(); }
196 
197  /// Author 'active' metadata for this prim at the current EditTarget.
198  ///
199  /// See \ref Usd_ActiveInactive for the effects of activating or deactivating
200  /// a prim.
201  bool SetActive(bool active) const {
202  return SetMetadata(SdfFieldKeys->Active, active);
203  }
204 
205  /// Remove the authored 'active' opinion at the current EditTarget. Do
206  /// nothing if there is no authored opinion.
207  ///
208  /// See \ref Usd_ActiveInactive for the effects of activating or deactivating
209  /// a prim.
210  bool ClearActive() const {
211  return ClearMetadata(SdfFieldKeys->Active);
212  }
213 
214  /// Return true if this prim has an authored opinion for 'active', false
215  /// otherwise.
216  ///
217  /// See \ref Usd_ActiveInactive for what it means for a prim to be active.
218  bool HasAuthoredActive() const {
219  return HasAuthoredMetadata(SdfFieldKeys->Active);
220  }
221 
222  /// Return true if this prim is active, and \em either it is loadable and
223  /// it is loaded, \em or its nearest loadable ancestor is loaded, \em or it
224  /// has no loadable ancestor; false otherwise.
225  bool IsLoaded() const { return _Prim()->IsLoaded(); }
226 
227  /// Return true if this prim is a model based on its kind metadata, false
228  /// otherwise.
229  bool IsModel() const { return _Prim()->IsModel(); }
230 
231  /// Return true if this prim is a model group based on its kind metadata,
232  /// false otherwise. If this prim is a group, it is also necessarily a
233  /// model.
234  bool IsGroup() const { return _Prim()->IsGroup(); }
235 
236  /// Return true if this prim or any of its ancestors is a class.
237  bool IsAbstract() const { return _Prim()->IsAbstract(); }
238 
239  /// Return true if this prim and all its ancestors have defining specifiers,
240  /// false otherwise. \sa SdfIsDefiningSpecifier.
241  bool IsDefined() const { return _Prim()->IsDefined(); }
242 
243  /// Return true if this prim has a specifier of type SdfSpecifierDef
244  /// or SdfSpecifierClass. \sa SdfIsDefiningSpecifier
245  bool HasDefiningSpecifier() const {
246  return _Prim()->HasDefiningSpecifier();
247  }
248 
249  /// Return a vector containing the names of API schemas which have
250  /// been applied to this prim, using the Apply() method on
251  /// the particular schema class.
252  USD_API
254 
255  /// Alias for the "predicate" function parameter passed into the various
256  /// Get{Authored}{PropertyNames,Properties} methods.
257  using PropertyPredicateFunc =
258  std::function<bool (const TfToken &propertyName)>;
259 
260  /// Return all of this prim's property names (attributes and relationships),
261  /// including all builtin properties.
262  ///
263  /// If a valid \p predicate is passed in, then only properties whose names
264  /// pass the predicate are included in the result. This is useful if the
265  /// client is interested only in a subset of properties on the prim. For
266  /// example, only the ones in a given namespace or only the ones needed to
267  /// compute a value.
268  ///
269  /// \sa GetAuthoredPropertyNames()
270  /// \sa UsdProperty::IsAuthored()
271  USD_API
273  const PropertyPredicateFunc &predicate={}) const;
274 
275  /// Return this prim's property names (attributes and relationships) that
276  /// have authored scene description, ordered according to the strongest
277  /// propertyOrder statement in scene description if one exists, otherwise
278  /// ordered according to TfDictionaryLessThan.
279  ///
280  /// If a valid \p predicate is passed in, then only the authored properties
281  /// whose names pass the predicate are included in the result. This is
282  /// useful if the client is interested only in a subset of authored
283  /// properties on the prim. For example, only the ones in a given namespace
284  /// or only the ones needed to compute a value.
285  ///
286  /// \sa GetPropertyNames()
287  /// \sa UsdProperty::IsAuthored()
288  USD_API
290  const PropertyPredicateFunc &predicate={}) const;
291 
292  /// Return all of this prim's properties (attributes and relationships),
293  /// including all builtin properties, ordered by name according to the
294  /// strongest propertyOrder statement in scene description if one exists,
295  /// otherwise ordered according to TfDictionaryLessThan.
296  ///
297  /// If a valid \p predicate is passed in, then only properties whose names
298  /// pass the predicate are included in the result. This is useful if the
299  /// client is interested only in a subset of properties on the prim. For
300  /// example, only the ones in a given namespace or only the ones needed to
301  /// compute a value.
302  ///
303  /// To obtain only either attributes or relationships, use either
304  /// GetAttributes() or GetRelationships().
305  ///
306  /// To determine whether a property is either an attribute or a
307  /// relationship, use the UsdObject::As() and UsdObject::Is() methods in
308  /// C++:
309  ///
310  /// \code
311  /// // Use As<>() to obtain a subclass instance.
312  /// if (UsdAttribute attr = property.As<UsdAttribute>()) {
313  /// // use attribute 'attr'.
314  /// else if (UsdRelationship rel = property.As<UsdRelationship>()) {
315  /// // use relationship 'rel'.
316  /// }
317  ///
318  /// // Use Is<>() to discriminate only.
319  /// if (property.Is<UsdAttribute>()) {
320  /// // property is an attribute.
321  /// }
322  /// \endcode
323  ///
324  /// In Python, use the standard isinstance() function:
325  ///
326  /// \code
327  /// if isinstance(property, Usd.Attribute):
328  /// # property is a Usd.Attribute.
329  /// elif isinstance(property, Usd.Relationship):
330  /// # property is a Usd.Relationship.
331  /// \endcode
332  ///
333  /// \sa GetAuthoredProperties()
334  /// \sa UsdProperty::IsAuthored()
335  USD_API
336  std::vector<UsdProperty> GetProperties(
337  const PropertyPredicateFunc &predicate={}) const;
338 
339  /// Return this prim's properties (attributes and relationships) that have
340  /// authored scene description, ordered by name according to the strongest
341  /// propertyOrder statement in scene description if one exists, otherwise
342  /// ordered according to TfDictionaryLessThan.
343  ///
344  /// If a valid \p predicate is passed in, then only authored properties
345  /// whose names pass the predicate are included in the result. This is
346  /// useful if the client is interested only in a subset of authored
347  /// properties on the prim. For example, only the ones in a given namespace
348  /// or only the ones needed to compute a value.
349  ///
350  /// \sa GetProperties()
351  /// \sa UsdProperty::IsAuthored()
352  USD_API
353  std::vector<UsdProperty> GetAuthoredProperties(
354  const PropertyPredicateFunc &predicate={}) const;
355 
356  /// Return this prim's properties that are inside the given property
357  /// namespace ordered according to the strongest propertyOrder statement in
358  /// scene description if one exists, otherwise ordered according to
359  /// TfDictionaryLessThan.
360  ///
361  /// A \p namespaces argument whose elements are ["ri", "attribute"] will
362  /// return all the properties under the namespace "ri:attribute",
363  /// i.e. "ri:attribute:*". An empty \p namespaces argument is equivalent to
364  /// GetProperties().
365  ///
366  /// For details of namespaced properties, see \ref Usd_Ordering
367  USD_API
368  std::vector<UsdProperty>
369  GetPropertiesInNamespace(const std::vector<std::string> &namespaces) const;
370 
371  /// \overload
372  /// \p namespaces must be an already-concatenated ordered set of namespaces,
373  /// and may or may not terminate with the namespace-separator character. If
374  /// \p namespaces is empty, this method is equivalent to GetProperties().
375  USD_API
376  std::vector<UsdProperty>
377  GetPropertiesInNamespace(const std::string &namespaces) const;
378 
379  /// Like GetPropertiesInNamespace(), but exclude properties that do not have
380  /// authored scene description from the result. See
381  /// UsdProperty::IsAuthored().
382  ///
383  /// For details of namespaced properties, see \ref Usd_Ordering
384  USD_API
385  std::vector<UsdProperty>
387  const std::vector<std::string> &namespaces) const;
388 
389  /// \overload
390  /// \p namespaces must be an already-concatenated ordered set of namespaces,
391  /// and may or may not terminate with the namespace-separator character. If
392  /// \p namespaces is empty, this method is equivalent to
393  /// GetAuthoredProperties().
394  USD_API
395  std::vector<UsdProperty>
396  GetAuthoredPropertiesInNamespace(const std::string &namespaces) const;
397 
398  /// Return the strongest propertyOrder metadata value authored on this prim.
399  USD_API
401 
402  /// Author an opinion for propertyOrder metadata on this prim at the current
403  /// EditTarget.
404  USD_API
405  void SetPropertyOrder(const TfTokenVector &order) const;
406 
407  /// Remove all scene description for the property with the
408  /// given \p propName <em>in the current UsdEditTarget</em>.
409  /// Return true if the property is removed, false otherwise.
410  USD_API
411  bool RemoveProperty(const TfToken &propName);
412 
413  /// Return a UsdProperty with the name \a propName. The property
414  /// returned may or may not \b actually exist so it must be checked for
415  /// validity. Suggested use:
416  ///
417  /// \code
418  /// if (UsdProperty myProp = prim.GetProperty("myProp")) {
419  /// // myProp is safe to use.
420  /// // Edits to the owning stage requires subsequent validation.
421  /// } else {
422  /// // myProp was not defined/authored
423  /// }
424  /// \endcode
425  USD_API
426  UsdProperty GetProperty(const TfToken &propName) const;
427 
428  /// Return true if this prim has an property named \p propName, false
429  /// otherwise.
430  USD_API
431  bool HasProperty(const TfToken &propName) const;
432 
433 private:
434  // The non-templated implementation of UsdPrim::IsA using the
435  // TfType system. \p validateSchemaType is provided for python clients
436  // because they can't use compile time assertions on the input type.
437  USD_API
438  bool _IsA(const TfType& schemaType, bool validateSchemaType) const;
439 
440  // The non-templated implementation of UsdPrim::HasAPI using the
441  // TfType system.
442  //
443  // \p validateSchemaType is provided for python clients
444  // because they can't use compile time assertions on the input type.
445  //
446  // \p instanceName is used to determine whether a particular instance
447  // of a multiple-apply API schema has been applied to the prim.
448  USD_API
449  bool _HasAPI(const TfType& schemaType, bool validateSchemaType,
450  const TfToken &instanceName) const;
451 
452 public:
453  /// Return true if the UsdPrim is/inherits a Schema of type T.
454  ///
455  /// This will also return true if the UsdPrim is a schema that inherits
456  /// from schema \c T.
457  template <typename T>
458  bool IsA() const {
460  "Provided type must derive UsdSchemaBase.");
461  return _IsA(TfType::Find<T>(), /*validateSchemaType=*/false);
462  };
463 
464  /// Return true if prim type is/inherits a Schema with TfType \p schemaType
465  USD_API
466  bool IsA(const TfType& schemaType) const;
467 
468  /// Return true if the UsdPrim has had an API schema represented by the C++
469  /// class type <b>T</b> applied to it through the Apply() method provided
470  /// on the API schema class.
471  ///
472  /// \p instanceName, if non-empty is used to determine if a particular
473  /// instance of a multiple-apply API schema (eg. UsdCollectionAPI) has been
474  /// applied to the prim. A coding error is issued if a non-empty
475  /// \p instanceName is passed in and <b>T</b> represents a single-apply API
476  /// schema.
477  ///
478  /// <b>Using HasAPI in C++</b>
479  /// \code
480  /// UsdPrim prim = stage->OverridePrim("/path/to/prim");
481  /// UsdModelAPI modelAPI = UsdModelAPI::Apply(prim);
482  /// assert(prim.HasAPI<UsdModelAPI>());
483  ///
484  /// UsdCollectionAPI collAPI = UsdCollectionAPI::Apply(prim,
485  /// /*instanceName*/ TfToken("geom"))
486  /// assert(prim.HasAPI<UsdCollectionAPI>()
487  /// assert(prim.HasAPI<UsdCollectionAPI>(/*instanceName*/ TfToken("geom")))
488  /// \endcode
489  ///
490  /// The python version of this method takes as an argument the TfType
491  /// of the API schema class. Similar validation of the schema type is
492  /// performed in python at run-time and a coding error is issued if
493  /// the given type is not a valid applied API schema.
494  ///
495  /// <b>Using HasAPI in Python</b>
496  /// \code{.py}
497  /// prim = stage.OverridePrim("/path/to/prim")
498  /// modelAPI = Usd.ModelAPI.Apply(prim)
499  /// assert prim.HasAPI(Usd.ModelAPI)
500  ///
501  /// collAPI = Usd.CollectionAPI.Apply(prim, "geom")
502  /// assert(prim.HasAPI(Usd.CollectionAPI))
503  /// assert(prim.HasAPI(Usd.CollectionAPI, instanceName="geom"))
504  /// \endcode
505  template <typename T>
506  bool HasAPI(const TfToken &instanceName=TfToken()) const {
508  "Provided type must derive UsdAPISchemaBase.");
510  "Provided type must not be UsdAPISchemaBase.");
511  static_assert(
512  (T::schemaType == UsdSchemaType::SingleApplyAPI
513  || T::schemaType == UsdSchemaType::MultipleApplyAPI),
514  "Provided schema type must be an applied API schema.");
515 
516  if (T::schemaType != UsdSchemaType::MultipleApplyAPI
517  && !instanceName.IsEmpty()) {
518  TF_CODING_ERROR("HasAPI: single application API schemas like %s do "
519  "not contain an application instanceName ( %s ).",
520  TfType::GetCanonicalTypeName(typeid(T)).c_str(),
521  instanceName.GetText());
522  return false;
523  }
524 
525  return _HasAPI(TfType::Find<T>(), /*validateSchemaType=*/false,
526  instanceName);
527  }
528 
529  /// Return true if a prim has an API schema with TfType \p schemaType.
530  ///
531  /// \p instanceName, if non-empty is used to determine if a particular
532  /// instance of a multiple-apply API schema (eg. UsdCollectionAPI) has been
533  /// applied to the prim. A coding error is issued if a non-empty
534  /// \p instanceName is passed in and <b>T</b> represents a single-apply API
535  /// schema.
536  USD_API
537  bool HasAPI(const TfType& schemaType,
538  const TfToken& instanceName=TfToken()) const;
539 
540  // --------------------------------------------------------------------- //
541  /// \name Prim Children
542  // --------------------------------------------------------------------- //
543 
544  /// Return this prim's direct child named \p name if it has one, otherwise
545  /// return an invalid UsdPrim. Equivalent to:
546  /// \code
547  /// prim.GetStage()->GetPrimAtPath(prim.GetPath().AppendChild(name))
548  /// \endcode
549  USD_API
550  UsdPrim GetChild(const TfToken &name) const;
551 
552  /// Return this prim's active, loaded, defined, non-abstract children as an
553  /// iterable range. Equivalent to:
554  /// \code
555  /// GetFilteredChildren(UsdPrimDefaultPredicate)
556  /// \endcode
557  ///
558  /// See \ref Usd_PrimFlags "Prim predicate flags"
559  /// and #UsdPrimDefaultPredicate for more information.
560  inline SiblingRange GetChildren() const;
561 
562  /// Return all this prim's children as an iterable range.
563  inline SiblingRange GetAllChildren() const;
564 
565  /// Return a subset of all of this prim's children filtered by \p predicate
566  /// as an iterable range. The \p predicate is generated by combining a
567  /// series of prim flag terms with either && or || and !.
568  ///
569  /// Example usage:
570  /// \code
571  /// // Get all active model children.
572  /// GetFilteredChildren(UsdPrimIsActive && UsdPrimIsModel);
573  ///
574  /// // Get all model children that pass the default predicate.
575  /// GetFilteredChildren(UsdPrimDefaultPredicate && UsdPrimIsModel);
576  /// \endcode
577  ///
578  /// If this prim is an instance, no children will be returned unless
579  /// #UsdTraverseInstanceProxies is used to allow instance proxies to be
580  /// returned, or if this prim is itself an instance proxy.
581  ///
582  /// See \ref Usd_PrimFlags "Prim predicate flags"
583  /// and #UsdPrimDefaultPredicate for more information.
584  inline SiblingRange
585  GetFilteredChildren(const Usd_PrimFlagsPredicate &predicate) const;
586 
587  /// Return this prim's active, loaded, defined, non-abstract descendants as
588  /// an iterable range. Equivalent to:
589  /// \code
590  /// GetFilteredDescendants(UsdPrimDefaultPredicate)
591  /// \endcode
592  ///
593  /// \note This method is not yet available in python, pending some
594  /// refactoring to make it more feasible.
595  ///
596  /// See \ref Usd_PrimFlags "Prim predicate flags" and
597  /// #UsdPrimDefaultPredicate for more information, UsdStage::Traverse(),
598  /// and \c UsdPrimRange for more general Stage traversal behaviors.
599  inline SubtreeRange GetDescendants() const;
600 
601  /// Return all this prim's descendants as an iterable range.
602  ///
603  /// \note This method is not yet available in python, pending some
604  /// refactoring to make it more feasible.
605  ///
606  /// See \ref Usd_PrimFlags "Prim predicate flags" and
607  /// #UsdPrimDefaultPredicate for more information, UsdStage::Traverse(),
608  /// and \c UsdPrimRange for more general Stage traversal behaviors.
609  inline SubtreeRange GetAllDescendants() const;
610 
611  /// Return a subset of all of this prim's descendants filtered by
612  /// \p predicate as an iterable range. The \p predicate is generated by
613  /// combining a series of prim flag terms with either && or || and !.
614  ///
615  /// Example usage:
616  /// \code
617  /// // Get all active model descendants.
618  /// GetFilteredDescendants(UsdPrimIsActive && UsdPrimIsModel);
619  ///
620  /// // Get all model descendants that pass the default predicate.
621  /// GetFilteredDescendants(UsdPrimDefaultPredicate && UsdPrimIsModel);
622  /// \endcode
623  ///
624  /// If this prim is an instance, no descendants will be returned unless
625  /// #UsdTraverseInstanceProxies is used to allow instance proxies to be
626  /// returned, or if this prim is itself an instance proxy.
627  ///
628  /// \note This method is not yet available in python, pending some
629  /// refactoring to make it more feasible.
630  ///
631  /// See \ref Usd_PrimFlags "Prim predicate flags" and
632  /// #UsdPrimDefaultPredicate for more information, UsdStage::Traverse(),
633  /// and \c UsdPrimRange for more general Stage traversal behaviors.
634  inline SubtreeRange
635  GetFilteredDescendants(const Usd_PrimFlagsPredicate &predicate) const;
636 
637 public:
638  // --------------------------------------------------------------------- //
639  /// \name Parent & Stage
640  // --------------------------------------------------------------------- //
641 
642  /// Return this prim's parent prim. Return an invalid UsdPrim if this is a
643  /// root prim.
644  UsdPrim GetParent() const {
646  SdfPath proxyPrimPath = _ProxyPrimPath();
647  Usd_MoveToParent(prim, proxyPrimPath);
648  return UsdPrim(prim, proxyPrimPath);
649  }
650 
651  /// Return this prim's next active, loaded, defined, non-abstract sibling
652  /// if it has one, otherwise return an invalid UsdPrim. Equivalent to:
653  /// \code
654  /// GetFilteredNextSibling(UsdPrimDefaultPredicate)
655  /// \endcode
656  ///
657  /// See \ref Usd_PrimFlags "Prim predicate flags"
658  /// and #UsdPrimDefaultPredicate for more information.
659  USD_API
660  UsdPrim GetNextSibling() const;
661 
662  /// Return this prim's next sibling that matches \p predicate if it has one,
663  /// otherwise return the invalid UsdPrim.
664  ///
665  /// See \ref Usd_PrimFlags "Prim predicate flags"
666  /// and #UsdPrimDefaultPredicate for more information.
667  USD_API
669  const Usd_PrimFlagsPredicate &predicate) const;
670 
671  /// Returns true if the prim is the pseudo root.
672  ///
673  /// Equivalent to
674  /// \code
675  /// prim.GetPath() == SdfPath::AbsoluteRootPath()
676  /// \endcode
677  USD_API
678  bool IsPseudoRoot() const;
679 
680  // --------------------------------------------------------------------- //
681  /// \name Variants
682  // --------------------------------------------------------------------- //
683 
684  /// Return a UsdVariantSets object representing all the VariantSets
685  /// present on this prim.
686  ///
687  /// The returned object also provides the API for adding new VariantSets
688  /// to the prim.
689  USD_API
691 
692  /// Retrieve a specifically named VariantSet for editing or constructing
693  /// a UsdEditTarget.
694  ///
695  /// This is a shortcut for
696  /// \code
697  /// prim.GetVariantSets().GetVariantSet(variantSetName)
698  /// \endcode
699  USD_API
700  UsdVariantSet GetVariantSet(const std::string& variantSetName) const;
701 
702  /// Return true if this prim has any authored VariantSets.
703  ///
704  /// \note this connotes only the *existence* of one of more VariantSets,
705  /// *not* that such VariantSets necessarily contain any variants or
706  /// variant opinions.
707  USD_API
708  bool HasVariantSets() const;
709 
710  // --------------------------------------------------------------------- //
711  /// \name Attributes
712  // --------------------------------------------------------------------- //
713 
714  /// Author scene description for the attribute named \a attrName at the
715  /// current EditTarget if none already exists. Return a valid attribute if
716  /// scene description was successfully authored or if it already existed,
717  /// return invalid attribute otherwise. Note that the supplied \a typeName
718  /// and \a custom arguments are only used in one specific case. See below
719  /// for details.
720  ///
721  /// Suggested use:
722  /// \code
723  /// if (UsdAttribute myAttr = prim.CreateAttribute(...)) {
724  /// // success.
725  /// }
726  /// \endcode
727  ///
728  /// To call this, GetPrim() must return a valid prim.
729  ///
730  /// - If a spec for this attribute already exists at the current edit
731  /// target, do nothing.
732  ///
733  /// - If a spec for \a attrName of a different spec type (e.g. a
734  /// relationship) exists at the current EditTarget, issue an error.
735  ///
736  /// - If \a name refers to a builtin attribute according to the prim's
737  /// definition, author an attribute spec with required metadata from the
738  /// definition.
739  ///
740  /// - If \a name refers to a builtin relationship, issue an error.
741  ///
742  /// - If there exists an absolute strongest authored attribute spec for
743  /// \a attrName, author an attribute spec at the current EditTarget by
744  /// copying required metadata from that strongest spec.
745  ///
746  /// - If there exists an absolute strongest authored relationship spec for
747  /// \a attrName, issue an error.
748  ///
749  /// - Otherwise author an attribute spec at the current EditTarget using
750  /// the provided \a typeName and \a custom for the required metadata fields.
751  /// Note that these supplied arguments are only ever used in this particular
752  /// circumstance, in all other cases they are ignored.
753  USD_API
756  const SdfValueTypeName &typeName,
757  bool custom,
758  SdfVariability variability = SdfVariabilityVarying) const;
759  /// \overload
760  /// Create a custom attribute with \p name, \p typeName and \p variability.
761  USD_API
764  const SdfValueTypeName &typeName,
765  SdfVariability variability = SdfVariabilityVarying) const;
766 
767  /// \overload
768  /// This overload of CreateAttribute() accepts a vector of name components
769  /// used to construct a \em namespaced property name. For details, see
770  /// \ref Usd_Ordering
771  USD_API
773  const std::vector<std::string> &nameElts,
774  const SdfValueTypeName &typeName,
775  bool custom,
776  SdfVariability variability = SdfVariabilityVarying) const;
777  /// \overload
778  /// Create a custom attribute with \p nameElts, \p typeName, and
779  /// \p variability.
780  USD_API
782  const std::vector<std::string> &nameElts,
783  const SdfValueTypeName &typeName,
784  SdfVariability variability = SdfVariabilityVarying) const;
785 
786  /// Like GetProperties(), but exclude all relationships from the result.
787  USD_API
788  std::vector<UsdAttribute> GetAttributes() const;
789 
790  /// Like GetAttributes(), but exclude attributes without authored scene
791  /// description from the result. See UsdProperty::IsAuthored().
792  USD_API
793  std::vector<UsdAttribute> GetAuthoredAttributes() const;
794 
795  /// Return a UsdAttribute with the name \a attrName. The attribute
796  /// returned may or may not \b actually exist so it must be checked for
797  /// validity. Suggested use:
798  ///
799  /// \code
800  /// if (UsdAttribute myAttr = prim.GetAttribute("myAttr")) {
801  /// // myAttr is safe to use.
802  /// // Edits to the owning stage requires subsequent validation.
803  /// } else {
804  /// // myAttr was not defined/authored
805  /// }
806  /// \endcode
807  USD_API
808  UsdAttribute GetAttribute(const TfToken& attrName) const;
809 
810  /// Return true if this prim has an attribute named \p attrName, false
811  /// otherwise.
812  USD_API
813  bool HasAttribute(const TfToken& attrName) const;
814 
815  /// Search the prim subtree rooted at this prim for attributes for which
816  /// \p predicate returns true, collect their connection source paths and
817  /// return them in an arbitrary order. If \p recurseOnSources is true,
818  /// act as if this function was invoked on the connected prims and owning
819  /// prims of connected properties also and return the union.
820  USD_API
823  std::function<bool (UsdAttribute const &)> const &pred = nullptr,
824  bool recurseOnSources = false) const;
825 
826  // --------------------------------------------------------------------- //
827  /// \name Relationships
828  // --------------------------------------------------------------------- //
829 
830  /// Author scene description for the relationship named \a relName at the
831  /// current EditTarget if none already exists. Return a valid relationship
832  /// if scene description was successfully authored or if it already existed,
833  /// return an invalid relationship otherwise.
834  ///
835  /// Suggested use:
836  /// \code
837  /// if (UsdRelationship myRel = prim.CreateRelationship(...)) {
838  /// // success.
839  /// }
840  /// \endcode
841  ///
842  /// To call this, GetPrim() must return a valid prim.
843  ///
844  /// - If a spec for this relationship already exists at the current edit
845  /// target, do nothing.
846  ///
847  /// - If a spec for \a relName of a different spec type (e.g. an
848  /// attribute) exists at the current EditTarget, issue an error.
849  ///
850  /// - If \a name refers to a builtin relationship according to the prim's
851  /// definition, author a relationship spec with required metadata from the
852  /// definition.
853  ///
854  /// - If \a name refers to a builtin attribute, issue an error.
855  ///
856  /// - If there exists an absolute strongest authored relationship spec for
857  /// \a relName, author a relationship spec at the current EditTarget by
858  /// copying required metadata from that strongest spec.
859  ///
860  /// - If there exists an absolute strongest authored attribute spec for \a
861  /// relName, issue an error.
862  ///
863  /// - Otherwise author a uniform relationship spec at the current
864  /// EditTarget, honoring \p custom .
865  ///
866  USD_API
868  bool custom=true) const;
869 
870  /// \overload
871  /// This overload of CreateRelationship() accepts a vector of
872  /// name components used to construct a \em namespaced property name.
873  /// For details, see \ref Usd_Ordering
874  USD_API
875  UsdRelationship CreateRelationship(const std::vector<std::string> &nameElts,
876  bool custom=true)
877  const;
878 
879  /// Like GetProperties(), but exclude all attributes from the result.
880  USD_API
881  std::vector<UsdRelationship> GetRelationships() const;
882 
883  /// Like GetRelationships(), but exclude relationships without authored
884  /// scene description from the result. See UsdProperty::IsAuthored().
885  USD_API
886  std::vector<UsdRelationship> GetAuthoredRelationships() const;
887 
888  /// Return a UsdRelationship with the name \a relName. The relationship
889  /// returned may or may not \b actually exist so it must be checked for
890  /// validity. Suggested use:
891  ///
892  /// \code
893  /// if (UsdRelationship myRel = prim.GetRelationship("myRel")) {
894  /// // myRel is safe to use.
895  /// // Edits to the owning stage requires subsequent validation.
896  /// } else {
897  /// // myRel was not defined/authored
898  /// }
899  /// \endcode
900  USD_API
901  UsdRelationship GetRelationship(const TfToken& relName) const;
902 
903  /// Return true if this prim has a relationship named \p relName, false
904  /// otherwise.
905  USD_API
906  bool HasRelationship(const TfToken& relName) const;
907 
908  /// Search the prim subtree rooted at this prim for relationships for which
909  /// \p predicate returns true, collect their target paths and return them in
910  /// an arbitrary order. If \p recurseOnTargets is true, act as if this
911  /// function was invoked on the targeted prims and owning prims of targeted
912  /// properties also (but not of forwarding relationships) and return the
913  /// union.
914  USD_API
917  std::function<bool (UsdRelationship const &)> const &pred = nullptr,
918  bool recurseOnTargets = false) const;
919 
920  // --------------------------------------------------------------------- //
921  /// \name Payload Authoring
922  /// \deprecated
923  /// This API is now deprecated. Please use the HasAuthoredPayloads and the
924  /// UsdPayloads API returned from GetPayloads() to query and author payloads
925  /// instead.
926  /// @{
927  // --------------------------------------------------------------------- //
928 
929  /// \deprecated
930  /// Clears the payload at the current EditTarget for this prim. Return false
931  /// if the payload could not be cleared.
932  USD_API
933  bool ClearPayload() const;
934 
935  /// \deprecated
936  /// Return true if a payload is present on this prim.
937  ///
938  /// \sa \ref Usd_Payloads
939  USD_API
940  bool HasPayload() const;
941 
942  /// \deprecated
943  /// Author payload metadata for this prim at the current edit
944  /// target. Return true on success, false if the value could not be set.
945  ///
946  /// \sa \ref Usd_Payloads
947  USD_API
948  bool SetPayload(const SdfPayload& payload) const;
949 
950  /// \deprecated
951  /// Shorthand for SetPayload(SdfPayload(assetPath, primPath)).
952  USD_API
953  bool SetPayload(
954  const std::string& assetPath, const SdfPath& primPath) const;
955 
956  /// \deprecated
957  /// Shorthand for SetPayload(SdfPayload(layer->GetIdentifier(),
958  /// primPath)).
959  USD_API
960  bool SetPayload(const SdfLayerHandle& layer, const SdfPath& primPath) const;
961 
962  /// @}
963 
964  // --------------------------------------------------------------------- //
965  /// \name Payloads, Load and Unload
966  // --------------------------------------------------------------------- //
967 
968  /// Return a UsdPayloads object that allows one to add, remove, or
969  /// mutate payloads <em>at the currently set UsdEditTarget</em>.
970  ///
971  /// There is currently no facility for \em listing the currently authored
972  /// payloads on a prim... the problem is somewhat ill-defined, and
973  /// requires some thought.
974  USD_API
975  UsdPayloads GetPayloads() const;
976 
977  /// Return true if this prim has any authored payloads.
978  USD_API
979  bool HasAuthoredPayloads() const;
980 
981  /// Load this prim, all its ancestors, and by default all its descendants.
982  /// If \p loadPolicy is UsdLoadWithoutDescendants, then load only this prim
983  /// and its ancestors.
984  ///
985  /// See UsdStage::Load for additional details.
986  USD_API
988 
989  /// Unloads this prim and all its descendants.
990  ///
991  /// See UsdStage::Unload for additional details.
992  USD_API
993  void Unload() const;
994 
995  // --------------------------------------------------------------------- //
996  /// \name References
997  // --------------------------------------------------------------------- //
998 
999  /// Return a UsdReferences object that allows one to add, remove, or
1000  /// mutate references <em>at the currently set UsdEditTarget</em>.
1001  ///
1002  /// There is currently no facility for \em listing the currently authored
1003  /// references on a prim... the problem is somewhat ill-defined, and
1004  /// requires some thought.
1005  USD_API
1006  UsdReferences GetReferences() const;
1007 
1008  /// Return true if this prim has any authored references.
1009  USD_API
1010  bool HasAuthoredReferences() const;
1011 
1012  // --------------------------------------------------------------------- //
1013  /// \name Inherits
1014  // --------------------------------------------------------------------- //
1015 
1016  /// Return a UsdInherits object that allows one to add, remove, or
1017  /// mutate inherits <em>at the currently set UsdEditTarget</em>.
1018  ///
1019  /// There is currently no facility for \em listing the currently authored
1020  /// inherits on a prim... the problem is somewhat ill-defined, and
1021  /// requires some thought.
1022  USD_API
1023  UsdInherits GetInherits() const;
1024 
1025  /// Return true if this prim has any authored inherits.
1026  USD_API
1027  bool HasAuthoredInherits() const;
1028 
1029  // --------------------------------------------------------------------- //
1030  /// \name Specializes
1031  // --------------------------------------------------------------------- //
1032 
1033  /// Return a UsdSpecializes object that allows one to add, remove, or
1034  /// mutate specializes <em>at the currently set UsdEditTarget</em>.
1035  ///
1036  /// There is currently no facility for \em listing the currently authored
1037  /// specializes on a prim... the problem is somewhat ill-defined, and
1038  /// requires some thought.
1039  USD_API
1041 
1042  /// Returns true if this prim has any authored specializes.
1043  USD_API
1044  bool HasAuthoredSpecializes() const;
1045 
1046  // --------------------------------------------------------------------- //
1047  /// \name Instancing
1048  /// See \ref Usd_Page_ScenegraphInstancing for more details.
1049  /// @{
1050  // --------------------------------------------------------------------- //
1051 
1052  /// Return true if this prim has been marked as instanceable.
1053  ///
1054  /// Note that this is not the same as IsInstance(). A prim may return
1055  /// true for IsInstanceable() and false for IsInstance() if this prim
1056  /// is not active or if it is marked as instanceable but contains no
1057  /// instanceable data.
1058  bool IsInstanceable() const {
1059  bool instanceable = false;
1060  return GetMetadata(SdfFieldKeys->Instanceable, &instanceable) &&
1061  instanceable;
1062  }
1063 
1064  /// Author 'instanceable' metadata for this prim at the current
1065  /// EditTarget.
1066  bool SetInstanceable(bool instanceable) const {
1067  return SetMetadata(SdfFieldKeys->Instanceable, instanceable);
1068  }
1069 
1070  /// Remove the authored 'instanceable' opinion at the current EditTarget.
1071  /// Do nothing if there is no authored opinion.
1072  bool ClearInstanceable() const {
1073  return ClearMetadata(SdfFieldKeys->Instanceable);
1074  }
1075 
1076  /// Return true if this prim has an authored opinion for 'instanceable',
1077  /// false otherwise.
1079  return HasAuthoredMetadata(SdfFieldKeys->Instanceable);
1080  }
1081 
1082  /// Return true if this prim is an instance of a master, false
1083  /// otherwise.
1084  ///
1085  /// If this prim is an instance, calling GetMaster() will return
1086  /// the UsdPrim for the corresponding master prim.
1087  bool IsInstance() const { return _Prim()->IsInstance(); }
1088 
1089  /// Return true if this prim is an instance proxy, false otherwise.
1090  /// An instance proxy prim represents a descendent of an instance
1091  /// prim.
1092  bool IsInstanceProxy() const {
1094  }
1095 
1096  /// Return true if this prim is a master prim, false otherwise.
1097  bool IsMaster() const { return _Prim()->IsMaster(); }
1098 
1099  /// Return true if this prim is located in a subtree of prims
1100  /// rooted at a master prim, false otherwise.
1101  ///
1102  /// If this function returns true, this prim is either a master prim
1103  /// or a descendent of a master prim.
1104  bool IsInMaster() const {
1105  return (IsInstanceProxy() ?
1106  _PrimPathIsInMaster() : _Prim()->IsInMaster());
1107  }
1108 
1109  /// If this prim is an instance, return the UsdPrim for the corresponding
1110  /// master. Otherwise, return an invalid UsdPrim.
1111  USD_API
1112  UsdPrim GetMaster() const;
1113 
1114  /// If this prim is an instance proxy, return the UsdPrim for the
1115  /// corresponding prim in the instance's master. Otherwise, return an
1116  /// invalid UsdPrim.
1118  if (IsInstanceProxy()) {
1119  return UsdPrim(_Prim(), SdfPath());
1120  }
1121  return UsdPrim();
1122  }
1123 
1124  /// @}
1125 
1126  // --------------------------------------------------------------------- //
1127  /// \name Composition Structure
1128  /// @{
1129  // --------------------------------------------------------------------- //
1130 
1131  /// Return the cached prim index containing all sites that contribute
1132  /// opinions to this prim.
1133  ///
1134  /// The prim index can be used to examine the composition arcs and scene
1135  /// description sites that contribute to this prim's property and metadata
1136  /// values.
1137  ///
1138  /// The prim index returned by this function is optimized and may not
1139  /// include sites that do not contribute opinions to this prim. Use
1140  /// UsdPrim::ComputeExpandedPrimIndex to compute a prim index that includes
1141  /// all possible sites that could contribute opinions.
1142  ///
1143  /// This prim index will be empty for master prims. This ensures that these
1144  /// prims do not provide any attribute or metadata values. For all other
1145  /// prims in masters, this is the prim index that was chosen to be shared
1146  /// with all other instances. In either case, the prim index's path will
1147  /// not be the same as the prim's path.
1148  ///
1149  /// Prim indexes may be invalidated by changes to the UsdStage and cannot
1150  /// detect if they are expired. Clients should avoid keeping copies of the
1151  /// prim index across such changes, which include scene description
1152  /// changes or changes to load state.
1153  const PcpPrimIndex &GetPrimIndex() const { return _Prim()->GetPrimIndex(); }
1154 
1155  /// Compute the prim index containing all sites that could contribute
1156  /// opinions to this prim.
1157  ///
1158  /// This function is similar to UsdPrim::GetPrimIndex. However, the
1159  /// returned prim index includes all sites that could possibly contribute
1160  /// opinions to this prim, not just the sites that currently do so. This is
1161  /// useful in certain situations; for example, this could be used to
1162  /// generate a list of sites where clients could make edits to affect this
1163  /// prim, or for debugging purposes.
1164  ///
1165  /// This function may be relatively slow, since it will recompute the prim
1166  /// index on every call. Clients should prefer UsdPrim::GetPrimIndex unless
1167  /// the additional site information is truly needed.
1168  USD_API
1170 
1171  /// @}
1172 
1173 private:
1174  friend class UsdObject;
1177  friend class UsdProperty;
1178  friend class UsdSchemaBase;
1179  friend class UsdAPISchemaBase;
1180  friend class UsdStage;
1181  friend class UsdPrimRange;
1182  friend class Usd_PrimData;
1186 
1187  // Prim constructor.
1188  UsdPrim(const Usd_PrimDataHandle &primData,
1189  const SdfPath &proxyPrimPath)
1190  : UsdObject(primData, proxyPrimPath) { }
1191 
1192  // General constructor.
1193  UsdPrim(UsdObjType objType,
1194  const Usd_PrimDataHandle &prim,
1195  const SdfPath &proxyPrimPath,
1196  const TfToken &propName)
1197  : UsdObject(objType, prim, proxyPrimPath, propName) {}
1198 
1199  // Helper to make a sibling range.
1200  inline SiblingRange
1201  _MakeSiblingRange(const Usd_PrimFlagsPredicate &pred) const;
1202 
1203  // Helper to make a range of descendants.
1204  inline SubtreeRange
1205  _MakeDescendantsRange(const Usd_PrimFlagsPredicate &pred) const;
1206 
1207  // Helper to make a vector of properties from names.
1208  std::vector<UsdProperty>
1209  _MakeProperties(const TfTokenVector &names) const;
1210 
1211  // Helper for Get{Authored}{PropertyNames,Properties}
1212  TfTokenVector _GetPropertyNames(
1213  bool onlyAuthored,
1214  bool applyOrder=true,
1215  const PropertyPredicateFunc &predicate={}) const;
1216 
1217  // Helper for Get(Authored)PropertiesInNamespace.
1218  std::vector<UsdProperty>
1219  _GetPropertiesInNamespace(const std::string &namespaces,
1220  bool onlyAuthored) const;
1221 
1222  // Helper for Get(Authored)Attributes.
1223  std::vector<UsdAttribute>
1224  _GetAttributes(bool onlyAuthored, bool applyOrder=false) const;
1225 
1226  // Helper for Get(Authored)Relationships.
1227  std::vector<UsdRelationship>
1228  _GetRelationships(bool onlyAuthored, bool applyOrder=false) const;
1229 
1230  // Helper for determining whether this prim is in a master based
1231  // on prim path.
1232  USD_API
1233  bool _PrimPathIsInMaster() const;
1234 
1235  friend const PcpPrimIndex &Usd_PrimGetSourcePrimIndex(const UsdPrim&);
1236  // Return a const reference to the source PcpPrimIndex for this prim.
1237  //
1238  // For all prims in masters (which includes the master prim itself),
1239  // this is the prim index for the instance that was chosen to serve
1240  // as the master for all other instances. This prim index will not
1241  // have the same path as the prim's path.
1242  //
1243  // This is a private helper but is also wrapped out to Python
1244  // for testing and debugging purposes.
1245  const PcpPrimIndex &_GetSourcePrimIndex() const
1246  { return _Prim()->GetSourcePrimIndex(); }
1247 };
1248 
1249 #ifdef doxygen
1250 
1251 /// Forward traversal iterator of sibling ::UsdPrim s. This is a
1252 /// standard-compliant iterator that may be used with STL algorithms, etc.
1253 class UsdPrimSiblingIterator {
1254 public:
1255  /// Iterator value type.
1256  typedef UsdPrim value_type;
1257  /// Iterator reference type, in this case the same as \a value_type.
1258  typedef value_type reference;
1259  /// Iterator difference type.
1260  typedef unspecified-integral-type difference_type;
1261  /// Dereference.
1262  reference operator*() const;
1263  /// Indirection.
1264  unspecified-type operator->() const;
1265  /// Postincrement.
1266  UsdPrimSiblingIterator &operator++();
1267  /// Preincrement.
1268  UsdPrimSiblingIterator operator++(int);
1269 private:
1270  /// Equality.
1271  friend bool operator==(const UsdPrimSiblingIterator &lhs,
1272  const UsdPrimSiblingIterator &rhs);
1273  /// Inequality.
1274  friend bool operator!=(const UsdPrimSiblingIterator &lhs,
1275  const UsdPrimSiblingIterator &rhs);
1276 };
1277 
1278 /// Forward iterator range of sibling ::UsdPrim s. This range type contains a
1279 /// pair of UsdPrimSiblingIterator s, denoting a half-open range of UsdPrim
1280 /// siblings. It provides a subset of container-like API, such as begin(),
1281 /// end(), front(), empty(), etc.
1282 class UsdPrimSiblingRange {
1283 public:
1284  /// Iterator type.
1285  typedef UsdPrimSiblingIterator iterator;
1286  /// Const iterator type.
1287  typedef UsdPrimSiblingIterator const_iterator;
1288  /// Iterator difference type.
1289  typedef unspecified-integral-type difference_type;
1290  /// Iterator value_type.
1292  /// Iterator reference_type.
1294 
1295  /// Construct with a pair of iterators.
1298 
1299  /// Construct/convert from another compatible range type.
1300  template <class ForwardRange>
1301  UsdPrimSiblingRange(const ForwardRange &r);
1302 
1303  /// Assign from another compatible range type.
1304  template <class ForwardRange>
1305  UsdPrimSiblingRange &operator=(const ForwardRange &r);
1306 
1307  /// First iterator.
1308  iterator begin() const;
1309 
1310  /// Past-the-end iterator.
1311  iterator end() const;
1312 
1313  /// Return !empty().
1314  operator unspecified_bool_type() const;
1315 
1316  /// Equality compare.
1317  bool equal(const iterator_range&) const;
1318 
1319  /// Return *begin(). This range must not be empty.
1320  reference front() const;
1321 
1322  /// Advance this range's begin iterator.
1323  iterator_range& advance_begin(difference_type n);
1324 
1325  /// Advance this range's end iterator.
1326  iterator_range& advance_end(difference_type n);
1327 
1328  ; /// Return begin() == end().
1329  bool empty() const;
1330 
1331 private:
1332  /// Equality comparison.
1333  friend bool operator==(const UsdPrimSiblingRange &lhs,
1334  const UsdPrimSiblingRange &rhs);
1335  /// Inequality comparison.
1336  friend bool operator!=(const UsdPrimSiblingRange &lhs,
1337  const UsdPrimSiblingRange &rhs);
1338 };
1339 
1340 #else
1341 
1342 // Sibling iterator class. Converts ref to weak and filters according to a
1343 // supplied predicate.
1344 class UsdPrimSiblingIterator : public hboost::iterator_adaptor<
1345  UsdPrimSiblingIterator, // crtp base.
1346  const Usd_PrimData *, // base iterator.
1347  UsdPrim, // value type.
1348  hboost::forward_traversal_tag, // traversal
1349  UsdPrim> // reference type.
1350 {
1351 public:
1352  // Default ctor.
1354 
1355 private:
1356  friend class UsdPrim;
1357 
1358  // Constructor used by Prim.
1359  UsdPrimSiblingIterator(const base_type &i, const SdfPath& proxyPrimPath,
1360  const Usd_PrimFlagsPredicate &predicate)
1361  : iterator_adaptor_(i)
1362  , _proxyPrimPath(proxyPrimPath)
1363  , _predicate(predicate) {
1364  // Need to advance iterator to first matching element.
1365  if (base() && !Usd_EvalPredicate(_predicate, base(), _proxyPrimPath))
1366  increment();
1367  }
1368 
1369  // Core implementation invoked by iterator_adaptor.
1371  bool equal(const UsdPrimSiblingIterator &other) const {
1372  return base() == other.base() &&
1373  _proxyPrimPath == other._proxyPrimPath &&
1374  _predicate == other._predicate;
1375  }
1376 
1377  void increment() {
1378  base_type &base = base_reference();
1379  if (Usd_MoveToNextSiblingOrParent(base, _proxyPrimPath, _predicate)) {
1380  base = nullptr;
1381  _proxyPrimPath = SdfPath();
1382  }
1383  }
1384 
1385  reference dereference() const {
1386  return UsdPrim(base(), _proxyPrimPath);
1387  }
1388 
1389  SdfPath _proxyPrimPath;
1390  Usd_PrimFlagsPredicate _predicate;
1391 };
1392 
1393 // Typedef iterator range.
1394 typedef hboost::iterator_range<UsdPrimSiblingIterator> UsdPrimSiblingRange;
1395 
1396 // Inform TfIterator it should feel free to make copies of the range type.
1397 template <>
1399  UsdPrimSiblingRange> : hboost::true_type {};
1400 template <>
1402  const UsdPrimSiblingRange> : hboost::true_type {};
1403 
1404 #endif // doxygen
1405 
1406 
1407 UsdPrimSiblingRange
1409 {
1410  return _MakeSiblingRange(
1412 }
1413 
1414 UsdPrimSiblingRange
1416 {
1418 }
1419 
1420 UsdPrimSiblingRange
1422 {
1424 }
1425 
1426 // Helper to make a sibling range.
1428 UsdPrim::_MakeSiblingRange(const Usd_PrimFlagsPredicate &pred) const {
1429  Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
1430  SdfPath firstChildPath = _ProxyPrimPath();
1431  if (!Usd_MoveToChild(firstChild, firstChildPath, pred)) {
1432  firstChild = nullptr;
1433  firstChildPath = SdfPath();
1434  }
1435 
1436  return SiblingRange(
1437  SiblingIterator(firstChild, firstChildPath, pred),
1438  SiblingIterator(nullptr, SdfPath(), pred));
1439 }
1440 
1441 #ifdef doxygen
1442 
1443 /// Forward traversal iterator of sibling ::UsdPrim s. This is a
1444 /// standard-compliant iterator that may be used with STL algorithms, etc.
1445 class UsdPrimSubtreeIterator {
1446 public:
1447  /// Iterator value type.
1448  typedef UsdPrim value_type;
1449  /// Iterator reference type, in this case the same as \a value_type.
1450  typedef value_type reference;
1451  /// Iterator difference type.
1452  typedef unspecified-integral-type difference_type;
1453  /// Dereference.
1454  reference operator*() const;
1455  /// Indirection.
1456  unspecified-type operator->() const;
1457  /// Postincrement.
1458  UsdPrimSubtreeIterator &operator++();
1459  /// Preincrement.
1460  UsdPrimSubtreeIterator operator++(int);
1461 private:
1462  /// Equality.
1463  friend bool operator==(const UsdPrimSubtreeIterator &lhs,
1464  const UsdPrimSubtreeIterator &rhs);
1465  /// Inequality.
1466  friend bool operator!=(const UsdPrimSubtreeIterator &lhs,
1467  const UsdPrimSubtreeIterator &rhs);
1468 };
1469 
1470 /// Forward iterator range of sibling ::UsdPrim s. This range type contains a
1471 /// pair of UsdPrimSubtreeIterator s, denoting a half-open range of UsdPrim
1472 /// siblings. It provides a subset of container-like API, such as begin(),
1473 /// end(), front(), empty(), etc.
1474 class UsdPrimSubtreeRange {
1475 public:
1476  /// Iterator type.
1477  typedef UsdPrimSubtreeIterator iterator;
1478  /// Const iterator type.
1479  typedef UsdPrimSubtreeIterator const_iterator;
1480  /// Iterator difference type.
1481  typedef unspecified-integral-type difference_type;
1482  /// Iterator value_type.
1484  /// Iterator reference_type.
1486 
1487  /// Construct with a pair of iterators.
1490 
1491  /// Construct/convert from another compatible range type.
1492  template <class ForwardRange>
1493  UsdPrimSubtreeRange(const ForwardRange &r);
1494 
1495  /// Assign from another compatible range type.
1496  template <class ForwardRange>
1497  UsdPrimSubtreeRange &operator=(const ForwardRange &r);
1498 
1499  /// First iterator.
1500  iterator begin() const;
1501 
1502  /// Past-the-end iterator.
1503  iterator end() const;
1504 
1505  /// Return !empty().
1506  operator unspecified_bool_type() const;
1507 
1508  /// Equality compare.
1509  bool equal(const iterator_range&) const;
1510 
1511  /// Return *begin(). This range must not be empty.
1512  reference front() const;
1513 
1514  /// Advance this range's begin iterator.
1515  iterator_range& advance_begin(difference_type n);
1516 
1517  /// Advance this range's end iterator.
1518  iterator_range& advance_end(difference_type n);
1519 
1520  /// Return begin() == end().
1521  bool empty() const;
1522 
1523 private:
1524  /// Equality comparison.
1525  friend bool operator==(const UsdPrimSubtreeRange &lhs,
1526  const UsdPrimSubtreeRange &rhs);
1527  /// Inequality comparison.
1528  friend bool operator!=(const UsdPrimSubtreeRange &lhs,
1529  const UsdPrimSubtreeRange &rhs);
1530 };
1531 
1532 #else
1533 
1534 // Subtree iterator class. Converts ref to weak and filters according to a
1535 // supplied predicate.
1536 class UsdPrimSubtreeIterator : public hboost::iterator_adaptor<
1537  UsdPrimSubtreeIterator, // crtp base.
1538  const Usd_PrimData *, // base iterator.
1539  UsdPrim, // value type.
1540  hboost::forward_traversal_tag, // traversal
1541  UsdPrim> // reference type.
1542 {
1543 public:
1544  // Default ctor.
1546 
1547 private:
1548  friend class UsdPrim;
1549 
1550  // Constructor used by Prim.
1551  UsdPrimSubtreeIterator(const base_type &i, const SdfPath &proxyPrimPath,
1552  const Usd_PrimFlagsPredicate &predicate)
1553  : iterator_adaptor_(i)
1554  , _proxyPrimPath(proxyPrimPath)
1555  , _predicate(predicate) {
1556  // Need to advance iterator to first matching element.
1557  base_type &base = base_reference();
1558  if (base && !Usd_EvalPredicate(_predicate, base, _proxyPrimPath)) {
1559  if (Usd_MoveToNextSiblingOrParent(base, _proxyPrimPath,
1560  _predicate)) {
1561  base = nullptr;
1562  _proxyPrimPath = SdfPath();
1563  }
1564  }
1565  }
1566 
1567  // Core implementation invoked by iterator_adaptor.
1569  bool equal(const UsdPrimSubtreeIterator &other) const {
1570  return base() == other.base() &&
1571  _proxyPrimPath == other._proxyPrimPath &&
1572  _predicate == other._predicate;
1573  }
1574 
1575  void increment() {
1576  base_type &base = base_reference();
1577  if (!Usd_MoveToChild(base, _proxyPrimPath, _predicate)) {
1578  while (Usd_MoveToNextSiblingOrParent(base, _proxyPrimPath,
1579  _predicate)) {}
1580  }
1581  }
1582 
1583  reference dereference() const {
1584  return UsdPrim(base(), _proxyPrimPath);
1585  }
1586 
1587  SdfPath _proxyPrimPath;
1588  Usd_PrimFlagsPredicate _predicate;
1589 };
1590 
1591 // Typedef iterator range.
1592 typedef hboost::iterator_range<UsdPrimSubtreeIterator> UsdPrimSubtreeRange;
1593 
1594 // Inform TfIterator it should feel free to make copies of the range type.
1595 template <>
1597  UsdPrimSubtreeRange> : hboost::true_type {};
1598 template <>
1600  const UsdPrimSubtreeRange> : hboost::true_type {};
1601 
1602 #endif // doxygen
1603 
1604 UsdPrimSubtreeRange
1606 {
1607  return _MakeDescendantsRange(
1609 }
1610 
1611 UsdPrimSubtreeRange
1613 {
1615 }
1616 
1617 UsdPrimSubtreeRange
1619 {
1621 }
1622 
1623 // Helper to make a sibling range.
1625 UsdPrim::_MakeDescendantsRange(const Usd_PrimFlagsPredicate &pred) const {
1626  Usd_PrimDataConstPtr firstChild = get_pointer(_Prim());
1627  SdfPath firstChildPath = _ProxyPrimPath();
1628  Usd_PrimDataConstPtr endChild = firstChild;
1629  SdfPath endChildPath = firstChildPath;
1630  if (Usd_MoveToChild(firstChild, firstChildPath, pred)) {
1631  while (Usd_MoveToNextSiblingOrParent(endChild, endChildPath, pred)) {}
1632  }
1633 
1634  return SubtreeRange(
1635  SubtreeIterator(firstChild, firstChildPath, pred),
1636  SubtreeIterator(endChild, endChildPath, pred));
1637 }
1638 
1639 
1640 ////////////////////////////////////////////////////////////////////////
1641 // UsdObject methods that require UsdPrim be a complete type.
1642 
1643 inline UsdPrim
1645 {
1646  return UsdPrim(_prim, _proxyPrimPath);
1647 }
1648 
1650 
1651 #endif // USD_PRIM_H
1652 
USD_API SdfPrimSpecHandleVector GetPrimStack() const
void Usd_MoveToParent(PrimDataPtr &p, SdfPath &proxyPrimPath)
Definition: primData.h:507
friend class UsdPrim
Definition: prim.h:1356
USD_API SdfPathVector FindAllRelationshipTargetPaths(std::function< bool(UsdRelationship const &)> const &pred=nullptr, bool recurseOnTargets=false) const
Color4< T > operator*(S a, const Color4< T > &v)
Definition: ImathColor.h:728
USD_API SdfPrimSpecHandle GetPrimDefinition() const
UsdObjType
Definition: object.h:48
Usd_PrimFlagsPredicate Usd_CreatePredicateForTraversal(const PrimDataPtr &p, const SdfPath &proxyPrimPath, Usd_PrimFlagsPredicate pred)
Definition: primData.h:487
GLuint const GLchar * name
Definition: glew.h:1814
#define USD_API
Definition: api.h:40
friend class hboost::iterator_core_access
Definition: prim.h:1568
hboost::math::policies::policy< hboost::math::policies::domain_error< hboost::math::policies::ignore_error >, hboost::math::policies::pole_error< hboost::math::policies::ignore_error >, hboost::math::policies::overflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::underflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::denorm_error< hboost::math::policies::ignore_error >, hboost::math::policies::rounding_error< hboost::math::policies::ignore_error >, hboost::math::policies::evaluation_error< hboost::math::policies::ignore_error >, hboost::math::policies::indeterminate_result_error< hboost::math::policies::ignore_error > > policy
Definition: SYS_MathCbrt.h:35
USD_API bool HasAuthoredPayloads() const
Return true if this prim has any authored payloads.
USD_API UsdVariantSet GetVariantSet(const std::string &variantSetName) const
FMT_CONSTEXPR auto begin(const C &c) -> decltype(c.begin())
Definition: format.h:251
USD_API std::vector< UsdAttribute > GetAuthoredAttributes() const
SiblingRange GetChildren() const
Definition: prim.h:1421
USD_API bool HasAuthoredInherits() const
Return true if this prim has any authored inherits.
USD_API bool HasAuthoredMetadata(const TfToken &key) const
SdfSpecifier GetSpecifier() const
Return this prim's composed specifier.
Definition: prim.h:151
static TF_API std::string GetCanonicalTypeName(const std::type_info &)
bool HasAuthoredInstanceable() const
Definition: prim.h:1078
UsdPrimSiblingRange SiblingRange
Definition: prim.h:136
USD_API UsdRelationship CreateRelationship(const TfToken &relName, bool custom=true) const
#define TF_CODING_ERROR
SiblingRange GetAllChildren() const
Return all this prim's children as an iterable range.
Definition: prim.h:1415
USD_API UsdAttribute CreateAttribute(const TfToken &name, const SdfValueTypeName &typeName, bool custom, SdfVariability variability=SdfVariabilityVarying) const
bool IsInstanceProxy() const
Definition: prim.h:1092
SubtreeRange GetAllDescendants() const
Definition: prim.h:1612
USD_API bool HasAuthoredReferences() const
Return true if this prim has any authored references.
Load a prim plus all its descendants.
Definition: common.h:140
bool SetMetadata(const TfToken &key, const T &value) const
Definition: object.h:751
USD_API bool HasProperty(const TfToken &propName) const
USD_API void Load(UsdLoadPolicy policy=UsdLoadWithDescendants) const
USD_API bool RemoveProperty(const TfToken &propName)
bool GetMetadata(const TfToken &key, T *value) const
Definition: object.h:742
USD_API bool ClearMetadata(const TfToken &key) const
USD_API UsdPrim GetMaster() const
uint64 value_type
Definition: GA_PrimCompat.h:29
USD_API std::vector< UsdProperty > GetAuthoredProperties(const PropertyPredicateFunc &predicate={}) const
GLuint GLdouble GLdouble GLint GLint order
Definition: glew.h:3446
bool IsDefined() const
Definition: prim.h:241
bool HasAPI(const TfToken &instanceName=TfToken()) const
Definition: prim.h:506
USD_API TfTokenVector GetPropertyNames(const PropertyPredicateFunc &predicate={}) const
USD_API std::vector< UsdProperty > GetProperties(const PropertyPredicateFunc &predicate={}) const
friend struct UsdPrim_AttrConnectionFinder
Definition: prim.h:1185
bool IsLoaded() const
Definition: prim.h:225
bool IsActive() const
Definition: prim.h:195
USD_API bool ClearPayload() const
bool IsA() const
Definition: prim.h:458
USD_API SdfPathVector FindAllAttributeConnectionPaths(std::function< bool(UsdAttribute const &)> const &pred=nullptr, bool recurseOnSources=false) const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
Definition: token.h:89
USD_API UsdProperty GetProperty(const TfToken &propName) const
bool IsMaster() const
Return true if this prim is a master prim, false otherwise.
Definition: prim.h:1097
T * get_pointer(PXR_NS::TfRefPtr< T > const &p)
Definition: refPtr.h:1368
bool IsGroup() const
Definition: prim.h:234
USD_API bool HasAttribute(const TfToken &attrName) const
USD_API bool HasRelationship(const TfToken &relName) const
USD_API void Unload() const
Multiple Apply API Schema.
bool Usd_IsInstanceProxy(const PrimDataPtr &p, const SdfPath &proxyPrimPath)
Definition: primData.h:473
USD_API bool HasAuthoredSpecializes() const
Returns true if this prim has any authored specializes.
USD_API UsdReferences GetReferences() const
GLuint GLuint end
Definition: glew.h:1253
friend class hboost::iterator_core_access
Definition: prim.h:1370
bool SetInstanceable(bool instanceable) const
Definition: prim.h:1066
bool HasAuthoredActive() const
Definition: prim.h:218
GLuint const GLuint * names
Definition: glew.h:2690
GLsizei n
Definition: glew.h:4040
USD_API bool SetPayload(const SdfPayload &payload) const
Definition: prim.h:131
std::function< bool(const TfToken &propertyName)> PropertyPredicateFunc
Definition: prim.h:258
SdfSpecifier
Definition: types.h:123
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:438
Single Apply API schema.
friend struct UsdPrim_RelTargetFinder
Definition: prim.h:1184
hboost::iterator_range< UsdPrimSubtreeIterator > UsdPrimSubtreeRange
Definition: prim.h:74
const SdfPath & _ProxyPrimPath() const
Definition: object.h:720
bool IsAbstract() const
Return true if this prim or any of its ancestors is a class.
Definition: prim.h:237
Definition: path.h:287
USD_API PcpPrimIndex ComputeExpandedPrimIndex() const
bool HasAuthoredTypeName() const
Return true if a typeName has been authored.
Definition: prim.h:187
bool ClearInstanceable() const
Definition: prim.h:1072
USD_API TfTokenVector GetAppliedSchemas() const
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
UsdPrim GetParent() const
Definition: prim.h:644
USD_API UsdPayloads GetPayloads() const
bool ClearTypeName() const
Definition: prim.h:182
std::vector< class SdfPath > SdfPathVector
A vector of SdfPaths.
Definition: path.h:208
USD_API void SetPropertyOrder(const TfTokenVector &order) const
bool Usd_MoveToChild(PrimDataPtr &p, SdfPath &proxyPrimPath, PrimDataPtr end, const Usd_PrimFlagsPredicate &pred)
Definition: primData.h:594
USD_API TfTokenVector GetAuthoredPropertyNames(const PropertyPredicateFunc &predicate={}) const
USD_API UsdInherits GetInherits() const
USD_API UsdPrim GetNextSibling() const
SdfVariability
Definition: types.h:182
USD_API UsdVariantSets GetVariantSets() const
friend class UsdPrim
Definition: prim.h:1548
const Usd_PrimDataHandle & _Prim() const
Definition: object.h:714
UsdPrim GetPrim() const
Definition: prim.h:1644
SubtreeRange GetDescendants() const
Definition: prim.h:1618
GLsizei const GLchar *const * string
Definition: glew.h:1844
USD_API std::vector< UsdRelationship > GetRelationships() const
Like GetProperties(), but exclude all attributes from the result.
bool IsInstance() const
Definition: prim.h:1087
SubtreeRange GetFilteredDescendants(const Usd_PrimFlagsPredicate &predicate) const
Definition: prim.h:1605
UsdLoadPolicy
Definition: common.h:138
USD_API const Usd_PrimFlagsConjunction UsdPrimDefaultPredicate
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1245
bool ClearActive() const
Definition: prim.h:210
hboost::iterator_range< UsdPrimSiblingIterator > UsdPrimSiblingRange
Definition: prim.h:71
USD_API const Usd_PrimFlagsPredicate UsdPrimAllPrimsPredicate
UsdPrim GetPrimInMaster() const
Definition: prim.h:1117
bool Usd_MoveToNextSiblingOrParent(PrimDataPtr &p, SdfPath &proxyPrimPath, PrimDataPtr end, const Usd_PrimFlagsPredicate &pred)
Definition: primData.h:537
const PcpPrimIndex & GetPrimIndex() const
Definition: prim.h:1153
USD_API std::vector< UsdProperty > GetAuthoredPropertiesInNamespace(const std::vector< std::string > &namespaces) const
bool IsModel() const
Definition: prim.h:229
USD_API TfTokenVector GetPropertyOrder() const
Return the strongest propertyOrder metadata value authored on this prim.
bool IsInstanceable() const
Definition: prim.h:1058
UsdPrimSubtreeIterator SubtreeIterator
Convenience typedefs.
Definition: prim.h:139
USD_API std::vector< UsdRelationship > GetAuthoredRelationships() const
USD_API UsdSpecializes GetSpecializes() const
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
const TfToken & GetTypeName() const
Definition: prim.h:173
GLint GLboolean GLint layer
Definition: glew.h:3601
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:83
USD_API UsdRelationship GetRelationship(const TfToken &relName) const
bool equal(T1 a, T2 b, T3 t)
Definition: ImathFun.h:143
Definition: type.h:70
USD_API UsdPrim GetChild(const TfToken &name) const
USD_API bool HasVariantSets() const
GLenum const void GLuint GLint reference
Definition: glew.h:13644
USD_API std::vector< UsdAttribute > GetAttributes() const
Like GetProperties(), but exclude all relationships from the result.
bool SetTypeName(const TfToken &typeName) const
Author this Prim's typeName at the current EditTarget.
Definition: prim.h:176
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:165
#define const
Definition: zconf.h:214
bool SetSpecifier(SdfSpecifier specifier) const
Definition: prim.h:167
USD_API UsdPrim GetFilteredNextSibling(const Usd_PrimFlagsPredicate &predicate) const
bool IsInMaster() const
Definition: prim.h:1104
UsdPrim()
Construct an invalid prim.
Definition: prim.h:143
bool SetActive(bool active) const
Definition: prim.h:201
USD_API UsdAttribute GetAttribute(const TfToken &attrName) const
bool HasDefiningSpecifier() const
Definition: prim.h:245
USD_API std::vector< UsdProperty > GetPropertiesInNamespace(const std::vector< std::string > &namespaces) const
GLsizei const GLfloat * value
Definition: glew.h:1849
UsdPrimSubtreeRange SubtreeRange
Definition: prim.h:140
USD_API bool HasPayload() const
UsdPrimSiblingIterator SiblingIterator
Convenience typedefs.
Definition: prim.h:135
SiblingRange GetFilteredChildren(const Usd_PrimFlagsPredicate &predicate) const
Definition: prim.h:1408
friend const PcpPrimIndex & Usd_PrimGetSourcePrimIndex(const UsdPrim &)
USD_API bool IsPseudoRoot() const