33#include <NDEVR/DesignObject.h>
42#if NDEVR_SUPPORTS_BONES
47 template<
class t_type>
132 template<
class t_valutype>
135 return column(
object, property)->
get<t_valutype>(
object->m_design_index);
142 template<NDPN t_property,
class t_valutype>
145 return column(
object, t_property)->
get<t_valutype>(
object->m_design_index);
153 template<
class t_valutype>
167 template<NDPN t_property,
class t_valutype>
203 return object->m_base->model_properties[eint01(property)];
225 template<NDPN t_property>
273 return object->m_base->model_properties[eint01(property)];
282 return object->m_design_index;
359 , e_by_selectable_children
404 void deleteModel(
bool deletchildren,
bool removfrom_parent =
true);
479 template<
class t_type>
509 template<
class t_buffer_type>
512 for (
const t_buffer_type& iter : types)
535 void copyFrom(
const Model& model,
bool deep_copy,
bool copy_ids =
false,
bool recursive =
true,
bool keep_root_properties =
false);
769 template<
class t_type>
774 for (
uint04 i = 0; i < models.size(); i++)
776 values.
add(t_type(models[i]));
801 template<
class t_type>
806 for (
uint04 i = 0; i < models.size(); i++)
808 values.
add(t_type(models[i]));
1214 void hasDescendants(
bool& has_point,
bool& has_line,
bool& has_mesh,
bool only_user_objects)
const;
1468#if NDEVR_SUPPORTS_BONES
1471 Bone createSceneBone()
const;
1482 uint04 getNumOfBones()
const;
1496 Bone getSceneBone(
UUID id)
const;
1514 uint04 getBoneGroupIndex(
uint04 child_index = 0)
const;
1521 void setBoneGroupIndex(
uint04 bone_group_index,
uint04 sub_index = 0);
1636 operator bool()
const
1651 ,
const std::function<
bool(
const Model&,
const Set<Model>&)>& filter);
1701 void setChildSize(
uint04 child_size);
1707 void setMaterialIndex(
uint04 material_index);
1732 void _copyFrom(
const Model& model,
bool deep_copy,
bool copy_ids,
bool recursive_copy,
Dictionary<UUID, DesignObject>& copy_to_index,
bool is_root_copy,
bool keep_root_properties);
1758 static_assert(!std::is_polymorphic<Model>(),
"Model should not be polymorphic");
1759 static_assert(std::is_trivially_destructible<Model>(),
"Model should not be polymorphic");
1791 std::size_t operator()(
const Model& d)
const noexcept
1794 std::size_t value = 0;
1795 for (
uint01 i = 0; i < 8; i++)
1796 value = value * 256 + (s[i + 0U] ^ s[i + 8U]);
Stores an angle in an optimized internal format with support for efficient trigonometric operations.
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
A specification of upper and lower bounds in N-dimensions.
The equivelent of std::vector but with a bit more control.
void add(t_type &&object)
Adds object to the end of the buffer.
Provides access to a set of named database tables.
Base information class for all design objects in the NDEVR property database.
uint04 m_design_index
Index of the parent design that owns this object.
DesignObjectBase * m_base
Pointer to the owning DesignObjectBase property database.
Provides the underlying data storage for the NDEVR Scene Model hierarchy.
ColumnT< uint08 > geometry_base_ptr
Column storing a pointer or handle to the geometry DesignObjectBase.
ColumnT< Bounds< 3, fltp08 > > visible_box
Column storing the visible bounding box for culling.
ColumnT< uint08 > parent_base_ptr
Column storing a pointer or handle to the parent DesignObjectBase.
ColumnT< uint08 > child_base_ptr
Column storing a pointer or handle to the child DesignObjectBase.
ColumnT< Bounds< 3, fltp08 > > global_bounds
Column storing the world-space axis-aligned bounding box.
ColumnT< String > model_type
Column storing the model type string identifier.
ColumnT< Bounds< 3, fltp08 > > global_selection_bounds
Column storing the world-space selection bounding box.
ColumnT< Matrix< fltp08 > > complete_transform
Column storing the fully composed world-space transform matrix.
ColumnT< uint04 > inherited_flags
Column storing flags inherited from ancestors (visibility, lock, etc.).
ColumnT< uint04 > personal_inherited_flags
Column storing flags set on this model that propagate to children.
ColumnT< uint08 > material_base_ptr
Column storing a pointer or handle to the material DesignObjectBase.
DesignObject()=default
Creates an "invalid" design object.
constexpr decltype(auto) get(t_property_type property) const
Retrieves a property value from the database, cast to the requested type.
void scale(Vector< 3, fltp08 > scale, Vertex< 3, fltp08 > center_of_scale=Constant< Vertex< 3, fltp08 > >::Invalid)
Scales this design object's geometry and transform by the given scale factors around a center point.
uint04 index() const
Returns the primary row index of this object within the DesignObjectBase property table.
bool isValid() const
Checks whether this design object has a valid index into the database.
bool is(t_property_type property, const StringView &value) const
Checks whether a string property matches the given StringView value.
DesignObjectBase & base() const
Returns a reference to the underlying DesignObjectBase database.
A hash-based key-value store, useful for quick associative lookups.
A core class that provides a dynamic effect to an object in a model hierarchy.
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
A core class within the model hierarchy containing vertex-based data (Usually 3D data) within a set c...
A light-weight base class for Log that allows processes to update, without the need for additional in...
Serves as the primary program interface for processes to report issues and allows any number of LogSt...
Container responsible for storing and setting the appearance of a Model or Geometry within the NDEVR ...
Templated logic for doing matrix multiplication.
A core class that represents a node on model hierarchy.
bool hasFocus() const
Checks whether this model currently has focus.
PrimitiveAlignedBuffer< std::pair< Model, Geometry >, 32 > getClippingGeometry() const
Returns model-geometry pairs used for clipping operations.
ModelBuffer getDescendants(bool include_deleted=false, bool local_only=false) const
Returns all descendant models recursively.
Buffer< t_type > getTypeChildren(const StringView &type) const
Returns children of a specific type, cast to the requested derived type.
void calculateSmoothTextures(Vector< 3, fltp08 > origin, fltp08 scale)
Calculates smooth texture coordinates based on a projection origin and scale.
uint04 visibleVertexCount() const
Returns the total number of visible vertices across all descendant geometries.
ParentMatrixFlags
Flags controlling which components of the parent's transformation matrix are applied to this model.
@ e_ignore_scale_distortion
Ignore non-uniform scale distortion from parent.
@ e_use_only_for_offset
Use parent transform only for translation (ignore scale and rotation).
@ e_follow_camera
Follow the camera position.
@ e_orient_to_camera
Orient this model to always face the camera (billboard).
@ e_scale_to_camera
Scale relative to camera distance for constant apparent size.
@ e_ignore_scale
Ignore parent scale.
@ e_ignore_rotation
Ignore parent rotation.
@ e_ignore_offset
Ignore parent translation.
void updateModifiedTime(Time time=Time::SystemTime())
Updates the modified timestamp for this model.
StringView getModelIcon() const
Returns the icon identifier string for this model's type.
bool isApplicationOwned() const
Checks whether this model is owned by the application (not user-created).
ModelBuffer getChildrenByType(const Buffer< String > &type) const
Returns all direct children whose type matches any of the given strings.
void hasDescendants(bool &has_point, bool &has_line, bool &has_mesh, bool only_user_objects) const
Checks which types of geometry primitives exist among descendants.
void clearMaterialDescendants()
Removes all descendant material assignments without deleting the materials.
Model createSceneModel() const
Creates a new model in the scene database associated with this model.
Vector< 2, fltp08 > calculateVolumeAndSurfaceArea(const Matrix< fltp08 > &transform=Constant< Matrix< fltp08 > >::Invalid, const void *lock=nullptr) const
Calculates both volume and surface area in a single pass for efficiency.
ColumnT< Buffer< uint04 > > & parentToChildReference() const
Returns the column mapping parent indices to child index lists.
uint04 getMaterialIdx() const
Returns the database index of the material assigned to this model.
bool hasGeometryDescendent() const
Checks whether any descendant has geometry data.
void restoreModel()
Restores a previously deleted model, re-adding it to the scene.
Vector< 3, fltp08 > size() const
Returns the size (extents) of the model's bounding box.
fltp08 calculateLength(const Matrix< fltp08 > &transform=Constant< Matrix< fltp08 > >::Invalid) const
Calculates the total length of all descendant linear geometries.
void calculateTangentSpace(bool calc_tan, bool calc_bitan)
Calculates tangent and/or bitangent vectors for all descendant geometries.
MaterialBuffer getMaterialDescendants(bool local_only=false) const
Recursively collects all descendant materials.
Model getLayer() const
Returns the layer model assigned to this model (direct or inherited).
Time getAscModifiedTime(bool include_self, bool include_layer=true) const
Returns the greatest modified time of this model and all ancestors.
bool hasEffect(uint04 index=0) const
Checks whether an effect exists at the given child index.
ModelColorMode
Determines how the model color is resolved for display purposes.
void setNormalMode(NormalMode mode, Angle< fltp08 > smoothing_angle, InfoPipe *log)
Sets the normal mode and recalculates normals with progress logging.
Geometry getGeometry() const
Returns the geometry attached to this model.
void setChildEffectSize(uint04 child_size)
Sets the number of child effect slots for this model.
Material getSceneMaterial(uint04 index) const
Returns a scene material by database index.
Effect createSceneEffect() const
Creates a new effect in the scene database.
Model(const DesignInfo &obj)
Constructs a Model from an existing DesignInfo descriptor.
void invalidateBounds()
Invalidates all cached bounding boxes, forcing recalculation on next access.
ModelBuffer getChildrenByType(const StringView &type) const
Returns all direct children whose type matches the given string.
DesignObjectBase * parentBase() const
Returns the DesignObjectBase used for parent model storage.
void addChild(uint04 child_idx, Model &child)
Adds an existing model as a child at a specific index.
RGBColor customModelColor(ModelColorMode mode) const
Returns the resolved model color based on the specified color mode.
void validate(bool validate_children=true) const
Validates this model's internal state for consistency.
void calculateNormals(NormalMode mode, Angle< fltp08 > smoothing_angle)
Recalculates normals for all descendant geometries.
bool doesModelPropertyContain(NDPN property, const StringView &value, bool ignorcase) const
Checks whether a model property contains a given substring.
Vector< 32, bool > inheritedFlagsNoCache(bool complete_cache_ignore) const
Computes inherited flags without using the cache.
ModelBuffer explodeModel()
Explodes this model, promoting its children to siblings in the parent.
void clearChildren()
Removes all children from this model without deleting them.
bool hasLinearDescendent() const
Checks whether any descendant has linear (line/polyline) geometry.
bool doesModelPropertyContain(NDPN property, const char *value, bool ignorcase) const
Checks whether a model property contains a given C-string substring.
BitFlag descendedFlagsNoCache(bool complete_cache_ignore) const
Computes descended flags without using the cache.
TranslatedString displayName() const
Returns the translated display name for this model.
void deleteModel(bool deletchildren, bool removfrom_parent=true)
Deletes this model from the scene.
void copyMaterialProperties(const Model &model)
Copies material properties from another model to this model.
void getChildren(ModelBuffer &children) const
Appends all direct children of this model to the provided buffer.
Vector< 32, bool > inheritedPersonalFlagsNoCache() const
Computes inherited personal flags without using the cache.
Material getSceneMaterial(UUID id) const
Returns a scene material by UUID.
EffectBuffer getEffectDescendants() const
Returns all descendant effects recursively.
bool hasMaterial() const
Checks whether this model has a material assigned.
void setParentMatrixFlags(BitFlag flags)
Sets the parent matrix flags controlling which parent transform components to inherit.
Time getDescModifiedTime(bool includself) const
Returns the greatest modified time of this model and all descendants.
TranslatedString displayNamePath(const StringView &seperator=":") const
Returns the full display name path from root to this model.
void updateDescGeometryTime(const Time &time, bool include_self)
Updates the geometry-modified timestamp for this model and all descendants.
void overrideMaterialDescendants(MaterialMode override_desc)
Overrides material mode for all descendants.
Bounds< 3, fltp08 > getBoundsOfVisible() const
Returns the bounding box of all visible descendants.
void setChildApplicationConstructed(DesignObjectBase *base)
Sets the child database to use an application-constructed DesignObjectBase.
void setIsLayer(bool is_layer)
Marks or unmarks this model as a layer definition.
DesignObjectBase * geometryBase() const
Returns the DesignObjectBase used for geometry storage.
Model getParent() const
Returns the parent model of this model.
MaterialMode
Determines how a model resolves its material for rendering.
Vector< 32, bool > inheritedFlags() const
Returns the cached inherited flags vector for this model.
bool isVisible() const
Checks whether this model is visible (accounting for inherited visibility).
bool hasChild(uint04 child_index=0U) const
Checks whether this model has a child at the given slot.
Geometry getSceneGeometry(UUID id) const
Returns a scene geometry by UUID.
Effect getSceneEffect(UUID id) const
Returns a scene effect by its UUID.
Vertex< 3, fltp08 > globalCenterOfRotation() const
Returns the center of rotation in global coordinates.
bool isSelected() const
Checks whether this model is currently selected.
bool hasRootMaterial() const
Checks whether a root material can be resolved through the hierarchy.
static ModelBuffer ReduceToRoots(const ModelBuffer &children, const std::function< bool(const Model &, const Set< Model > &)> &filter)
Reduces a collection of models to only root-level models (removing any that are descendants of others...
Model createChild(uint04 child_slot)
Creates a new child model at a specific child slot index.
bool setModelVisible(bool is_visible)
Sets the visibility of this model.
bool hasDirectLayer() const
Checks whether this model has a directly assigned layer (not inherited).
uint04 childCount() const
Returns the number of direct children this model has.
void updateGeometryTime(Time time=Time::SystemTime())
Updates the geometry-modified timestamp for this model.
bool isType(const Buffer< t_buffer_type > &types) const
Checks whether the model's type matches any type in the given buffer.
void setLayer(Model layer)
Assigns this model to a specific layer.
void getMaterialDescendants(MaterialBuffer &materials, bool local_only=false) const
Appends all descendant materials to the provided buffer.
EffectBuffer getEffectChildren() const
Returns all direct child effects of this model.
void invalidateTransformCache()
Invalidates the cached transformation matrix, forcing recomputation.
bool hasSelectedDescendent() const
Checks whether any descendant of this model is selected.
Model getRootMaterialModel()
Returns the ancestor model that determines the root material for this model.
Model findDescendentByType(const StringView &type) const
Recursively searches descendants for a model with the given type.
void removeChild(const Model &model)
Removes a specific child model from this model's child list.
Model createChild()
Creates a new child model and appends it to this model's child list.
bool isScene() const
Checks whether this model represents a scene root node.
void getDescendants(ModelBuffer &buffer, bool include_deleted=false, bool local_only=false) const
Appends all descendant models recursively to the provided buffer.
bool hasLayerRootMaterial() const
Checks whether a root material exists through the layer hierarchy.
bool hasDescendent(const UUID &id) const
Checks whether a model with the given UUID is a descendant of this model.
void updateDescTime(const Time &time, bool include_self)
Updates the modified timestamp for this model and all descendants.
Model getSceneLayer(UUID id) const
Returns a scene layer by its UUID.
void setMaterialApplicationConstructed(const StringView &database_name=StringView())
Sets the material database to an application-constructed database by name.
Buffer< t_type > getTypeDescendants(const StringView &type) const
Recursively searches descendants for models of a specific type, cast to a derived type.
fltp08 calculateVolume(const Matrix< fltp08 > &transform=Constant< Matrix< fltp08 > >::Invalid) const
Calculates the volume of all descendant mesh geometries.
Effect createChildEffect()
Creates a new child effect attached to this model.
void eraseModel()
Erases this model from the database without removing children.
uint04 getGeometryIndex() const
Returns the database index of the geometry associated with this model.
void setWindingMode(WindingMode mode)
Sets the winding mode for all descendant geometries.
ModelBuffer getSceneModelsByName(const StringView &name, uint04 max_count=Constant< uint04 >::Max, bool includdeleted=false) const
Returns scene models filtered by name.
InheritedFlags
Flags that are recursively inherited from ancestor models down through the hierarchy.
@ e_inherited_exportable
Whether this model is exportable (inherited).
@ e_inherited_does_not_follow_camera
Whether this model does not follow the camera (inherited).
@ e_inherited_is_tree_visible
Whether this model is visible in the tree view (inherited).
@ e_inherited_is_visible
Whether this model is visible (inherited from ancestors).
@ e_inherited_does_not_scale_to_camera
Whether this model does not scale to camera (inherited).
@ e_inherited_not_deleted
Whether this model is not deleted (inherited).
@ e_inherited_not_application_owned
Whether this model is not application-owned (inherited).
@ e_inherited_can_delete
Whether this model can be deleted (inherited).
@ e_inherited_not_selected
Whether this model is not selected (inherited).
@ e_placholder
Reserved placeholder flag.
@ e_inherited_does_not_orient_to_camera
Whether this model does not orient to camera (inherited).
@ e_inherited_has_no_focus
Whether this model lacks focus (inherited).
void invalidateVisibleBounds()
Invalidates the cached visible bounding box.
ModelBuffer getDescendantsByType(const StringView &type, uint04 max_count=Constant< uint04 >::Max) const
Recursively searches all descendants for models matching the given type.
bool hasMeshDescendent() const
Checks whether any descendant has mesh (triangle) geometry.
bool hasPointsDescendent() const
Checks whether any descendant has point geometry.
bool hasDescendent(const Model &model) const
Checks whether a given model is a descendant of this model.
bool isTreeVisible() const
Checks whether this model is visible in the model tree view.
void setMaterialMode(MaterialMode option)
Sets the material mode for this model.
MaterialMode getMaterialMode() const
Returns the material mode determining how materials are resolved for this model.
bool isLocked() const
Checks whether this model is locked against editing.
Matrix< fltp08 > applyTransformToParent(Matrix< fltp08 > mat, const Matrix< fltp08 > &parent_mat) const
Applies a transformation matrix to the parent transform, respecting parent matrix flags.
Geometry createChildGeometry()
Creates a new child geometry for this model.
void setMaterial(const Material &material)
Assigns a material to this model.
Model getFamilyMember(uint04 index) const
Returns a model from the family tree (ancestors + descendants) by flat index.
void addPerVertexColorFromMaterialConstant(UVType constant_index)
Adds per-vertex color data derived from a material constant UV channel.
void colorByChannel(Material &mat, const StringView &channel, fltp08 avg=Constant< fltp08 >::Invalid) const
Colors geometry vertices by a data channel value from a material.
Effect getEffect(uint04 index=0) const
Returns the effect at the specified child index.
Vector< 3, fltp08 > calculateAverageDirection(const Matrix< fltp08 > &parent_transform=Constant< Matrix< fltp08 > >::Invalid) const
Calculates the average direction vector of descendant linear geometries.
DescendedFlags
Flags that propagate upward from descendant models to ancestors, indicating aggregate states of the s...
@ e_descendent_focussed
At least one descendant has focus.
@ e_descendent_selected
At least one descendant is selected.
@ e_descendent_deletion_blocked
At least one descendant blocks deletion.
ModelBuffer getSceneModelsByType(const StringView &type, uint04 max_count=Constant< uint04 >::Max, bool includdeleted=false) const
Returns scene models filtered by type.
uint04 vertexCount() const
Returns the total number of vertices across all descendant geometries.
DesignObjectBase * childBase() const
Returns the DesignObjectBase used for child model storage.
void removeMaterial()
Removes the material from this model.
bool isDeleted() const
Checks whether this model has been deleted.
ModelBuffer getDescendantsByName(const StringView &name, uint04 max_count=Constant< uint04 >::Max) const
Recursively searches all descendants for models matching the given name.
void calculateIndexNeighborList()
Calculates the index neighbor list for geometry processing.
void setChildApplicationConstructed(const StringView &database_name=StringView())
Sets the child database to an application-constructed database by name.
ModelBuffer getSceneModels(bool include_deleted=false, bool local_only=false) const
Returns all models in the scene database.
bool isLayer() const
Checks whether this model is a layer definition.
ModelBuffer getDescendantsByNameAndType(const StringView &name, const StringView &type, uint04 max_count=Constant< uint04 >::Max) const
Recursively searches all descendants for models matching both name and type.
MaterialBuffer getMaterialDescendantsByName(const StringView &name, uint04 max_count=Constant< uint04 >::Max) const
Returns descendant materials filtered by name.
uint04 getDirectLayerIndex() const
Returns the database index of the directly assigned layer.
ModelBuffer getChildrenByName(const StringView &name) const
Returns all direct children whose name matches the given string.
BitFlag parentMatrixFlags() const
Returns the parent matrix flags for this model.
Matrix< fltp08 > getCompleteTransform() const
Returns the fully composed local-to-global transform matrix for this model.
void setModelTransform(const Matrix< fltp08 > &transform)
Sets the model's local transformation matrix, replacing the current one.
void addChild(Model &child)
Adds an existing model as a child of this model.
Model()
Default constructor. Creates an uninitialized Model.
Bounds< 3, fltp08 > globalBounds() const
Returns the global bounding box of this model (including transform).
ModelBuffer getChildren() const
Returns a buffer containing all direct children of this model.
bool canExplode() const
Checks whether this model can be exploded into its constituent children.
void addChild(uint04 child_index)
Adds a child by its database index.
void ensureTangentSpace(bool ensure_tan, bool ensure_bitan)
Ensures that tangent and/or bitangent data exists, calculating if needed.
uint04 getParentIndex() const
Returns the database index of this model's parent.
ColumnT< uint04 > & childToParentReference() const
Returns the column mapping child indices to parent indices.
Buffer< UUID > getChildrenIDs() const
Returns the UUIDs of all direct children.
Vertex< 3, fltp08 > centerAlignModel()
Centers the model geometry at the origin and returns the offset applied.
bool exportIgnored() const
Checks whether this model is excluded from export operations.
MaterialBuffer getSceneMaterials() const
Returns all materials in the scene database.
Material getMaterial() const
Returns the material assigned to this model.
void setChildIndex(uint04 child, uint04 id)
Sets the database index for a specific child slot.
void restoreModel(Model &parent, uint04 index=Constant< uint04 >::Invalid)
Restores a previously deleted model under a specific parent.
Bounds< 3, fltp08 > getSelectionBounds() const
Returns the selection-specific bounding box in local space.
EffectBuffer getSceneEffects() const
Returns all effects in the scene database.
void updateInheritedFlagsCache(bool force_update_all=false, bool update_personal_flags=false)
Recalculates and caches the inherited flags for this model.
Buffer< uint04 > getChildIndices() const
Returns the database indices of all direct children.
uint04 getEffectIndex(uint04 child_index=0) const
Returns the database index of the effect at the given child slot.
void updateModelTransform(const Matrix< fltp08 > &transform, const void *lock=nullptr)
Applies a delta transform to the current model transform.
BitFlag descendedPersonalFlagsNoCache() const
Computes descended personal flags without using the cache.
void setParentMatrixFlag(ParentMatrixFlags flag, bool value)
Sets or clears a specific parent matrix flag.
void removeDuplicateVertices(fltp08 epsilon, void *lock, InfoPipe *log=nullptr)
Removes duplicate vertices from all descendant geometries.
Material createSceneMaterial() const
Creates a new material in the scene database.
DesignObjectBase * materialBase() const
Returns the DesignObjectBase used for material storage.
Model(DesignObjectBase *base)
Constructs a Model from a design object base, using the next available index.
Model getChild(uint04 child) const
Returns the child model at the given child slot index.
void clearMaterial()
Removes the material assignment from this model.
Geometry createSceneGeometry() const
Creates a new geometry in the scene database.
Model(uint04 index, DesignObjectBase *base)
Constructs a Model at a specific index within the design object base.
Model getChild(UUID id) const
Returns the child model with the specified UUID.
void descendentGeometryTypes(Set< GeometryType > &buffer) const
Collects all unique geometry types from descendants into the provided set.
void deleteChildren()
Deletes all children of this model.
void invalidateSelectionBounds()
Invalidates the cached selection bounding box.
Model getSceneModel(UUID id) const
Retrieves a scene model by its UUID.
void setOrientation(const Vector< 3, Angle< sint04 > > &new_orientation, const void *lock=nullptr)
Sets the orientation of this model using integer-precision angles.
void removeGeometry()
Removes the geometry reference from this model (does not delete the geometry).
Model createSceneLayer() const
Creates a new layer model in the scene database.
void setGeometryChild(Geometry &geo)
Sets the geometry child of this model to an existing Geometry object.
void setEffectIndex(uint04 material_index, uint04 sub_index=0)
Sets the effect database index at a given sub-index.
void ensureVisibleChildren(uint04 count)
Hides children whos child index is greater than size, or creates/shows children if needed such that t...
Geometry getSceneGeometry(uint04 index) const
Returns a scene geometry by database index.
void invalidateGlobalBoundsDesc()
Invalidates global bounding boxes for this model and all descendants.
void setGeometryApplicationConstructed(const StringView &database_name=StringView())
Sets the geometry database to an application-constructed database by name.
Matrix< fltp08 > getParentTransform() const
Returns the parent's transformation matrix as seen by this model.
void updateFrom(const Model &model, bool check_resources)
Updates this model's properties from another model, optionally checking resources.
void swapChildren(uint04 a, uint04 b)
Swaps the positions of two children in the child list.
bool hasHoles(PrimitiveProperty property) const
Checks whether the geometry has holes (missing primitives) for a given property.
void clearLayer()
Removes the layer assignment from this model.
void setSize(const Vector< 3, fltp08 > &size)
Sets the model size by scaling its transform to match the desired dimensions.
void getMaterialDescendants(Set< Material > &materials, bool local_only=false) const
Appends all descendant materials to the provided set (deduplicating).
fltp08 calculateSurfaceArea(const Matrix< fltp08 > &transform=Constant< Matrix< fltp08 > >::Invalid) const
Calculates the surface area of all descendant mesh geometries.
uint04 getChildIndex() const
Returns this model's index within its parent's child list.
BitFlag personalDescendedFlags() const
Returns the cached personal descended flags.
void updateAscTime(const Time &time, bool includself)
Updates the modified timestamp for this model and all ancestors.
Bounds< 3, fltp08 > globalSelectionBounds() const
Returns the global selection bounding box.
uint04 getChildLayerIndex() const
Returns this model's index within its parent's layer child list.
GeometryBuffer getGeometryDescendants(bool remove_redundant=true, uint04 max_count=Constant< uint04 >::Max) const
Recursively collects all descendant geometries.
Bounds< 3, fltp08 > getBounds() const
Returns the local bounding box of this model.
GeometryBuffer getSceneGeometries() const
Returns all geometries in the scene database.
Vector< 2, fltp08 > calculateHVLength(const Matrix< fltp08 > &parent_transform=Constant< Matrix< fltp08 > >::Invalid) const
Calculates horizontal and vertical length components of descendant linear geometries.
void setGeometryIndex(uint04 geo_index)
Sets the geometry database index for this model.
Vector< 32, bool > personalInheritedFlags() const
Returns the personal inherited flags from the cache.
void setOrientation(const Vector< 3, Angle< fltp08 > > &new_orientation, const void *lock=nullptr)
Sets the orientation of this model using floating-point angles.
uint04 getChildIndex(uint04 child) const
Returns the database index of the child at the given slot.
uint04 getNumOfEffects() const
Returns the number of effects attached to this model.
void updateAscGeometryTime(const Time &time, bool include_self)
Updates the geometry-modified timestamp for this model and all ancestors.
void copyFrom(const Model &model, bool deep_copy, bool copy_ids=false, bool recursive=true, bool keep_root_properties=false)
Copies data from another model into this model.
Model findDescendentByName(const StringView &name) const
Recursively searches descendants for a model with the given name.
bool canInteract() const
Checks whether this model can be interacted with (visible, not locked, etc.).
ModelBuffer getSceneLayers(bool include_deleted=false) const
Returns all layer models in the scene.
void checkBounds()
Validates and recalculates cached bounding boxes if needed.
void updateVisibleRecursive(bool is_visible)
Recursively updates visibility for this model and all descendants.
bool hasLayer() const
Checks whether this model has a layer (directly or inherited).
Model getRoot() const
Returns the root ancestor of this model's hierarchy.
Material createChildMaterial(bool copy_child=false)
Creates a new child material for this model.
void createChildren(uint04 child_size)
Creates multiple children at once.
Model directLayer() const
Returns the directly assigned layer model.
Material getRootMaterial() const
Returns the root material resolved through the hierarchy.
static constexpr TableColumn * column(const DesignInfo *object, NDPN property)
Returns the TableColumn pointer for a given NDPN property.
static constexpr uint04 index(const DesignInfo *object, NDPN)
Returns the row index for the given design object.
Provides access to the TableColumn and row index for a given property enum value.
static decltype(auto) Get(const DesignInfo *object)
Retrieves a model property value at compile time by template property enum.
static decltype(auto) Get(const DesignInfo *object, NDPN property)
Retrieves a model property value at runtime by property enum and requested type.
static void Set(DesignInfo *object, NDPN property, const t_valutype &value)
Sets a model property value at runtime by property enum.
static decltype(auto) Get(const DesignInfo *object)
Retrieves a model property at compile time with optimized direct member access.
static void Set(DesignInfo *object, const t_valutype &value)
Sets a model property value at compile time with optimized direct member access.
static constexpr TableColumn * column(const DesignInfo *object, NDPN property)
Returns the TableColumn pointer for a given NDPN property.
static bool IsSame(const DesignInfo *object, NDPN property, const StringView &value)
Checks whether the stored property value matches a given string.
Typed interface for getting and setting design object properties by enum.
static TableColumn * column(const DesignInfo *object, t_property_enum property)
Retrieves the TableColumn pointer for a given property on the specified design object.
Represents a color in the RGB space with optional alpha transparency.
The root Model that is responsible for storing the underlying data for all Scene Models.
Container that stores unique elements in no particular order, and which allow for fast retrieval or i...
Logic for reading or writing to a string or a user friendly, TranslatedString.
The core String View class for the NDEVR API.
A virtual storage type that is used with Table class to store data where the actual mechanism for sto...
virtual bool isSame(uint04 index, const StringView &value) const =0
Checks whether the stored string at the given row is exactly equal to the given value.
std::enable_if<!ObjectInfo< t_class >::Enum >::type set(uint04 index, const t_class &value)
Sets the value at the given row index from a non-enum type.
void get(uint04 index, Vector< 1, t_class > &vector) const
Retrieves a 1D vector value at the given row index by delegating to the scalar get.
Represents a timestamp with utilities for manipulation and conversion.
static Time SystemTime()
Retrieves the current system time which is a combination of std::chrono::steady_clock to ensure smoot...
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...
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
A point in N-dimensional space, used primarily for spatial location information.
The primary namespace for the NDEVR SDK.
NormalMode
Describes how surface normals are computed or stored for a Geometry object.
NDPN
NDPN - NDEVR Design Property Node: Values stored in the model database.
@ calculation_ignored
Whether this model is ignored in calculations (e.g., volume, area).
@ geometry_base_ptr
Pointer to the DesignObjectBase that stores geometry data.
@ material_mode
How the material is resolved for this model (see Model::MaterialMode).
@ visible_box
The cached visible bounding box in local coordinates.
@ model_property_size
Sentinel value marking the end of the property enum (always last).
@ type
The type identifier string for this model node.
@ child_base_ptr
Pointer to the DesignObjectBase that stores child model data.
@ inherited_flags
Cached flags recursively inherited from ancestors.
@ model_color
The color assigned directly to this model node.
@ parent_matrix_flags
Flags controlling which parent transform components to inherit.
@ export_ignored
Whether this item should be excluded from file export.
@ complete_transform
The fully composed local-to-global transformation matrix.
@ material_base_ptr
Pointer to the DesignObjectBase that stores material data.
@ personal_inherited_flags
This node's own contribution to inherited flags (before recursion).
@ fixed_bounding_box
A user-defined fixed bounding box override for this model.
@ global_selection_bounds
Cached selection bounding box in global coordinates.
@ can_select_children
Whether children of this model can be individually selected.
@ parent_base_ptr
Pointer to the DesignObjectBase that stores parent model data.
@ global_bounds
Cached axis-aligned bounding box in global coordinates.
PrimitiveAlignedBuffer< Effect, 16 > EffectBuffer
Aligned buffer of Effect objects with 16-byte alignment.
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
constexpr t_to & rcast(t_from &value)
Casts the given value.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
@ guid
A 128-bit globally unique identifier for the object.
PrimitiveProperty
Describes which rendering property a primitive index buffer corresponds to.
PrimitiveAlignedBuffer< Model, 16 > ModelBuffer
Aligned buffer of Model objects with 16-byte alignment.
WindingMode
Describes the vertex winding order used to determine front-facing direction of polygons.
PrimitiveAlignedBuffer< Geometry, 16 > GeometryBuffer
Aligned buffer of Geometry objects with 16-byte alignment.
UVType
Channels that describe how an object should interact with light.
PrimitiveAlignedBuffer< Material, 16 > MaterialBuffer
Aligned buffer of Material objects with 16-byte alignment.
static const Model Invalid
The invalid (null) Model sentinel value.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
static const bool Buffer
Whether this is a buffer type.
static const bool Primitive
Whether this is a primitive type.
static const bool Number
Whether this is a numeric type.
static const bool Float
Whether this is a floating-point type.
static const bool Vector
Whether this is a vector type.
static constexpr ObjectInfo< Model, false, false > VectorSub()
Returns the vector sub-info (identity for non-vector types).
static const uint01 Dimensions
Number of dimensions (0 for non-spatial types).
static const bool Integer
Whether this is an integer type.
static const bool Boolean
Whether this is a boolean type.
static const bool Unsigned
Whether this is an unsigned numeric type.
static const bool String
Whether this is a string type.
static const bool Color
Whether this is a color type.
static const bool Enum
Whether this is an enum type.
static const bool Pointer
Whether this is a pointer type.
Information about the object.
Maps a compile-time property enum value to its corresponding C++ storage type.