NDEVR
API Documentation
ModelTileGroup.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2020, 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: Design
28File: ModelTileGroup
29Included in API: True
30Author(s): tyler.parke
31 *-----------------------------------------------------------------------------------------**/
32
33#pragma once
34#include "DLLInfo.h"
35#include <NDEVR/Model.h>
36#include <NDEVR/ModelTileOptions.h>
37#include <NDEVR/DesignCommand.h>
38namespace NDEVR
39{
40 class Effect;
41
50 class NDEVR_DESIGN_API ModelTileGroup : public Model
51 {
52 public:
57 ModelTileGroup(const Model& model);
58
63
68 static constexpr StringView TypeName() { return "model_tile_group"; }
69
74 void setOptions(const ModelTileOptions& options);
75
80 ModelTileOptions tileOptions() const;
81
86 bool hasTileOptions() const;
87
92
98
104
109 void setModelToTile(Model& model);
110 private:
115 Effect tileEffect() const;
116
120 void init();
121 };
122
129 {
130 public:
135 ModelTileCommand(const ModelTileOptions& options)
136 : DesignCommand()
137 , m_options(options)
138 {}
139
144 virtual StringView icon() const override { return "copy"; }
145
150 NDEVR_DESIGN_API virtual TranslatedString name() const override;
151
156 NDEVR_DESIGN_API virtual void execute(DesignObjectLookup* lookup) override;
157
163 virtual bool addTarget(UUID target_id) override { m_tile_targets.add(target_id); return true; }
164
170 NDEVR_DESIGN_API virtual bool canGroupWith(const DynamicPointer<DesignCommand>& command) override;
171
177 NDEVR_DESIGN_API virtual bool canCombineWith(const DynamicPointer<DesignCommand>& command) override;
178
183 NDEVR_DESIGN_API virtual void combineWith(const DynamicPointer<DesignCommand>& command) override;
184
189 virtual bool isAsyncExecution() const override { return true; };
190 private:
191 Buffer<UUID> m_tile_targets;
192 Buffer<ModelTileOptions> m_undo_options;
193 ModelTileOptions m_options;
194 };
195}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
DesignCommand()
Default constructor.
A core class where all Design Objects including models, materials, and geometries are stored.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
A core class that provides a dynamic effect to an object in a model hierarchy.
Definition Effect.h:158
virtual TranslatedString name() const override
Returns the user-facing translated name of this command.
ModelTileCommand(const ModelTileOptions &options)
Constructs a ModelTileCommand with the given tiling options.
virtual void execute(DesignObjectLookup *lookup) override
Executes the tiling command, applying tile options to all target models.
virtual bool canCombineWith(const DynamicPointer< DesignCommand > &command) override
Checks whether this command can be combined (merged) with another command.
virtual StringView icon() const override
Returns the icon identifier for this command.
virtual bool canGroupWith(const DynamicPointer< DesignCommand > &command) override
Checks whether this command can be grouped with another command in the undo stack.
virtual void combineWith(const DynamicPointer< DesignCommand > &command) override
Merges another compatible command into this one, absorbing its targets and options.
virtual bool isAsyncExecution() const override
Indicates that this command executes asynchronously.
virtual bool addTarget(UUID target_id) override
Adds a target model (by UUID) to the list of models to tile.
bool hasTileOptions() const
Checks whether this tile group has tiling options configured.
void updateTiles()
Regenerates the tiled instances based on the current options and source model.
static constexpr StringView TypeName()
Returns the type name identifier for this model type.
Model tileRoot()
Retrieves the root model that contains the generated tile instances.
ModelTileOptions tileOptions() const
Retrieves the current tiling options for this group.
void setOptions(const ModelTileOptions &options)
Sets the tiling options that control spacing, alignment, and orientation of tiles.
void setModelToTile(Model &model)
Sets the source model to be used as the tile template.
ModelTileGroup(const Model &model)
Constructs a ModelTileGroup from an existing Model.
ModelTileGroup()
Default constructor.
Model modelToTile()
Retrieves the source model that is being tiled (repeated).
Model()
Default constructor. Creates an uninitialized Model.
Definition Model.h:365
The core String View class for the NDEVR API.
Definition StringView.h:58
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
The primary namespace for the NDEVR SDK.