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
87 return _ValueSourceMightBeTimeVarying();
88 }
89
98 bool IsTimeVarying(UsdTimeCode from, UsdTimeCode to) const {
99 return _IsTimeVarying(from, to);
100 }
101
102protected:
105
106private:
107 // These methods must be implemented by the scene adapter implementation.
108 virtual bool _IsValid() const = 0;
109 virtual SdfPath _GetPath() const = 0;
110 virtual void _Initialize() = 0;
111 virtual bool _Get(VtValue *value, UsdTimeCode time) const = 0;
112 virtual std::optional<TsSpline> _GetSpline() const = 0;
113 virtual bool _ValueSourceMightBeTimeVarying() const = 0;
114 virtual bool _IsTimeVarying(UsdTimeCode from, UsdTimeCode to) const = 0;
115};
116
125 : public EsfFixedSizePolymorphicHolder<EsfAttributeQueryInterface, 176>
126{
127public:
129};
130
131PXR_NAMESPACE_CLOSE_SCOPE
132
133#endif
Holds an implementation of EsfAttributeQueryInterface in a fixed-size buffer.
Attribute query abstraction for scene adapter implementations.
bool ValueSourceMightBeTimeVarying() const
Returns true if the attribute value might be varying over time, and false if the value is definitely ...
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 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:281
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
Definition timeCode.h:73
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition value.h:90