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