Loading...
Searching...
No Matches
editReason.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_EDIT_REASON_H
8#define PXR_EXEC_ESF_EDIT_REASON_H
9
11
12#include "pxr/pxr.h"
13
14#include "pxr/exec/esf/api.h"
15
16#include <cstdint>
17#include <string>
18
19PXR_NAMESPACE_OPEN_SCOPE
20
31{
32public:
33
36
37 static const EsfEditReason None;
38
44
50
54
58
60
63
65 constexpr explicit operator bool() const {
66 return _bits;
67 }
68
69 constexpr bool operator==(EsfEditReason other) const {
70 return _bits == other._bits;
71 }
72
73 constexpr bool operator!=(EsfEditReason other) const {
74 return _bits != other._bits;
75 }
76
77 constexpr EsfEditReason& operator&=(EsfEditReason other) {
78 _bits &= other._bits;
79 return *this;
80 }
81
82 constexpr EsfEditReason& operator|=(EsfEditReason other) {
83 _bits |= other._bits;
84 return *this;
85 }
86
87 constexpr EsfEditReason operator&(EsfEditReason other) const {
88 return {_bits & other._bits};
89 }
90
91 constexpr EsfEditReason operator|(EsfEditReason other) const {
92 return {_bits | other._bits};
93 }
94
98 constexpr bool Contains(EsfEditReason other) const {
99 return (_bits & other._bits) == other._bits;
100 }
101
103
105 bool operator<(const EsfEditReason &other) const {
106 return _bits < other._bits;
107 }
108
110 constexpr EsfEditReason() = default;
111
117 ESF_API std::string GetDescription() const;
118
119private:
120 using _BitsType = uint32_t;
121
122 // Private methods use this constructor to initialize from a raw bitmask.
123 constexpr EsfEditReason(_BitsType bits) : _bits(bits) {}
124
125 // By using an enum class value for each bit position, we make it less
126 // error-prone to define new edit reasons.
127 enum class _BitIndex : uint8_t {
132 Max
133 };
134
135 // Predefined edit reasons use this constructor.
136 constexpr EsfEditReason(_BitIndex bit)
137 : _bits(1 << static_cast<int>(bit))
138 {}
139
140 // Returns a string describing this _BitIndex enum value.
141 static const char *_GetBitDescription(_BitIndex bit);
142
143 _BitsType _bits = 0;
144};
145
146inline constexpr EsfEditReason EsfEditReason::None(0);
147
149 EsfEditReason::_BitIndex::ResyncedObject);
150
152 EsfEditReason::_BitIndex::ChangedPropertyList);
153
155 EsfEditReason::_BitIndex::ChangedConnectionPaths);
156
158 EsfEditReason::_BitIndex::ChangedTargetPaths);
159
160PXR_NAMESPACE_CLOSE_SCOPE
161
162#endif
Set of scene changes that should trigger edits to the exec network.
Definition: editReason.h:31
static const EsfEditReason ResyncedObject
Something about an object has changed.
Definition: editReason.h:43
static const EsfEditReason ChangedConnectionPaths
The list of connection paths on an attribute has changed.
Definition: editReason.h:53
constexpr bool Contains(EsfEditReason other) const
Return true if other's reasons are entirely contained by this set of reasons.
Definition: editReason.h:98
static const EsfEditReason ChangedTargetPaths
The list of target paths on a relationship has changed.
Definition: editReason.h:57
ESF_API std::string GetDescription() const
Get a string describing the contents of this edit reason.
bool operator<(const EsfEditReason &other) const
Enables consistent sorting of EsfEditReasons.
Definition: editReason.h:105
constexpr EsfEditReason()=default
Equivalent to EsfEditReason::None.
static const EsfEditReason ChangedPropertyList
The list of properties on a prim has changed.
Definition: editReason.h:49