API Documentation
Loading...
Searching...
No Matches
Model.h
Go to the documentation of this file.
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: Design
28File: Model
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/DesignObject.h>
34namespace NDEVR
35{
36 enum class UVType;
37 enum class PrimitiveProperty;
38 enum class WindingMode;
39 class Scene;
40 class Database;
41 class File;
42 class Material;
43 class Geometry;
44#if NDEVR_SUPPORTS_BONES
45 class Bone;
46#endif
47 class Effect;
48 class Log;
49 class ProgressInfo;
50 template<class t_type>
51 class Set;
52
53 /**--------------------------------------------------------------------------------------------------
54 \brief A core class that represents a node on model heirarchy. This node may contain a Geometry or
55 one or more child Models as well as 3 different materials for rendering the Geometry parts.
56 **/
58 {
59 public:
60 enum class MaterialMode
61 {
62 e_by_parent
64 , e_custom
65 , e_hidden
66 };
68 {
69 e_ignore_offset = 0
70 , e_ignore_scale = 1
71 , e_ignore_rotation = 2
72 , e_ignore_scale_distortion = 3
73 , e_use_only_for_offset = 4
74 , e_orient_to_camera = 5
75 , e_follow_camera = 6
76 , e_scale_to_camera = 7
77 };
78
80 {
81 e_inherited_is_visible = 0
82 , e_inherited_has_no_focus = 1
83 , e_inherited_is_tree_visible = 2
84 , e_inherited_not_selected = 3
85 , e_inherited_is_manager_visible = 4
86 , e_inherited_can_delete = 5
87 , e_inherited_does_not_follow_camera = 6
88 , e_inherited_does_not_orient_to_camera = 7
89 , e_inherited_does_not_scale_to_camera = 8
90 , e_inherited_not_deleted = 9
91 , e_inherited_not_application_owned = 10
92 , e_inherited_exportable = 11
93 };
94
96 {
97 e_descendent_selected = 0
98 , e_descendent_focussed = 1
99 , e_descendent_deletion_blocked = 2
100 };
101
103 {
104 e_type
105 , e_fixed_bounding_box
106 , e_visible_box
107 , e_calculation_ignored
108 , e_can_select_children
109 , e_complete_transform
110 , e_material_mode_solid
111 , e_material_mode_outline
112 , e_material_mode_vertices
113 , e_parent_matrix_flags
114 , e_global_bounds
115 , e_global_selection_bounds
116 , e_model_color
117 , e_inherited_flags//recursive lookup
118 , e_personal_inherited_flags
119 , e_export_ignored //do not export this item
120 , e_descended_flags//recursive lookup
121 , e_personal_descended_flags
122 , e_application_constructed
123 , e_application_constructed_parent_base
124 , e_model_property_size//always last
125 };
126
127 public:
128 Model(){};
131 explicit Model(const DesignObject& obj);
132 [[nodiscard]] bool isSelected() const;
133 [[nodiscard]] bool isApplicationOwned() const;
134 [[nodiscard]] bool isVisible() const;
135 [[nodiscard]] bool isTreeVisible() const;
136 [[nodiscard]] bool hasFocus() const;
137 [[nodiscard]] bool exportIgnored() const;
138 [[nodiscard]] TranslatedString displayName() const;
139 [[nodiscard]] TranslatedString displayNamePath(const String& seperator = ":") const;
140 template<class t_type>
141 void setModelProperty(ModelProperty property, const t_type& value)
142 {
143 m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].set(m_design_index, value);
144 }
145 template<class t_type>
146 void updateModelProperty(ModelProperty property, const t_type& type, const void* lock_ptr = nullptr)
147 {
148 if (getModelProperty<t_type>(property) != type)
149 {
150 WLock wLock(lock_ptr);
151 setModelProperty(property, type);
152 updateModifiedTime();
153 }
154 }
155 template<class t_type>
156 t_type getModelProperty(ModelProperty property) const
157 {
158 return m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].get<t_type>(m_design_index);
159 }
160 bool isModelProperty(ModelProperty property, const String& value) const
161 {
162 return m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].isSame(m_design_index, value);
163 }
164 bool isModelProperty(ModelProperty property, const char* value) const
165 {
166 return m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].isSame(m_design_index, value);
167 }
168 bool doesModelPropertyContain(ModelProperty property, const String& value, bool ignore_case) const
169 {
170 return propertyTable().get()[m_base->model_property_index[cast<uint04>(property)]].contains(m_design_index, value, ignore_case);
171 }
172 bool doesModelPropertyContain(ModelProperty property, const char* value, bool ignore_case) const
173 {
174 return propertyTable().get()[m_base->model_property_index[cast<uint04>(property)]].contains(m_design_index, value, ignore_case);
175 }
178 void deleteModel(bool delete_children, bool remove_from_parent = true);
180 [[nodiscard]] bool canExplode() const;
181 [[nodiscard]] bool isOfType(const String& type) const;
182 [[nodiscard]] bool isOfType(const char* type) const;
183
186 void createChildren(uint04 child_size);
191
192 void addChild(Model& child);
193 void addChild(uint04 child_index);
195 //Parent functions
201 enum class ModelColorMode
202 {
203 e_direct
204 , e_by_selectable_children
205 , e_by_material_root
206 , e_by_layer
207 };
209 void updateTransform(const Matrix<fltp08>& transform, const void* lock = nullptr);
210 void setTransform(const Matrix<fltp08>& transform);
212
213
215
216 //Geometry functions
218
219 void setGeometryChild(uint04 geo_index);
220 void setGeometryChild(const Geometry& geo);
221 void updateVisible(bool is_visible);
222 void updateVisibleRecursive(bool is_visible);
225 bool hasMeshDescendent() const;
228 void hasDescendents(bool& has_point, bool& has_line, bool& has_mesh) const;
229
233 Material createChildMaterial(bool copy_child = false);
234 Material createChildMaterial(PrimitiveProperty property, bool copy_child = false);
238 void setMaterial(PrimitiveProperty property, uint04 material_index);
239 void setMaterial(uint04 material_index);
240 void setMaterial(PrimitiveProperty property, const Material& material);
241 void setMaterial(const Material& material);
242 void colorByChannel(Material& mat, const String& channel, fltp08 avg = Constant<fltp08>::Invalid) const;
244
245#if NDEVR_SUPPORTS_BONES
246 Bone createSceneBone() const;
247 bool hasBone(uint04 index = 0) const;
248 uint04 getNumOfBones() const;
249 Bone getBone(uint04 index = 0) const;
250 Bone getSceneBone(UUID id) const;
252 Matrix<fltp08> getBoneTransform(uint04 index = 0) const;
253 uint04 getBoneGroupIndex(uint04 child_index = 0) const;
254 void setBoneGroupIndex(uint04 bone_group_index, uint04 sub_index = 0);
255#endif
257
258 void setIsLayer(bool is_layer);
259 bool isLayer() const;
260 bool hasLayer() const;
261 [[nodiscard]] bool hasDirectLayer() const;
262 [[nodiscard]] Model getLayer() const;
263 [[nodiscard]] uint04 getDirectLayerIndex() const;
264
265 //Returns the center of rotation in global units
267
268 [[nodiscard]] bool isLocked() const;
269 [[nodiscard]] bool canInteract() const;
270 [[nodiscard]] bool hasSelectedDescendent() const;
271 void updateModifiedTime(Time time = Time::SystemTime());
272 void updateAscTime(const Time& time, bool include_self);
273 void updateDescTime(const Time& time, bool include_self);
274 void setLayer(Model layer);
276 [[nodiscard]] uint04 getChildIndex() const;
277 [[nodiscard]] uint04 getChildLayerIndex() const;
278
279 void setChildIndex(uint04 child, uint04 id);
280 [[nodiscard]] Model getChild(uint04 child) const;
281 [[nodiscard]] uint04 getChildIndex(uint04 child) const;
282 [[nodiscard]] bool hasChild(uint04 child_index) const;
284 [[nodiscard]] Buffer<UUID> getChildrenIDs() const;
285 [[nodiscard]] Buffer<uint04> getChildIndices() const;
287 template<class t_type>
288 [[nodiscard]] Buffer<t_type> getTypeChildren(const String& type) const
289 {
290 Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> models = getChildrenByType(type);
291 Buffer<t_type> values(models.size());
292 for (uint04 i = 0; i < models.size(); i++)
293 {
294 values.add(t_type(models[i]));
295 }
296 return values;
297 }
300
301 template<class t_type>
302 [[nodiscard]] Buffer<t_type> getTypeDescendents(const String& type) const
303 {
304 Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> models = getDescendentsByType(type);
305 Buffer<t_type> values(models.size());
306 for (uint04 i = 0; i < models.size(); i++)
307 {
308 values.add(t_type(models[i]));
309 }
310 return values;
311 }
315
316 [[nodiscard]] uint04 childCount() const;
317 [[nodiscard]] uint04 getNumOfEffects() const;
318 [[nodiscard]] bool hasEffect(uint04 index = 0) const;
319
320 [[nodiscard]] Effect getSceneEffect(UUID id) const;
321
322
323 [[nodiscard]] Geometry getGeometry() const;
324 [[nodiscard]] Geometry getSceneGeometry(uint04 index) const;
325 [[nodiscard]] Geometry getSceneGeometry(UUID id) const;
330
331 [[nodiscard]] bool hasMaterial() const;
332 [[nodiscard]] bool hasMaterial(PrimitiveProperty property) const;
333 [[nodiscard]] Material getMaterial(PrimitiveProperty property) const;
334 [[nodiscard]] Material getSceneMaterial(uint04 index) const;
335 [[nodiscard]] Material getRootMaterial(PrimitiveProperty property) const;
336 [[nodiscard]] Material getSceneMaterial(UUID id) const;
337 [[nodiscard]] bool hasLayerRootMaterial(PrimitiveProperty property) const;
343 void removeMaterial(const Material& material);
345
346
350 [[nodiscard]] Effect getEffect(uint04 index = 0) const;
351
352 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getSceneModels(bool include_deleted = false, bool local_only = false) const;
353 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getSceneModelsByType(const String& type, uint04 max_count = Constant<uint04>::Max, bool include_deleted = false) const;
354 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getSceneModelsByName(const String& name, uint04 max_count = Constant<uint04>::Max, bool include_deleted = false) const;
355 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getSceneLayers(bool include_deleted = false) const;
356 [[nodiscard]] Buffer<Model, uint04, ObjectAllocator<DESIGN_PRIM>> getDescendents(bool include_deleted = false, bool local_only = false) const;
357
359 void removeChild(const Model& model);
360
361 [[nodiscard]] uint04 visibleVertexCount() const;
362 [[nodiscard]] uint04 vertexCount() const;
363
364 [[nodiscard]] Model getFamilyMember(uint04 index) const;
365 [[nodiscard]] Model findDescendentByName(const String& name) const;
366 [[nodiscard]] Model findDescendentByType(const String& type) const;
367
368 [[nodiscard]] bool hasDescendent(const Model& model) const;
369 [[nodiscard]] bool hasDescendent(const UUID& id) const;
370
372
374 [[nodiscard]] Matrix<fltp08> getParentTransform() const;
375
376
377
378 [[nodiscard]] Bounds<3, fltp08> getBounds() const;
379 [[nodiscard]] Bounds<3, fltp08> globalBounds() const;
383 [[nodiscard]] Vector<3, fltp08> size() const;
384 void setSize(const Vector<3, fltp08>& size);
386 //virtual bool processSelection(SelectionInfo& info) const override;
387 //Returns the greatest modified time of this + all descendents
388 [[nodiscard]] Time getDescModifiedTime(bool include_self) const;
389
390 //Returns the greatest modified time of this + all parents
391 [[nodiscard]] Time getAscModifiedTime(bool include_self, bool include_layer = true) const;
392
393 //Centers th
396 void updateFrom(const Model& model, bool check_resources);
397 Dictionary<UUID, DesignObject> copyFrom(const Model& model, bool deep_copy, bool copy_ids = false, bool recursive = true);
400 void setNormalMode(NormalMode mode, Angle<fltp08> smoothing_angle, ProgressInfo* log);
401 void setOrientation(const Vector<3, Angle<sint04>>& new_orientation, const void* lock = nullptr);
402 void setOrientation(const Vector<3, Angle<fltp08>>& new_orientation, const void* lock = nullptr);
403 void calculateNormals(NormalMode mode, Angle<fltp08> smoothing_angle);
404 void removeDuplicateVertices(fltp08 epsilon, void* lock, ProgressInfo* log = nullptr);
405 bool isDeleted() const;
406 bool hasHoles(PrimitiveProperty property) const;
407 void calculateTangentSpace(bool calc_tan, bool calc_bitan);
409 bool isScene() const;
410 void validate(bool validate_children = true) const;
416
417 [[nodiscard]] fltp08 calculateVolume(const Matrix<fltp08>& transform = Constant<Matrix<fltp08>>::Invalid) const;
418 [[nodiscard]] fltp08 calculateSurfaceArea(const Matrix<fltp08>& transform = Constant<Matrix<fltp08>>::Invalid) const;
419 [[nodiscard]] Vector<2, fltp08> calculateVolumeAndSurfaceArea(const Matrix<fltp08>& transform = Constant<Matrix<fltp08>>::Invalid, const void* lock = nullptr) const;
420 [[nodiscard]] fltp08 calculateLength(const Matrix<fltp08>& transform = Constant<Matrix<fltp08>>::Invalid) const;
421 [[nodiscard]] Vector<3, fltp08> calculateAverageDirection(const Matrix<fltp08>& parent_transform = Constant<Matrix<fltp08>>::Invalid) const;
422 [[nodiscard]] Vector<2, fltp08> calculateHVLength(const Matrix<fltp08>& parent_transform = Constant<Matrix<fltp08>>::Invalid) const;
423 [[nodiscard]] uint04 getGeometryIndex() const;
424 [[nodiscard]] uint04 getMaterialIndex(PrimitiveProperty property) const;
425 [[nodiscard]] uint04 getEffectIndex(uint04 child_index = 0) const;
426 [[nodiscard]] Vector<32, bool> inheritedFlags() const;
427 void updateInheritedFlagsCache(bool force_update_all = false, bool update_personal_flags = false);
430 [[nodiscard]] Vector<32, bool> inheritedFlagsNoCache(bool complete_cache_ignore) const;
431
433 [[nodiscard]] BitFlag descendedFlags() const;
434 void updateDescendedFlagsCache(bool force_update_all = false);
436 [[nodiscard]] BitFlag personalDescendedFlags() const;
437 [[nodiscard]] BitFlag descendedFlagsNoCache(bool complete_cache_ignore) const;
438 operator bool() const
439 {
440 return isValid();
441 }
446 , const std::function<bool(const Model&, const Set<Model>&)>& filter);
447 protected:
452 private:
453 //Returns the greatest modified time of this + all descendents
454 Model getRootMaterialModel(PrimitiveProperty property, const Model& value_to_return, bool allow_layer) const;
455 Vertex<3, fltp08> _center();
456 Bounds<3, fltp08> _bounds(bool use_selection_bounds, bool get_global) const;
457 void setChildEffectSize(uint04 child_size);
458 void setChildSize(uint04 child_size);
459 void setGeometryIndex(uint04 geo_index);
460 void setMaterialIndex(PrimitiveProperty property, uint04 material_index);
461 void setMaterialIndex(uint04 material_index);
462 void setEffectIndex(uint04 material_index, uint04 sub_index = 0);
463 void setPersonalInheritedFlags(const Vector<32, bool>& flags);
464 void setPersonalInheritedFlag(InheritedFlags flag, bool value);
465 void _copyFrom(const Model& model, bool deep_copy, bool copy_ids, bool recursive_copy, Dictionary<UUID, DesignObject>& copy_to_index, bool is_root_copy);
466 };
467
468 template<>
469 struct ObjectInfo<Model, false, false>
470 {
471 static const uint01 Dimensions = 0;
472 static const bool Vector = false;
473 static const bool Buffer = false;
474 static const bool Primitive = DESIGN_PRIM;
475 static const bool Pointer = false;
476 static const bool Unsigned = false;
477 static const bool Float = false;
478 static const bool Integer = false;
479 static const bool Number = false;
480 static const bool Enum = false;
481 static const bool String = false;
482 static const bool Color = false;
483 static const bool Boolean = false;
484 static constexpr ObjectInfo<Model, false, false> VectorSub() { return ObjectInfo<Model, false, false>(); }
485 };
486 //static_assert(!std::is_polymorphic<Model>(), "Model should not be polymorphic");
487
488 /**--------------------------------------------------------------------------------------------------
489 \brief The root Model that is responsible for storing the underlying data for all Scene Models.
490 **/
492 {
493 public:
494 Scene();//Invalid object
495 Scene(const TranslatedString& name, DesignObjectBase* base = nullptr);
496 Scene(const File& file, DesignObjectBase* base = nullptr);
497 Scene(const String& file, DesignObjectBase* base = nullptr) = delete;
498 Scene(const TranslatedString& name, Scene& application_scene, DesignObjectBase* base = nullptr);
500
501 explicit Scene(const Model& model);
502
504 bool hasVertexColumn(const String& name) const;
505 bool hasVertexColumn(VertexProperty property) const;
507 bool isApplicationOwned() const;
508 void deleteBase() const;
509 Buffer<UUID> allObjectIDs(bool include_deleted) const;
511
513 const TableColumn& vertexColumn(const String& name) const;
516 static const Scene CreateApplicationScene(const TranslatedString& string);
517 };
518
519 template<>
520 struct ObjectInfo<Scene, false, false>
521 {
522 static const uint01 Dimensions = 0;
523 static const bool Vector = false;
524 static const bool Buffer = false;
525 static const bool Primitive = DESIGN_PRIM;
526 static const bool Pointer = false;
527 static const bool Unsigned = false;
528 static const bool Float = false;
529 static const bool Integer = false;
530 static const bool Number = false;
531 static const bool Enum = false;
532 static const bool String = false;
533 static const bool Color = false;
534 static const bool Boolean = false;
535 static constexpr ObjectInfo<Scene, false, false> VectorSub() { return ObjectInfo<Scene, false, false>(); }
536 };
537 template<>
538 struct NDEVR_DESIGN_API Constant<Model>
539 {
540 /** The Invalid. */
541 static const Model Invalid;
542 };
543
544 template class NDEVR_DESIGN_API StringStream<Model::ModelProperty>;
545}
546namespace std//Define things to allow use within std libs
547{
548 template <>
549 struct hash<NDEVR::Model>
550 {
551 std::size_t operator()(const NDEVR::Model& d) const noexcept
552 {
553 NDEVR::UUID s = d.uuid();
554 std::size_t value = 0;
555 for (NDEVR::uint01 i = 0; i < 8; i++)
556 value = value * 256 + (s[i + 0U] ^ s[i + 8U]);
557 return value;
558 }
559 };
560 template <>
561 struct hash<NDEVR::Scene>
562 {
563 std::size_t operator()(const NDEVR::Scene& d) const noexcept
564 {
565 NDEVR::UUID s = d.uuid();
566 std::size_t value = 0;
567 for (NDEVR::uint01 i = 0; i < 8; i++)
568 value = value * 256 + (s[i + 0U] ^ s[i + 8U]);
569 return value;
570 }
571 };
572};
#define NDEVR_DESIGN_API
Definition DLLInfo.h:55
The primary angle storage class for this API. Stores an angle in an optimized format.
Definition StringStream.h:540
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
Definition BitFlag.hpp:55
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:52
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
void add(t_type &&object)
Adds object to the end of the buffer.
Definition Buffer.hpp:186
constexpr t_index_type size() const
Definition Buffer.hpp:823
The core Color class in the NDEVR API. Colors can be defined in several ways. The ACIColor is compact...
Definition Color.h:41
Provides the underlying data storage for the NDEVR Scene Model heirarchy.
Definition DesignObjectBase.h:150
A low-level database object that can be used to access general stored properties within the NDEVR Mod...
Definition DesignObject.h:67
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
A core class that provides a dynamic effect to an object in a model heirarchy.
Definition Effect.h:45
Logic for reading or writing to a file as well as navigating filesystems.
Definition File.h:48
A core class within the model heirarchy containing vertex-based data (Usually 3D data) within a set c...
Definition Geometry.h:64
Container responsible for storing and setting the appearance of a Model or Geometry within the NDEVR ...
Definition Material.h:51
Definition Matrix.hpp:176
A core class that represents a node on model heirarchy. This node may contain a Geometry or one or mo...
Definition Model.h:58
BitFlag descendedFlagsNoCache(bool complete_cache_ignore) const
Buffer< Effect, uint04, ObjectAllocator< false > > getEffectChildren() const
void setGeometryChild(const Geometry &geo)
void invalidateVisibleBounds()
Time getDescModifiedTime(bool include_self) const
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getSceneModelsByType(const String &type, uint04 max_count=Constant< uint04 >::Max, bool include_deleted=false) const
void invalidateBounds()
fltp08 calculateLength(const Matrix< fltp08 > &transform=Constant< Matrix< fltp08 > >::Invalid) const
void clearChildren()
Vertex< 3, fltp08 > globalCenterOfRotation() const
Model getSceneModel(UUID id) const
Buffer< uint04 > getChildIndices() const
void calculateSmoothTextures(Vector< 3, fltp08 > origin, fltp08 scale)
Matrix< fltp08 > getCompleteTransform() const
void restoreModel()
Model getSceneLayer(UUID id) const
void eraseModel()
Dictionary< UUID, DesignObject > copyFrom(const Model &model, bool deep_copy, bool copy_ids=false, bool recursive=true)
Buffer< Material, uint04, ObjectAllocator< DESIGN_PRIM > > getMaterialChildren() const
void invalidateTransformCache()
bool doesModelPropertyContain(ModelProperty property, const char *value, bool ignore_case) const
Definition Model.h:172
Vector< 3, fltp08 > size() const
void colorByChannel(Material &mat, const String &channel, fltp08 avg=Constant< fltp08 >::Invalid) const
bool hasEffect(uint04 index=0) const
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getDescendentsByType(const String &type, uint04 max_count=Constant< uint04 >::Max) const
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getDescendentsByName(const String &name, uint04 max_count=Constant< uint04 >::Max) const
void calculateNormals(NormalMode mode, Angle< fltp08 > smoothing_angle)
void setTransform(const Matrix< fltp08 > &transform)
Buffer< t_type > getTypeDescendents(const String &type) const
Definition Model.h:302
Geometry getGeometry() const
Vertex< 3, fltp08 > centerAlignModel()
Matrix< fltp08 > getParentTransform() const
ModelColorMode
Definition Model.h:202
void setMaterialMode(MaterialMode vertex, MaterialMode outline, MaterialMode solid)
void updateModifiedTime(Time time=Time::SystemTime())
void createChildren(uint04 child_size)
Model(uint04 index, DesignObjectBase *base)
void clearMaterialDescendents()
void deleteModel(bool delete_children, bool remove_from_parent=true)
Vector< 3, fltp08 > calculateAverageDirection(const Matrix< fltp08 > &parent_transform=Constant< Matrix< fltp08 > >::Invalid) const
Buffer< Material, uint04, ObjectAllocator< DESIGN_PRIM > > getMaterialDescendents(bool local_only=false) const
Material getMaterial(PrimitiveProperty property) const
void updateModelProperty(ModelProperty property, const t_type &type, const void *lock_ptr=nullptr)
Definition Model.h:146
Buffer< Effect, uint04, ObjectAllocator< false > > getEffectDescendents() const
Bounds< 3, fltp08 > globalBounds() const
Vector< 32, bool > personalInheritedFlags() const
Model()
Definition Model.h:128
bool doesModelPropertyContain(ModelProperty property, const String &value, bool ignore_case) const
Definition Model.h:168
void setParentMatrixFlag(ParentMatrixFlags flag, bool value)
void updateFrom(const Model &model, bool check_resources)
Buffer< Material, uint04, ObjectAllocator< DESIGN_PRIM > > getMaterialDescendentsByName(const String &name, uint04 max_count=Constant< uint04 >::Max) const
void updateDescendedFlagsCache(bool force_update_all=false)
Material createSceneMaterial() const
void calculateTangentSpace(bool calc_tan, bool calc_bitan)
void hasDescendents(bool &has_point, bool &has_line, bool &has_mesh) const
Material getSceneMaterial(UUID id) const
DesignObjectBase * childBase() const
uint04 getDirectLayerIndex() const
TranslatedString displayNamePath(const String &seperator=":") const
void overrideMaterialDescendents(PrimitiveProperty property, MaterialMode override_desc)
void invalidateGlobalBoundsDesc()
bool isLocked() const
bool hasMeshDescendent() const
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > explodeModel()
uint04 getEffectIndex(uint04 child_index=0) const
MaterialMode
Definition Model.h:61
Effect createSceneEffect() const
bool canInteract() const
Geometry createSceneGeometry() const
void invalidateGlobalBoundsAsc()
bool isModelProperty(ModelProperty property, const String &value) const
Definition Model.h:160
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getChildrenByName(const String &name) const
bool isSelected() const
bool hasGeometryDescendent() const
Buffer< GeometryType > descendentGeometryTypes() const
Model getChild(uint04 child) const
bool hasChild(uint04 child_index) const
Model(const DesignObject &obj)
uint04 vertexCount() const
uint04 getChildIndex() const
Vector< 32, bool > inheritedPersonalFlagsNoCache() const
void removeDuplicateVertices(fltp08 epsilon, void *lock, ProgressInfo *log=nullptr)
bool hasFocus() const
Buffer< Material, uint04, ObjectAllocator< DESIGN_PRIM > > getMaterialDescendents(PrimitiveProperty property) const
Model(DesignObjectBase *base)
uint04 getGeometryIndex() const
bool canExplode() const
void removeMaterial(PrimitiveProperty property)
void setMaterial(const Material &material)
uint04 getNumOfEffects() const
uint04 getMaterialIndex(PrimitiveProperty property) const
uint04 parentToChildReference() const
bool hasDirectLayer() const
void setNormalMode(NormalMode mode, Angle< fltp08 > smoothing_angle, ProgressInfo *log)
String getModelIcon() const
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getSceneModelsByName(const String &name, uint04 max_count=Constant< uint04 >::Max, bool include_deleted=false) const
uint04 visibleVertexCount() const
bool hasLayer() const
Buffer< std::pair< Model, Geometry >, uint04, ObjectAllocator< DESIGN_PRIM > > getClippingGeometry() const
BitFlag parentMatrixFlags() const
Time getAscModifiedTime(bool include_self, bool include_layer=true) const
void addChild(Model &child)
BitFlag personalDescendedFlags() const
uint04 childToParentReference() const
void setChildIndex(uint04 child, uint04 id)
void updateInheritedFlagsCache(bool force_update_all=false, bool update_personal_flags=false)
DescendedFlags
Definition Model.h:96
bool isModelProperty(ModelProperty property, const char *value) const
Definition Model.h:164
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getSceneModels(bool include_deleted=false, bool local_only=false) const
Model createChild()
fltp08 calculateSurfaceArea(const Matrix< fltp08 > &transform=Constant< Matrix< fltp08 > >::Invalid) const
Vector< 32, bool > inheritedFlags() const
bool isOfType(const char *type) const
Model getParent() const
bool hasPointsDescendent() const
Bounds< 3, fltp08 > getBounds() const
Effect createChildEffect()
Vector< 2, fltp08 > calculateHVLength(const Matrix< fltp08 > &parent_transform=Constant< Matrix< fltp08 > >::Invalid) const
void removeChild(const Model &model)
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getDescendents(bool include_deleted=false, bool local_only=false) const
Effect getSceneEffect(UUID id) const
Effect getEffect(uint04 index=0) const
Model findDescendentByName(const String &name) const
void setWindingMode(WindingMode mode)
Model createChild(uint04 child_slot)
void removeGeometry()
Material createChildMaterial(bool copy_child=false)
Vector< 2, fltp08 > calculateVolumeAndSurfaceArea(const Matrix< fltp08 > &transform=Constant< Matrix< fltp08 > >::Invalid, const void *lock=nullptr) const
void addChild(uint04 child_index)
bool hasMaterial(PrimitiveProperty property) const
void validate(bool validate_children=true) const
void addPerVertexColorFromMaterialConstant(UVType constant_index)
uint04 getParentIndex() const
Bounds< 3, fltp08 > getSelectionBounds() const
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getDescendentsByNameAndType(const String &name, const String &type, uint04 max_count=Constant< uint04 >::Max) const
InheritedFlags
Definition Model.h:80
bool isVisible() const
void setGeometryChild(uint04 geo_index)
Model findDescendentByType(const String &type) const
Model getLayer() const
void calculateIndexNeighborList()
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getChildrenByType(const String &type) const
fltp08 calculateVolume(const Matrix< fltp08 > &transform=Constant< Matrix< fltp08 > >::Invalid) const
BitFlag descendedFlags() const
Bounds< 3, fltp08 > globalSelectionBounds() const
Buffer< Geometry, uint04, ObjectAllocator< DESIGN_PRIM > > getSceneGeometries() const
void setParentMatrixFlags(BitFlag flags)
RGBColor customModelColor(ModelColorMode mode) const
bool isTreeVisible() const
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getChildren() const
void setMaterial(PrimitiveProperty property, const Material &material)
void checkBounds()
Geometry getSceneGeometry(uint04 index) const
void setMaterial(uint04 material_index)
Buffer< t_type > getTypeChildren(const String &type) const
Definition Model.h:288
BitFlag descendedPersonalFlagsNoCache() const
bool isApplicationOwned() const
bool hasLayerRootMaterial(PrimitiveProperty property) const
bool hasHoles(PrimitiveProperty property) const
void setIsLayer(bool is_layer)
void overrideMaterialDescendents(MaterialMode vertex, MaterialMode outline, MaterialMode solid)
bool exportIgnored() const
bool isLayer() const
void setOrientation(const Vector< 3, Angle< fltp08 > > &new_orientation, const void *lock=nullptr)
Buffer< Geometry, uint04, ObjectAllocator< DESIGN_PRIM > > getGeometryDescendents(bool remove_redundant=true, uint04 max_count=Constant< uint04 >::Max) const
bool hasDescendent(const UUID &id) const
bool isDeleted() const
void setModelProperty(ModelProperty property, const t_type &value)
Definition Model.h:141
Model getFamilyMember(uint04 index) const
DesignObjectBase * parentBase() const
Geometry createChildGeometry()
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getSceneLayers(bool include_deleted=false) const
bool hasSelectedDescendent() const
uint04 childCount() const
void setOrientation(const Vector< 3, Angle< sint04 > > &new_orientation, const void *lock=nullptr)
bool hasMaterial() const
void updateTransform(const Matrix< fltp08 > &transform, const void *lock=nullptr)
Material getRootMaterial(PrimitiveProperty property) const
Buffer< Material, uint04, ObjectAllocator< DESIGN_PRIM > > getSceneMaterials() const
static Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > ReduceToRoots(const Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > &children, const std::function< bool(const Model &, const Set< Model > &)> &filter)
Matrix< fltp08 > applyTransformToParent(const Matrix< fltp08 > &parent_mat) const
Model createSceneModel() const
t_type getModelProperty(ModelProperty property) const
Definition Model.h:156
bool isOfType(const String &type) const
void swapChildren(uint04 a, uint04 b)
void setSize(const Vector< 3, fltp08 > &size)
void updateVisibleRecursive(bool is_visible)
void setMaterialMode(PrimitiveProperty property, MaterialMode option)
Geometry getSceneGeometry(UUID id) const
void updateDescTime(const Time &time, bool include_self)
Model getRootMaterialModel(PrimitiveProperty property)
void setMaterial(PrimitiveProperty property, uint04 material_index)
bool isScene() const
Bounds< 3, fltp08 > getBoundsOfVisible() const
Buffer< Effect, uint04, ObjectAllocator< false > > getSceneEffects() const
void updateAscTime(const Time &time, bool include_self)
Buffer< UUID > getChildrenIDs() const
ParentMatrixFlags
Definition Model.h:68
bool hasLinearDescendent() const
uint04 getChildLayerIndex() const
Material getSceneMaterial(uint04 index) const
ModelProperty
Definition Model.h:103
MaterialMode getMaterialMode(PrimitiveProperty property) const
void updateVisible(bool is_visible)
uint04 getChildIndex(uint04 child) const
bool hasDescendent(const Model &model) const
Dictionary< UUID, DesignObject > copyMaterialProperties(const Model &model)
void setLayer(Model layer)
void removeMaterial(const Material &material)
TranslatedString displayName() const
void clearLayer()
Buffer< Model, uint04, ObjectAllocator< DESIGN_PRIM > > getChildrenByType(const Buffer< String > &type) const
Vector< 32, bool > inheritedFlagsNoCache(bool complete_cache_ignore) const
Model createSceneLayer() const
Material createChildMaterial(PrimitiveProperty property, bool copy_child=false)
Definition MemoryManager.h:261
Provides shared ownership of a dynamically allocated object.
Definition Pointer.hpp:71
A light-weight base class for Log that allows processes to update, without the need for additional in...
Definition ProgressInfo.hpp:48
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:54
The root Model that is responsible for storing the underlying data for all Scene Models.
Definition Model.h:492
bool hasVertexColumn(const String &name) const
Scene(const TranslatedString &name, Scene &application_scene, DesignObjectBase *base=nullptr)
Scene(const Model &model)
bool hasVertexIndexColumn() const
void createDefaultMaterial()
const TableColumn & vertexColumn(const String &name) const
TableColumn & vertexColumn(const String &name)
Scene(const String &file, DesignObjectBase *base=nullptr)=delete
static const Scene CreateApplicationScene(const TranslatedString &string)
Scene(const File &file, DesignObjectBase *base=nullptr)
Scene(const TranslatedString &name, DesignObjectBase *base=nullptr)
void deleteBase() const
const TableColumn & vertexColumn(VertexProperty property) const
bool isApplicationOwned() const
bool hasVertexColumn(VertexProperty property) const
Buffer< UUID > allObjectIDs(bool include_deleted) const
Scene(DesignObjectBase *base)
Scene applicationScene() const
const TableColumn & vertexIndexColumn() const
Container that stores unique elements in no particular order, and which allow for fast retrieval or i...
Definition Model.h:51
The core String class for the NDEVR API.
Definition String.h:69
A virtual storage type that is used with Table class to store data where the actual mechanism for sto...
Definition TableColumn.h:76
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
A vertex or point. A specific type of Vector used primarily for spacial location information.
Definition Vertex.hpp:48
Used to lock a particular variable for writing. Only one write lock can be created when no read locks...
Definition RWLock.h:115
Definition ACIColor.h:37
NormalMode
Definition DesignObjectBase.h:105
VertexProperty
Definition DesignObjectBase.h:52
@ e_by_layer
Definition CADEntities.h:48
constexpr bool DESIGN_PRIM
Definition DesignObject.h:47
PrimitiveProperty
Definition DesignObjectBase.h:44
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
@ e_type
Definition ModuleResourceManager.h:56
WindingMode
Definition DesignObjectBase.h:97
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:149
UVType
Channels that describe how an object should interact with light.
Definition DesignObjectBase.h:133
Definition File.h:211
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
Information about the object.
Definition ObjectInfo.h:54