ufe 6.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 "D:/Jenkins/workspace/EMS/ECG/ufe/full/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 kUInt[] = "UInt";
49 static constexpr char kFloat[] = "Float";
50 static constexpr char kDouble[] = "Double";
51 static constexpr char kString[] = "String";
52 static constexpr char kColorFloat3[] = "ColorFloat3";
53 static constexpr char kColorFloat4[] = "ColorFloat4";
54 static constexpr char kFilename[] = "Filename";
55 static constexpr char kEnumString[] = "EnumString";
56 static constexpr char kInt3[] = "Int3";
57 static constexpr char kFloat2[] = "Float2";
58 static constexpr char kFloat3[] = "Float3";
59 static constexpr char kFloat4[] = "Float4";
60 static constexpr char kDouble3[] = "Double3";
61 static constexpr char kMatrix3d[] = "Matrix3d";
62 static constexpr char kMatrix4d[] = "Matrix4d";
63 static constexpr char kGeneric[] = "Generic";
65
68 virtual ~Attribute();
69
71
72 Attribute(const Attribute&) = delete;
73 Attribute& operator=(const Attribute&) = delete;
74 Attribute(Attribute&&) = delete;
77
79
82 bool operator==(const Attribute& rhs) const;
83 bool operator!=(const Attribute& rhs) const;
85
88
90 virtual bool hasValue() const = 0;
91
93 virtual std::string name() const = 0;
94
96 virtual std::string displayName() const;
97
99 virtual std::string documentation() const = 0;
100
102 virtual Type type() const = 0;
103
105 virtual std::string string() const = 0;
106
107 // --------------------------------------------------------------------- //
110 // --------------------------------------------------------------------- //
111
116 static constexpr char kLocked[] = "Locked";
117
118 // --------------------------------------------------------------------- //
120 // --------------------------------------------------------------------- //
121
122
123 // --------------------------------------------------------------------- //
126 // --------------------------------------------------------------------- //
127
133 virtual Value getMetadata(const std::string& key) const = 0;
134
141 virtual bool setMetadata(const std::string& key, const Value& value) = 0;
142
148 virtual UndoableCommand::Ptr setMetadataCmd(const std::string& key, const Value& value);
149
155 virtual bool clearMetadata(const std::string& key) = 0;
156
164
166 virtual bool hasMetadata(const std::string& key) const = 0;
167
168 // --------------------------------------------------------------------- //
170 // --------------------------------------------------------------------- //
171
172private:
174
175}; // end class Attribute
176
179{
180public:
181 typedef std::shared_ptr<AttributeGeneric> Ptr;
182
183 using Attribute::Attribute;
184
185 // Ufe::Attribute overrides
186 Type type() const final;
187
189 virtual std::string nativeType() const = 0;
190};
191
194 public Attribute
195{
196public:
197 typedef std::shared_ptr<AttributeFilename> Ptr;
198
199 using Attribute::Attribute;
200
201 // Ufe::Attribute overrides
202 Type type() const final;
203
205 virtual std::string get() const = 0;
206
209 virtual bool isDefault() const = 0;
210
212 virtual void set(const std::string& value) = 0;
213
215 virtual void reset() = 0;
216
223 virtual UndoableCommand::Ptr setCmd(const std::string& value);
224
231 virtual UndoableCommand::Ptr resetCmd();
232};
233
236 public Attribute
237{
238public:
239 typedef std::shared_ptr<AttributeEnumString> Ptr;
240 typedef std::vector< std::string > EnumValues;
241
242 using Attribute::Attribute;
243
244 // Ufe::Attribute overrides
245 Type type() const final;
246
248 virtual std::string get() const = 0;
249
252 virtual bool isDefault() const = 0;
253
255 virtual void set(const std::string& value) = 0;
256
258 virtual void reset() = 0;
259
266 virtual UndoableCommand::Ptr setCmd(const std::string& value);
267
274 virtual UndoableCommand::Ptr resetCmd();
275
277 virtual EnumValues getEnumValues() const = 0;
278};
279
281template<typename T>
283 public Attribute
284{
285public:
286 typedef std::shared_ptr<TypedAttribute<T>> Ptr;
287
288 using Attribute::Attribute;
289
290 // Ufe::Attribute overrides
291 Type type() const final;
292
294 virtual T get() const = 0;
295
298 virtual bool isDefault() const = 0;
299
301 virtual void set(const T& value) = 0;
302
304 virtual void reset() = 0;
305
310 virtual UndoableCommand::Ptr setCmd(const T& value);
311
318 virtual UndoableCommand::Ptr resetCmd();
319};
320
324
328
331typedef TypedAttribute<unsigned int> AttributeUInt;
332
336
340
344
348
352
356
360
364
368
372
375
380
383
388
389} // end namespace
390
391#endif /* _ufe_attribute */
Attribute which has a list of strings as enumerated values.
Definition: attribute.h:237
std::shared_ptr< AttributeEnumString > Ptr
Definition: attribute.h:239
Type type() const final
std::vector< std::string > EnumValues
Definition: attribute.h:240
Attribute which represents a filename.
Definition: attribute.h:195
std::shared_ptr< AttributeFilename > Ptr
Definition: attribute.h:197
Type type() const final
Generic attribute which doesn't match any defined type.
Definition: attribute.h:179
Type type() const final
std::shared_ptr< AttributeGeneric > Ptr
Definition: attribute.h:181
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:173
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:284
std::shared_ptr< TypedAttribute< T > > Ptr
Definition: attribute.h:286
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