33#include <NDEVR/SnapController.h>
35#include <NDEVR/CommandLockObject.h>
36#include <NDEVR/SelectionController.h>
40 class ModelEditController;
46 friend class ModelEditController;
48 TranslatedString name;
51 virtual ~ModelFunction(){};
52 virtual TranslatedString group()
const;
53 virtual TranslatedString hint()
const {
return TranslatedString(); };
54 virtual TranslatedString expandedHint()
const {
return TranslatedString(); };
55 virtual bool selectionModeAllowed(
const SubSelectionMode& mode)
const = 0;
56 virtual bool processMouseEvent(
const MouseEvent&, DesignObjectLookup*, Camera*) {
return false; }
57 virtual bool processKeyEvent(
const KeyEvent&, DesignObjectLookup*, Camera*) {
return false; }
58 virtual void refreshState(ModelEditController& controller) = 0;
59 virtual bool canAutoFinishNow()
const {
return false; };
60 virtual SubSelectionMode defaultSelectionMode()
const = 0;
61 virtual void setupFilters(SelectionController*) {}
62 virtual void onSelect(
const Buffer<UUID>&) {}
63 virtual bool isSelecting()
const = 0;
64 virtual void onCancel() = 0;
65 virtual void requestCancel();
66 virtual void requestFinish();
67 virtual bool shouldShowInterface()
const {
return false; }
68 virtual void requestFinishSelection();
71 virtual void setController(ModelEditController* controller);
72 ModelEditController* m_controller =
nullptr;
80 enum ModelEditMode :
uint04
83 , e_center_locked_scale
85 , e_two_point_locked_scale
97 , e_set_real_thickness
102 , e_add_selection_mask
108 ModelEditController(DesignObjectLookup* manager);
109 ModelEditController(
const ModelEditController&) =
delete;
110 virtual ~ModelEditController(){};
111 virtual void begin()
override;
112 virtual void finish()
override;
113 virtual void cancel()
override;
114 bool hasCommandLock()
const {
return m_command_lock.isLocked(); }
115 const UUID& material()
const {
return m_paint_material; }
116 const UUID& pasteModel()
const {
return m_paste_model; }
117 const UUID& activeModel()
const {
return m_current_model; }
118 UUID activeModelFunction()
const;
119 void setPasteModel(UUID model);
120 void setActiveModel(UUID model);
121 void addEditFunction(
const DynamicPointer<ModelFunction>& function);
122 void setActiveEditFunction(
const UUID& function);
123 const Dictionary<UUID, DynamicPointer<ModelFunction>>& editFunctions()
const {
return m_edit_functions; };
124 void setActiveVertex(
const Matrix<fltp08>& complete_transform, UUID geometry, uint04 vertex_id);
126 void addPoint(
const Vertex<3, fltp08>& point)
override;
127 virtual void updateLocation(
const Vertex<3, fltp08>& location,
bool is_select =
false, Camera* camera =
nullptr)
override;
128 bool selectionModeAllowed(
const SubSelectionMode& mode)
const;
129 bool shouldShowInterface()
const;
130 TranslatedString title()
const;
131 TranslatedString hint()
const;
132 TranslatedString expandedHint()
const;
133 SubSelectionMode defaultSelectionMode()
const;
134 Resource<BitFlag> grip_mode;
135 Resource<ModelEditMode> edit_mode;
136 Buffer<UUID> editedModels() {
return m_edited_models; }
137 bool tryCommandLock();
138 Matrix<fltp08> originalTransform()
const {
return m_original_matrix; }
139 void setOriginalTransform(
const Matrix<fltp08>& transform);
140 SelectionInfo createSelectionInfo(
const MouseEvent& event, Camera* camera)
override;
141 virtual void addPoint(
const SnapPoint& point)
override;
142 virtual void addNextFinishedCallback(std::function<
void(
bool canceled, UUID
id)> callback) { m_next_finished_callback = callback; }
143 bool isSelecting()
const;
144 void finishSelection();
145 void setAutoFinish(
bool auto_finish);
146 bool hasFinishedMouseActions()
const;
148 void refreshOffsetState();
149 void refreshPlaceState();
150 void refreshVertexOffsetState();
151 void refreshScaleState();
152 void refreshRotateState();
153 void refreshRealThicknessState();
154 void refreshTwoPointSelectState();
155 void setSelectionFilters();
156 void onSelect(UUID
object);
157 void onMouseSelect();
158 virtual bool processMouseEvent(
const MouseEvent& mouse_event, DesignObjectLookup* lookup, Camera* camera)
override;
159 virtual bool processKeyEvent(
const KeyEvent& event, DesignObjectLookup* lookup, Camera* camera)
override;
161 CommandLockObject m_command_lock;
162 UUID m_paint_material;
164 UUID m_current_model;
165 UUID m_current_geometry;
167 Buffer<UUID> m_edited_models;
168 Matrix<fltp08> m_original_matrix;
169 Vector<2, sint02> m_mouse_screen_original;
170 Vector<3, fltp08> m_mouse_scene_original;
171 Plane<3, fltp08> m_command_plane;
172 bool m_snap_to_normal;
173 bool m_yaw_to_normal;
175 bool m_ignore_elevation;
178 std::function<void(
bool canceled, UUID
id)> m_next_finished_callback;
179 Dictionary<UUID, DynamicPointer<ModelFunction>> m_edit_functions;
180 DynamicPointer<ModelFunction> m_active_edit_function;
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:94