Loading...
Searching...
No Matches
siteUtils.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_SITE_UTILS_H
25#define PXR_USD_SDF_SITE_UTILS_H
26
32
33#include "pxr/pxr.h"
34#include "pxr/usd/sdf/site.h"
35#include "pxr/usd/sdf/layer.h"
38#include "pxr/usd/sdf/spec.h"
39
40PXR_NAMESPACE_OPEN_SCOPE
41
42inline
43SdfSpecHandle
44SdfGetObjectAtPath(const SdfSite& site)
45{
46 return site.layer->GetObjectAtPath(site.path);
47}
48
49inline
50SdfPrimSpecHandle
51SdfGetPrimAtPath(const SdfSite& site)
52{
53 return site.layer->GetPrimAtPath(site.path);
54}
55
56inline
57SdfPropertySpecHandle
58SdfGetPropertyAtPath(const SdfSite& site)
59{
60 return site.layer->GetPropertyAtPath(site.path);
61}
62
63inline
64bool
65SdfHasField(const SdfSite& site, const TfToken& field)
66{
67 return site.layer->HasField(site.path, field);
68}
69
70template <class T>
71inline bool
72SdfHasField(const SdfSite& site, const TfToken& field, T* value)
73{
74 return site.layer->HasField(site.path, field, value);
75}
76
77inline
78const VtValue
79SdfGetField(const SdfSite& site, const TfToken& field)
80{
81 return site.layer->GetField(site.path, field);
82}
83
84template <class T>
85inline
86T
87SdfGetFieldAs(const SdfSite& site, const TfToken& field,
88 const T& defaultValue = T())
89{
90 return site.layer->GetFieldAs<T>(site.path, field, defaultValue);
91}
92
93PXR_NAMESPACE_CLOSE_SCOPE
94
95#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:43
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:88
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:164