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
contextOps.h
Go to the documentation of this file.
1#line 1 "S:/jenkins/workspace/ECP/ufe/ufe-full-python3.11-windows/ufe/include/contextOps.h"
2#ifndef _contextOps
3#define _contextOps
4// ===========================================================================
5// Copyright 2020 Autodesk, Inc. All rights reserved.
6//
7// Use of this software is subject to the terms of the Autodesk license
8// agreement provided at the time of installation or download, or which
9// otherwise accompanies this software in either electronic or hard copy form.
10// ===========================================================================
11
12#include "common/ufeExport.h"
13
14#include "sceneItem.h"
15#include "undoableCommand.h"
16#include "value.h"
17
18#include <map>
19#include <memory>
20#include <vector>
21#include <string>
22
24
26
32
33 enum HasChildren { kNoChildren = false, kHasChildren = true };
34 enum Checkable { kNotCheckable = false, kCheckable = true };
35 enum Checked { kNotChecked = false, kChecked = true };
36 enum Exclusive { kNotExclusive = false, kExclusive = true };
37 enum Enabled { kDisabled = false, kEnabled = true };
38
39 enum SeparatorTag { kSeparator };
40
41 ContextItem() = default;
43 const std::string& argItem,
44 const std::string& argLabel,
45 bool argHasChildren = false,
46 bool argCheckable = false,
47 bool argChecked = false,
48 bool argExclusive = false,
49 bool argEnabled = true
50 );
53 const std::string& argItem,
54 const std::string& argLabel,
55 const std::string& argImage,
56 bool argHasChildren = false,
57 bool argCheckable = false,
58 bool argChecked = false,
59 bool argExclusive = false,
60 bool argEnabled = true
61 );
63 ContextItem(SeparatorTag, const std::string& argLabel = "");
64
65 // --------------------------------------------------------------------- //
68 // --------------------------------------------------------------------- //
69
75 static constexpr char kIsOptionBox[] = "isOptionBox";
76
77 // --------------------------------------------------------------------- //
79 // --------------------------------------------------------------------- //
80
81 // --------------------------------------------------------------------- //
84 // --------------------------------------------------------------------- //
85
92
98 void setMetaData(const std::string& key, const Ufe::Value& value);
99
102
103 // --------------------------------------------------------------------- //
105 // --------------------------------------------------------------------- //
106
109
111 std::string label{};
112
114 std::string image{};
115
118 bool hasChildren{false};
119
121 bool checkable{false};
122
124 bool checked{false};
125
128 bool exclusive{false};
129
131 bool enabled{true};
132
134 bool separator{false};
135};
136
138
153{
154public:
155 typedef std::shared_ptr<ContextOps> Ptr;
156 typedef std::vector<std::string> ItemPath;
157 typedef std::vector<ContextItem> Items;
158
166 static Ptr contextOps(const SceneItem::Ptr& item);
167
171 ContextOps(const ContextOps&) = default;
173 virtual ~ContextOps();
174
176 virtual SceneItem::Ptr sceneItem() const = 0;
177
180 virtual Items getItems(const ItemPath& itemPath) const = 0;
181
187 virtual void doOp(const ItemPath& itemPath);
188
197 virtual UndoableCommand::Ptr doOpCmd(const ItemPath& itemPath) = 0;
198};
199
200}
201
202#endif /* _contextOps */
Abstract base class for context operations interface.
Definition: contextOps.h:153
std::shared_ptr< ContextOps > Ptr
Definition: contextOps.h:155
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:157
static Ptr contextOps(const SceneItem::Ptr &item)
virtual void doOp(const ItemPath &itemPath)
std::vector< std::string > ItemPath
Definition: contextOps.h:156
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:44
std::shared_ptr< UndoableCommand > Ptr
std::string string(const Path &path)
std::unordered_map< std::string, Value > ValueDictionary
Definition: value.h:122
Structure to describe contextual operations.
Definition: contextOps.h:31
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:101
#define UFE_NS_DEF
Definition: ufe.h:35
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:36