Loading...
Searching...
No Matches
attributeQuery.h
Go to the documentation of this file.
1//
2// Copyright 2025 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_EXEC_ESF_ATTRIBUTE_QUERY_H
8#define PXR_EXEC_ESF_ATTRIBUTE_QUERY_H
9
11
12#include "pxr/pxr.h"
13
14#include "pxr/exec/esf/api.h"
16
17#include "pxr/base/ts/spline.h"
18#include "pxr/base/vt/value.h"
19#include "pxr/usd/sdf/path.h"
20#include "pxr/usd/usd/timeCode.h"
21
22#include <optional>
23
24PXR_NAMESPACE_OPEN_SCOPE
25
33class ESF_API_TYPE EsfAttributeQueryInterface :
35{
36public:
37 ESF_API ~EsfAttributeQueryInterface() override;
38
43 bool IsValid() const {
44 return _IsValid();
45 }
46
48 SdfPath GetPath() const {
49 return _GetPath();
50 }
51
58 void Initialize() {
59 _Initialize();
60 }
61
66 bool Get(VtValue *value, UsdTimeCode time) const {
67 return _Get(value, time);
68 }
69
74 std::optional<TsSpline> GetSpline() const {
75 return _GetSpline();
76 }
77
84 return _ValueMightBeTimeVarying();
85 }
86
95 bool IsTimeVarying(UsdTimeCode from, UsdTimeCode to) const {
96 return _IsTimeVarying(from, to);
97 }
98
99protected:
102
103private:
104 // These methods must be implemented by the scene adapter implementation.
105 virtual bool _IsValid() const = 0;
106 virtual SdfPath _GetPath() const = 0;
107 virtual void _Initialize() = 0;
108 virtual bool _Get(VtValue *value, UsdTimeCode time) const = 0;
109 virtual std::optional<TsSpline> _GetSpline() const = 0;
110 virtual bool _ValueMightBeTimeVarying() const = 0;
111 virtual bool _IsTimeVarying(UsdTimeCode from, UsdTimeCode to) const = 0;
112};
113
122 : public EsfFixedSizePolymorphicHolder<EsfAttributeQueryInterface, 160>
123{
124public:
126};
127
128PXR_NAMESPACE_CLOSE_SCOPE
129
130#endif
Holds an implementation of EsfAttributeQueryInterface in a fixed-size buffer.
Attribute query abstraction for scene adapter implementations.
bool IsTimeVarying(UsdTimeCode from, UsdTimeCode to) const
Returns true if the resolved value of the attribute is different on time from and time to.
SdfPath GetPath() const
Returns the path of the attribute that is being queried.
void Initialize()
Reinitialize the query object from the attribute it was initially constructed with.
std::optional< TsSpline > GetSpline() const
Gets the authored spline if the strongest opinion is a spline.
EsfAttributeQueryInterface()=default
This constructor may only be called by the scene adapter implementation.
bool ValueMightBeTimeVarying() const
Returns true if the attribute value might be varying over time, and false if the value is definitely ...
bool IsValid() const
Returns true if the query object is valid.
bool Get(VtValue *value, UsdTimeCode time) const
Gets the resolved value of the attribute at a given time.
Enables a base class to be used with EsfFixedSizePolymorphicHolder.
Stores polymorphic objects in a fixed-size buffer.
EsfFixedSizePolymorphicHolder()=delete
The default constructor is deleted because instances must always contain a derived object.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition: timeCode.h:72
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:152