Loading...
Searching...
No Matches
siteUtils.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_SITE_UTILS_H
8#define PXR_USD_SDF_SITE_UTILS_H
9
15
16#include "pxr/pxr.h"
17#include "pxr/usd/sdf/site.h"
18#include "pxr/usd/sdf/layer.h"
21#include "pxr/usd/sdf/spec.h"
22
23PXR_NAMESPACE_OPEN_SCOPE
24
25inline
26SdfSpecHandle
27SdfGetObjectAtPath(const SdfSite& site)
28{
29 return site.layer->GetObjectAtPath(site.path);
30}
31
32inline
33SdfPrimSpecHandle
34SdfGetPrimAtPath(const SdfSite& site)
35{
36 return site.layer->GetPrimAtPath(site.path);
37}
38
39inline
40SdfPropertySpecHandle
41SdfGetPropertyAtPath(const SdfSite& site)
42{
43 return site.layer->GetPropertyAtPath(site.path);
44}
45
46inline
47bool
48SdfHasField(const SdfSite& site, const TfToken& field)
49{
50 return site.layer->HasField(site.path, field);
51}
52
53template <class T>
54inline bool
55SdfHasField(const SdfSite& site, const TfToken& field, T* value)
56{
57 return site.layer->HasField(site.path, field, value);
58}
59
60inline
61const VtValue
62SdfGetField(const SdfSite& site, const TfToken& field)
63{
64 return site.layer->GetField(site.path, field);
65}
66
67template <class T>
68inline
69T
70SdfGetFieldAs(const SdfSite& site, const TfToken& field,
71 const T& defaultValue = T())
72{
73 return site.layer->GetFieldAs<T>(site.path, field, defaultValue);
74}
75
76PXR_NAMESPACE_CLOSE_SCOPE
77
78#endif // PXR_USD_SDF_SITE_UTILS_H
An SdfSite is a simple representation of a location in a layer where opinions may possibly be found.
Definition: site.h:26
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:152