ufe 5.5
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
attribute.h
Go to the documentation of this file.
1#line 1 "S:/jenkins/workspace/ECP/ufe/ufe-full-python3.11-windows/ufe/include/attribute.h"
2#ifndef _ufe_attribute
3#define _ufe_attribute
4
5// =======================================================================
6// Copyright 2019 Autodesk, Inc. All rights reserved.
7//
8// This computer source code and related instructions and comments are the
9// unpublished confidential and proprietary information of Autodesk, Inc.
10// and are protected under applicable copyright and trade secret law. They
11// may not be disclosed to, copied or used by any third party without the
12// prior written consent of Autodesk, Inc.
13// =======================================================================
14
15#include "common/ufeExport.h"
16#include "sceneItem.h"
17#include "observer.h"
18#include "types.h"
19#include "undoableCommand.h" // For UndoableCommand::Ptr
20#include "value.h"
21
22#include <memory>
23#include <vector>
24#include <string>
25
27
37class UFE_SDK_DECL Attribute : public std::enable_shared_from_this<Attribute>
38{
39public:
40 typedef std::shared_ptr<Attribute> Ptr;
42
45 static constexpr char kInvalid[] = "Invalid";
46 static constexpr char kBool[] = "Bool";
47 static constexpr char kInt[] = "Int";
48 static constexpr char kFloat[] = "Float";
49 static constexpr char kDouble[] = "Double";
50 static constexpr char kString[] = "String";
51 static constexpr char kColorFloat3[] = "ColorFloat3";
52 static constexpr char kColorFloat4[] = "ColorFloat4";
53 static constexpr char kFilename[] = "Filename";
54 static constexpr char kEnumString[] = "EnumString";
55 static constexpr char kInt3[] = "Int3";
56 static constexpr char kFloat2[] = "Float2";
57 static constexpr char kFloat3[] = "Float3";
58 static constexpr char kFloat4[] = "Float4";
59 static constexpr char kDouble3[] = "Double3";
60 static constexpr char kMatrix3d[] = "Matrix3d";
61 static constexpr char kMatrix4d[] = "Matrix4d";
62 static constexpr char kGeneric[] = "Generic";
64
67 virtual ~Attribute();
68
70
71 Attribute(const Attribute&) = delete;
72 Attribute& operator=(const Attribute&) = delete;
73 Attribute(Attribute&&) = delete;
76
78
81 bool operator==(const Attribute& rhs) const;
82 bool operator!=(const Attribute& rhs) const;
84
87
89 virtual bool hasValue() const = 0;
90
92 virtual std::string name() const = 0;
93
95 virtual std::string displayName() const;
96
98 virtual std::string documentation() const = 0;
99
101 virtual Type type() const = 0;
102
104 virtual std::string string() const = 0;
105
106 // --------------------------------------------------------------------- //
109 // --------------------------------------------------------------------- //
110
115 static constexpr char kLocked[] = "Locked";
116
117 // --------------------------------------------------------------------- //
119 // --------------------------------------------------------------------- //
120
121
122 // --------------------------------------------------------------------- //
125 // --------------------------------------------------------------------- //
126
132 virtual Value getMetadata(const std::string& key) const = 0;
133
140 virtual bool setMetadata(const std::string& key, const Value& value) = 0;
141
144 virtual UndoableCommand::Ptr setMetadataCmd(const std::string& key, const Value& value);
145
151 virtual bool clearMetadata(const std::string& key) = 0;
152
157
159 virtual bool hasMetadata(const std::string& key) const = 0;
160
161 // --------------------------------------------------------------------- //
163 // --------------------------------------------------------------------- //
164
165private:
167
168}; // end class Attribute
169
172{
173public:
174 typedef std::shared_ptr<AttributeGeneric> Ptr;
175
176 using Attribute::Attribute;
177
178 // Ufe::Attribute overrides
179 Type type() const final;
180
182 virtual std::string nativeType() const = 0;
183};
184
187 public Attribute
188{
189public:
190 typedef std::shared_ptr<AttributeFilename> Ptr;
191
192 using Attribute::Attribute;
193
194 // Ufe::Attribute overrides
195 Type type() const final;
196
198 virtual std::string get() const = 0;
199
201 virtual void set(const std::string& value) = 0;
202
206 virtual UndoableCommand::Ptr setCmd(const std::string& value);
207};
208
211 public Attribute
212{
213public:
214 typedef std::shared_ptr<AttributeEnumString> Ptr;
215 typedef std::vector< std::string > EnumValues;
216
217 using Attribute::Attribute;
218
219 // Ufe::Attribute overrides
220 Type type() const final;
221
223 virtual std::string get() const = 0;
224
226 virtual void set(const std::string& value) = 0;
227
231 virtual UndoableCommand::Ptr setCmd(const std::string& value);
232
234 virtual EnumValues getEnumValues() const = 0;
235};
236
238template<typename T>
240 public Attribute
241{
242public:
243 typedef std::shared_ptr<TypedAttribute<T>> Ptr;
244
245 using Attribute::Attribute;
246
247 // Ufe::Attribute overrides
248 Type type() const final;
249
251 virtual T get() const = 0;
252
254 virtual void set(const T& value) = 0;
255
257 virtual UndoableCommand::Ptr setCmd(const T& value);
258};
259
263
267
271
275
279
283
287
291
295
299
303
307
310
315
318
323
324} // end namespace
325
326#endif /* _ufe_attribute */
Attribute which has a list of strings as enumerated values.
Definition: attribute.h:212
std::shared_ptr< AttributeEnumString > Ptr
Definition: attribute.h:214
Type type() const final
std::vector< std::string > EnumValues
Definition: attribute.h:215
Attribute which represents a filename.
Definition: attribute.h:188
std::shared_ptr< AttributeFilename > Ptr
Definition: attribute.h:190
Type type() const final
Generic attribute which doesn't match any defined type.
Definition: attribute.h:172
Type type() const final
std::shared_ptr< AttributeGeneric > Ptr
Definition: attribute.h:174
Abstract base class for Attribute interface.
Definition: attribute.h:38
virtual UndoableCommand::Ptr clearMetadataCmd(const std::string &key)
virtual std::string documentation() const =0
SceneItem::Ptr sceneItem() const
virtual std::string displayName() const
virtual bool setMetadata(const std::string &key, const Value &value)=0
Attribute & operator=(const Attribute &)=delete
const SceneItem::Ptr fItem
Definition: attribute.h:166
virtual std::string string() const =0
bool operator!=(const Attribute &rhs) const
virtual UndoableCommand::Ptr setMetadataCmd(const std::string &key, const Value &value)
Attribute(const SceneItem::Ptr &)
Constructor.
virtual std::string name() const =0
virtual Value getMetadata(const std::string &key) const =0
Attribute & operator=(Attribute &&)=delete
std::string Type
Definition: attribute.h:41
virtual Type type() const =0
std::shared_ptr< Attribute > Ptr
Definition: attribute.h:40
Attribute(Attribute &&)=delete
virtual bool clearMetadata(const std::string &key)=0
virtual ~Attribute()
bool operator==(const Attribute &rhs) const
virtual bool hasValue() const =0
virtual bool hasMetadata(const std::string &key) const =0
Returns true if metadata key has a non-empty value.
Attribute(const Attribute &)=delete
No copy or move constructor/assignment.
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:44
Typed attribute template for creating a specialized type.
Definition: attribute.h:241
std::shared_ptr< TypedAttribute< T > > Ptr
Definition: attribute.h:243
Type type() const final
Abstract base class for undoable commands.
std::shared_ptr< UndoableCommand > Ptr
const Ptr & get()
std::string string(const Path &path)
Definition: path.h:201
Typed square matrix template.
Definition: types.h:224
Typed vector template for creating a specialized vector with N elements.
Definition: types.h:40
#define UFE_NS_DEF
Definition: ufe.h:35
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:36