NDEVR
API Documentation
ModelCommandsWidget.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVR
28File: ModelCommandsWidget
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#if NDEVR_VIEWPORT
35#include <NDEVR/SoftwareService.h>
36#include <NDEVR/SnapsEditorWidget.h>
37#include <NDEVR/QTModelManager.h>
38#include <NDEVR/MouseController.h>
39#include <NDEVR/SelectionController.h>
40#include <NDEVR/ModelEditController.h>
41#include <QWidget>
42class QVBoxLayout;
43namespace NDEVR
44{
45 class Ribbon;
46 class Button;
47 class RibbonGroup;
49 class RibbonSubGroup;
58 {
59 public:
64 virtual QWidget* editWidget() = 0;
69 virtual bool shouldShowInterface() const override { return true; }
70 };
71
75 class NDEVR_API ModelCommandsWidget : public QWidget, public SoftwareServiceManager
76 {
77 Q_OBJECT
78 public:
84 ModelCommandsWidget(QTModelManager* manager, QWidget *parent = nullptr);
94#if NDEVR_GRIPS
99 void setupGripModeRibbon(RibbonGroup* group);
100#endif
110 void setControl(UUID mode);
115 void setControlEnabled(bool is_enabled);
120 void removeControl(bool keep_existing);
125 protected:
130 void refreshUI(bool force);
135 void updateSelectionMode(bool force);
139 void init();
156 signals:
166 void requestVisibleSignal(bool visible);
167 protected slots:
173 void onSelectedSlot(Buffer<UUID> ids, bool is_selected);
174 private:
175 Buffer<DynamicPointer<MouseController>> m_mouse_controllers;
176 SnapsEditorWidget* m_snaps_widget;
177 QTModelManager* m_manager;
178 Buffer<uint04> m_key_draw_action_indices;
179 Ribbon* m_draw_type_ribbon;
180 ModelEditController::ModelEditMode m_last_command_mode;
181 SubSelectionMode m_last_selection_mode;
182 Buffer<RibbonSubGroup*> m_inverted_sections;
183 RibbonSubGroup* m_selection_sections = nullptr;
184 RibbonSubGroup* m_mask_sections = nullptr;
185 Buffer<Button*> m_mask_buttons;
186 QTResourceListener* m_enabled_listener;
187 Buffer<Buffer<Button*>> m_command_mode_buttons;
188 Buffer<Buffer<Button*>> m_grip_mode_buttons;
189 Buffer<Dictionary<UUID, Button*>> m_command_function_buttons;
190 Buffer<Button*> m_selection_mode_buttons;
191 UUID m_controller_id;
192 QTimer* m_mask_highlight_timer;
193 uint04 m_mask_highlight_request;
194 QCustomStackedWidget* m_stacked_widget;
195 ModelOffsetCommandWidget* m_offset_command_widget;
196 VertexOffsetWidget* m_vertex_offset_command_widget;
197 QCustomLabel* m_hint_label;
198 bool m_is_enabled;
199 bool m_last_inverted;
200 bool m_is_dirty;
201 };
202}
203#endif
204
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A core widget that allows the user to click one of many button types.
Definition Button.h:68
virtual ~ModelCommandsWidget()
Destroys the model commands widget and releases resources.
void refreshMaskWidgets()
Refreshes the mask widgets based on the current selection state.
void init()
Initializes internal state, UI elements, and signal connections.
void removeControl(bool keep_existing)
Removes the active editing control.
void updateCheckedButtons()
Updates the checked state of all mode buttons to reflect the current mode.
void setControlEnabled(bool is_enabled)
Enables or disables the model editing controls.
void requestVisibleSignal(bool visible)
Emitted to request visibility changes for this widget.
void refreshUI(bool force)
Refreshes the UI to reflect the current editing state.
ModelCommandsWidget(QTModelManager *manager, QWidget *parent=nullptr)
Constructs the model commands widget for editing 3D objects.
void controlModeSet(ModelEditController::ModelEditMode mode)
Emitted when the model editing mode changes.
void setupForVertexOffsetCommand()
Sets up the UI for the vertex offset command.
void setupCommandModeRibbon(RibbonGroup *group)
Sets up ribbon buttons for model edit command modes (move, rotate, scale, etc.).
void onSelectedSlot(Buffer< UUID > ids, bool is_selected)
Slot called when objects are selected or deselected in the scene.
void updateSelectionMode(bool force)
Updates the sub-selection mode UI (vertex, edge, face, etc.).
void setControl(ModelEditController::ModelEditMode mode)
Activates the specified model editing mode.
void setupForOffsetCommand()
Sets up the UI for the model offset command.
void refreshButtonEnabled()
Refreshes the enabled state of all buttons based on the current selection.
void setControl(UUID mode)
Activates a custom model editing function by UUID.
ModelEditMode
Enumerates the available model editing modes.
A Model function allows a user to interact with the program to perform a task on models.
Allows the user to offset a model to a different location.
Displays translated text.
The main class for a layout where all widgets occupy the same same and only one widget is shown at a ...
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object...
Definition QTTools.h:493
Can be used to add functionality to the ModelCommandsWidget by showing a unique widget when the actio...
virtual bool shouldShowInterface() const override
Returns whether the function should show a UI interface.
virtual QWidget * editWidget()=0
Returns the widget used to configure this model function.
Represents the "Tab" of a widget.
Definition RibbonGroup.h:52
Represents a sub-section of "Tab" of a ribbon representing a grouping of buttons or widgets within a ...
The UI ribbon is a horizontal menu bar typically located at the top of the application interface or a...
Definition Ribbon.h:56
A ribbon sub-group widget that allows the user to configure snap settings such as endpoint,...
Software Service Managers take a Software service to modify the behavior of the software.
Base interface for services that extend or modify software behavior through modules.
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
A widget allowing the user to offset a vertex.
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
SubSelectionMode
Defines the mode of sub-selection used by the SelectionController.