Loading...
Searching...
No Matches
object.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_OBJECT_H
8#define PXR_EXEC_ESF_OBJECT_H
9
11
12#include "pxr/pxr.h"
13
14#include "pxr/exec/esf/api.h"
17#include "pxr/exec/esf/stage.h"
18
19#include "pxr/usd/sdf/path.h"
20
21PXR_NAMESPACE_OPEN_SCOPE
22
23class EsfAttribute;
24class EsfJournal;
25class EsfObject;
26class EsfPrim;
27class EsfRelationship;
28class TfToken;
29class TfType;
30class VtValue;
31
45{
46public:
47 ESF_API ~EsfObjectInterface() override;
48
54 ESF_API bool IsValid(EsfJournal *journal) const;
55
57 ESF_API SdfPath GetPath(EsfJournal *journal) const;
58
60 ESF_API TfToken GetName(EsfJournal *journal) const;
61
63 ESF_API EsfPrim GetPrim(EsfJournal *journal) const;
64
68 ESF_API SdfPathVector GetIncomingConnections(EsfJournal *journal) const;
69
72 return _GetStage();
73 }
74
81
84
89 ESF_API VtValue GetMetadata(const TfToken &key) const;
90
94 ESF_API bool IsValidMetadataKey(const TfToken &key) const;
95
100 ESF_API TfType GetMetadataValueType(const TfToken &key) const;
101
103
105 virtual bool IsPrim() const = 0;
106
108 virtual bool IsAttribute() const = 0;
109
111 virtual bool IsRelationship() const = 0;
112
114 virtual EsfObject AsObject() const = 0;
115
117 virtual EsfAttribute AsAttribute() const = 0;
118
120 virtual EsfRelationship AsRelationship() const = 0;
121
123 virtual EsfPrim AsPrim() const = 0;
124
125protected:
127 EsfObjectInterface(const SdfPath &path) : _path(path) {}
128
130 const SdfPath &_GetPath() const { return _path; }
131
132 virtual EsfStage _GetStage() const = 0;
133
134 static EsfSchemaConfigKey CreateSchemaConfigKey(const void *const id) {
135 return EsfSchemaConfigKey(id);
136 }
137
138private:
139 // Object path that will be added to EsfJournals.
140 SdfPath _path;
141
142 // These methods must be implemented by the scene adapter implementation.
143 virtual bool _IsValid() const = 0;
144 virtual TfToken _GetName() const = 0;
145 virtual EsfPrim _GetPrim() const = 0;
146 virtual SdfPathVector _GetIncomingConnections() const = 0;
147 virtual EsfSchemaConfigKey _GetSchemaConfigKey() const = 0;
148 virtual VtValue _GetMetadata(const TfToken &key) const = 0;
149 virtual bool _IsValidMetadataKey(const TfToken &key) const = 0;
150 virtual TfType _GetMetadataValueType(const TfToken &key) const = 0;
151};
152
159class EsfObject : public EsfFixedSizePolymorphicHolder<EsfObjectInterface, 48>
160{
161public:
163};
164
165PXR_NAMESPACE_CLOSE_SCOPE
166
167#endif
Holds an implementation of EsfAttributeInterface in a fixed-size buffer.
Definition attribute.h:70
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.
Stores a collection of edit reasons associated with scene objects.
Definition journal.h:38
Holds an implementation of EsfObjectInterface in a fixed-size buffer.
Definition object.h:160
Scene object abstraction for scene adapter implementations.
Definition object.h:45
ESF_API bool IsValidMetadataKey(const TfToken &key) const
Returns true if the field indicated by key is a valid metadata field for this object.
virtual EsfAttribute AsAttribute() const =0
virtual bool IsRelationship() const =0
ESF_API EsfPrim GetPrim(EsfJournal *journal) const
ESF_API bool IsValid(EsfJournal *journal) const
Returns true if the object is valid, active, loaded, defined, and non-abstract.
virtual EsfPrim AsPrim() const =0
ESF_API EsfSchemaConfigKey GetSchemaConfigKey(EsfJournal *journal) const
Returns an opaque value that is guaranteed to be unique and stable.
virtual bool IsPrim() const =0
EsfObjectInterface(const SdfPath &path)
This constructor may only be called by the scene adapter implementation.
Definition object.h:127
virtual bool IsAttribute() const =0
const SdfPath & _GetPath() const
Gets the path to this object used for journaling.
Definition object.h:130
ESF_API VtValue GetMetadata(const TfToken &key) const
Returns the value of the metadata field indicated by key.
ESF_API TfType GetMetadataValueType(const TfToken &key) const
Returns the value type for the indicated key.
ESF_API TfToken GetName(EsfJournal *journal) const
ESF_API SdfPath GetPath(EsfJournal *journal) const
virtual EsfObject AsObject() const =0
ESF_API SdfPathVector GetIncomingConnections(EsfJournal *journal) const
Returns the paths of all attributes that have connections that target the object.
EsfStage GetStage() const
Definition object.h:71
virtual EsfRelationship AsRelationship() const =0
Holds an implementation of EsfPrimInterface in a fixed-size buffer.
Definition prim.h:85
Holds an implementation of EsfRelationshipInterface in a fixed-size buffer.
An opaque type that can be used to identify the configuration of typed and applied schemas for a prim...
Holds an implementation of EsfStageInterface in a fixed-size buffer.
Definition stage.h:108
A path value used to locate objects in layers or scenegraphs.
Definition path.h:281
Token for efficient comparison, assignment, and hashing of known strings.
Definition token.h:71
TfType represents a dynamic runtime type.
Definition type.h:48
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition value.h:90