56 #define SKELETONOBJECT_C
62 #include <ACG/Scenegraph/TextNode.hh>
63 #include <ACG/Scenegraph/LineNode.hh>
117 std::cerr <<
"Destructor error : Skeleton already deleted" << std::endl;
135 std::cerr <<
"Cleanup error : Skeleton already deleted" << std::endl;
157 std::cerr <<
"Error when creating Skeleton Object! materialNode is NULL!" << std::endl;
177 std::cerr <<
"Error when creating Skeleton Object! materialNode is NULL!" << std::endl;
199 std::string nodename = std::string(
"SkeletonNode for Skeleton " + _name.toUtf8() );
234 output +=
"========================================================================\n";
238 output +=
"Object Contains a Skeleton : ";
240 output += QString::number(
skeleton()->jointCount()) +
" joints.\n";
242 output +=
"========================================================================\n";
325 for(
unsigned int i = 0; i < skeleton_->jointCount(); ++i)
327 std::stringstream buf;
328 std::string nameTransformNode;
330 buf <<
"TextNode " << i <<
" Transform";
331 nameTransformNode = buf.str();
343 unsigned int i = skeleton_->jointCount();
344 bool bAdditionalNodes =
true;
346 std::stringstream buf;
347 std::string nameTransformNode;
349 buf <<
"TextNode " << i <<
" Transform";
350 nameTransformNode = buf.str();
359 bAdditionalNodes =
false;
360 }
while(bAdditionalNodes);
388 unsigned int i = skeleton_->jointCount();
389 bool bAdditionalNodes =
true;
391 std::stringstream buf;
392 std::string nameTransformNode;
394 buf <<
"TextNode " << i <<
" Transform";
395 nameTransformNode = buf.str();
404 bAdditionalNodes =
false;
405 }
while(bAdditionalNodes);
409 for(
unsigned int i = 0; i < skeleton_->jointCount(); ++i)
411 std::stringstream buf;
412 std::string nameJoint, nameTextNode, nameTransformNode, nameSubMatNode;
416 nameJoint = buf.str();
419 buf <<
"TextNode " << i;
420 nameTextNode = buf.str();
423 nameTransformNode = buf.str();
426 nameSubMatNode = buf.str();
450 nameTextNode.c_str(),
451 ACG::SceneGraph::TextNode::SCREEN_ALIGNED,
455 pTextNode->
setText(
" " + nameJoint);
466 bool SkeletonObject::indicesVisible()
477 bool SkeletonObject::motionPathVisible()
516 for(
unsigned int i = 0; i < skeleton_->jointCount(); ++i)
519 std::stringstream buf;
520 std::string nameTransformNode;
522 buf <<
"LineNode " << i <<
" Transform";
523 nameTransformNode = buf.str();
534 unsigned int i = skeleton_->jointCount();
535 bool bAdditionalNodes =
true;
537 std::stringstream buf;
538 std::string nameTransformNode;
540 buf <<
"LineNode " << i <<
" Transform";
541 nameTransformNode = buf.str();
550 bAdditionalNodes =
false;
551 }
while(bAdditionalNodes);
579 unsigned int i = skeleton_->jointCount();
580 bool bAdditionalNodes =
true;
582 std::stringstream buf;
583 std::string nameTransformNode;
585 buf <<
"LineNode " << i <<
" Transform";
586 nameTransformNode = buf.str();
595 bAdditionalNodes =
false;
596 }
while(bAdditionalNodes);
602 for(
unsigned int i = 0; i < skeleton_->jointCount(); ++i)
604 std::stringstream buf;
605 std::string nameLineNode, nameTransformNode;
608 buf <<
"LineNode " << i;
609 nameLineNode = buf.str();
612 nameTransformNode = buf.str();
622 pTransNode->
scale(mat);
627 pLineNode =
new ACG::SceneGraph::LineNode( ACG::SceneGraph::LineNode::LineSegmentsMode, pTransNode, nameLineNode.c_str());
634 if ( joint->
size() > 0 ){
636 for (uint c=0; c < joint->
size(); c++ ){
639 for (
unsigned int a = 0; a < skeleton_->animationCount(); a++){
646 if (animation->name() ==
"")
652 for(
unsigned int k = 0; k < animation->frameCount(); ++k){
668 pLineNode->
add_line( lastPos, trans );
bool removeAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
remove an additional node from the object
QString getObjectinfo()
Returns a string holding information on this object.
void setActivePose(const AnimationHandle &_hAni)
Call this to set the active pose.
void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
virtual QString getObjectinfo()
Get all Info for the Object as a string.
bool pickingEnabled()
Check if picking is enabled for this object.
QString name() const
return the name of the object. The name defaults to NONAME if unset.
void multipassNodeSetActive(const unsigned int _i, bool _active)
Set Node status to traverse in a specific pass.
void deleteData()
Delete all data attached to this object ( calls delete on each object )
virtual void update(UpdateType _type=UPDATE_ALL)
This function is called to update the object.
bool getAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
get an addition node from the object
virtual BaseObject * copy()
Returns a full copy of the object.
Hide this node and its children.
void setSize(const double _size)
sets the size by which the quads displaying the text will be scaled
void showMotionPath(bool _visible=true)
Shows or hides the local motion space for a joint.
virtual void setName(QString _name)
path to the file from which the object is loaded ( defaults to "." )
Joint * child(size_t _index)
Returns the child joint with the given index.
DrawMode SOLID_FLAT_SHADED
draw flat shaded faces (requires face normals)
MaterialNode * materialNode()
get a pointer to the materialnode
DataType dataType() const
A general pose, used to store the frames of the animation.
void updateMotionPath()
Updates the node that visualizes the local space of joint motions.
void setText(std::string _text)
sets the string that will be rendered
void enablePicking(bool _enable)
Enable or disable picking for this object.
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode_
A pointer to the scenegraph node.
SeparatorNode * baseNode()
void set_status(StatusMode _s)
Set the status of this node.
SkeletonT< ACG::Vec3d > Skeleton
Simple Name for the Skeleton, based on double vectors.
void set_color(const Vec4f &_c)
set color (base, ambient, diffuse, specular) based on _c
SkeletonObject()
Constructor.
void clear()
clear points/lines and colors
void set_point_size(float _sz)
set point size (default: 1.0)
const Matrix & unifiedMatrix(unsigned int _joint)
Returns the unified matrix.
DrawMode POINTS
draw unlighted points using the default base color
bool picked(uint _node_idx)
Returns true if the picked node given by _node_idx is this objects scenegraph node.
Skeleton * skeleton()
Returns a pointer to the skeleton.
void set_line_width(float _sz)
set line width (default: 1.0)
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
void setDataType(DataType _type)
void set_round_points(bool _b)
set round points enabled
void scale(double _s)
Add scaling to the current Transformation.
unsigned int id()
returns the joint id
void show()
Show node: set status to Active.
void showIndices(bool _bVisible=true)
Shows or hides the indices.
A handle used to refer to an animation or to a specific frame in an animation.
Skeleton * skeleton_
A pointer to the skeleton data.
void translate(const Vec3d &_v)
Add a translation to the current Transformation.
size_t size()
Returns the number of children.
StatusMode status() const
Get node's status.
virtual ~SkeletonObject()
Destructor.
bool addAdditionalNode(NodeT *_node, QString _pluginName, QString _nodeName, int _id=0)
add an additional node to the object
void setFrame(unsigned int _iFrame)
Sets the current animation frame (not failsafe)
void add_line(const Vec3d &_v0, const Vec3d &_v1)
add line (for LineMode == LineSegmentsMode)
const Matrix & globalMatrix(unsigned int _joint) const
Returns the global matrix for the given joint.
ACG::SceneGraph::MaterialNode MaterialNode
Materialnode.
virtual void init()
Initialize current object, including all related nodes.
BaseObject * child(int row)
return a child
Represents a single joint in the skeleton.
bool invert()
matrix inversion (returns true on success)
virtual void cleanup()
Reset current object, including all related nodes.
void setName(QString _name)
Set the name of the Object.
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode()
Returns the skeleton scenegraph node.
void updateIndices()
Updates the joint index text node positions.
const Scalar * get_raw_data() const
void add_color(const ACG::Vec3uc &_c)
add color (only for LineMode == LineSegmentsMode)