HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
primSpec.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_SDF_PRIM_SPEC_H
8 #define PXR_USD_SDF_PRIM_SPEC_H
9 
10 /// \file sdf/primSpec.h
11 
12 #include "pxr/pxr.h"
14 #include "pxr/usd/sdf/spec.h"
15 #include "pxr/usd/sdf/path.h"
16 #include "pxr/usd/sdf/payload.h"
17 #include "pxr/usd/sdf/proxyTypes.h"
18 #include "pxr/usd/sdf/types.h"
19 #include "pxr/usd/sdf/api.h"
21 
22 #include <iosfwd>
23 #include <map>
24 #include <string>
25 #include <vector>
26 
28 
29 /// \class SdfPrimSpec
30 ///
31 /// Represents a prim description in an SdfLayer object.
32 ///
33 /// Every SdfPrimSpec object is defined in a layer. It is identified by its
34 /// path (SdfPath class) in the namespace hierarchy of its layer. SdfPrimSpecs
35 /// can be created using the New() method as children of either the containing
36 /// SdfLayer itself (for "root level" prims), or as children of other
37 /// SdfPrimSpec objects to extend a hierarchy. The helper function
38 /// SdfCreatePrimInLayer() can be used to quickly create a hierarchy of
39 /// primSpecs.
40 ///
41 /// SdfPrimSpec objects have properties of two general types: attributes
42 /// (containing values) and relationships (different types of connections to
43 /// other prims and attributes). Attributes are represented by the
44 /// SdfAttributeSpec class and relationships by the SdfRelationshipSpec class.
45 /// Each prim has its own namespace of properties. Properties are stored and
46 /// accessed by their name.
47 ///
48 /// SdfPrimSpec objects have a typeName, permission restriction, and they
49 /// reference and inherit prim paths. Permission restrictions control which
50 /// other layers may refer to, or express opinions about a prim. See the
51 /// SdfPermission class for more information.
52 ///
53 /// \todo
54 /// \li Insert doc about references and inherits here.
55 /// \li Should have validate... methods for name, children, properties
56 ///
57 class SdfPrimSpec : public SdfSpec
58 {
59  SDF_DECLARE_SPEC(SdfPrimSpec, SdfSpec);
60 
61 public:
66 
67  ///
68  /// \name Spec creation
69  /// @{
70 
71  /// Create a root prim spec.
72  ///
73  /// Creates a prim spec with a \p name, \p specifier and \p typeName as a
74  /// root prim in the given layer.
75  SDF_API
76  static SdfPrimSpecHandle
77  New(const SdfLayerHandle& parentLayer,
78  const std::string& name, SdfSpecifier spec,
79  const std::string& typeName = std::string());
80 
81  /// Create a prim spec.
82  ///
83  /// Creates a prim spec with a \p name, \p specifier and \p typeName as
84  /// a namespace child of the given prim.
85  ///
86  /// \sa SdfCreatePrimInLayer() to create a PrimSpec with all required
87  /// ancestor specs as SdfSpecifierOver.
88  SDF_API
89  static SdfPrimSpecHandle
90  New(const SdfPrimSpecHandle& parentPrim,
91  const std::string& name, SdfSpecifier spec,
92  const std::string& typeName = std::string());
93 
94  /// \name Name
95  /// @{
96 
97  /// Returns the prim's name.
98  SDF_API
99  const std::string& GetName() const;
100 
101  /// Returns the prim's name, as a token.
102  SDF_API
103  TfToken GetNameToken() const;
104 
105  /// Returns true if setting the prim spec's name to \p newName will
106  /// succeed.
107  ///
108  /// Returns false if it won't, and sets \p whyNot with a string
109  /// describing why not.
110  SDF_API
111  bool CanSetName(const std::string& newName, std::string* whyNot) const;
112 
113  /// Sets the prim's name.
114  ///
115  /// Children prims must be unique by name. It is an error to
116  /// set the name to the same name as an existing child of this
117  /// prim's parent.
118  ///
119  /// Setting validate to false, will skip validation of the \p newName
120  /// (that is, CanSetName will not be called).
121  ///
122  /// Returns true if successful, false otherwise.
123  SDF_API
124  bool SetName(const std::string& newName, bool validate = true);
125 
126  /// Returns true if the given string is a valid prim name.
127  SDF_API
128  static bool IsValidName(const std::string& name);
129 
130  /// @}
131  /// \name Namespace hierarchy
132  /// @{
133 
134  /// Returns the prim's namespace pseudo-root prim.
135  SDF_API
136  SdfPrimSpecHandle GetNameRoot() const;
137 
138  /// Returns the prim's namespace parent.
139  ///
140  /// This does not return the pseudo-root for root prims. Most
141  /// algorithms that scan the namespace hierarchy upwards don't
142  /// want to process the pseudo-root the same way as actual prims.
143  /// Algorithms that do can always call \c GetRealNameParent().
144  SDF_API
145  SdfPrimSpecHandle GetNameParent() const;
146 
147  /// Returns the prim's namespace parent.
148  SDF_API
149  SdfPrimSpecHandle GetRealNameParent() const;
150 
151  /// Returns a keyed vector view of the prim's namespace children.
152  SDF_API
154 
155  /// Updates nameChildren to match the given vector of prims.
156  SDF_API
157  void SetNameChildren(const SdfPrimSpecHandleVector&);
158 
159  /// Inserts a child.
160  ///
161  /// \p index is ignored except for range checking; -1 is permitted.
162  ///
163  /// Returns true if successful, false if failed.
164  SDF_API
165  bool InsertNameChild(const SdfPrimSpecHandle& child, int index = -1);
166 
167  /// Removes the child. Returns true if successful, false if failed.
168  SDF_API
169  bool RemoveNameChild(const SdfPrimSpecHandle& child);
170 
171  /// Returns the list of child names for this prim's reorder.
172  /// nameChildren statement.
173  ///
174  /// See SetNameChildrenOrder() for more info.
175  SDF_API
177 
178  /// Returns true if this prim has name children order specified
179  SDF_API
180  bool HasNameChildrenOrder() const;
181 
182  /// Given a list of (possibly sparse) child names, authors a reorder
183  /// nameChildren statement for this prim.
184  ///
185  /// The reorder statement can modify the order of name children
186  /// during composition. This order doesn't affect GetNameChildren(),
187  /// InsertNameChild(), SetNameChildren(), et al.
188  SDF_API
189  void SetNameChildrenOrder(const std::vector<TfToken>& names);
190 
191  /// Adds a new name child \p name in the name children order.
192  /// If \p index is -1, the name is inserted at the end.
193  SDF_API
194  void InsertInNameChildrenOrder(const TfToken& name, int index = -1);
195 
196  /// Removes a name child name from the name children order.
197  SDF_API
198  void RemoveFromNameChildrenOrder(const TfToken& name);
199 
200  /// Removes a name child name from the name children order by index.
201  SDF_API
203 
204  /// Reorders the given list of child names according to the reorder
205  /// nameChildren statement for this prim.
206  ///
207  /// This routine employs the standard list editing operation for ordered
208  /// items in a ListEditor.
209  SDF_API
210  void ApplyNameChildrenOrder(std::vector<TfToken>* vec) const;
211 
212  /// @}
213  /// \name Properties
214  /// @{
215 
216  /// Returns the prim's properties.
217  SDF_API
219 
220  /// Updates properties to match the given vector of properties.
221  SDF_API
222  void SetProperties(const SdfPropertySpecHandleVector&);
223 
224  /// Inserts a property.
225  ///
226  /// \p index is ignored except for range checking; -1 is permitted.
227  ///
228  /// Returns true if successful, false if failed.
229  SDF_API
230  bool InsertProperty(const SdfPropertySpecHandle& property, int index = -1);
231 
232  /// Removes the property.
233  SDF_API
234  void RemoveProperty(const SdfPropertySpecHandle& property);
235 
236  /// Returns a view of the attributes of this prim.
237  SDF_API
239 
240  /// Returns a view of the relationships of this prim.
241  SDF_API
243 
244  /// Returns the list of property names for this prim's reorder
245  /// properties statement.
246  ///
247  /// See SetPropertyOrder() for more info.
248  SDF_API
250 
251  /// Returns true if this prim has a property ordering specified.
252  SDF_API
253  bool HasPropertyOrder() const;
254 
255  /// Given a list of (possibly sparse) property names, authors a
256  /// reorder properties statement for this prim.
257  ///
258  /// The reorder statement can modify the order of properties during
259  /// composition. This order doesn't affect GetProperties(),
260  /// InsertProperty(), SetProperties(), et al.
261  SDF_API
262  void SetPropertyOrder(const std::vector<TfToken>& names);
263 
264  /// Add a new property \p name in the property order.
265  /// If \p index is -1, the name is inserted at the end.
266  SDF_API
267  void InsertInPropertyOrder(const TfToken& name, int index = -1);
268 
269  /// Remove a property name from the property order.
270  SDF_API
271  void RemoveFromPropertyOrder(const TfToken& name);
272 
273  /// Remove a property name from the property order by index.
274  SDF_API
276 
277  /// Reorders the given list of property names according to the
278  /// reorder properties statement for this prim.
279  ///
280  /// This routine employs the standard list editing operation for ordered
281  /// items in a ListEditor.
282  SDF_API
283  void ApplyPropertyOrder(std::vector<TfToken>* vec) const;
284 
285  /// @}
286  /// \name Lookup
287  /// @{
288 
289  /// Returns the object for the given \p path.
290  ///
291  /// If \p path is relative then it will be interpreted as
292  /// relative to this prim. If it is absolute then it will be
293  /// interpreted as absolute in this prim's layer.
294  ///
295  /// Returns invalid handle if there is no object at \p path.
296  SDF_API
297  SdfSpecHandle GetObjectAtPath(const SdfPath& path) const;
298 
299  /// Returns a prim given its \p path.
300  ///
301  /// Returns invalid handle if there is no prim at \p path.
302  /// This is simply a more specifically typed version of GetObjectAtPath.
303  SDF_API
304  SdfPrimSpecHandle GetPrimAtPath(const SdfPath& path) const;
305 
306  /// Returns a property given its \p path.
307  ///
308  /// Returns invalid handle if there is no property at \p path.
309  /// This is simply a more specifically typed version of GetObjectAtPath.
310  SDF_API
311  SdfPropertySpecHandle GetPropertyAtPath(const SdfPath& path) const;
312 
313  /// Returns an attribute given its \p path.
314  ///
315  /// Returns invalid handle if there is no attribute at \p path.
316  /// This is simply a more specifically typed version of GetObjectAtPath.
317  SDF_API
318  SdfAttributeSpecHandle GetAttributeAtPath(const SdfPath& path) const;
319 
320  /// Returns a relationship given its \p path.
321  ///
322  /// Returns invalid handle if there is no relationship at \p path.
323  /// This is simply a more specifically typed version of GetObjectAtPath.
324  SDF_API
325  SdfRelationshipSpecHandle GetRelationshipAtPath(const SdfPath& path) const;
326 
327  /// @}
328  /// \name Metadata
329  /// @{
330 
331  /// Returns the typeName of the prim.
332  ///
333  /// The typeName should be meaningful to a higher level
334  /// prim definition system.
335  ///
336  /// The default value for typeName is the empty token.
337  SDF_API
338  TfToken GetTypeName() const;
339 
340  /// Sets the typeName of the model prim.
341  SDF_API
342  void SetTypeName(const std::string& value);
343 
344  /// Returns the comment string for this prim spec.
345  ///
346  /// The default value for comment is @"".
347  SDF_API
348  std::string GetComment() const;
349 
350  /// Sets the comment string for this prim spec.
351  SDF_API
352  void SetComment(const std::string& value);
353 
354  /// Returns the documentation string for this prim spec.
355  ///
356  /// The default value for documentation is @"".
357  SDF_API
358  std::string GetDocumentation() const;
359 
360  /// Sets the documentation string for this prim spec.
361  SDF_API
362  void SetDocumentation(const std::string& value);
363 
364  /// Returns whether this prim spec is active.
365  ///
366  /// The default value for active is true.
367  SDF_API
368  bool GetActive() const;
369 
370  /// Sets whether this prim spec is active.
371  SDF_API
372  void SetActive(bool value);
373 
374  /// Returns true if this prim spec has an opinion about active.
375  SDF_API
376  bool HasActive() const;
377 
378  /// Removes the active opinion in this prim spec if there is one.
379  SDF_API
380  void ClearActive();
381 
382  /// Returns whether this prim spec will be hidden in browsers.
383  ///
384  /// The default value for hidden is false.
385  ///
386  /// \deprecated
387  /// See UsdUIObjectHints.
388  SDF_API
389  bool GetHidden() const;
390 
391  /// Sets whether this prim spec will be hidden in browsers.
392  ///
393  /// \deprecated
394  /// See UsdUIObjectHints.
395  SDF_API
396  void SetHidden( bool value );
397 
398  /// Returns this prim spec's kind.
399  ///
400  /// The default value for kind is an empty \c TfToken.
401  SDF_API
402  TfToken GetKind() const;
403 
404  /// Sets this prim spec's kind.
405  SDF_API
406  void SetKind(const TfToken& value);
407 
408  /// Returns true if this prim spec has an opinion about kind.
409  SDF_API
410  bool HasKind() const;
411 
412  /// Remove the kind opinion from this prim spec if there is one.
413  SDF_API
414  void ClearKind();
415 
416  /// \name ClipSets
417  /// @{
418 
419  /// Returns a proxy for the prim's value clip sets.
420  ///
421  /// Clip sets for this prim may be modified through the proxy.
422  SDF_API
424 
425  /// Returns true if this prim has value clip sets set.
426  SDF_API
427  bool HasClipSets() const;
428 
429  /// Returns the value clips for this prim.
430  ///
431  /// The default value for value clips is an empty dictionary.
432  SDF_API
434 
435  /// Sets the value clips for this prim spec.
436  ///
437  /// If \p value is empty, then this removes the setting
438  /// for the given value clips \p name.
439  void SetClips(const std::string& name, const VtValue& value);
440 
441  /// @}
442 
443  /// Returns the symmetry function for this prim.
444  ///
445  /// The default value for symmetry function is an empty token.
446  SDF_API
448 
449  /// Sets the symmetry function for this prim.
450  ///
451  /// If \p functionName is an empty token, then this removes any symmetry
452  /// function for the given prim.
453  SDF_API
454  void SetSymmetryFunction(const TfToken& functionName);
455 
456  /// Returns the symmetry arguments for this prim.
457  ///
458  /// The default value for symmetry arguments is an empty dictionary.
459  SDF_API
461 
462  /// Sets a symmetry argument for this prim.
463  ///
464  /// If \p value is empty, then this removes the setting
465  /// for the given symmetry argument \p name.
466  SDF_API
467  void SetSymmetryArgument(const std::string& name, const VtValue& value);
468 
469  /// Returns the symmetric peer for this prim.
470  ///
471  /// The default value for symmetric peer is an empty string.
472  SDF_API
473  std::string GetSymmetricPeer() const;
474 
475  /// Sets a symmetric peer for this prim.
476  ///
477  /// If \p peerName is empty, then this removes the symmetric peer
478  /// for this prim.
479  SDF_API
480  void SetSymmetricPeer(const std::string& peerName);
481 
482  /// Returns the prefix string for this prim spec.
483  ///
484  /// The default value for prefix is "".
485  SDF_API
486  std::string GetPrefix() const;
487 
488  /// Sets the prefix string for this prim spec.
489  SDF_API
490  void SetPrefix(const std::string& value);
491 
492  /// Returns the suffix string for this prim spec.
493  ///
494  /// The default value for suffix is "".
495  SDF_API
496  std::string GetSuffix() const;
497 
498  /// Sets the suffix string for this prim spec.
499  SDF_API
500  void SetSuffix(const std::string& value);
501 
502  /// Returns the custom data for this prim.
503  ///
504  /// The default value for custom data is an empty dictionary.
505  ///
506  /// Custom data is for use by plugins or other non-tools supplied
507  /// extensions that need to be able to store data attached to arbitrary
508  /// scene objects. Note that if the only objects you want to store data
509  /// on are prims, using custom attributes is probably a better choice.
510  /// But if you need to possibly store this data on attributes or
511  /// relationships or as annotations on reference arcs, then custom data
512  /// is an appropriate choice.
513  SDF_API
515 
516  /// Returns the asset info dictionary for this prim.
517  ///
518  /// The default value is an empty dictionary.
519  ///
520  /// The asset info dictionary is used to annotate prims representing the
521  /// root-prims of assets (generally organized as models) with various
522  /// data related to asset management. For example, asset name, root layer
523  /// identifier, asset version etc.
524  ///
525  SDF_API
527 
528  /// Sets a custom data entry for this prim.
529  ///
530  /// If \p value is empty, then this removes the given custom data entry.
531  SDF_API
532  void SetCustomData(const std::string& name, const VtValue& value);
533 
534  /// Sets a asset info entry for this prim.
535  ///
536  /// If \p value is empty, then this removes the given asset info entry.
537  ///
538  /// \sa GetAssetInfo()
539  ///
540  SDF_API
541  void SetAssetInfo(const std::string& name, const VtValue& value);
542 
543  /// Returns the spec specifier (def, over or class).
544  SDF_API
545  SdfSpecifier GetSpecifier() const;
546 
547  /// Sets the spec specifier (def or over).
548  SDF_API
550 
551  /// Returns the prim's permission restriction.
552  ///
553  /// The default value for permission is SdfPermissionPublic.
554  SDF_API
556 
557  /// Sets the prim's permission restriction.
558  SDF_API
560 
561  /// Returns the prefixSubstitutions dictionary for this prim spec.
562  ///
563  /// The default value for prefixSubstitutions is an empty VtDictionary.
564  SDF_API
566 
567  /// Sets the \p prefixSubstitutions dictionary for this prim spec.
568  SDF_API
569  void SetPrefixSubstitutions(const VtDictionary& prefixSubstitutions);
570 
571  /// Returns the suffixSubstitutions dictionary for this prim spec.
572  ///
573  /// The default value for suffixSubstitutions is an empty VtDictionary.
574  SDF_API
576 
577  /// Sets the \p suffixSubstitutions dictionary for this prim spec.
578  SDF_API
579  void SetSuffixSubstitutions(const VtDictionary& suffixSubstitutions);
580 
581  /// Sets the value for the prim's instanceable flag.
582  SDF_API
583  void SetInstanceable(bool instanceable);
584 
585  /// Returns the value for the prim's instanceable flag.
586  SDF_API
587  bool GetInstanceable() const;
588 
589  /// Returns true if this prim spec has a value authored for its
590  /// instanceable flag, false otherwise.
591  SDF_API
592  bool HasInstanceable() const;
593 
594  /// Clears the value for the prim's instanceable flag.
595  SDF_API
596  void ClearInstanceable();
597 
598  /// @}
599  /// \name Payloads
600  /// @{
601 
602  /// Returns a proxy for the prim's payloads.
603  ///
604  /// Payloads for this prim may be modified through the proxy.
605  SDF_API
607 
608  /// Returns true if this prim has payloads set.
609  SDF_API
610  bool HasPayloads() const;
611 
612  /// Clears the payloads for this prim.
613  SDF_API
614  void ClearPayloadList();
615 
616  /// @}
617  /// \name Inherits
618  /// @{
619 
620  /// Returns a proxy for the prim's inherit paths.
621  ///
622  /// Inherit paths for this prim may be modified through the proxy.
623  SDF_API
625 
626  /// Returns true if this prim has inherit paths set.
627  SDF_API
628  bool HasInheritPaths() const;
629 
630  /// Clears the inherit paths for this prim.
631  SDF_API
632  void ClearInheritPathList();
633 
634  /// @}
635  /// \name Specializes
636  /// @{
637 
638  /// Returns a proxy for the prim's specializes paths.
639  ///
640  /// Specializes for this prim may be modified through the proxy.
641  SDF_API
643 
644  /// Returns true if this prim has specializes set.
645  SDF_API
646  bool HasSpecializes() const;
647 
648  /// Clears the specializes for this prim.
649  SDF_API
650  void ClearSpecializesList();
651 
652  /// @}
653  /// \name References
654  /// @{
655 
656  /// Returns a proxy for the prim's references.
657  ///
658  /// References for this prim may be modified through the proxy.
659  SDF_API
661 
662  /// Returns true if this prim has references set.
663  SDF_API
664  bool HasReferences() const;
665 
666  /// Clears the references for this prim.
667  SDF_API
668  void ClearReferenceList();
669 
670  /// @}
671  /// \name Variants
672  /// @{
673 
674  /// Returns a proxy for the prim's variant sets.
675  ///
676  /// Variant sets for this prim may be modified through the proxy.
677  SDF_API
679 
680  /// Returns true if this prim has variant sets set.
681  SDF_API
682  bool HasVariantSetNames() const;
683 
684  /// Returns list of variant names for the given variant set.
685  SDF_API
686  std::vector<std::string> GetVariantNames(const std::string& name) const;
687 
688  /// Returns the variant sets.
689  ///
690  /// The result maps variant set names to variant sets. Variant sets
691  /// may be removed through the proxy.
692  SDF_API
694 
695  /// Removes the variant set with the given \a name.
696  ///
697  /// Note that the set's name should probably also be removed from
698  /// the variant set names list.
699  SDF_API
700  void RemoveVariantSet(const std::string& name);
701 
702  /// Returns an editable map whose keys are variant set names and
703  /// whose values are the variants selected for each set.
704  SDF_API
706 
707  /// Sets the variant selected for the given variant set.
708  /// If \p variantName is empty, then this removes the variant
709  /// selection opinion for the variant set \p variantSetName. To
710  /// explicitly set the variant selection to be empty, use
711  /// BlockVariantSelection instead.
712  SDF_API
713  void SetVariantSelection(const std::string& variantSetName,
714  const std::string& variantName);
715 
716  /// Blocks the variant selected for the given variant set by setting
717  /// the variant selection to empty.
718  SDF_API
719  void BlockVariantSelection(const std::string& variantSetName);
720 
721  /// @}
722  /// \name Relocates
723  /// @{
724 
725  /// Get an editing proxy for the map of namespace relocations
726  /// specified on this prim.
727  ///
728  /// The map of namespace relocation paths is editable in-place via
729  /// this editing proxy. Individual source-target pairs can be added,
730  /// removed, or altered using common map operations.
731  ///
732  /// The map is organized as target \c SdfPath indexed by source \c SdfPath.
733  /// Key and value paths are stored as absolute regardless of how they're
734  /// added.
735  SDF_API
737 
738  /// Set the entire map of namespace relocations specified on this prim.
739  /// Use the editing proxy for modifying single paths in the map.
740  SDF_API
741  void SetRelocates(const SdfRelocatesMap& newMap);
742 
743  /// Returns true if this prim has any relocates opinion, including
744  /// that there should be no relocates (i.e. an empty map). An empty
745  /// map (no relocates) does not mean the same thing as a missing map
746  /// (no opinion).
747  SDF_API
748  bool HasRelocates() const;
749 
750  /// Clears the relocates opinion for this prim.
751  SDF_API
752  void ClearRelocates();
753 
754  /// @}
755 
756 private:
757  // Returns true if this object is the pseudo-root.
758  bool _IsPseudoRoot() const;
759 
760  // Raises an error and returns false if this is the pseudo-root,
761  // otherwise returns true. We want to allow clients to be able
762  // to use pseudo-roots as any other prim in namespace editing
763  // operations as well as silently permit read accesses on fields
764  // pseudo-roots don't actually have in order to promote generic
765  // algorithm programming. Mutating methods on SdfPrimSpec use
766  // this function as write access validation.
767  bool _ValidateEdit(const TfToken& key) const;
768 
769 private:
770  static SdfPrimSpecHandle
771  _New(const SdfPrimSpecHandle &parentPrim,
772  const TfToken &name, SdfSpecifier spec,
773  const TfToken &typeName);
774 };
775 
776 /// Convenience function to create a prim at the given path, and any
777 /// necessary parent prims, in the given layer.
778 ///
779 /// If a prim already exists at the given path it will be returned
780 /// unmodified.
781 ///
782 /// The new specs are created with SdfSpecifierOver and an empty type.
783 /// primPath must be a valid prim path.
784 SDF_API
785 SdfPrimSpecHandle SdfCreatePrimInLayer(const SdfLayerHandle& layer,
786  const SdfPath& primPath);
787 
788 
789 /// Convenience function to create a prim at the given path, and any
790 /// necessary parent prims, in the given layer.
791 ///
792 /// If a prim already exists at the given path, do nothing and return true.
793 ///
794 /// Any newly created specs have SdfSpecifierOver and an empty type. primPath
795 /// must be a valid prim path. Return false and issue an error if we fail to
796 /// author the required scene description.
797 SDF_API
798 bool SdfJustCreatePrimInLayer(const SdfLayerHandle& layer,
799  const SdfPath& primPath);
800 
802 
803 #endif // PXR_USD_SDF_PRIM_SPEC_H
SDF_API std::string GetSuffix() const
SDF_API bool GetHidden() const
SDF_API bool SdfJustCreatePrimInLayer(const SdfLayerHandle &layer, const SdfPath &primPath)
SDF_API std::vector< std::string > GetVariantNames(const std::string &name) const
Returns list of variant names for the given variant set.
SdfRelationshipSpecView RelationshipSpecView
Definition: primSpec.h:65
SDF_API void RemoveFromNameChildrenOrder(const TfToken &name)
Removes a name child name from the name children order.
SDF_API SdfPrimSpecHandle GetNameRoot() const
Returns the prim's namespace pseudo-root prim.
SDF_API SdfPropertySpecHandle GetPropertyAtPath(const SdfPath &path) const
SDF_API bool HasClipSets() const
Returns true if this prim has value clip sets set.
SDF_API bool HasReferences() const
Returns true if this prim has references set.
std::map< SdfPath, SdfPath > SdfRelocatesMap
A map of source SdfPaths to target SdfPaths for relocation.
Definition: types.h:270
SDF_API bool HasPropertyOrder() const
Returns true if this prim has a property ordering specified.
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
SDF_API SdfInheritsProxy GetInheritPathList() const
GLsizei const GLfloat * value
Definition: glcorearb.h:824
SDF_API void SetTypeName(const std::string &value)
Sets the typeName of the model prim.
SDF_API bool SetName(const std::string &newName, bool validate=true)
SDF_API void SetComment(const std::string &value)
Sets the comment string for this prim spec.
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
SDF_API bool HasSpecializes() const
Returns true if this prim has specializes set.
SDF_API void SetNameChildrenOrder(const std::vector< TfToken > &names)
SDF_API void SetSymmetryArgument(const std::string &name, const VtValue &value)
SDF_API void SetSuffix(const std::string &value)
Sets the suffix string for this prim spec.
SDF_API SdfDictionaryProxy GetSymmetryArguments() const
SDF_API SdfNameEditorProxy GetClipSetsList() const
SDF_API void InsertInPropertyOrder(const TfToken &name, int index=-1)
Definition: spec.h:32
SDF_API SdfPropertyOrderProxy GetPropertyOrder() const
SDF_API void SetDocumentation(const std::string &value)
Sets the documentation string for this prim spec.
SDF_API std::string GetSymmetricPeer() const
SDF_API SdfPrimSpecHandle SdfCreatePrimInLayer(const SdfLayerHandle &layer, const SdfPath &primPath)
SDF_API SdfVariantSetsProxy GetVariantSets() const
SDF_API void ClearRelocates()
Clears the relocates opinion for this prim.
SDF_API bool InsertProperty(const SdfPropertySpecHandle &property, int index=-1)
SDF_API SdfAttributeSpecHandle GetAttributeAtPath(const SdfPath &path) const
SDF_API bool HasRelocates() const
SDF_API void ClearReferenceList()
Clears the references for this prim.
SDF_API TfToken GetSymmetryFunction() const
SDF_API AttributeSpecView GetAttributes() const
Returns a view of the attributes of this prim.
SDF_API void SetActive(bool value)
Sets whether this prim spec is active.
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
SDF_API bool HasVariantSetNames() const
Returns true if this prim has variant sets set.
SDF_API void SetNameChildren(const SdfPrimSpecHandleVector &)
Updates nameChildren to match the given vector of prims.
SDF_API SdfSpecHandle GetObjectAtPath(const SdfPath &path) const
Definition: token.h:70
static SDF_API SdfPrimSpecHandle New(const SdfLayerHandle &parentLayer, const std::string &name, SdfSpecifier spec, const std::string &typeName=std::string())
SdfPrimSpecView NameChildrenView
Definition: primSpec.h:62
SDF_API bool RemoveNameChild(const SdfPrimSpecHandle &child)
Removes the child. Returns true if successful, false if failed.
SDF_API void BlockVariantSelection(const std::string &variantSetName)
SDF_API void ClearActive()
Removes the active opinion in this prim spec if there is one.
SDF_API NameChildrenView GetNameChildren() const
Returns a keyed vector view of the prim's namespace children.
SDF_API RelationshipSpecView GetRelationships() const
Returns a view of the relationships of this prim.
SDF_API SdfVariantSelectionProxy GetVariantSelections() const
SDF_API std::string GetComment() const
SDF_API TfToken GetKind() const
SDF_API PropertySpecView GetProperties() const
Returns the prim's properties.
SDF_API void SetVariantSelection(const std::string &variantSetName, const std::string &variantName)
SDF_API const std::string & GetName() const
Returns the prim's name.
SDF_API bool HasInstanceable() const
SDF_API SdfPermission GetPermission() const
SDF_API bool HasPayloads() const
Returns true if this prim has payloads set.
SDF_API void SetCustomData(const std::string &name, const VtValue &value)
SDF_API SdfPrimSpecHandle GetRealNameParent() const
Returns the prim's namespace parent.
SdfSpecifier
Definition: types.h:103
SDF_API void SetRelocates(const SdfRelocatesMap &newMap)
SDF_API SdfPrimSpecHandle GetPrimAtPath(const SdfPath &path) const
SDF_API void SetPrefix(const std::string &value)
Sets the prefix string for this prim spec.
SDF_API TfToken GetNameToken() const
Returns the prim's name, as a token.
SDF_API void SetKind(const TfToken &value)
Sets this prim spec's kind.
SDF_API void RemoveFromPropertyOrder(const TfToken &name)
Remove a property name from the property order.
GLuint const GLchar * name
Definition: glcorearb.h:786
SDF_API void SetProperties(const SdfPropertySpecHandleVector &)
Updates properties to match the given vector of properties.
Definition: path.h:280
SDF_API void ClearInstanceable()
Clears the value for the prim's instanceable flag.
SDF_API void SetPermission(SdfPermission value)
Sets the prim's permission restriction.
SDF_API VtDictionary GetSuffixSubstitutions() const
SDF_API void RemoveProperty(const SdfPropertySpecHandle &property)
Removes the property.
SDF_API bool HasActive() const
Returns true if this prim spec has an opinion about active.
SDF_API void SetHidden(bool value)
SDF_API bool GetActive() const
SDF_API void RemoveFromPropertyOrderByIndex(int index)
Remove a property name from the property order by index.
static SDF_API bool IsValidName(const std::string &name)
Returns true if the given string is a valid prim name.
SDF_API bool HasKind() const
Returns true if this prim spec has an opinion about kind.
#define SDF_API
Definition: api.h:23
SDF_API void RemoveFromNameChildrenOrderByIndex(int index)
Removes a name child name from the name children order by index.
SDF_API void SetSymmetryFunction(const TfToken &functionName)
SDF_API bool CanSetName(const std::string &newName, std::string *whyNot) const
SDF_API SdfDictionaryProxy GetCustomData() const
SDF_API void RemoveVariantSet(const std::string &name)
SDF_API VtDictionary GetPrefixSubstitutions() const
SDF_API void SetSpecifier(SdfSpecifier value)
Sets the spec specifier (def or over).
SDF_API SdfVariantSetNamesProxy GetVariantSetNameList() const
SDF_API bool InsertNameChild(const SdfPrimSpecHandle &child, int index=-1)
SDF_API void ApplyNameChildrenOrder(std::vector< TfToken > *vec) const
SDF_API void ClearKind()
Remove the kind opinion from this prim spec if there is one.
SDF_API bool HasNameChildrenOrder() const
Returns true if this prim has name children order specified.
SDF_API std::string GetPrefix() const
GLuint index
Definition: glcorearb.h:786
SDF_API SdfDictionaryProxy GetAssetInfo() const
SDF_API void SetSuffixSubstitutions(const VtDictionary &suffixSubstitutions)
Sets the suffixSubstitutions dictionary for this prim spec.
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
SDF_API void ClearSpecializesList()
Clears the specializes for this prim.
SDF_API void SetAssetInfo(const std::string &name, const VtValue &value)
SdfPropertySpecView PropertySpecView
Definition: primSpec.h:63
SDF_API SdfRelationshipSpecHandle GetRelationshipAtPath(const SdfPath &path) const
SDF_API void SetPropertyOrder(const std::vector< TfToken > &names)
SDF_API SdfRelocatesMapProxy GetRelocates() const
SDF_API SdfPayloadsProxy GetPayloadList() const
SDF_API void ClearInheritPathList()
Clears the inherit paths for this prim.
SDF_API bool GetInstanceable() const
Returns the value for the prim's instanceable flag.
SDF_API TfToken GetTypeName() const
SDF_API std::string GetDocumentation() const
SDF_API SdfSpecifier GetSpecifier() const
Returns the spec specifier (def, over or class).
SDF_API SdfPrimSpecHandle GetNameParent() const
SDF_API SdfSpecializesProxy GetSpecializesList() const
SDF_API SdfReferencesProxy GetReferenceList() const
SDF_API void ApplyPropertyOrder(std::vector< TfToken > *vec) const
SDF_API void SetInstanceable(bool instanceable)
Sets the value for the prim's instanceable flag.
SDF_API SdfDictionaryProxy GetClips() const
SDF_API SdfNameChildrenOrderProxy GetNameChildrenOrder() const
SDF_API void SetPrefixSubstitutions(const VtDictionary &prefixSubstitutions)
Sets the prefixSubstitutions dictionary for this prim spec.
SDF_API bool HasInheritPaths() const
Returns true if this prim has inherit paths set.
Definition: value.h:89
SDF_API void ClearPayloadList()
Clears the payloads for this prim.
SdfPermission
Definition: types.h:135
SDF_API void SetSymmetricPeer(const std::string &peerName)
void SetClips(const std::string &name, const VtValue &value)
SDF_API void InsertInNameChildrenOrder(const TfToken &name, int index=-1)
SdfAttributeSpecView AttributeSpecView
Definition: primSpec.h:64