3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
coat::SceneElement Class Reference

The scene element, like sculpt object or curve. More...

#include <CoreAPI.h>

Inheritance diagram for coat::SceneElement:
coat::Curve

Public Member Functions

 SceneElement (VolumeObject *vo)
 
 SceneElement (ItemsTree *c)
 
 SceneElement (const SceneElement &other)
 
const bool operator== (const SceneElement &other) const
 
const bool operator!= (const SceneElement &other) const
 
SceneElement parent () const
 get the parent scene graph element
 
int childCount () const
 returns the child elements count
 
SceneElement child (int index) const
 returns child element by index
 
bool isSculptObject () const
 Check if it is the sculpt object.
 
bool isCurve () const
 Check if the element is curve.
 
const SceneElementsetTransform (const mat4 &Transform) const
 Set the transform matrix.
 
const SceneElementtransform (const mat4 &Transform) const
 Additional transform over the object.
 
const SceneElementdensity (float density_value) const
 this command useful if you use voxels, it sets the scale for the volume so that there will be density_value of voxels per mm
 
const SceneElementtransform_single (const mat4 &Transform) const
 Additional transform over the object, not applied to child objects.
 
mat4 getTransform () const
 get the scene element transform
 
const SceneElementclear () const
 Clear the element content.
 
const char * name () const
 get the element name
 
const SceneElementrename (const char *name) const
 rename the element
 
SceneElement addChild (const char *name) const
 add the child element of the same nature
 
SceneElement findInSubtree (const char *name) const
 find the element in subtree by name
 
bool iterateSubtree (const std::function< bool(SceneElement)> &fn) const
 iterate over the subtree
 
bool iterateVisibleSubtree (const std::function< bool(SceneElement)> &fn) const
 iterate over the visible subtree
 
void mergeSubtree (bool booleanMerge=false) const
 merge all subtree volumes into this
 
void mergeTo (const SceneElement &dest, BoolOpType op)
 merge the volume to another one, delete this volume
 
void copyMergeTo (SceneElement &dest, BoolOpType op)
 copy and merge the volume to another one, delete this volume
 
void removeSubtree () const
 remove the whole subtree
 
void removeSubtreeItem (int index) const
 remove one child from the subtree
 
void remove () const
 remove this item and all child objects from the scene
 
SceneElement duplicate () const
 diplicate the item
 
SceneElement duplicateAsInstance () const
 create the instance of the object if instancing supported
 
void changeParent (SceneElement newParent) const
 change the parent element for the current one
 
bool isParentOf (SceneElement child) const
 check if the element is parent of another one
 
bool & visible () const
 returns own visibility state reference. It does not take into account that parent may be invisible.
 
void setVisibility (bool visible) const
 set the visibility of the element
 
bool ghost () const
 returs the state of ghosting (if available)
 
void setGhost (bool ghost) const
 sets the ghosting state (if available)
 
vec4 getReferenceColor ()
 get the reference color for the element
 
void setReferenceColor (const vec4 &color)
 set the reference color for the element
 
Volume Volume () const
 returns the volume object to operate over voxels or surface
 
void select () const
 add the object to selected
 
void selectOne () const
 unselect all similar elements and select this one
 
void unselectAll () const
 unselect all similar objects
 
bool selected ()
 Check if the scene element is selected.
 
void collectSelected (list< SceneElement > &elemList)
 Collect the selected elements in the subtree (including this element if selected)
 
std::vector< SceneElementcollectSelected ()
 Collect the selected elements in the subtree (including this element if selected)
 

Protected Member Functions

VoxTreeBranch * tb () const
 
OneCurveObject * cu () const
 

Protected Attributes

ItemsTree * el
 

Friends

class Scene
 
class Curve
 
class Volume
 

Detailed Description

The scene element, like sculpt object or curve.

Examples
GeneratorExample.cpp, TreesGenerator.cpp, and square_volume.cpp.

Member Function Documentation

◆ addChild()

SceneElement coat::SceneElement::addChild ( const char *  name) const

◆ changeParent()

void coat::SceneElement::changeParent ( SceneElement  newParent) const

change the parent element for the current one

Parameters
newParentthe new parent reference. Pay attention, changing paren is not always possible!

◆ child()

SceneElement coat::SceneElement::child ( int  index) const

returns child element by index

Parameters
indexthe index of the element in subtree
Returns
the child reference
Examples
TreesGenerator.cpp.

◆ childCount()

int coat::SceneElement::childCount ( ) const

◆ clear()

const SceneElement & coat::SceneElement::clear ( ) const

Clear the element content.

Returns
this element reference

◆ copyMergeTo()

void coat::SceneElement::copyMergeTo ( SceneElement dest,
BoolOpType  op 
)

copy and merge the volume to another one, delete this volume

Parameters
destthe destination
opthe boolean operation type

