ufe 7.0
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
contextOps.h
Go to the documentation of this file.
1#line 1 "D:/Jenkins/workspace/EMS/ECG/ufe/full/ufe-full-python3.13-windows/ufe/include/contextOps.h"
2#ifndef UFE_CONTEXTOPS_H
3#define UFE_CONTEXTOPS_H
4
5// ===========================================================================
6// Copyright 2025 Autodesk, Inc. All rights reserved.
7//
8// The use of this software is subject to the Autodesk Terms of Use or other
9// license agreement provided at the time of installation or download, or
10// which otherwise accompanies this software.
11// ===========================================================================
12
13#include "common/ufeExport.h"
14
15#include "sceneItem.h"
16#include "undoableCommand.h"
17#include "value.h"
18
19#include <map>
20#include <memory>
21#include <vector>
22#include <string>
23
25
27
33
34 enum HasChildren { kNoChildren = false, kHasChildren = true };
35 enum Checkable { kNotCheckable = false, kCheckable = true };
36 enum Checked { kNotChecked = false, kChecked = true };
37 enum Exclusive { kNotExclusive = false, kExclusive = true };
38 enum Enabled { kDisabled = false, kEnabled = true };
39
40 enum SeparatorTag { kSeparator };
41
42 ContextItem() = default;
44 const std::string& argItem,
45 const std::string& argLabel,
46 bool argHasChildren = false,
47 bool argCheckable = false,
48 bool argChecked = false,
49 bool argExclusive = false,
50 bool argEnabled = true
51 );
54 const std::string& argItem,
55 const std::string& argLabel,
56 const std::string& argImage,
57 bool argHasChildren = false,
58 bool argCheckable = false,
59 bool argChecked = false,
60 bool argExclusive = false,
61 bool argEnabled = true
62 );
64 ContextItem(SeparatorTag, const std::string& argLabel = "");
65
66 // --------------------------------------------------------------------- //
69 // --------------------------------------------------------------------- //
70
76 static constexpr char kIsOptionBox[] = "isOptionBox";
77
78 // --------------------------------------------------------------------- //
80 // --------------------------------------------------------------------- //
81
82 // --------------------------------------------------------------------- //
85 // --------------------------------------------------------------------- //
86
93
99 void setMetaData(const std::string& key, const Ufe::Value& value);
100
103
104 // --------------------------------------------------------------------- //
106 // --------------------------------------------------------------------- //
107
110
112 std::string label{};
113
115 std::string image{};
116
119 bool hasChildren{false};
120
122 bool checkable{false};
123
125 bool checked{false};
126
129 bool exclusive{false};
130
132 bool enabled{true};
133
135 bool separator{false};
136};
137
139
154{
155public:
156 typedef std::shared_ptr<ContextOps> Ptr;
157 typedef std::vector<std::string> ItemPath;
158 typedef std::vector<ContextItem> Items;
159
167 static Ptr contextOps(const SceneItem::Ptr& item);
168
172 ContextOps(const ContextOps&) = default;
174 virtual ~ContextOps();
175
177 virtual SceneItem::Ptr sceneItem() const = 0;
178
181 virtual Items getItems(const ItemPath& itemPath) const = 0;
182
188 virtual void doOp(const ItemPath& itemPath);
189
198 virtual UndoableCommand::Ptr doOpCmd(const ItemPath& itemPath) = 0;
199};
200
201}
202
203#endif /* UFE_CONTEXTOPS_H */
Abstract base class for context operations interface.
Definition: contextOps.h:154
std::shared_ptr< ContextOps > Ptr
Definition: contextOps.h:156
ContextOps()
Constructor.
virtual Items getItems(const ItemPath &itemPath) const =0
virtual ~ContextOps()
Destructor.
ContextOps(const ContextOps &)=default
Default copy constructor.
virtual SceneItem::Ptr sceneItem() const =0
Scene item accessor.
virtual UndoableCommand::Ptr doOpCmd(const ItemPath &itemPath)=0
std::vector< ContextItem > Items
Definition: contextOps.h:158
static Ptr contextOps(const SceneItem::Ptr &item)
virtual void doOp(const ItemPath &itemPath)
std::vector< std::string > ItemPath
Definition: contextOps.h:157
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:45
std::shared_ptr< UndoableCommand > Ptr
Value class that can hold a wide set of types.
Definition: value.h:66
std::string string(const Path &path)
std::unordered_map< std::string, Value > ValueDictionary
Definition: value.h:173
Structure to describe contextual operations.
Definition: contextOps.h:32
ContextItem(const std::string &argItem, const std::string &argLabel, const std::string &argImage, bool argHasChildren=false, bool argCheckable=false, bool argChecked=false, bool argExclusive=false, bool argEnabled=true)
Convenience constructor for creating an item with image icon.
ContextItem(const std::string &argItem, const std::string &argLabel, bool argHasChildren=false, bool argCheckable=false, bool argChecked=false, bool argExclusive=false, bool argEnabled=true)
Ufe::Value getMetaData(const std::string &key) const
ContextItem()=default
ContextItem(SeparatorTag, const std::string &argLabel="")
Convenience constructor for creating a separator item, with optional label.
void setMetaData(const std::string &key, const Ufe::Value &value)
ValueDictionary metaData
The meta data can be used to include DCC-specific data, without making UFE's interface platform speci...
Definition: contextOps.h:102
#define UFE_NS_DEF
Definition: ufe.h:36
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:35