33#include <NDEVR/DesignObject.h>
44#if NDEVR_SUPPORTS_BONES
50 template<
class t_type>
67 , e_ignore_rotation = 2
68 , e_ignore_scale_distortion = 3
69 , e_use_only_for_offset = 4
70 , e_orient_to_camera = 5
72 , e_scale_to_camera = 7
77 e_inherited_is_visible = 0
78 , e_inherited_has_no_focus = 1
79 , e_inherited_is_tree_visible = 2
80 , e_inherited_not_selected = 3
81 , e_inherited_is_manager_visible = 4
82 , e_inherited_can_delete = 5
83 , e_inherited_does_not_follow_camera = 6
84 , e_inherited_does_not_orient_to_camera = 7
85 , e_inherited_does_not_scale_to_camera = 8
86 , e_inherited_not_deleted = 9
87 , e_inherited_not_application_owned = 10
88 , e_inherited_exportable = 11
93 e_descendent_selected = 0
94 , e_descendent_focussed = 1
95 , e_descendent_deletion_blocked = 2
101 , e_fixed_bounding_box
103 , e_calculation_ignored
104 , e_can_select_children
105 , e_complete_transform
106 , e_material_mode_solid
107 , e_material_mode_outline
108 , e_material_mode_vertices
109 , e_parent_matrix_flags
111 , e_global_selection_bounds
114 , e_personal_inherited_flags
117 , e_personal_descended_flags
118 , e_application_constructed
119 , e_application_constructed_parent_base
120 , e_model_property_size
128 [[nodiscard]]
bool isSelected()
const;
129 [[nodiscard]]
bool isApplicationOwned()
const;
130 [[nodiscard]]
bool isVisible()
const;
131 [[nodiscard]]
bool isTreeVisible()
const;
132 [[nodiscard]]
bool hasFocus()
const;
133 [[nodiscard]]
bool exportIgnored()
const;
136 template<
class t_type>
139 m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].set(m_design_index, value);
141 template<
class t_type>
144 if (getModelProperty<t_type>(property) != type)
146 WLock wLock(lock_ptr);
147 setModelProperty(property, type);
148 updateModifiedTime();
151 template<
class t_type>
154 return m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].get<t_type>(m_design_index);
158 return m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].isSame(m_design_index, value);
162 return m_base->model_table.get()[m_base->model_property_index[cast<uint04>(property)]].isSame(m_design_index, value);
166 return propertyTable().get()[m_base->model_property_index[cast<uint04>(property)]].contains(m_design_index, value, ignore_case);
170 return propertyTable().get()[m_base->model_property_index[cast<uint04>(property)]].contains(m_design_index, value, ignore_case);
174 void deleteModel(
bool delete_children,
bool remove_from_parent =
true);
176 [[nodiscard]]
bool canExplode()
const;
177 [[nodiscard]]
bool isOfType(
const String& type)
const;
178 [[nodiscard]]
bool isOfType(
const char* type)
const;
182 void createChildren(
uint04 child_size);
183 Model createSceneModel()
const;
184 Model createSceneLayer()
const;
188 void addChild(
Model& child);
189 void addChild(
uint04 child_index);
192 void setParentMatrixFlags(
BitFlag flags);
193 void setParentMatrixFlag(ParentMatrixFlags flag,
bool value);
194 BitFlag parentMatrixFlags()
const;
195 Model getParent()
const;
196 uint04 getParentIndex()
const;
200 , e_by_selectable_children
204 RGBColor customModelColor(ModelColorMode mode)
const;
205 void updateTransform(
const Matrix<fltp08>& transform,
const void* lock =
nullptr);
207 String getModelIcon()
const;
210 Effect createChildEffect();
215 void setGeometryChild(
uint04 geo_index);
216 void setGeometryChild(
const Geometry& geo);
217 void updateVisible(
bool is_visible);
218 void updateVisibleRecursive(
bool is_visible);
220 bool hasGeometryDescendent()
const;
221 bool hasMeshDescendent()
const;
222 bool hasLinearDescendent()
const;
223 bool hasPointsDescendent()
const;
224 void hasDescendents(
bool& has_point,
bool& has_line,
bool& has_mesh)
const;
227 void setMaterialMode(MaterialMode vertex, MaterialMode outline, MaterialMode solid);
229 Material createChildMaterial(
bool copy_child =
false);
231 void clearMaterialDescendents();
232 void overrideMaterialDescendents(
PrimitiveProperty property, MaterialMode override_desc);
233 void overrideMaterialDescendents(MaterialMode vertex, MaterialMode outline, MaterialMode solid);
235 void setMaterial(
uint04 material_index);
237 void setMaterial(
const Material& material);
241#if NDEVR_SUPPORTS_BONES
242 Bone createSceneBone()
const;
243 bool hasBone(
uint04 index = 0)
const;
244 uint04 getNumOfBones()
const;
245 Bone getBone(
uint04 index = 0)
const;
246 Bone getSceneBone(
UUID id)
const;
250 void setBoneGroupIndex(
uint04 bone_group_index,
uint04 sub_index = 0);
252 Effect createSceneEffect()
const;
254 void setIsLayer(
bool is_layer);
255 bool isLayer()
const;
256 bool hasLayer()
const;
257 [[nodiscard]]
bool hasDirectLayer()
const;
258 [[nodiscard]]
Model getLayer()
const;
259 [[nodiscard]]
uint04 getDirectLayerIndex()
const;
264 [[nodiscard]]
bool isLocked()
const;
265 [[nodiscard]]
bool canInteract()
const;
266 [[nodiscard]]
bool hasSelectedDescendent()
const;
267 void updateModifiedTime(
Time time = Time::SystemTime());
268 void updateAscTime(
const Time& time,
bool include_self);
269 void updateDescTime(
const Time& time,
bool include_self);
270 void setLayer(
Model layer);
272 [[nodiscard]]
uint04 getChildIndex()
const;
273 [[nodiscard]]
uint04 getChildLayerIndex()
const;
278 [[nodiscard]]
bool hasChild(
uint04 child_index)
const;
283 template<
class t_type>
290 values.
add(t_type(models[i]));
297 template<
class t_type>
304 values.
add(t_type(models[i]));
312 [[nodiscard]]
uint04 childCount()
const;
313 [[nodiscard]]
uint04 getNumOfEffects()
const;
314 [[nodiscard]]
bool hasEffect(
uint04 index = 0)
const;
316 [[nodiscard]]
Effect getSceneEffect(
UUID id)
const;
319 [[nodiscard]]
Geometry getGeometry()
const;
325 void removeGeometry();
327 [[nodiscard]]
bool hasMaterial()
const;
339 void removeMaterial(
const Material& material);
354 void clearChildren();
355 void removeChild(
const Model& model);
357 [[nodiscard]]
uint04 visibleVertexCount()
const;
358 [[nodiscard]]
uint04 vertexCount()
const;
360 [[nodiscard]]
Model getFamilyMember(
uint04 index)
const;
361 [[nodiscard]]
Model findDescendentByName(
const String& name)
const;
362 [[nodiscard]]
Model findDescendentByType(
const String& type)
const;
364 [[nodiscard]]
bool hasDescendent(
const Model& model)
const;
365 [[nodiscard]]
bool hasDescendent(
const UUID&
id)
const;
384 [[nodiscard]]
Time getDescModifiedTime(
bool include_self)
const;
387 [[nodiscard]]
Time getAscModifiedTime(
bool include_self,
bool include_layer =
true)
const;
391 void calculateIndexNeighborList();
392 void updateFrom(
const Model& model,
bool check_resources);
397 void setOrientation(
const Vector<3,
Angle<sint04>>& new_orientation,
const void* lock =
nullptr);
398 void setOrientation(
const Vector<3,
Angle<fltp08>>& new_orientation,
const void* lock =
nullptr);
400 void removeDuplicateVertices(
fltp08 epsilon,
void* lock,
ProgressInfo* log =
nullptr);
401 bool isDeleted()
const;
403 void calculateTangentSpace(
bool calc_tan,
bool calc_bitan);
404 void addPerVertexColorFromMaterialConstant(
UVType constant_index);
405 bool isScene()
const;
406 void validate(
bool validate_children =
true)
const;
407 void invalidateBounds();
408 void invalidateVisibleBounds();
409 void invalidateGlobalBoundsAsc();
410 void invalidateGlobalBoundsDesc();
411 void invalidateTransformCache();
419 [[nodiscard]]
uint04 getGeometryIndex()
const;
421 [[nodiscard]]
uint04 getEffectIndex(
uint04 child_index = 0)
const;
426 void updateInheritedFlagsCache(
bool force_update_all =
false,
bool update_personal_flags =
false);
429 [[nodiscard]]
Vector<32, bool> inheritedFlagsNoCache(
bool complete_cache_ignore)
const;
432 [[nodiscard]]
BitFlag descendedFlags()
const;
433 void updateDescendedFlagsCache(
bool force_update_all =
false);
434 [[nodiscard]]
BitFlag descendedPersonalFlagsNoCache()
const;
435 [[nodiscard]]
BitFlag personalDescendedFlags()
const;
436 [[nodiscard]]
BitFlag descendedFlagsNoCache(
bool complete_cache_ignore)
const;
437 operator bool()
const
442 Geometry createSceneGeometry()
const;
443 Material createSceneMaterial()
const;
452 void setChildEffectSize(
uint04 child_size);
453 void setChildSize(
uint04 child_size);
454 void setGeometryIndex(
uint04 geo_index);
456 void setMaterialIndex(
uint04 material_index);
457 void setEffectIndex(
uint04 material_index,
uint04 sub_index = 0);
460 void setPersonalInheritedFlag(InheritedFlags flag,
bool value);
463 uint04 childToParentReference()
const;
464 uint04 parentToChildReference()
const;
477 static const bool Unsigned =
false;
478 static const bool Float =
false;
479 static const bool Integer =
false;
480 static const bool Number =
false;
481 static const bool Enum =
false;
484 static const bool Boolean =
false;
502 void createDefaultMaterial();
503 bool hasVertexColumn(
const String& name)
const;
505 bool hasVertexIndexColumn()
const;
506 bool isApplicationOwned()
const;
507 void deleteBase()
const;
509 Scene applicationScene()
const;
526 static const bool Unsigned =
false;
527 static const bool Float =
false;
528 static const bool Integer =
false;
529 static const bool Number =
false;
530 static const bool Enum =
false;
533 static const bool Boolean =
false;
548 struct hash<NDEVR::Model>
553 std::size_t value = 0;
555 value = value * 256 + (s[i + 0U] ^ s[i + 8U]);
560 struct hash<NDEVR::Scene>
565 std::size_t value = 0;
567 value = value * 256 + (s[i + 0U] ^ s[i + 8U]);
Stores an angle in an optimized format.
Definition StringStream.h:352
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
Definition BitFlag.hpp:68
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:57
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
void add(t_type &&object)
Definition Buffer.hpp:199
constexpr t_index_type size() const
Definition Buffer.hpp:1461
Definition DesignObjectBase.h:140
Definition DesignObject.h:66
Definition Dictionary.h:48
Definition Matrix.hpp:173
bool doesModelPropertyContain(ModelProperty property, const char *value, bool ignore_case) const
Definition Model.h:168
Buffer< t_type > getTypeDescendents(const String &type) const
Definition Model.h:298
ModelColorMode
Definition Model.h:198
void updateModelProperty(ModelProperty property, const t_type &type, const void *lock_ptr=nullptr)
Definition Model.h:142
Model()
Definition Model.h:124
bool doesModelPropertyContain(ModelProperty property, const String &value, bool ignore_case) const
Definition Model.h:164
MaterialMode
Definition Model.h:57
bool isModelProperty(ModelProperty property, const String &value) const
Definition Model.h:156
DescendedFlags
Definition Model.h:92
bool isModelProperty(ModelProperty property, const char *value) const
Definition Model.h:160
InheritedFlags
Definition Model.h:76
Buffer< t_type > getTypeChildren(const String &type) const
Definition Model.h:284
void setModelProperty(ModelProperty property, const t_type &value)
Definition Model.h:137
t_type getModelProperty(ModelProperty property) const
Definition Model.h:152
ParentMatrixFlags
Definition Model.h:64
ModelProperty
Definition Model.h:99
Definition MemoryManager.h:283
Definition Pointer.hpp:62
Definition ProgressInfo.hpp:43
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:53
Scene(const String &file, DesignObjectBase *base=nullptr)=delete
Definition StringStream.h:62
Definition TableColumn.h:68
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:54
Definition TranslatedString.h:9
An element of a vector space. An element of the real coordinate space Rn Basis vector,...
Definition Vector.hpp:62
A vertex.
Definition Vertex.hpp:54
NormalMode
Definition DesignObjectBase.h:105
VertexProperty
Definition DesignObjectBase.h:52
@ e_by_layer
Definition CADEntities.h:45
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:98
@ e_type
Definition ModuleResourceManager.h:40
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:120
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:181
UVType
Definition DesignObjectBase.h:127
static const Model NaN
Definition Model.h:540
Definition BaseValues.hpp:272
static constexpr ObjectInfo< Model, false, false > VectorSub()
Definition Model.h:485
static constexpr ObjectInfo< Scene, false, false > VectorSub()
Definition Model.h:534
Information about the object.
Definition ObjectInfo.h:56
std::size_t operator()(const NDEVR::Model &d) const noexcept
Definition Model.h:550
std::size_t operator()(const NDEVR::Scene &d) const noexcept
Definition Model.h:562