◆ density()

const SceneElement & coat::SceneElement::density ( float  density_value) const

this command useful if you use voxels, it sets the scale for the volume so that there will be density_value of voxels per mm

Parameters
density_valuethe voxels per mm

◆ duplicate()

SceneElement coat::SceneElement::duplicate ( ) const

diplicate the item

Returns
the new item reference

◆ duplicateAsInstance()

SceneElement coat::SceneElement::duplicateAsInstance ( ) const

create the instance of the object if instancing supported

Returns
the instance reference

◆ findInSubtree()

SceneElement coat::SceneElement::findInSubtree ( const char *  name) const

find the element in subtree by name

Parameters
namethe name t seek
Returns
the element reference
Examples
TreesGenerator.cpp.

◆ getReferenceColor()

vec4 coat::SceneElement::getReferenceColor ( )

get the reference color for the element

Returns
the color (r,g,b,a), each channel is 0..1

◆ getTransform()

mat4 coat::SceneElement::getTransform ( ) const

get the scene element transform

Returns
the transform matrix
Examples
GeneratorExample.cpp, and TreesGenerator.cpp.

◆ ghost()

bool coat::SceneElement::ghost ( ) const

returs the state of ghosting (if available)

Returns
true if ghosted

◆ isCurve()

bool coat::SceneElement::isCurve ( ) const

Check if the element is curve.

Returns
true if this is curve

◆ isParentOf()

bool coat::SceneElement::isParentOf ( SceneElement  child) const

check if the element is parent of another one

Parameters
childthe child element
Returns
true if this element is parent of the child

◆ isSculptObject()

bool coat::SceneElement::isSculptObject ( ) const

Check if it is the sculpt object.

Returns
true if this is the sculpt object
Examples
square_volume.cpp.

◆ iterateSubtree()

bool coat::SceneElement::iterateSubtree ( const std::function< bool(SceneElement)> &  fn) const

iterate over the subtree

Parameters
fnthe function to call, return true if need to stop the iterations
Returns
true if the callback interrupted the iterations

◆ iterateVisibleSubtree()

bool coat::SceneElement::iterateVisibleSubtree ( const std::function< bool(SceneElement)> &  fn) const

iterate over the visible subtree

Parameters
fnthe function to call, return true if need to stop the iterations
Returns
true if the callback interrupted the iterations

◆ mergeSubtree()

void coat::SceneElement::mergeSubtree ( bool  booleanMerge = false) const

merge all subtree volumes into this

Parameters
booleanMergeuse boolean summ to merge. Othervice merge meshes without booleans. This option works only for surfave, in voxels it will always do boolean summ

◆ mergeTo()

void coat::SceneElement::mergeTo ( const SceneElement dest,
BoolOpType  op 
)

merge the volume to another one, delete this volume

Parameters
destthe destination
opthe boolean operation type

◆ name()

const char * coat::SceneElement::name ( ) const

get the element name

Returns
the name
Examples
square_volume.cpp.

◆ parent()

SceneElement coat::SceneElement::parent ( ) const

get the parent scene graph element

Returns
the parent reference

◆ removeSubtreeItem()

void coat::SceneElement::removeSubtreeItem ( int  index) const

remove one child from the subtree

Parameters
indexindex of the child

◆ rename()

const SceneElement & coat::SceneElement::rename ( const char *  name) const

rename the element

Parameters
namethe new name
Returns
this element reference

◆ setGhost()

void coat::SceneElement::setGhost ( bool  ghost) const

sets the ghosting state (if available)

Parameters
ghostset true to ghost

◆ setReferenceColor()

void coat::SceneElement::setReferenceColor ( const vec4 color)

set the reference color for the element

Parameters
colorthe (r, g, b, a) color, each channel is 0..1

◆ setTransform()

const SceneElement & coat::SceneElement::setTransform ( const mat4 Transform) const

Set the transform matrix.

Parameters
Transformthe transform matrix
Returns
this element reference
Examples
GeneratorExample.cpp, and TreesGenerator.cpp.

◆ setVisibility()

void coat::SceneElement::setVisibility ( bool  visible) const

set the visibility of the element

Parameters
visibletrue if need to be visible

◆ transform()

const SceneElement & coat::SceneElement::transform ( const mat4 Transform) const

Additional transform over the object.

Parameters
Transformthe matrix
Returns
this element reference

◆ transform_single()

const SceneElement & coat::SceneElement::transform_single ( const mat4 Transform) const

Additional transform over the object, not applied to child objects.

Parameters
Transformthe matrix
Returns
this element reference

◆ visible()

bool & coat::SceneElement::visible ( ) const

returns own visibility state reference. It does not take into account that parent may be invisible.

Returns
item local visibility reference, you may get and set the visibility with the reference.

The documentation for this class was generated from the following file: